Commit 97678fa6 by 李小惠

修改装备树接口,修改人员绑定箱门接口

parent 04335258
...@@ -21,6 +21,8 @@ public class OrderDto implements Serializable { ...@@ -21,6 +21,8 @@ public class OrderDto implements Serializable {
* 工作流ID * 工作流ID
*/ */
private String processId; private String processId;
private String examineState;
/** /**
* 单据业务类型 * 单据业务类型
*/ */
...@@ -95,6 +97,7 @@ public class OrderDto implements Serializable { ...@@ -95,6 +97,7 @@ public class OrderDto implements Serializable {
private String createUser; private String createUser;
private String allocateType; private String allocateType;
private Integer manualState;
/** /**
* 附件地址 * 附件地址
......
...@@ -12,10 +12,8 @@ public class PolicemanDto { ...@@ -12,10 +12,8 @@ public class PolicemanDto {
private String name; private String name;
private List<String> soloBoxList; private List<String> boxList;
private List<String> publicBoxList; private String boxName;
private String soloBoxName;
private String publicBoxName;
private String policeCode; private String policeCode;
private String sex; private String sex;
......
...@@ -21,7 +21,7 @@ public class PolicemanReq extends BaseRequest { ...@@ -21,7 +21,7 @@ public class PolicemanReq extends BaseRequest {
private String cabinetId; private String cabinetId;
private List<CabinetBoxReq> boxList; private List<String> boxList;
@NotNull(message = "组织机构id不能为空",groups = {add.class,page.class}) @NotNull(message = "组织机构id不能为空",groups = {add.class,page.class})
private Long orgId; private Long orgId;
......
...@@ -71,10 +71,10 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -71,10 +71,10 @@ public class UpdatePolicemanReq extends BaseRequest {
//当前登录人的id //当前登录人的id
private Long createUser; private Long createUser;
/** // /**
* 人脸照片list // * 人脸照片list
*/ // */
private List<String> faceInfoList; // private List<String> faceInfoList;
/** /**
* 指纹照片list * 指纹照片list
*/ */
......
...@@ -86,8 +86,8 @@ public class EquipmentTypeController { ...@@ -86,8 +86,8 @@ public class EquipmentTypeController {
//返回整棵物资树 //返回整棵物资树
@PostMapping("/GetTypeTree") @PostMapping("/GetTypeTree")
@ApiOperation("/获取整棵物资树") @ApiOperation("/获取整棵物资树")
public ApiRes<List<EquipmentTreeDto>> GetTypeTree(){ public ApiRes<List<EquipmentTreeDto>> GetTypeTree(@RequestBody QueryEquipmentTypeReq req){
return ApiRes.success(equipmentTypeService.GetTypeTree()); return ApiRes.success(equipmentTypeService.GetTypeTree(req));
} }
......
...@@ -105,9 +105,6 @@ public class Cabinet implements Serializable { ...@@ -105,9 +105,6 @@ public class Cabinet implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE, value = "update_time") @TableField(fill = FieldFill.INSERT_UPDATE, value = "update_time")
private Date updateTime; private Date updateTime;
/** /**
* 新增人员 * 新增人员
*/ */
...@@ -127,13 +124,22 @@ public class Cabinet implements Serializable { ...@@ -127,13 +124,22 @@ public class Cabinet implements Serializable {
*/ */
@ApiModelProperty(value = "箱数") @ApiModelProperty(value = "箱数")
private Integer num; private Integer num;
@TableField(exist = false)
private String policeName; private String policeName;
@TableField(exist = false)
private String policeId; private String policeId;
@TableField(exist = false)
private Integer number; private Integer number;
@TableField(exist = false)
private String orgName; private String orgName;
@TableField(exist = false)
private String boxId; private String boxId;
@TableField(exist = false)
private String containType; private String containType;
@TableField(exist = false)
private String boxState; private String boxState;
@TableField(exist = false)
private String equipmentConfig; private String equipmentConfig;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -13,7 +13,7 @@ import java.util.Map; ...@@ -13,7 +13,7 @@ import java.util.Map;
public interface CabinetMapper extends BaseMapper<Cabinet> { public interface CabinetMapper extends BaseMapper<Cabinet> {
List<Cabinet> getAllCabinetByOrgList(@Param("list") List<Long> allOrgId); List<Cabinet> getAllCabinetByOrgList(@Param("list") List<Long> allOrgId);
List<Cabinet> getAllCabinetsWithSingleCabinet(@Param("orgId")String id); List<Cabinet> getAllCabinetsWithSingleCabinet(@Param("orgId")String orgId,@Param("policeId")String policeId);
boolean SetInventoryInfo(String id); boolean SetInventoryInfo(String id);
} }
\ No newline at end of file
...@@ -28,5 +28,5 @@ public interface EquipmentTypeService extends IService<EquipmentType> { ...@@ -28,5 +28,5 @@ public interface EquipmentTypeService extends IService<EquipmentType> {
ESTypeDto getTypeTreeByEs(QueryEquipmentTypeReq req) throws IOException; ESTypeDto getTypeTreeByEs(QueryEquipmentTypeReq req) throws IOException;
List<EquipmentTreeDto> GetTypeTree(); List<EquipmentTreeDto> GetTypeTree(QueryEquipmentTypeReq req);
} }
...@@ -179,7 +179,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -179,7 +179,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override @Override
public List<CabinetDto> getAllCabinetList(CabinetReq req) { public List<CabinetDto> getAllCabinetList(CabinetReq req) {
List<CabinetDto> cabinetList = new ArrayList<>(); List<CabinetDto> cabinetList = new ArrayList<>();
List<Cabinet> list = cabinetMapper.getAllCabinetsWithSingleCabinet(String.valueOf(req.getOrgId())); List<Cabinet> list = cabinetMapper.getAllCabinetsWithSingleCabinet(String.valueOf(req.getOrgId()),null);
if (list.size() == 0) { if (list.size() == 0) {
return new ArrayList<>(); return new ArrayList<>();
......
...@@ -389,7 +389,13 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E ...@@ -389,7 +389,13 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
return tree; return tree;
} }
//获取整棵type树 //获取整棵type树
public List<EquipmentTreeDto> GetTypeTree() { public List<EquipmentTreeDto> GetTypeTree(QueryEquipmentTypeReq req) {
//默认type为1(也就是需要将整棵数进行返回,如果只需要返回上面的装备类型,那么前端传递的type是0,否则就是1)
Integer type=1;
if (ObjectUtil.isNotNull(req.getType())&& req.getType()==0){
type=0;
}
//获取所有的装备,不包括超级根
List<EquipmentType> list = list(new LambdaQueryWrapper<EquipmentType>() List<EquipmentType> list = list(new LambdaQueryWrapper<EquipmentType>()
.ne(EquipmentType::getId, "00000000-0000-0000-0000-000000000000")); .ne(EquipmentType::getId, "00000000-0000-0000-0000-000000000000"));
List<EquipmentTreeDto> dtoList = new ArrayList<>(); List<EquipmentTreeDto> dtoList = new ArrayList<>();
...@@ -402,25 +408,31 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E ...@@ -402,25 +408,31 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
} }
// 递归转换为输出类节点 // 递归转换为输出类节点
for (EquipmentType rootEntity : rootEntities) { for (EquipmentType rootEntity : rootEntities) {
EquipmentTreeDto dto = convertNode(rootEntity, list); EquipmentTreeDto dto = convertNode(rootEntity, list,type);
dtoList.add(dto); dtoList.add(dto);
} }
return dtoList; return dtoList;
} }
private EquipmentTreeDto convertNode(EquipmentType entity, List<EquipmentType> entityList) { private EquipmentTreeDto convertNode(EquipmentType entity, List<EquipmentType> entityList,Integer type) {
EquipmentTreeDto dto = new EquipmentTreeDto(); EquipmentTreeDto dto = new EquipmentTreeDto();
BeanPlusUtil.copyProperties(entity,dto); BeanPlusUtil.copyProperties(entity,dto);
dto.setIsLeaf(true); // 默认为叶子节点 dto.setIsLeaf(true); // 默认为叶子节点
List<EquipmentTreeDto> children = new ArrayList<>(); List<EquipmentTreeDto> children = new ArrayList<>();
for (EquipmentType childEntity : entityList) { for (EquipmentType childEntity : entityList) {
if (childEntity.getParentId().equals(entity.getId())) { if (childEntity.getParentId().equals(entity.getId()) ) {
EquipmentTreeDto childDto = convertNode(childEntity, entityList); EquipmentTreeDto childDto = convertNode(childEntity, entityList,type);
children.add(childDto); if (childEntity.getType()!=1 && type==0){
children.add(childDto);
} else if (type==1) {
children.add(childDto);
}
dto.setIsLeaf(false); // 存在子节点,当前节点不是叶子节点 dto.setIsLeaf(false); // 存在子节点,当前节点不是叶子节点
} }
} }
dto.setChildren(children); dto.setChildren(children);
return dto; return dto;
} }
......
...@@ -125,6 +125,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -125,6 +125,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Resource @Resource
private PubOrgService pubOrgService; private PubOrgService pubOrgService;
@Resource
private PolicemanService policemanService;
@Resource @Resource
private InventorySummaryMapper inventorySummaryMapper; private InventorySummaryMapper inventorySummaryMapper;
...@@ -786,13 +788,14 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -786,13 +788,14 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
e = policeBindEqs(req, reqList, orgId); e = policeBindEqs(req, reqList, orgId);
} }
//如果是归还入库,将警员下面的装备进行处理 //如果是归还入库,将警员下面的装备进行处理
boolean f=true;
if (req.getBussinessType().equals("return")){ if (req.getBussinessType().equals("return")){
f = policeUnBindEqs(req, reqList, orgId);
} }
//如果是快速移库,记账完成之后新增入库单并且该单据不走审核流,但是审核状态和入库状态显示已完成 //如果是快速移库,记账完成之后新增入库单并且该单据不走审核流,但是审核状态和入库状态显示已完成
boolean f=true; boolean g=true;
if (req.getBussinessType().equals("quick")){ if (req.getBussinessType().equals("quick")){
f = addQuickOrder(orderMain); g = addQuickOrder(orderMain);
} }
//记账结束之后往消息队列中推送一条消息 //记账结束之后往消息队列中推送一条消息
String exchangeName="orderExchange"; String exchangeName="orderExchange";
...@@ -807,12 +810,45 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -807,12 +810,45 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
MQ.SendMsg(exchangeName,req.getStartOrgId().toString(),mqReturnMsgDto); MQ.SendMsg(exchangeName,req.getStartOrgId().toString(),mqReturnMsgDto);
} }
//更新主单据 //更新主单据
return (a && b && c && d && e && f ); return (a && b && c && d && e && f && g );
} }
public boolean policeUnBindEqs(UpdateOrderReq req,List<UpdateOrderDetailReq> reqList,Long orgId){ public boolean policeUnBindEqs(UpdateOrderReq req,List<UpdateOrderDetailReq> reqList,Long orgId){
//根据传递的装备信息对警员进行解绑操作 //根据传递的装备信息对警员进行解绑操作(判断警员下面是否有装备信息,如果有则直接进行修改或者删除,如果没有则跳过不处理)
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>().eq(Policeman::getUserId, req.getReturnUserId()));
return true; List<PoliceEquipment> list = policeEquipmentService.list(new LambdaQueryWrapper<PoliceEquipment>()
.eq(ObjectUtil.isNotNull(req.getReturnUserId()), PoliceEquipment::getPoliceId, one.getId())
.eq(PoliceEquipment::getOrgId,orgId));
List<PoliceEquipment> delList=new ArrayList<>();
List<PoliceEquipment> updateList=new ArrayList<>();
if (list.size()>0){
for (UpdateOrderDetailReq upReq:reqList) {
for (PoliceEquipment pEqs:list ) {
if (upReq.getSizeId().equals(pEqs.getSizeId()) && upReq.getTypeId().equals(pEqs.getTypeId())
&& upReq.getPrice().compareTo(pEqs.getPrice())==0){
//如果数量大于的情况下直接将该条数据进行删除,否则直接修改数量并且更新
if (upReq.getModifyQuantity()>=pEqs.getNum()){
delList.add(pEqs);
}else {
pEqs.setNum(pEqs.getNum()-upReq.getModifyQuantity());
updateList.add(pEqs);
}
break;
}
}
}
boolean a=true;
if (delList.size()>0){
a=policeEquipmentService.removeBatchByIds(delList);
}
boolean b=true;
if (updateList.size()>0){
b=policeEquipmentService.updateBatchById(updateList);
}
return a && b;
}else {
return true;
}
} }
public boolean policeBindEqs(UpdateOrderReq req,List<UpdateOrderDetailReq> reqList,Long orgId){ public boolean policeBindEqs(UpdateOrderReq req,List<UpdateOrderDetailReq> reqList,Long orgId){
//如果是领用出库,那记账结束以后将装备挂到警员名下(存储到policemanEquipment表中) //如果是领用出库,那记账结束以后将装备挂到警员名下(存储到policemanEquipment表中)
......
...@@ -124,7 +124,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -124,7 +124,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Resource @Resource
private OrderLogService orderLogService; private OrderLogService orderLogService;
@Resource
private CabinetMapper cabinetMapper;
private static final String REDIS_POLICE = "Policeman_"; private static final String REDIS_POLICE = "Policeman_";
private static final String REDIS_ORG = "Organization_"; private static final String REDIS_ORG = "Organization_";
...@@ -253,15 +254,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -253,15 +254,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
PolicemanDto policemanDto = new PolicemanDto(); PolicemanDto policemanDto = new PolicemanDto();
BeanPlusUtil.copyProperties(one, policemanDto); BeanPlusUtil.copyProperties(one, policemanDto);
//将箱门信息展示: //将箱门信息展示:
List<CabinetBoxPolice> list = cabinetBoxPoliceService.list(new LambdaQueryWrapper<CabinetBoxPolice>() List<Cabinet> cabinetInfo = cabinetMapper.getAllCabinetsWithSingleCabinet(String.valueOf(req.getOrgId()), req.getId());
.eq(CabinetBoxPolice::getPoliceId, req.getId()) List<String> boxList=new ArrayList<>();
); if (cabinetInfo.size()>0){
List<String> soloList=new ArrayList<>(); for (Cabinet cabinet:cabinetInfo) {
List<String> publicList=new ArrayList<>();
String soloName="";
String publicName="";
if (list.size()>0){
for (CabinetBoxPolice boxPolice:list) {
// if (boxPolice.getContainType()==1){ // if (boxPolice.getContainType()==1){
// soloList.add(boxPolice.getCabinetBoxId()); // soloList.add(boxPolice.getCabinetBoxId());
...@@ -272,15 +268,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -272,15 +268,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
// publicName = publicName + boxPolice.getCabinetName()+","; // publicName = publicName + boxPolice.getCabinetName()+",";
// } // }
} }
policemanDto.setPublicBoxList(publicList); policemanDto.setBoxList(boxList);
policemanDto.setSoloBoxList(soloList);
}else {
policemanDto.setSoloBoxList(new ArrayList<>());
policemanDto.setPublicBoxList(new ArrayList<>());
} }
// policemanDto.setBoxName(soloName.trim().isEmpty()?soloName:soloName.substring(0,soloName.length()-1));
policemanDto.setSoloBoxName(soloName.trim().isEmpty()?soloName:soloName.substring(0,soloName.length()-1));
policemanDto.setPublicBoxName(publicName.trim().isEmpty()?publicName:publicName.substring(0,publicName.length()-1));
//将警员的指纹信息查询出来 //将警员的指纹信息查询出来
List<PoliceFinger> list1 = policeFingerService.list(new LambdaQueryWrapper<PoliceFinger>() List<PoliceFinger> list1 = policeFingerService.list(new LambdaQueryWrapper<PoliceFinger>()
...@@ -656,17 +646,17 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -656,17 +646,17 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//根据警员id和箱门id绑定公共柜 //根据警员id和箱门id绑定公共柜
List<CabinetBoxPolice> cabinetBoxPoliceList=new ArrayList<>(); List<CabinetBoxPolice> cabinetBoxPoliceList=new ArrayList<>();
List<CabinetBoxReq> boxList = req.getBoxList(); List<String> boxList = req.getBoxList();
//将箱门全部清除 //将箱门全部清除
cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId())); cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId()));
//公共柜和单警柜一起批量绑定 //公共柜和单警柜一起批量绑定
for (CabinetBoxReq boxReq:boxList ) { for (String boxReq:boxList ) {
CabinetBoxPolice cabinetBoxPolice = new CabinetBoxPolice(); CabinetBoxPolice cabinetBoxPolice = new CabinetBoxPolice();
cabinetBoxPolice.setPoliceId(req.getId()); cabinetBoxPolice.setPoliceId(req.getId());
// cabinetBoxPolice.setCabinetId(boxReq.getCabinetId()); // cabinetBoxPolice.setCabinetId(boxReq.getCabinetId());
cabinetBoxPolice.setCabinetBoxId(boxReq.getId()); cabinetBoxPolice.setCabinetBoxId(boxReq);
cabinetBoxPolice.setCreateTime(DateTimeUtil.getCurrentDateTime()); cabinetBoxPolice.setCreateTime(DateTimeUtil.getCurrentDateTime());
// cabinetBoxPolice.setCabinetName(boxReq.getCabinetName()); // cabinetBoxPolice.setCabinetName(boxReq.getCabinetName());
// cabinetBoxPolice.setNum(boxReq.getNum()); // cabinetBoxPolice.setNum(boxReq.getNum());
...@@ -675,17 +665,18 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -675,17 +665,18 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//调岗警员绑定第一个单警柜以后,不管之后他是否还有单警柜,我都默认是不绑了。 //调岗警员绑定第一个单警柜以后,不管之后他是否还有单警柜,我都默认是不绑了。
// 判断他下面是否有箱门,如果有则表示他已经帮过单警柜并且调岗携带的装备都已经记录过,那么将不再被记录 // 判断他下面是否有箱门,如果有则表示他已经帮过单警柜并且调岗携带的装备都已经记录过,那么将不再被记录
if (boxReq.getContainType()==1 && ObjectUtil.isNotNull(orderLog) && list1.size()==0 && !flag && !locationId.trim().isEmpty()){ // if (ObjectUtil.isNotNull(orderLog) && list1.size()==0 && !flag && !locationId.trim().isEmpty()){
flag=true; // flag=true;
cabinet = cabinetService.getById(boxReq.getCabinetId()); //
for (PoliceEquipment equipment:policeEqsList) { // cabinet = cabinetService.getById(boxReq.getCabinetId());
equipment.setLocationId(boxReq.getCabinetId()); // for (PoliceEquipment equipment:policeEqsList) {
equipment.setOrgId(req.getOrgId()); // equipment.setLocationId(boxReq.getCabinetId());
Object[] item=new Object[]{req.getOrgId(),boxReq.getCabinetId(),equipment.getTypeId(),equipment.getSizeId(),equipment.getPrice()}; // equipment.setOrgId(req.getOrgId());
searchItem.add(item); // Object[] item=new Object[]{req.getOrgId(),boxReq.getCabinetId(),equipment.getTypeId(),equipment.getSizeId(),equipment.getPrice()};
} // searchItem.add(item);
policeEquipmentService.updateBatchById(policeEqsList); // }
} // policeEquipmentService.updateBatchById(policeEqsList);
// }
} }
if (cabinetBoxPoliceList.size()>0){ if (cabinetBoxPoliceList.size()>0){
result = cabinetBoxPoliceService.saveBatch(cabinetBoxPoliceList); result = cabinetBoxPoliceService.saveBatch(cabinetBoxPoliceList);
...@@ -1190,20 +1181,20 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -1190,20 +1181,20 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
boolean flag=false; boolean flag=false;
Policeman one = getById(req.getId()); Policeman one = getById(req.getId());
if (one.getFaceInfo()!=null && !one.getFaceInfo().isEmpty()){ // if (one.getFaceInfo()!=null && !one.getFaceInfo().isEmpty()){
flag=true; // flag=true;
if(req.getFaceInfoList().size()>0 && !req.getFaceInfoList().get(0).equals(one.getFaceInfo())){ // if(req.getFaceInfoList().size()>0 && !req.getFaceInfoList().get(0).equals(one.getFaceInfo())){
one.setFaceInfo(req.getFaceInfoList().get(0)); // one.setFaceInfo(req.getFaceInfoList().get(0));
}else { // }else {
one.setFaceInfo(null); // one.setFaceInfo(null);
//
} // }
a = updateById(one); // a = updateById(one);
}else { // }else {
flag=true; // flag=true;
one.setFaceInfo(req.getFaceInfoList().get(0)); // one.setFaceInfo(req.getFaceInfoList().get(0));
a = updateById(one); // a = updateById(one);
} // }
//指纹 //指纹
List<PoliceFinger> addFingerList=new ArrayList<>(); List<PoliceFinger> addFingerList=new ArrayList<>();
......
...@@ -88,7 +88,10 @@ ...@@ -88,7 +88,10 @@
LEFT JOIN base_cabinet_box cb ON cb.cabinet_id = cabinet.id LEFT JOIN base_cabinet_box cb ON cb.cabinet_id = cabinet.id
LEFT JOIN base_cabinet_box_police ccp ON ccp.cabinet_box_id = cb.id LEFT JOIN base_cabinet_box_police ccp ON ccp.cabinet_box_id = cb.id
LEFT JOIN base_policeman bp ON bp.id = ccp.police_id LEFT JOIN base_policeman bp ON bp.id = ccp.police_id
WHERE cabinet.org_id_int = #{orgId} and cb.num is not null; WHERE cabinet.org_id_int = #{orgId} and cb.num is not null
<if test="policeId != '' and policeId != null">
and bp.id=#{policeId}
</if>
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论