|
@@ -95,6 +95,13 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
private FlowUtil flowUtil;
|
|
|
@Autowired
|
|
|
private BillGoodsInventoryMapper inventoryMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysAccountMultilevelMapper multilevelMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper userMapper;
|
|
|
+ @Autowired
|
|
|
+ private BaseFarmMapper farmMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -103,8 +110,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
MultipartFile imgUrl, String img, String vistitDate, String vistitReson, String destId,
|
|
|
String destName, String farmId, String carNum, String source, String goods,
|
|
|
String departureId, String departureName, MultipartFile picture1, MultipartFile picture2,
|
|
|
- MultipartFile picture3, MultipartFile picture4, MultipartFile picture5
|
|
|
- , MultipartFile picture6, MultipartFile picture7, MultipartFile picture8, Integer midId, String midName) throws IOException {
|
|
|
+ MultipartFile picture3, Integer midId, String midName) throws IOException {
|
|
|
Integer userId = TokenSign.getMemberIdByJwtToken(httpServletRequest);
|
|
|
if (!PhoneNumberValidator.isValidPhoneNumber(phone)) {
|
|
|
return new Result(10001, "手机号格式错误!", false);
|
|
@@ -127,115 +133,41 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
String picUrl = null;
|
|
|
|
|
|
- if (vistitType.equals("0")) {
|
|
|
- if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
- String pic1 = uploadImage.getImageCom(picture1);
|
|
|
- if (pic1.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片1上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = pic1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
- String pic2 = uploadImage.getImageCom(picture2);
|
|
|
- if (pic2.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片2上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
- String pic3 = uploadImage.getImageCom(picture3);
|
|
|
- if (pic3.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片3上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic3;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
- String pic1 = uploadImage.getVideoCom(picture1);
|
|
|
- if (pic1.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频1上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = pic1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
- String pic2 = uploadImage.getVideoCom(picture2);
|
|
|
- if (pic2.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频2上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
- String pic3 = uploadImage.getVideoCom(picture3);
|
|
|
- if (pic3.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频3上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic3;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture4)) {
|
|
|
- String pic4 = uploadImage.getVideoCom(picture4);
|
|
|
- if (pic4.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频4上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic4;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture5)) {
|
|
|
- String pic5 = uploadImage.getVideoCom(picture5);
|
|
|
- if (pic5.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频5上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic5;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture6)) {
|
|
|
- String pic6 = uploadImage.getVideoCom(picture6);
|
|
|
- if (pic6.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频6上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic6;
|
|
|
- }
|
|
|
+ if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
+ String pic1 = uploadImage.getImageCom(picture1);
|
|
|
+ if (pic1.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片1上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = pic1;
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(picture7)) {
|
|
|
- String pic7 = uploadImage.getVideoCom(picture7);
|
|
|
- if (pic7.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频7上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic7;
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
+ String pic2 = uploadImage.getImageCom(picture2);
|
|
|
+ if (pic2.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片2上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = picUrl + "," + pic2;
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(picture8)) {
|
|
|
- String pic8 = uploadImage.getVideoCom(picture8);
|
|
|
- if (pic8.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频8上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic8;
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
+ String pic3 = uploadImage.getImageCom(picture3);
|
|
|
+ if (pic3.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片3上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = picUrl + "," + pic3;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SysAccountMultilevel sysAccountMultilevel1 = sysAccountMultilevelMapper.selectById(userId);
|
|
|
-
|
|
|
+ BaseFarm baseFarm = farmMapper.selectById(farmId);
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
BillPersonnelAdmission billPersonnelAdmission = new BillPersonnelAdmission();
|
|
|
+ billPersonnelAdmission.setFarmName(baseFarm.getFarmName());
|
|
|
billPersonnelAdmission.setAdmissionType(Integer.parseInt(admissionType));
|
|
|
billPersonnelAdmission.setVistitType(Integer.parseInt(vistitType));
|
|
|
if (vistitType.equals("0")) {
|
|
@@ -399,9 +331,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
}
|
|
|
SysAccountMultilevel sysAccountMultilevel1 = sysAccountMultilevelMapper.selectById(userId);
|
|
|
-
|
|
|
+ BaseFarm baseFarm = farmMapper.selectById(farmId);
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
BillPersonnelAdmission billPersonnelAdmission = new BillPersonnelAdmission();
|
|
|
+ billPersonnelAdmission.setFarmName(baseFarm.getFarmName());
|
|
|
billPersonnelAdmission.setAdmissionType(Integer.parseInt(admissionType));
|
|
|
billPersonnelAdmission.setVistitType(Integer.parseInt(vistitType));
|
|
|
billPersonnelAdmission.setDestId(Integer.parseInt(destId));
|
|
@@ -550,6 +483,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
String farmId = paramsMap.get("farmId");
|
|
|
QueryWrapper<BillPersonnelAdmission> queryWrapper = new QueryWrapper<>();
|
|
|
Integer userType = TokenSign.getUserTypeByJwtToken(httpServletRequest);
|
|
|
+ Integer id = TokenSign.getMemberIdByJwtToken(httpServletRequest);
|
|
|
+ SysAccountMultilevel accountMultilevel = multilevelMapper.selectById(id);
|
|
|
+ Integer userId = accountMultilevel.getUserId();
|
|
|
+ SysUser sysUser = userMapper.selectById(userId);
|
|
|
if (userType == 3) {
|
|
|
//生物安全负责人
|
|
|
queryWrapper.eq("admission_type", 0);
|
|
@@ -570,7 +507,12 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- queryWrapper.orderByDesc("sub_date").eq("farm_id", farmId);
|
|
|
+ if (sysUser.getIsAllFarm() == 0) {
|
|
|
+ queryWrapper.orderByDesc("sub_date").eq("farm_id", farmId);
|
|
|
+ } else {
|
|
|
+ queryWrapper.orderByDesc("sub_date");
|
|
|
+ }
|
|
|
+
|
|
|
// List<BaseLocation> baseLocations = baseLocationMapper.selectList(new QueryWrapper<BaseLocation>().eq("serial_number", 0));
|
|
|
// List<Integer> locationIds = new ArrayList<>();
|
|
|
// for (BaseLocation baseLocation : baseLocations) {
|
|
@@ -582,7 +524,11 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
Page<BillPersonnelAdmission> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
Page<BillPersonnelAdmission> billPersonnelAdmissionPage = billPersonnelAdmissionMapper.selectPage(page, queryWrapper);
|
|
|
QueryWrapper<BillPersonnelAdmission> queryWrapper1 = new QueryWrapper<>();
|
|
|
- queryWrapper1.eq("farm_id", farmId);
|
|
|
+ if (sysUser.getIsAllFarm() == 0) {
|
|
|
+ queryWrapper1.eq("farm_id", farmId);
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+
|
|
|
if (userType == 3) {
|
|
|
//生物安全负责人
|
|
|
queryWrapper1.eq("admission_type", 0);
|
|
@@ -1395,8 +1341,7 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
String papersCode, MultipartFile imgUrl, String img, String vistitDate,
|
|
|
String vistitReson, String destId, String destName, String farmId, String carNum,
|
|
|
String source, String goods, String departureId, String departureName,
|
|
|
- MultipartFile picture1, MultipartFile picture2, MultipartFile picture3,MultipartFile picture4, MultipartFile picture5
|
|
|
- , MultipartFile picture6, MultipartFile picture7, MultipartFile picture8, Integer midId, String midName) throws IOException {
|
|
|
+ MultipartFile picture1, MultipartFile picture2, MultipartFile picture3, Integer midId, String midName) throws IOException {
|
|
|
if (!PhoneNumberValidator.isValidPhoneNumber(phone)) {
|
|
|
return new Result(10001, "手机号格式错误!", false);
|
|
|
}
|
|
@@ -1406,109 +1351,36 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
}
|
|
|
String picUrl = null;
|
|
|
- if (vistitType.equals("0")) {
|
|
|
- if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
- String pic1 = uploadImage.getImageCom(picture1);
|
|
|
- if (pic1.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片1上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = pic1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
- String pic2 = uploadImage.getImageCom(picture2);
|
|
|
- if (pic2.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片2上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
- String pic3 = uploadImage.getImageCom(picture3);
|
|
|
- if (pic3.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "物品照片3上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic3;
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
- String pic1 = uploadImage.getVideoCom(picture1);
|
|
|
- if (pic1.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频1上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = pic1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
- String pic2 = uploadImage.getVideoCom(picture2);
|
|
|
- if (pic2.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频2上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic2;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
- String pic3 = uploadImage.getVideoCom(picture3);
|
|
|
- if (pic3.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频3上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic3;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture4)) {
|
|
|
- String pic4 = uploadImage.getVideoCom(picture4);
|
|
|
- if (pic4.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频4上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic4;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture5)) {
|
|
|
- String pic5 = uploadImage.getVideoCom(picture5);
|
|
|
- if (pic5.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频5上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic5;
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtil.isNotEmpty(picture6)) {
|
|
|
- String pic6 = uploadImage.getVideoCom(picture6);
|
|
|
- if (pic6.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频6上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic6;
|
|
|
- }
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(picture1)) {
|
|
|
+ String pic1 = uploadImage.getImageCom(picture1);
|
|
|
+ if (pic1.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片1上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = pic1;
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(picture7)) {
|
|
|
- String pic7 = uploadImage.getVideoCom(picture7);
|
|
|
- if (pic7.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频7上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic7;
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(picture2)) {
|
|
|
+ String pic2 = uploadImage.getImageCom(picture2);
|
|
|
+ if (pic2.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片2上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = picUrl + "," + pic2;
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(picture8)) {
|
|
|
- String pic8 = uploadImage.getVideoCom(picture8);
|
|
|
- if (pic8.equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001, "车辆视频8上传失败", false);
|
|
|
- } else {
|
|
|
- picUrl = picUrl + "," + pic8;
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(picture3)) {
|
|
|
+ String pic3 = uploadImage.getImageCom(picture3);
|
|
|
+ if (pic3.equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001, "物品照片3上传失败", false);
|
|
|
+ } else {
|
|
|
+ picUrl = picUrl + "," + pic3;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
Integer userId = TokenSign.getMemberIdByJwtToken(httpServletRequest);
|
|
|
SysAccountMultilevel sysAccountMultilevel1;
|
|
|
//先进行账号注册
|
|
@@ -1557,7 +1429,9 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
}
|
|
|
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
+ BaseFarm baseFarm = farmMapper.selectById(farmId);
|
|
|
BillPersonnelAdmission billPersonnelAdmission = new BillPersonnelAdmission();
|
|
|
+ billPersonnelAdmission.setFarmName(baseFarm.getFarmName());
|
|
|
billPersonnelAdmission.setAdmissionType(Integer.parseInt(admissionType));
|
|
|
billPersonnelAdmission.setVistitType(Integer.parseInt(vistitType));
|
|
|
billPersonnelAdmission.setDestId(Integer.parseInt(destId));
|