|
@@ -1,5 +1,6 @@
|
|
|
package com.huimv.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.huimv.admin.common.token.TokenSign;
|
|
@@ -74,7 +75,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 vistitDate, String vistitReson, String destId, String destName,String farmId) 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) throws IOException {
|
|
|
Integer userId = TokenSign.getMemberIdByJwtToken(httpServletRequest);
|
|
|
if (!PhoneNumberValidator.isValidPhoneNumber(phone)) {
|
|
|
return new Result(10001,"手机号格式错误!",false);
|
|
@@ -98,11 +99,16 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
billPersonnelAdmission.setWorkName(workName);
|
|
|
billPersonnelAdmission.setPapersType(Integer.parseInt(papersType));
|
|
|
billPersonnelAdmission.setPapersCode(papersCode);
|
|
|
- if (uploadImage.getImageCom(imgUrl).equals("上传失败")) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return new Result(10001,"图片上传失败",false);
|
|
|
+ if (ObjectUtil.isNotEmpty(imgUrl)){
|
|
|
+ if (uploadImage.getImageCom(imgUrl).equals("上传失败")) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"图片上传失败",false);
|
|
|
+ }
|
|
|
+ billPersonnelAdmission.setImgUrl(uploadImage.getImageCom(imgUrl));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(img)){
|
|
|
+ billPersonnelAdmission.setImgUrl(img);
|
|
|
}
|
|
|
- billPersonnelAdmission.setImgUrl(uploadImage.getImageCom(imgUrl));
|
|
|
billPersonnelAdmission.setVistitReson(vistitReson);
|
|
|
billPersonnelAdmission.setFarmId(Integer.parseInt(farmId));
|
|
|
BaseProcess baseProcess = new BaseProcess();
|
|
@@ -115,6 +121,10 @@ public class BillPersonnelAdmissionServiceImpl extends ServiceImpl<BillPersonnel
|
|
|
baseProcess.setCurrentStatus("0");
|
|
|
//获取位置
|
|
|
BaseLocation baseLocation = baseLocationMapper.selectOne(new QueryWrapper<BaseLocation>().eq("farm_id", farmId).eq("vistit_type", vistitType).eq("parent_id", 0));
|
|
|
+ if (ObjectUtil.isEmpty(baseLocation)){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return new Result(10001,"该来访类型位置不存在",false);
|
|
|
+ }
|
|
|
baseProcess.setCurrentLocation(baseLocation.getLocationName());
|
|
|
baseProcess.setCurrentLocationId(baseLocation.getId().toString());
|
|
|
baseProcess.setFarmId(Integer.parseInt(farmId));
|