|
@@ -86,7 +86,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Result addAdmission(HttpServletRequest httpServletRequest, String admissionType, String vistitType, String userName, String phone, String workName, String papersType, String papersCode, MultipartFile imgUrl, String img, String vistitDate, String vistitReson, String destId, String destName, String farmId, String carNum, String source,String goods) throws IOException {
|
|
|
+ public Result addAdmission(HttpServletRequest httpServletRequest, String admissionType, String vistitType, String userName, String phone, String workName, String papersType, String papersCode, MultipartFile imgUrl, String img, String vistitDate, String vistitReson, String destId, String destName, String farmId, String carNum, String source, String goods) throws IOException {
|
|
|
Integer userId = TokenSign.getMemberIdByJwtToken(httpServletRequest);
|
|
|
if (!PhoneNumberValidator.isValidPhoneNumber(phone)) {
|
|
|
return new Result(10001, "手机号格式错误!", false);
|
|
@@ -138,9 +138,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
baseProcess.setCurrentStatus("0");
|
|
|
//获取位置
|
|
|
BaseLocation baseLocation;
|
|
|
- if (vistitType.equals("5")){
|
|
|
+ if (vistitType.equals("5")) {
|
|
|
baseLocation = baseLocationMapper.selectById(destId);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseLocation = baseLocationMapper.selectOne(new QueryWrapper<BaseLocation>().eq("farm_id", farmId).eq("vistit_type", vistitType).eq("parent_id", 0));
|
|
|
}
|
|
|
if (ObjectUtil.isEmpty(baseLocation)) {
|
|
@@ -159,9 +159,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
phoneList.add(sysAccountMultilevel.getPhone());
|
|
|
}
|
|
|
// SendSMS.sendSMS(phoneList,TokenSign.getUserNameByJwtToken(httpServletRequest)+"入场申请测试");
|
|
|
- if (ObjectUtil.isNotEmpty(goods)){
|
|
|
+ if (ObjectUtil.isNotEmpty(goods)) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- List<BillGoodsInventory> admissionAndGoods = objectMapper.readValue(goods, new TypeReference<List<BillGoodsInventory>>() {});
|
|
|
+ List<BillGoodsInventory> admissionAndGoods = objectMapper.readValue(goods, new TypeReference<List<BillGoodsInventory>>() {
|
|
|
+ });
|
|
|
for (BillGoodsInventory good : admissionAndGoods) {
|
|
|
good.setBillAdmission(billPersonnelAdmission.getId());
|
|
|
BaseLocation baseLocation1 = baseLocationMapper.selectById(destId);
|
|
@@ -179,8 +180,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
String pageSize = paramsMap.get("pageSize");
|
|
|
String vistitType = paramsMap.get("vistitType");
|
|
|
Page<BillPersonnelAdmission> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
- Page<BillPersonnelAdmission> billPersonnelAdmissionPage = billPersonnelAdmissionMapper.selectPage(page, new QueryWrapper<BillPersonnelAdmission>().eq(StringUtils.isNotBlank(vistitType),"vistit_type",vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date"));
|
|
|
- return new Result(ResultCode.SUCCESS, billPersonnelAdmissionPage);
|
|
|
+ QueryWrapper<BillPersonnelAdmission> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq(StringUtils.isNotBlank(vistitType), "vistit_type", vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date");
|
|
|
+ Page<BillPersonnelAdmission> billPersonnelAdmissionPage = billPersonnelAdmissionMapper.selectPage(page, new QueryWrapper<BillPersonnelAdmission>().eq(StringUtils.isNotBlank(vistitType), "vistit_type", vistitType).eq("admission_user_id", TokenSign.getMemberIdByJwtToken(httpServletRequest)).orderByDesc("sub_date"));
|
|
|
+ return new Result(ResultCode.SUCCESS, billPersonnelAdmissionPage, billPersonnelAdmissionMapper.selectCount(queryWrapper));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -222,7 +225,17 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
// }
|
|
|
Page<BillPersonnelAdmission> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
Page<BillPersonnelAdmission> billPersonnelAdmissionPage = billPersonnelAdmissionMapper.selectPage(page, queryWrapper);
|
|
|
- return new Result(ResultCode.SUCCESS, billPersonnelAdmissionPage);
|
|
|
+ QueryWrapper<BillPersonnelAdmission> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id",farmId);
|
|
|
+ if (userType == 3) {
|
|
|
+ //生物安全负责人
|
|
|
+ queryWrapper1.eq("admission_type", 0);
|
|
|
+ } else if (userType == 2) {
|
|
|
+ //紧急入场
|
|
|
+ queryWrapper1.ne("admission_type", 0);
|
|
|
+ }
|
|
|
+ queryWrapper1.eq("bill_status", 0);
|
|
|
+ return new Result(ResultCode.SUCCESS, billPersonnelAdmissionPage,billPersonnelAdmissionMapper.selectList(queryWrapper1).size());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -247,11 +260,11 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
if (type.equals("0")) {
|
|
|
String[] split = baseProcess.getCurrentStatus().split(",");
|
|
|
- split[split.length-1]="2";
|
|
|
+ split[split.length - 1] = "2";
|
|
|
//拒绝
|
|
|
billPersonnelAdmission.setBillStatus(2);
|
|
|
baseProcess.setProcessType(2);
|
|
|
- baseProcess.setCurrentStatus(String.join(",",split));
|
|
|
+ baseProcess.setCurrentStatus(String.join(",", split));
|
|
|
// SendSMS.sendSMS(phoneList,"拒绝入场申请测试");
|
|
|
} else {
|
|
|
//通过
|
|
@@ -259,11 +272,11 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
//获取pcr位置
|
|
|
String locationId = baseProcess.getCurrentLocationId();
|
|
|
String[] strings = locationId.split(",");
|
|
|
- String laseLocationId = strings[strings.length-1];
|
|
|
+ String laseLocationId = strings[strings.length - 1];
|
|
|
BaseLocation baseLocation = baseLocationMapper.selectById(laseLocationId);
|
|
|
if (userType == 3) {
|
|
|
String[] split = baseProcess.getCurrentStatus().split(",");
|
|
|
- split[split.length-1]="1";
|
|
|
+ split[split.length - 1] = "1";
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
for (String element : split) {
|
|
|
result.append(element).append(",");
|
|
@@ -317,7 +330,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
factoryDirectorList = billPersonnelAdmissionMapper.listCarAll(type, farmId, page);
|
|
|
}
|
|
|
|
|
|
- return new Result(ResultCode.SUCCESS, factoryDirectorList);
|
|
|
+ return new Result(ResultCode.SUCCESS, factoryDirectorList,factoryDirectorList.getSize());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -327,10 +340,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if (type.equals("0")) {
|
|
|
BillPersonnelAdmission billPersonnelAdmission = billPersonnelAdmissionMapper.selectById(id);
|
|
|
BillAdmissionAndGoods billAdmissionAndGoods = new BillAdmissionAndGoods();
|
|
|
- BeanUtil.copyProperties(billPersonnelAdmission,billAdmissionAndGoods);
|
|
|
+ BeanUtil.copyProperties(billPersonnelAdmission, billAdmissionAndGoods);
|
|
|
List<BillGoodsInventory> billGoodsInventories = billGoodsInventoryMapper.selectList(new QueryWrapper<BillGoodsInventory>().eq("bill_admission", id));
|
|
|
billAdmissionAndGoods.setGoods(billGoodsInventories);
|
|
|
- return new Result(ResultCode.SUCCESS,billAdmissionAndGoods);
|
|
|
+ return new Result(ResultCode.SUCCESS, billAdmissionAndGoods);
|
|
|
} else if (type.equals("1")) {
|
|
|
return new Result(ResultCode.SUCCESS, billPcrMapper.selectById(id));
|
|
|
} else if (type.equals("2")) {
|
|
@@ -384,7 +397,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if ("3".equals(type)) {
|
|
|
queryWrapper.eq("pcr_type", 3);
|
|
|
}
|
|
|
- return new Result(ResultCode.SUCCESS, pcrMapper.selectPage(page, queryWrapper));
|
|
|
+ QueryWrapper<BillPcr> queryWrapper1 = new QueryWrapper<>();
|
|
|
+
|
|
|
+ queryWrapper1.eq("farm_id", farmId).orderByDesc("sub_date").eq("pcr_type",1);
|
|
|
+ return new Result(ResultCode.SUCCESS, pcrMapper.selectPage(page, queryWrapper),pcrMapper.selectCount(queryWrapper1));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -417,7 +433,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
|
|
|
return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
|
|
|
} else {
|
|
|
- if (billPcr.getDestId() > billPcr.getTestLocationId()) { //说明当前不是目的地
|
|
|
+ if (billPcr.getDestId() >= billPcr.getTestLocationId()) { //说明当前不是目的地
|
|
|
if ("1".equals(type)) {
|
|
|
billPcr.setBillStatus(1);
|
|
|
billPcr.setPcrType(2);
|
|
@@ -443,8 +459,8 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
billClean.setPassDate(billPcr.getPassDate());
|
|
|
billClean.setPassUserId(billPcr.getPassUserId());
|
|
|
billClean.setProcessId(billPcr.getProcessId());
|
|
|
- billClean.setTestLocation(baseLocation.getNextLocation());
|
|
|
- billClean.setTestLocationId(baseLocation.getNextId());
|
|
|
+ billClean.setTestLocation(baseLocation.getLocationName());
|
|
|
+ billClean.setTestLocationId(baseLocation.getId());
|
|
|
billClean.setImgStatus(0);
|
|
|
billClean.setCarNum(billPcr.getCarNum());
|
|
|
cleanMapper.insert(billClean);
|
|
@@ -559,7 +575,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if ("3".equals(type)) {
|
|
|
queryWrapper.eq("bill_status", 3);
|
|
|
}
|
|
|
- return new Result(ResultCode.SUCCESS, isolateMapper.selectPage(page, queryWrapper));
|
|
|
+ QueryWrapper<BillIsolate> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id", farmId).orderByDesc("sub_date").eq("bill_status", 0);
|
|
|
+ return new Result(ResultCode.SUCCESS, isolateMapper.selectPage(page, queryWrapper),isolateMapper.selectCount(queryWrapper1));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -594,8 +612,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
if (isolate.getBillStatus() == 1) {
|
|
|
isolate.setBillStatus(2);
|
|
|
- if (isolate.getDestId() > isolate.getIsolateLocationId()) { //当前不是目的地
|
|
|
- if (isolate.getIsolateLocationId() == 8) {
|
|
|
+ if (isolate.getDestId() >= isolate.getIsolateLocationId()) { //当前不是目的地
|
|
|
+ if (isolate.getIsolateLocationId() == 3 && baseProcess.getDestId() > 3) {
|
|
|
+
|
|
|
//通过生成洗消记录
|
|
|
BillClean billClean = new BillClean();
|
|
|
billClean.setPhone(isolate.getPhone());
|
|
@@ -614,16 +633,23 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
billClean.setTestLocation(baseLocation.getNextLocation());
|
|
|
billClean.setTestLocationId(baseLocation.getNextId());
|
|
|
cleanMapper.insert(billClean);
|
|
|
+ baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
|
|
|
+ baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getNextLocation());
|
|
|
+ baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getNextId());
|
|
|
+ String status = baseProcess.getCurrentStatus();
|
|
|
+ String substring = status.substring(0, status.length() - 1);
|
|
|
+ baseProcess.setCurrentStatus(substring + "1," + 0);
|
|
|
+ processMapper.updateById(baseProcess);
|
|
|
+ } else {
|
|
|
+ baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
|
|
|
+ baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
|
|
|
+ baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId());
|
|
|
+ String status = baseProcess.getCurrentStatus();
|
|
|
+ String substring = status.substring(0, status.length() - 1);
|
|
|
+ baseProcess.setCurrentStatus(substring + "2");
|
|
|
+ baseProcess.setProcessType(1);
|
|
|
+ processMapper.updateById(baseProcess);
|
|
|
}
|
|
|
- baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
|
|
|
- baseProcess.setCurrentLocation(baseProcess.getCurrentLocation() + "," + baseLocation.getNextLocation());
|
|
|
- baseProcess.setCurrentLocationId(baseProcess.getCurrentLocationId() + "," + baseLocation.getNextId());
|
|
|
- String status = baseProcess.getCurrentStatus();
|
|
|
- String substring = status.substring(0, status.length() - 1);
|
|
|
-
|
|
|
- baseProcess.setCurrentStatus(substring + "1," + 0);
|
|
|
-
|
|
|
- processMapper.updateById(baseProcess);
|
|
|
} else {
|
|
|
baseProcess.setUpdateDate(baseProcess.getUpdateDate() + "," + sdf.format(new Date()));
|
|
|
baseProcess.setCurrentLocation(baseProcess.getCurrentLocation());
|
|
@@ -793,7 +819,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
String farmId = paramsMap.get("farmId");
|
|
|
QueryWrapper<BillClean> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("farm_id", farmId).ne("vistit_type", 0).orderByDesc("sub_date");
|
|
|
+ queryWrapper.eq("farm_id", farmId).ne("vistit_type", 0).orderByDesc("sub_date").eq("img_status",1);
|
|
|
+ QueryWrapper<BillDry> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id", farmId).ne("vistit_type", 0).orderByDesc("sub_date").eq("img_status",1);
|
|
|
if ("0".equals(type)) {
|
|
|
cleanAndDryVo2Page = cleanMapper.CleanAndDry2(page, farmId, "0,1,2".split(","));
|
|
|
}
|
|
@@ -813,7 +841,11 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
String[] s = arrayList.toArray(new String[arrayList.size()]);
|
|
|
cleanAndDryVo2Page = cleanMapper.CleanAndDry2(page, farmId, s);
|
|
|
}
|
|
|
- return new Result(ResultCode.SUCCESS, cleanAndDryVo2Page);
|
|
|
+ queryWrapper.eq("bill_status",0);
|
|
|
+ queryWrapper1.eq("bill_status",0);
|
|
|
+ Integer integer = cleanMapper.selectCount(queryWrapper);
|
|
|
+ Integer integer1 = dryMapper.selectCount(queryWrapper1);
|
|
|
+ return new Result(ResultCode.SUCCESS, cleanAndDryVo2Page,integer+integer1);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -841,7 +873,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
|
|
|
return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
|
|
|
} else {
|
|
|
- if (billClean.getDestId() > billClean.getTestLocationId()) { //说明当前不是目的地
|
|
|
+ if (billClean.getDestId() >= billClean.getTestLocationId()) { //说明当前不是目的地
|
|
|
if ("1".equals(result)) {
|
|
|
billClean.setBillStatus(1);
|
|
|
billClean.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
@@ -891,25 +923,32 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
dryMapper.insert(billDry);
|
|
|
}
|
|
|
//拉猪车洗消合格生成烘干申请
|
|
|
+
|
|
|
if (billClean.getTestLocationId() == 15) {
|
|
|
- BillDry billDry = new BillDry();
|
|
|
- billDry.setVistitType(billClean.getVistitType());
|
|
|
- billDry.setDestName(billClean.getDestName());
|
|
|
- billDry.setDestId(billClean.getDestId());
|
|
|
- billDry.setAdmissionUserName(billClean.getAdmissionUserName());
|
|
|
- billDry.setAdmissionUserId(billClean.getAdmissionUserId());
|
|
|
- billDry.setVistitDate(billClean.getVistitDate());
|
|
|
- billDry.setSubDate(LocalDateTime.now());
|
|
|
- billDry.setFarmId(billClean.getFarmId());
|
|
|
- billDry.setBillStatus(0);
|
|
|
- billDry.setProcessId(billClean.getProcessId());
|
|
|
- billDry.setTestLocation(baseLocation.getLocationName());
|
|
|
- billDry.setTestLocationId(baseLocation.getId());
|
|
|
- billDry.setPhone(billClean.getPhone());
|
|
|
- billDry.setCarNum(billClean.getCarNum());
|
|
|
- billDry.setImgStatus(0);
|
|
|
- dryMapper.insert(billDry);
|
|
|
+ QueryWrapper<BillClean> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("farm_id", farmId).eq("process_id", baseProcess.getId());
|
|
|
+ List<BillClean> billCleans = cleanMapper.selectList(queryWrapper);
|
|
|
+ if (billCleans.size() == 1) {
|
|
|
+ BillDry billDry = new BillDry();
|
|
|
+ billDry.setVistitType(billClean.getVistitType());
|
|
|
+ billDry.setDestName(billClean.getDestName());
|
|
|
+ billDry.setDestId(billClean.getDestId());
|
|
|
+ billDry.setAdmissionUserName(billClean.getAdmissionUserName());
|
|
|
+ billDry.setAdmissionUserId(billClean.getAdmissionUserId());
|
|
|
+ billDry.setVistitDate(billClean.getVistitDate());
|
|
|
+ billDry.setSubDate(LocalDateTime.now());
|
|
|
+ billDry.setFarmId(billClean.getFarmId());
|
|
|
+ billDry.setBillStatus(0);
|
|
|
+ billDry.setProcessId(billClean.getProcessId());
|
|
|
+ billDry.setTestLocation(baseLocation.getLocationName());
|
|
|
+ billDry.setTestLocationId(baseLocation.getId());
|
|
|
+ billDry.setPhone(billClean.getPhone());
|
|
|
+ billDry.setCarNum(billClean.getCarNum());
|
|
|
+ billDry.setImgStatus(0);
|
|
|
+ dryMapper.insert(billDry);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//送猪车洗消合格生成烘干申请
|
|
|
if (billClean.getTestLocationId() == 17) {
|
|
|
BillDry billDry = new BillDry();
|
|
@@ -1019,7 +1058,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
if (baseProcess.getProcessType() == 2 || baseProcess.getProcessType() == 1) {
|
|
|
return new Result(10001, "修改失败!该申请已提前结束或者被拒绝", false);
|
|
|
} else {
|
|
|
- if (billClean.getDestId() > billClean.getTestLocationId()) { //说明当前不是目的地
|
|
|
+ if (billClean.getDestId() >= billClean.getTestLocationId()) { //说明当前不是目的地
|
|
|
if ("1".equals(result)) {
|
|
|
billClean.setBillStatus(1);
|
|
|
billClean.setPassUserName(TokenSign.getUserNameByJwtToken(httpServletRequest));
|
|
@@ -1048,7 +1087,8 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
|
|
|
//环保车烘干合格生成洗消申请
|
|
|
- if (billClean.getTestLocationId() == 12) {
|
|
|
+ if (billClean.getTestLocationId() == 12 && baseProcess.getDestId() > 12) {
|
|
|
+
|
|
|
BillClean clean = new BillClean();
|
|
|
clean.setVistitType(billClean.getVistitType());
|
|
|
clean.setDestName(billClean.getDestName());
|