Pārlūkot izejas kodu

公出修改客户BUG修复

anderx 1 gadu atpakaļ
vecāks
revīzija
9f9d36afd0

+ 20 - 0
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -204,6 +204,26 @@ public class AdminReleaseApiController extends CertifyApiController{
 	}
 
 
+	@RequestMapping(value = "/techExamine", method = RequestMethod.POST)
+	public Result techExamine(Integer id ,Integer status,String remarks){
+		Result res =new Result();
+		if (id==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
+			return res;
+		}
+		if (status!=0&&status!=2) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"审核状态"));
+			return res;
+		}
+		if (remarks.length()>20) {
+			res.getError().add(buildError("备注长度不能超过20个字符。"));
+			return res;
+		}
+		res.setData(publicReleaseService.pushExaminePublicRelease(id,status,remarks,2));
+		return res;
+	}
+
+
 	/**
 	 * 咨询驳回
 	 * @return

+ 64 - 20
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -78,12 +78,15 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 //			in.setAssistAidName(getAssistAidName(in.getAssistAid()));
 			in.setMainName(my.getName());
 		}
-		Map checkOrderNo = checkOrderNoDuration(in);
-		boolean isValid = (boolean) checkOrderNo.get("code");
-		if (isValid){
-			in.setTechStartProcess(0);
-		}else {
-			in.setTechStartProcess(1);
+		Map checkOrderNo =null;
+		if (in.getType() == 1) {
+			checkOrderNo = checkOrderNoDuration(in);
+			boolean isValid = (boolean) checkOrderNo.get("code");
+			if (isValid){
+				in.setTechStartProcess(0);
+			}else {
+				in.setTechStartProcess(1);
+			}
 		}
 		publicReleaseMapper.insertSelective(in);
 		List<PublicReleaseDetails> prdList=new ArrayList<>();
@@ -348,9 +351,19 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			e.printStackTrace();
 			throw new BusinessException("转换异常");
 		}
+		Map checkOrderNo =null;
+		if (in.getType() == 1) {
+			checkOrderNo = checkOrderNoDuration(in);
+			boolean isValid = (boolean) checkOrderNo.get("code");
+			if (isValid){
+				in.setTechStartProcess(0);
+			}else {
+				in.setTechStartProcess(1);
+			}
+		}
 		List<User> uses=null;
 		PublicRelease use = publicReleaseMapper.selectByPrimaryKey(in.getId());
-
+		in.setCreateTime(use.getCreateTime());
 		String userNames=publicReleaseDetailsMapper.getNamesByPrid(in.getId());
 		PublicReleaseLog log=new PublicReleaseLog(in.getId(),TokenManager.getAdminId(),null,in.getReason(),date);
 		in.setUserNames(userNames);
@@ -377,18 +390,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				publicExamineMapper.updateByPridSelective(pe);
 			}
 			AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
-			Map checkOrderNo=new HashMap();
-			if (in.getType()==1){
-				checkOrderNo = checkOrderNoDuration(in);
-				boolean isValid = (boolean) checkOrderNo.get("code");
-				if (isValid){
-					in.setTechStartProcess(0);
-				}else {
-					in.setTechStartProcess(1);
-				}
-			}else {
-				in.setTechStartProcess(0);
-			}
 			//重新发起
 			addPublicReleaseLog(my,in,in.getUserNames(),date,uses,checkOrderNo);
 		}else {
@@ -607,6 +608,10 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		if (use.getStatus()!=1) {
 			throw new BusinessException("只能修改发起的状态公出");
 		}
+		if(examineType==0||examineType==1){
+			if(use.getTechStartProcess()!=0) throw new BusinessException("技术公出先需营销审核。");
+
+		}
 		//当前审核人员
 		Admin ad=adminMapper.selectByPrimaryKey(aid);
 		//公出负责人
@@ -689,6 +694,45 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				p.setRejectName(ad.getName());
 				addpublicLog(id, 0, str.toString());
 			}
+		}else if (examineType==2){
+			//通知公出人切换成公出人审核人
+			a=adminMapper.selectByPrimaryKey(a.getReviewer());
+			if (status==2){//审核通过
+				str=str.append("同意公出我的企业,").append(remarks);
+				content=content.append("已通过审核,请尽快审核。");
+				List<PublicExamine> publicExamines = publicExamineMapper.selectByPrid(use.getId());
+				int x=0;
+				for (PublicExamine pe : publicExamines) {
+					if (pe.getAid().equals(aid)){
+						pe.setStatus(1);
+						PublicExamine newp=new PublicExamine();
+						newp.setId(pe.getId());
+						newp.setStatus(1);
+						publicExamineMapper.updateByPrimaryKeySelective(newp);
+						x++;
+					}else {
+						if (pe.getStatus()==1){
+							x++;
+						}
+					}
+				}
+				if (x==publicExamines.size()){
+					p.setPublicType(2);
+					flag=true;
+				}
+				addpublicLog(id, status, str.toString());
+
+			}else if (status==0){//审核驳回
+				//切换通知人公出负责人
+				a=publicAdmin;
+				str=str.append("不同意公出我的企业,").append(remarks);;
+				content=content.append("未通过审核,请修改后重新发起。");
+				p.setPublicType(3);
+				p.setStatus(0);
+				p.setAuditInfo(str.toString());
+				p.setRejectName(ad.getName());
+				addpublicLog(id, 0, str.toString());
+			}
 		}
 		AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 		if (flag){
@@ -1602,7 +1646,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 				map.put("code",false);
 				map.put("data",data);
 			}
-		} else if (t.getTotalAmount().compareTo(BigDecimal.valueOf(10))>0) {
+		} else if (t.getTotalAmount().compareTo(BigDecimal.valueOf(10))>=0) {
 			data.setAmountType(4);
 			map.put("code",true);
 			map.put("data",null);