Commit 73ce52ca by 李小惠

修改单警柜,仓库,警员错误信息

parent af146aa8
......@@ -41,7 +41,7 @@ public class CabinetReq extends BaseRequest {
* 组织机构号
*/
@ApiModelProperty(value = "组织机构号")
private String orgId;
private Long orgId;
/**
* 位置信息
......
......@@ -5,6 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
......@@ -16,9 +17,10 @@ public class PolicemanReq extends BaseRequest {
private String name;
@NotBlank(message = "箱门id不能为空", groups = {edit.class, delete.class, detail.class})
@NotBlank(message = "箱门id不能为空", groups = {edit.class, delete.class})
private String cabinetBoxId;
@NotNull(message = "组织机构id不能为空",groups = {})
private Long orgId;
private Long departmentId;
......
......@@ -43,9 +43,9 @@ public class UpdateCabinetReq extends BaseRequest {
/**
* 组织机构号
*/
@NotBlank(message = "组织机构号不能为空", groups = {add.class,edit.class, detail.class})
@NotNull(message = "组织机构号不能为空", groups = {add.class,edit.class, detail.class})
@ApiModelProperty(value = "组织机构号")
private String orgId;
private Long orgId;
/**
* 位置信息
......
......@@ -14,20 +14,20 @@ public class UpdatePolicemanReq extends BaseRequest {
@NotNull(message = "警员主键不能为空", groups = {add.class,edit.class, delete.class, detail.class})
private String id;
@NotNull(message = "警员名字不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "警员名字不能为空", groups = {add.class,edit.class})
private String name;
private String cabinetBoxId;
@NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class})
private Long orgId;
private Long departmentId;
@NotNull(message = "警员编号不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "警员编号不能为空", groups = {add.class,edit.class})
private String policeCode;
@NotNull(message = "性别不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "性别不能为空", groups = {add.class,edit.class})
private String sex;
private String faceInfo;
......@@ -38,7 +38,7 @@ public class UpdatePolicemanReq extends BaseRequest {
private String password;
@NotNull(message = "电话不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "电话不能为空", groups = {add.class,edit.class})
private String photo;
private String phone;
......@@ -47,7 +47,7 @@ public class UpdatePolicemanReq extends BaseRequest {
private Date updateTime;
@NotNull(message = "身份证号不能为空", groups = {add.class,edit.class, delete.class, detail.class})
@NotNull(message = "身份证号不能为空", groups = {add.class,edit.class})
private String idCard;
private String updateUser;
......
......@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
......@@ -35,6 +34,13 @@ public class CabinetController {
private CabinetBoxService cabinetBoxService;
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息")
public ApiRes<String> addCabinetInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetReq req){
String cabinetId = cabinetService.addCabinetInfo(req);
return ApiRes.success(cabinetId);
}
@PostMapping("/ErrorState")
@ApiOperation("单警柜状态变更")
public ApiRes<Boolean> ChangeCabinetState(@RequestBody UpdateCabinetReq req) {
......@@ -45,12 +51,6 @@ public class CabinetController {
return ApiRes.success(result);
}
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息")
public ApiRes<String> addCabinetInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetReq req){
String cabinetId = cabinetService.addCabinetInfo(req);
return ApiRes.success(cabinetId);
}
@PostMapping("/DeleteCabinetInfo")
@ApiOperation("删除单警柜信息")
......@@ -73,11 +73,12 @@ public class CabinetController {
//通过单警柜id查询单个箱门及其箱门信息
@PostMapping("/ShowOneCabinet")
@ApiOperation("查询单个单警柜及其箱门信息")
public ApiRes<CabinetDto> showOneCabinet(@RequestBody CabinetReq req){
public ApiRes<CabinetDto> showOneCabinet(@RequestBody @Validated(ValidationApi.detail.class) CabinetReq req){
return ApiRes.success(cabinetService.showOneCabinet(req));
}
//根据组织机构id查询出单警柜的详细信息
@PostMapping("/ShowCabinetList")
@ApiOperation("查询单警柜列表")
public ApiRes<List<CabinetDto>> showCabinetList(@RequestBody CabinetReq req){
......@@ -108,8 +109,8 @@ public class CabinetController {
@PostMapping("/SearchOrgId")
@ApiOperation("/根据单警柜id查询组织机构id")
public ApiRes<Long> SearchOrgId(String id){
return ApiRes.success(cabinetService.SearchOrgId(id));
public ApiRes<Long> SearchOrgId(@RequestBody @Validated(ValidationApi.detail.class) CabinetReq req){
return ApiRes.success(cabinetService.SearchOrgId(req));
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil;
import com.junmp.jyzb.api.bean.dto.PoliceDto;
import com.junmp.jyzb.api.bean.dto.PolicemanDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq;
import com.junmp.jyzb.entity.Policeman;
......@@ -37,7 +38,7 @@ public class PoliceController {
@PostMapping("/DeletePolice")
@ApiOperation("删除警员信息")
public ApiRes<Boolean> DeletePolice(@RequestBody UpdatePolicemanReq req) {
public ApiRes<Boolean> DeletePolice(@RequestBody @Validated(ValidationApi.delete.class) UpdatePolicemanReq req) {
boolean b = policemanService.DeletePolice(req);
if (!b){
return ApiRes.failure("删除失败");
......@@ -71,8 +72,8 @@ public class PoliceController {
//根据组织机构id查询,只查询本级,不包含下级
@PostMapping("/ShowPoliceList")
@ApiOperation("查询某个组织机构下的所有警员信息")
public ApiRes<PoliceDto> GetAllPolicemanList(Long orgId){
PoliceDto policeDto = policemanService.GetAllPolicemanList(orgId);
public ApiRes<PoliceDto> GetAllPolicemanList(PolicemanReq req){
PoliceDto policeDto = policemanService.GetAllPolicemanList(req.getOrgId());
return ApiRes.success(policeDto);
}
......@@ -85,7 +86,7 @@ public class PoliceController {
*/
@PostMapping("/GetPoliceDetail")
@ApiOperation("查询单个警员信息")
public ApiRes<PolicemanDto> GetOnePolice(@RequestBody PolicemanReq req) {
public ApiRes<PolicemanDto> GetOnePolice(@RequestBody @Validated(ValidationApi.detail.class) PolicemanReq req) {
return ApiRes.success(policemanService.GetOnePolice(req));
}
......@@ -97,9 +98,9 @@ public class PoliceController {
*/
@PostMapping("/GetPoliceData")
@ApiOperation("查询与单警柜绑定的警员信息") //根据单警柜id查询
public ApiRes<PoliceDto> GetPoliceData(String id){
public ApiRes<PoliceDto> GetPoliceData(CabinetReq req){
//获取该组织机构下所有警员的id
PoliceDto policeDto = policemanService.GetPoliceData(id);
PoliceDto policeDto = policemanService.GetPoliceData(req.getId());
return ApiRes.success(policeDto);
}
......@@ -115,7 +116,7 @@ public class PoliceController {
@PostMapping("/AddFaceInfo")
@ApiOperation("添加警员面部信息")
public ApiRes<Boolean> AddFaceInfo(@RequestBody UpdatePolicemanReq req) {
public ApiRes<Boolean> AddFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) UpdatePolicemanReq req) {
boolean b = policemanService.AddFaceInfo(req);
if (!b){
return ApiRes.failure("添加失败");
......@@ -125,7 +126,7 @@ public class PoliceController {
@PostMapping("/UpdateFaceInfo")
@ApiOperation("修改、删除人脸信息")
public ApiRes<Boolean> UpdateFaceInfo(@RequestBody UpdatePolicemanReq req) {
public ApiRes<Boolean> UpdateFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) UpdatePolicemanReq req) {
boolean b = policemanService.UpdateFaceInfo(req);
if (!b){
return ApiRes.failure("操作失败");
......@@ -135,7 +136,7 @@ public class PoliceController {
@PostMapping("/SearchFaceInfo")
@ApiOperation("查找人脸信息")
public ApiRes<Policeman> SearchFaceInfo(@RequestBody PolicemanReq req) {
public ApiRes<Policeman> SearchFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) PolicemanReq req) {
Policeman policeman = policemanService.SearchFaceInfo(req);
if (ObjectUtil.isEmpty(policeman)){
return ApiRes.failure("未找到警员信息");
......
......@@ -28,7 +28,7 @@ public class PolicemanFingerController implements PolicemanFingerDoc {
@PostMapping("/AddFingerInfo")
@ApiOperation("添加指纹信息")
public ApiRes<Boolean> addFingerInfo(@RequestBody @Validated(ValidationApi.add.class) UpdatePoliceFingerReq req) {
public ApiRes<Integer> addFingerInfo(@RequestBody @Validated(ValidationApi.add.class) UpdatePoliceFingerReq req) {
return ApiRes.success(policeFingerService.addFingerInfo(req)) ;
}
......
......@@ -14,7 +14,7 @@ import java.util.List;
@Api(value = "警员指纹管理",tags = "警员指纹管理接口")
public interface PolicemanFingerDoc {
@ApiOperation(value = "添加指纹信息", tags = "警员指纹管理接口")
ApiRes<Boolean> addFingerInfo(UpdatePoliceFingerReq req);
ApiRes<Integer> addFingerInfo(UpdatePoliceFingerReq req);
@ApiOperation(value = "修改指纹信息", tags = "警员指纹管理接口")
ApiRes<Boolean> updateFingerInfo(UpdatePoliceFingerReq req);
......
......@@ -20,6 +20,7 @@ public class User implements Serializable {
@TableField(value = "real_name")
private String realName;
private String nickName;
private String account;
private String password;
......
......@@ -12,7 +12,7 @@ import java.util.Map;
@Mapper
public interface CabinetMapper extends BaseMapper<Cabinet> {
List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<String> allOrgId);
List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<Long> allOrgId);
......
......@@ -68,5 +68,10 @@ public interface CabinetService extends IService<Cabinet> {
*/
boolean ChangeCabinetState(UpdateCabinetReq req);
Long SearchOrgId(String id);
//根据单警柜id查询出组织机构id
Long SearchOrgId(CabinetReq req);
//判断单警柜是否存在
Cabinet CabinetExist(String id);
}
......@@ -17,7 +17,7 @@ public interface PoliceFingerService extends IService<PoliceFinger> {
* @param req
* @return
*/
boolean addFingerInfo(UpdatePoliceFingerReq req);
Integer addFingerInfo(UpdatePoliceFingerReq req);
/**
* 更新指纹信息
......
......@@ -50,4 +50,6 @@ public interface PolicemanService extends IService<Policeman> {
boolean PoliceBindBox(PolicemanReq req);
//判断警员信息是否存在
Policeman PoliceExist(String policeId);
}
......@@ -16,7 +16,7 @@ public interface PubOrgService extends IService<PubOrg> {
ResponseResult setShortName(Map<String, Object> orgId);
List<String> getLowerOrg(String orgId);
List<Long> getLowerOrg(Long orgId);
ResponseResult setOrgParentIds();
......@@ -25,4 +25,7 @@ public interface PubOrgService extends IService<PubOrg> {
Boolean ChangeState(UpdateOrgReq req);
//根据组织机构id查询出组织机构是否存在
PubOrg PubOrgExist(Long id);
}
......@@ -44,4 +44,7 @@ public interface WarehouseService extends IService<Warehouse> {
ResponseResult setWarehouseInventory(Map<String, Object> msg);
//通过仓库id 判断仓库是否存在
Warehouse WarehoustExist(String id);
}
......@@ -26,8 +26,6 @@ import java.util.Map;
@Service
public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService {
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetService cabinetService;
......@@ -51,11 +49,6 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
@Override
@Transactional(rollbackFor = Exception.class)
public boolean AddBoxInfo(UpdateCabinetBoxReq req) {
CabinetBox one = this.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getId, req.getId()));
if (ObjectUtil.isNotNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
}
CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(req,cabinetBox);
//添加单警柜箱门信息默认状态为1
......
......@@ -31,7 +31,6 @@ import javax.annotation.Resource;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> implements CabinetService {
......@@ -49,8 +48,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
private PolicemanService policemanService;
private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) {
List<String> allOrg = new ArrayList<>();
private List<Long> getAllOrgId(CabinetReq req, String includeLowerLevel) {
List<Long> allOrg = new ArrayList<>();
if (includeLowerLevel.equals("false")) {
allOrg.add(req.getOrgId());
} else if (includeLowerLevel.equals("true")) {
......@@ -60,7 +59,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return allOrg;
}
private List<Cabinet> getAllCabinetByOrg( List<String> allOrgId) {
private List<Cabinet> getAllCabinetByOrg( List<Long> allOrgId) {
List<Cabinet> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet;
......@@ -97,12 +96,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
public String addCabinetInfo(UpdateCabinetReq req) {
Cabinet cabinet = new Cabinet();
//查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(ObjectUtil.isNotEmpty(req.getOrgId()),PubOrg::getOrgId,req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
pubOrgService.PubOrgExist(req.getOrgId());
//查询是否有重复的单警柜编号
List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum()));
......@@ -151,12 +145,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//遍历单警柜id列表
for (String id:cabinetIdList) {
//通过单警柜id查询出他的箱门数
Cabinet cabinet = this.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(id), Cabinet::getId,id));
//如果查询不到单警柜抛出异常
if (ObjectUtil.isEmpty(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
Cabinet cabinet = CabinetExist(id);
//查询出单警柜之后添加到列表中
cabinetList.add(cabinet);
//通过单警柜id循环遍历出并删除所有箱门信息
......@@ -197,6 +186,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
*/
@Override
public List<CabinetDto> getAllCabinetList(CabinetReq req) {
//判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId());
List<Cabinet> cabinets = new ArrayList<>();
List<CabinetDto> cabinetList=new ArrayList<>();
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
......@@ -222,7 +213,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
}
//分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则incluLowerLevel为true,如果是查询本级的单警柜信息则为false
if (req.getIncludeLowerLevel().equals("true") || req.getIncludeLowerLevel().equals("false")) {
List<String> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
List<Long> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
if (allOrgId.size()==0) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
......@@ -259,11 +250,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override
public CabinetDto showOneCabinet(CabinetReq req) {
//查询单警柜信息
Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
Cabinet cabinet = CabinetExist(req.getId());
//查询单警柜的箱门信息
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getCabinetId, req.getId()));
......@@ -275,7 +262,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
}
//将单警柜的信息和它的箱门信息返回
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(one,cabinetDto);
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
cabinetDto.setCabinetBoxList(boxList);
return cabinetDto;
}
......@@ -289,15 +276,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override
public boolean updateCabinetInfo(UpdateCabinetReq req) {
//查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(ObjectUtil.isNotEmpty(req.getOrgId()),PubOrg::getOrgId,req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
pubOrgService.PubOrgExist(req.getOrgId());
//查询是否有重复的单警柜编号
List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum()));
.eq(Cabinet::getCabinetNum,req.getCabinetNum()));
if (list.size()>0) {
//判断是否是本身,如果是则不抛出异常(根据单警柜id进行比较)
Cabinet cabinet = list.get(0);
......@@ -363,11 +345,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Transactional(rollbackFor = Exception.class)
public boolean ChangeCabinetState(UpdateCabinetReq req) {
//查询单警柜是否存在
Cabinet cabinet = getOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
CabinetExist(req.getId());
List<UpdateCabinetBoxReq> cabinetBoxList = req.getCabinetBoxList();
List<CabinetBox> list =new ArrayList<>();
for (UpdateCabinetBoxReq updateCabinet:cabinetBoxList) {
......@@ -378,25 +356,21 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return cabinetBoxService.updateBatchById(list);
}
//根据单警柜id查询出组织机构id
@Override
public Long SearchOrgId(CabinetReq req) {
Cabinet cabinet = CabinetExist(req.getId());
return cabinet.getOrgId();
}
//根据单警柜id判断单警柜是否存在
@Override
public Long SearchOrgId(String id) {
public Cabinet CabinetExist(String id) {
Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getId, id));
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
return one.getOrgId();
return one;
}
//查询机构id是否存在
private LambdaQueryWrapper<PubOrg> PubOrgWrapper(long orgId) {
LambdaQueryWrapper<PubOrg> wrapper = new LambdaQueryWrapper<>();
//查询全部
if (ObjectUtil.isEmpty(orgId)) {
return wrapper;
}
//查询机构id是否存在
wrapper.eq(ObjectUtil.isNotEmpty(orgId),PubOrg::getOrgId,orgId);
return wrapper;
}
}
\ No newline at end of file
......@@ -35,10 +35,9 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
//新增指纹信息
@Override
public boolean addFingerInfo(UpdatePoliceFingerReq req) {
public Integer addFingerInfo(UpdatePoliceFingerReq req) {
//判断警员是否存在
PoliceExist(req.getPoliceId());
policemanService.PoliceExist(req.getPoliceId());
PoliceFinger policeFinger = getOne(new LambdaQueryWrapper<PoliceFinger>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceId()),PoliceFinger::getPoliceId,req.getPoliceId())
.eq(ObjectUtil.isNotEmpty(req.getFingerInfo()),PoliceFinger::getFingerInfo,req.getFingerInfo()));
......@@ -48,7 +47,8 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
}
PoliceFinger policeFinger1=new PoliceFinger();
BeanPlusUtil.copyProperties(req, policeFinger1);
return this.save(policeFinger1);
save(policeFinger1);
return policeFinger1.getId();
}
//修改指纹信息
......@@ -62,6 +62,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
//查询指纹信息
@Override
public List<PoliceFinger> searchFingerInfo(PolicemanFingerReq req) {
policemanService.PoliceExist(req.getPoliceId());
LambdaQueryWrapper<PoliceFinger> wrapper = createWrapper(req);
return this.list(wrapper);
}
......@@ -71,7 +72,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
@Override
public boolean deleteFinger(UpdatePoliceFingerReq req) {
//判断警员是否存在
PoliceExist(req.getPoliceId());
policemanService.PoliceExist(req.getPoliceId());
PoliceFinger policeFinger = PolicemanFingerExist(req.getId(), req.getPoliceId());
return removeById(policeFinger);
}
......@@ -107,15 +108,6 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
return wrapper;
}
//判断警员是否存在
public boolean PoliceExist(String id){
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, id));
if (ObjectUtil.isNull(one)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
return true;
}
//判断指纹信息是否存在
public PoliceFinger PolicemanFingerExist(Integer fingerId,String policeId){
PoliceFinger one = getOne(new LambdaQueryWrapper<PoliceFinger>()
......
......@@ -39,17 +39,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PoliceFingerMapper policeFingerMapper;
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetMapper cabinetMapper;
@Resource
private PubOrgMapper pubOrgMapper;
@Resource
private PubOrgService pubOrgService;
......@@ -58,9 +47,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
private CabinetService cabinetService;
@Resource
private PolicemanService policemanService;
@Resource
private CabinetBoxService cabinetBoxService;
@Resource
......@@ -82,14 +68,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override
public String AddPoliceman(UpdatePolicemanReq req) {
//查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), PubOrg::getOrgId, req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
pubOrgService.PubOrgExist(req.getOrgId());
//查询是否有重复的policeCode
List<Policeman> list = policemanService.list(new LambdaQueryWrapper<Policeman>()
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode()));
if (list.size() > 0) {
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
......@@ -97,7 +78,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
Policeman policeman = new Policeman();
BeanPlusUtil.copyProperties(req, policeman);
//添加警员绑定用户信息
policemanService.save(policeman);
save(policeman);
return policeman.getId();
}
......@@ -143,11 +124,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
*/
@Override
public PolicemanDto GetOnePolice(PolicemanReq req) {
Policeman one = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman one = PoliceExist(req.getId());
PolicemanDto policemanDto = new PolicemanDto();
BeanPlusUtil.copyProperties(one, policemanDto);
//将警员的指纹信息查询出来
......@@ -174,12 +151,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override
public boolean DeletePolice(UpdatePolicemanReq req) {
//通过警员id查询警员信息
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
//查询不到警员信息则抛异常
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman policeman = PoliceExist(req.getId());
//如果查询出来的警员信息中没有绑定箱门而参数传递了箱门id,则抛出异常警员绑定箱门错误
//如果传递的箱门id参数与查询出来的箱门id不一致,则抛出异常警员绑定的箱门与实际绑定不符合
if ((ObjectUtil.isNull(policeman.getCabinetBoxId()) && ObjectUtil.isNotNull(req.getCabinetBoxId()))) {
......@@ -188,7 +160,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//通过警员信息中的userId对账号进行删除
sysUserService.remove(new LambdaQueryWrapper<User>()
.eq(User::getUserId, policeman.getUserId()));
return policemanService.removeById(policeman);
return removeById(policeman);
}
......@@ -204,17 +176,14 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
Policeman policeman = new Policeman();
BeanPlusUtil.copyProperties(req, policeman);
//查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), PubOrg::getOrgId, req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
pubOrgService.PubOrgExist(req.getOrgId());
//判断传入的修改的警员编号与本身编号一致,如果一致则无所谓,如果不一致则需要判断修改的警员编号是否已经存在
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
Policeman one = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
//判断警员是否存在
if (!req.getPoliceCode().equals(one.getPoliceCode())) {
Policeman one1 = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
Policeman one1 = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode()));
if (ObjectUtil.isNotNull(one1)) {
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
......@@ -228,7 +197,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(policeman);
return updateById(policeman);
}
......@@ -241,13 +210,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override
public boolean ChangePoliceState(UpdatePolicemanReq req) {
//通过警员id查询出警员信息
Policeman one = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman one = PoliceExist(req.getId());
one.setState(req.getState());
return policemanService.updateById(one);
return updateById(one);
}
......@@ -287,12 +252,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override
public PoliceDto GetAllPolicemanList(Long orgId) {
//查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(ObjectUtil.isNotEmpty(orgId), PubOrg::getOrgId, orgId));
if (ObjectUtil.isNull(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
PubOrg pubOrg = pubOrgService.PubOrgExist(orgId);
//查询出组织机构下的所有警员信息
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(orgId), Policeman::getOrgId, orgId)
......@@ -317,7 +277,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
PoliceDto policeDto = new PoliceDto();
policeDto.setPolicemanlist(policeList);
//设置组织机构名
policeDto.setOrgName(puborg.getOrgName());
policeDto.setOrgName(pubOrg.getOrgName());
policeDto.setOrgId(orgId);
return policeDto;
}
......@@ -329,11 +289,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public PoliceDto GetPoliceData(String id) {
PoliceDto policeDto = new PoliceDto();
//判断单警柜id是否正确
Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getId, id));
if (ObjectUtil.isNull(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
Cabinet cabinet = cabinetService.CabinetExist(id);
//通过箱门id查询出警员
List<Policeman> policemenList = policemanMapper.SearchPoliceList(id);
List<PolicemanDto> list = new ArrayList<>();
......@@ -369,14 +325,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
if (ObjectUtil.isNull(req.getFaceInfo()) || ObjectUtil.isEmpty(req.getFaceInfo())) {
return false;
}
Policeman police = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(police)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman police = PoliceExist(req.getId());
police.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(police);
return updateById(police);
}
/**
......@@ -389,15 +341,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
**/
@Override
public boolean UpdateFaceInfo(UpdatePolicemanReq req) {
//警员id不能为空
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())) {
return false;
}
Policeman police = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
Policeman police = PoliceExist(req.getId());
police.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(police);
return updateById(police);
}
......@@ -410,15 +357,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
**/
@Override
public Policeman SearchFaceInfo(PolicemanReq req) {
//警员id不能为空
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())) {
return null;
}
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman policeman = PoliceExist(req.getId());
return policeman;
}
......@@ -434,7 +373,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public boolean PoliceBindUser(PolicemanReq req) {
User user = new User();
BeanPlusUtil.copyProperties(req, user);
//密码加密,依赖注入错误
//密码加密,bcrypt加密方式
BcryptPasswordStoredEncrypt passwordStoredEncrypt = new BcryptPasswordStoredEncrypt();
String encrypt = passwordStoredEncrypt.encrypt(req.getPassword());
user.setPassword(encrypt);
......@@ -447,36 +386,46 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
user.setRealName(req.getName());
user.setNickName(req.getName());
System.out.println("user = " + user);
sysUserService.save(user);
//判断警员是否存在
Policeman policeman = PoliceExist(req.getId());
//通过警员id将查询到的警员信息进行修改设置
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
policeman.setUserId(user.getUserId());
policeman.setIsCreatedAccount(true);
policeman.setPassword(encrypt);
return policemanService.updateById(policeman);
return updateById(policeman);
}
//人员绑定箱门
@Override
public boolean PoliceBindBox(PolicemanReq req) {
Policeman policeman = new Policeman();
Policeman policeman = PoliceExist(req.getId());
BeanPlusUtil.copyProperties(req, policeman);
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
//判断箱子是否存在
CabinetBox cabinetBox = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getId, req.getCabinetBoxId()));
if (ObjectUtil.isNull(cabinetBox)) {
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
return policemanService.updateById(policeman);
return updateById(policeman);
}
/**
* 通过警员id判断警员是否存在,不存在则抛出异常
*/
@Override
public Policeman PoliceExist(String policeId) {
Policeman policeman = getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId,policeId));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
return policeman;
}
}
......@@ -11,6 +11,7 @@ import com.junmp.jyzb.api.bean.req.UpdateOrgReq;
import com.junmp.jyzb.api.exception.JYZBAppException;
import com.junmp.jyzb.api.exception.enums.EquipmentTypeExceptionEnum;
import com.junmp.jyzb.api.exception.enums.OrgExceptionEnum;
import com.junmp.jyzb.api.exception.enums.PubOrgExceptionEnum;
import com.junmp.jyzb.entity.EquipmentType;
import com.junmp.jyzb.entity.PubOrg;
import com.junmp.jyzb.entity.Supplier;
......@@ -18,6 +19,7 @@ import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.RedisUtils;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -52,7 +54,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
@Override
public List<String> getLowerOrg(String orgId) {
public List<Long> getLowerOrg(Long orgId) {
//构建 Redis 缓存�
String redisKey = "getLowerOrg";
......@@ -66,40 +68,40 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
redisUtils.set(redisKey, menuList);
}
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<String, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
List<Long> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<String, List<Long>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
resultList.add(orgId); //将自己加入到返回的List中
// 构建子菜单映射表
for (PubOrg menu : menuList) {
String org = menu.getOrgId().toString();
Long org = menu.getOrgId();
if (!childrenMap.containsKey(menu.getOrgParentId().toString())) { // 如果父菜单还不存在于映射表中
childrenMap.put(menu.getOrgParentId().toString(), new ArrayList<>()); // 创建一个新的子菜单列表
}
childrenMap.get(menu.getOrgParentId().toString()).add(org); // 将当前菜单项放入对应的子菜单列表中
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中
}
Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息
//Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
// 获取顶级菜单
List<String> topMenus = childrenMap.get(orgId);
List<Long> topMenus = childrenMap.get(orgId);
// 迭代构建菜单树
if (topMenus != null) {
for (String topMenu : topMenus) {
Stack<String> stack = new Stack<>(); // 使用栈结构辅助构建菜单树
for (Long topMenu : topMenus) {
Stack<Long> stack = new Stack<>(); // 使用栈结构辅助构建菜单树
stack.push(topMenu); // 将当前顶级菜单项放入栈中
while (!stack.isEmpty()) {
String currentMenu = stack.pop(); // 取出队首的当前菜单项
Long currentMenu = stack.pop(); // 取出队首的当前菜单项
//Long currentMenuId = currentMenu; // 获取当前菜单项的标识符
if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜单
List<String> children = childrenMap.get(currentMenu); // 获取子菜单列表
List<Long> children = childrenMap.get(currentMenu); // 获取子菜单列表
for (int i = children.size() - 1; i >= 0; i--) {
stack.push(children.get(i));
......@@ -244,6 +246,8 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
}
}
public List<String> CheckOrgList(List<String> req){
LambdaQueryWrapper<PubOrg> wp = new LambdaQueryWrapper<>();
wp.in(ObjectUtil.isNotEmpty(req), PubOrg::getOrgId, req);
......@@ -359,6 +363,18 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
return wrapper;
}
//根据组织机构id查询出组织机构是否存在
@Override
public PubOrg PubOrgExist(Long id) {
PubOrg puborg = getOne(new LambdaQueryWrapper<PubOrg>()
.eq(PubOrg::getOrgId,id));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
return puborg;
}
}
......
......@@ -48,16 +48,12 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
@Override
public WarehouseDto getOneWarehouse(WarehouseReq req) {
Warehouse warehouseMsg=this.getById(req.getId());
if (ObjectUtil.isNull(warehouseMsg)){
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
Warehouse warehouse = WarehoustExist(req.getId());
WarehouseDto warehouseDto = new WarehouseDto();
BeanPlusUtil.copyProperties(warehouseMsg,warehouseDto);
BeanPlusUtil.copyProperties(warehouse,warehouseDto);
//获取组织机构名称
PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(PubOrg::getOrgId, warehouseMsg.getOrgId()));
warehouseDto.setOrgName(one.getOrgName());
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
warehouseDto.setOrgName(pubOrg.getOrgName());
return warehouseDto;
}
......@@ -88,13 +84,9 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
List<Warehouse> allWarehouse=new ArrayList<>();
List<WarehouseDto> warehouseDtoList=new ArrayList<>();
//判断组织机构是否存在
PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>()
.eq(PubOrg::getOrgId, msg.getOrgId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
PubOrg pubOrg = pubOrgService.PubOrgExist(msg.getOrgId());
//根据组织机构id查询组织机构名称
String orgName = one.getOrgName();
String orgName = pubOrg.getOrgName();
//如果组织机构是浙江省公安厅
if (msg.getOrgId().equals(1369509498032808905L) && msg.getIncludeLowerLevel().equals("true")){
allWarehouse = this.list();
......@@ -108,7 +100,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
}
//获取组织机构Id
List<String> allOrgId =getAllOrgId(msg);
List<Long> allOrgId =getAllOrgId(msg);
allWarehouse = getAllWarehouseByOrg(allOrgId);
......@@ -122,18 +114,18 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
}
private List<String> getAllOrgId(WarehouseReq msg) {
List<String> allOrg = new ArrayList<>();
private List<Long> getAllOrgId(WarehouseReq msg) {
List<Long> allOrg = new ArrayList<>();
if (msg.getIncludeLowerLevel().equals("false")){
allOrg.add(msg.getOrgId().toString());
allOrg.add(msg.getOrgId());
}else if(msg.getIncludeLowerLevel().equals("true")){
//查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.getOrgId().toString());
allOrg = pubOrgService.getLowerOrg(msg.getOrgId());
}
return allOrg;
}
private List<Warehouse> getAllWarehouseByOrg(List<String> allOrgId) {
private List<Warehouse> getAllWarehouseByOrg(List<Long> allOrgId) {
List<Warehouse> allWarehouse = new ArrayList<>();
LambdaQueryWrapper<Warehouse> queryWrapper = new LambdaQueryWrapper<>();
......@@ -171,24 +163,21 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
private Warehouse queryWarehouse(WarehouseReq req) {
Warehouse app = this.getById(req.getId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
return app;
Warehouse warehouse = WarehoustExist(req.getId());
return warehouse;
}
private LambdaQueryWrapper<Product> createWrapper(ProductReq req) {
LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
//判断仓库是否存在
@Override
public Warehouse WarehoustExist(String id) {
Warehouse warehouseMsg=this.getById(id);
if (ObjectUtil.isNull(warehouseMsg)){
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getProductCode()), Product::getProductCode, req.getProductCode());
//根据企业名称模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), Product::getName, req.getName());
wrapper.orderByDesc(Product::getUpdateTime);
return wrapper;
return warehouseMsg;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论