wwh 10 månader sedan
förälder
incheckning
502a3a073b

+ 229 - 14
huimv-receive/src/main/java/com/huimv/receive/service/impl/BillPersonnelAdmissionServiceImpl.java

@@ -1536,6 +1536,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
     private BillSamplingMapper samplingMapper;
     @Autowired
     private BillCleanBeforeMapper beforeMapper;
+    @Autowired
+    private BaseWashoutPointMapper washoutPointMapper;
+
 
     @Override
     public Result listPrc(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
@@ -1586,6 +1589,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
         String type = paramsMap.get("type");
         String id = paramsMap.get("id");
         String data = paramsMap.get("data");
+
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         if (StringUtils.isBlank(data)) {
             data = sdf.format(new Date());
@@ -1616,6 +1620,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
             //说明当前不是目的地
             if ("1".equals(type)) {
 
+                Integer pcrTime = washoutPointMapper.selectOne(new QueryWrapper<BaseWashoutPoint>().eq("farm_ids", farmId)
+                        .eq("visiting_type", billPcr.getVistitType()).eq("location_id", baseLocation.getId())).getPcrTime();
+                billPcr.setQualifiedDate(pcrTime);
                 billPcr.setBillStatus(1);
                 billPcr.setPcrType(2);
                 billPcr.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
@@ -1630,36 +1637,244 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
                         billPcr.getProcessId(), billPcr.getFarmId(), billPcr.getTestLocation(), billPcr.getTestLocationId(),billPcr.getVistitType(),
                         billPcr.getPhone(),billPcr.getDepartureName(),billPcr.getDepartureId());
                 if (nextId == 0) {
-                    int index = allLocationId.indexOf(baseLocation.getId().toString());
-                    StringBuilder status = new StringBuilder(baseProcess.getAllLocationId());
-                    status.setCharAt(index, '1');
-                    status.setCharAt(index + 2, '1');
-                    baseProcess.setAllLocationStatus(status.toString());
+                    if (split.length == 1) {
+                        baseProcess.setProcessType(1);
+                        String[] strings = allLocationId.split(",");
+                        String ss2 = "";
+                        for (int i = 0; i < strings.length; i++) {
+                            strings[i].replaceAll(strings[i], "2");
+                            if (i == strings.length - 1) {
+                                ss2 = ss2 + strings[i].replaceAll(strings[i], "2");
+                            } else {
+                                ss2 = strings[i].replaceAll(strings[i], "2") + "," + ss2;
+                            }
+                        }
+                        baseProcess.setAllLocationStatus(ss2);
+                    } else {
+                        String[] strings = allLocationId.split(",");
+                        Integer index = 0;
+                        for (int i = 0; i < strings.length; i++) {
+                            if ((baseLocation.getId().toString()).equals(strings[i])) {
+                                index = i;
+                            }
+                        }
+                        QueryWrapper<BaseLocation> queryWrapper1 = new QueryWrapper();
+                        queryWrapper1.eq("id", strings[index + 2]);
+                        BaseLocation location = locationMapper.selectOne(queryWrapper1);
+                        FlowUtil flowUtil = new FlowUtil();
+                        Object entity = flowUtil.getEntity(Integer.parseInt(split[1]), billPcr.getVistitType(), billPcr.getDestName()
+                                , billPcr.getDestId(), billPcr.getAdmissionUserId(), billPcr.getAdmissionUserName(), billPcr.getPhone(),
+                                billPcr.getVistitDate(), location.getId(), location.getLocationName(), Integer.parseInt(farmId)
+                                , baseProcess.getId(), billPcr.getDepartureName(), billPcr.getDepartureId());
+                        if (Integer.parseInt(split[1]) == 1) {
+                            //新增采样
+                            BillSampling billSampling = (BillSampling) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                billSampling.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                billSampling.setResource(billPcr.getResource());
+                                billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                billSampling.setRemark(billPcr.getRemark());
+                            }
+                            billSamplingMapper.insert(billSampling);
+                        } else if (Integer.parseInt(split[1]) == 2) {
+                            //新增pcr
+                            BillPcr billClean = (BillPcr) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                billClean.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                billClean.setResource(billPcr.getResource());
+                                billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                billClean.setRemark(billPcr.getRemark());
+                            }
+                            billClean.setSamplingId(Integer.parseInt(id));
+                            pcrMapper.insert(billClean);
+                        } else if (Integer.parseInt(split[1]) == 3) {
+                            //新增洗澡
+                            BillClean billClean = (BillClean) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                billClean.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                billClean.setResource(billPcr.getResource());
+                                billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                billClean.setRemark(billPcr.getRemark());
+                            }
+                            cleanMapper.insert(billClean);
+                        } else if (Integer.parseInt(split[1]) == 4) {
+                            //新增隔离
+                            BillIsolate pcr = (BillIsolate) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                pcr.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                pcr.setResource(billPcr.getResource());
+                                pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                pcr.setRemark(billPcr.getRemark());
+                            }
+                            isolateMapper.insert(pcr);
+                        } else if (Integer.parseInt(split[1]) == 5) {
+                            BillDry billClean = (BillDry) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                billClean.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                billClean.setResource(billPcr.getResource());
+                                billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                billClean.setRemark(billPcr.getRemark());
+                            }
+                            dryMapper.insert(billClean);
+                            //新增烘干
+                        } else if (Integer.parseInt(split[1]) == 6) {
+                            //新增洗澡前拍照
+                            BillCleanBefore before = (BillCleanBefore) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                before.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                before.setResource(billPcr.getResource());
+                                before.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                before.setRemark(billPcr.getRemark());
+                            }
+                            billCleanBeforeMapper.insert(before);
+                        }else if (Integer.parseInt(split[1]) == 7) {
+                            //新增洗澡前拍照
+                            BillGoodsInventory before = (BillGoodsInventory) entity;
+                            if (billPcr.getVistitType() != 0) {
+                                before.setCarNum(billPcr.getCarNum());
+                            }
+                            if (billPcr.getVistitType() == 5) {
+                                before.setResource(billPcr.getResource());
+                                before.setFeedImgUrl(billPcr.getFeedImgUrl());
+                                before.setRemark(billPcr.getRemark());
+                            }
+                            inventoryMapper.insert(before);
+                        }
+                        baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId + "," + split[1]);
+                        Integer locationId = billPcr.getTestLocationId();
+                        String[] split2 = allLocationId.split(",");
+                        int a=0;
+                        for (int i = 0; i < split2.length; i++) {
+                            if (locationId.toString().equals(split2[i])) {
+                                a = i + 1;
+                            }
+                        }
+                        int indexOf = 2 * (a - 2);//当前位置在所有流程位置中的下标
+
+                        String substring = baseProcess.getAllLocationStatus().substring(0, indexOf + 3);//截取已经过的位置状态
+                        String[] split1 = substring.split(",");
+                        String sb2 = "";
+                        for (int i = 0; i < split1.length; i++) {
+                            if (i == split1.length - 1) {
+                                sb2 = sb2 + split1[i].replaceAll(split1[i], "2");
+                            } else {
+                                sb2 = split1[i].replaceAll(split1[i], "2") + "," + sb2;
+                            }
+                        }
+                        sb2 = sb2 + baseProcess.getAllLocationStatus().substring(indexOf + 3);
+                        StringBuilder sb = new StringBuilder(sb2);
+                        sb.replace(indexOf + 4, indexOf + 5, "2");
+                        sb.replace(indexOf + 6, indexOf + 7, "1");
+                        baseProcess.setAllLocationStatus(sb.toString());
+                    }
                 } else if (nextId == 1) {
                     //新增采样
-                    BillSampling sampling = (BillSampling) newObject;
-                    samplingMapper.insert(sampling);
-                } else if (nextId == 2) {
+                    BillSampling billSampling = (BillSampling) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        billSampling.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        billSampling.setResource(billPcr.getResource());
+                        billSampling.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        billSampling.setRemark(billPcr.getRemark());
+                    }
+                    billSamplingMapper.insert(billSampling);
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                }else if (nextId == 2) {
                     //新增pcr
                     BillPcr billClean = (BillPcr) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        billClean.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        billClean.setResource(billPcr.getResource());
+                        billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        billClean.setRemark(billPcr.getRemark());
+                    }
+                    billClean.setSamplingId(Integer.parseInt(id));
                     pcrMapper.insert(billClean);
-                } else if (nextId == 3) {
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                }else if (nextId == 3) {
                     //新增洗澡
                     BillClean billClean = (BillClean) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        billClean.setCarNum(billPcr.getCarNum());
+                    }if (billPcr.getVistitType() == 5) {
+                        billClean.setResource(billPcr.getResource());
+                        billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        billClean.setRemark(billPcr.getRemark());
+                    }
                     cleanMapper.insert(billClean);
-                } else if (nextId == 4) {
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                }else if (nextId == 4) {
                     //新增隔离
-                } else if (nextId == 5) {
+                    BillIsolate pcr = (BillIsolate) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        pcr.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        pcr.setResource(billPcr.getResource());
+                        pcr.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        pcr.setRemark(billPcr.getRemark());
+                    }
+                    isolateMapper.insert(pcr);
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                }else if (nextId == 5) {
                     BillDry billClean = (BillDry) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        billClean.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        billClean.setResource(billPcr.getResource());
+                        billClean.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        billClean.setRemark(billPcr.getRemark());
+                    }
                     dryMapper.insert(billClean);
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
                     //新增烘干
-                } else if (nextId == 6) {
+                }else if (nextId == 6) {
                     //新增洗澡前拍照
                     BillCleanBefore before = (BillCleanBefore) newObject;
-                    beforeMapper.insert(before);
+                    if (billPcr.getVistitType() != 0) {
+                        before.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        before.setResource(billPcr.getResource());
+                        before.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        before.setRemark(billPcr.getRemark());
+                    }
+                    billCleanBeforeMapper.insert(before);
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
+                }
+                else if (nextId == 7) {
+                    //新增洗澡前拍照
+                    BillGoodsInventory before = (BillGoodsInventory) newObject;
+                    if (billPcr.getVistitType() != 0) {
+                        before.setCarNum(billPcr.getCarNum());
+                    }
+                    if (billPcr.getVistitType() == 5) {
+                        before.setResource(billPcr.getResource());
+                        before.setFeedImgUrl(billPcr.getFeedImgUrl());
+                        before.setRemark(billPcr.getRemark());
+                    }
+                    inventoryMapper.insert(before);
+                    baseProcess.setCurrentFlowId(baseProcess.getCurrentFlowId() + "," + nextId);
                 }
-
                 baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
+                baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getLocationName());
+                baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getId());
                 String status = baseProcess.getCurrentStatus();
                 String substring = status.substring(0, status.length() - 1);
 

+ 1 - 1
huimv-receive/src/main/resources/com/huimv/receive/mapper/BaseProcessMapper.xml

@@ -51,7 +51,7 @@
 
 
       UNION
-   SELECT   NULL AS qualified_date,null  AS pass_user_name,NULL AS pcr_type,process_id ,id,farm_id ,admission_user_id ,   test_location, null as  check_date,   test_location_id
+   SELECT   NULL AS qualified_date, pass_user_name,NULL AS pcr_type,process_id ,id,farm_id ,admission_user_id ,   test_location, null as  check_date,   test_location_id
       ,bill_status  ,NULL AS isolate_end_date ,7 AS `type`   , NULL AS isolate_day_num   ,NULL AS isolate_real_day_num, NULL AS isolate_real_end_date ,img_url,null as  img_status,NULL AS clean_time ,NULL AS dry_time,NULL AS dry_tem , goods_type ,feed_img_url, null as 'carryImgUrl'
      FROM `bill_goods_inventory`