Commit 97678fa6 by 李小惠

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

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