|
|
@@ -102,33 +102,112 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
in.setPublicType(0);
|
|
|
in.setTechStartProcess(0);
|
|
|
in.setStatus(1);
|
|
|
- in.setAid(TokenManager.getAdminId());
|
|
|
AdminListBo my = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
|
|
|
- if (in.getAssist()==1){
|
|
|
-// in.setAssistAidName(getAssistAidName(in.getAssistAid()));
|
|
|
- in.setMainName(my.getName());
|
|
|
- in.setAssistProcess(1);
|
|
|
- }
|
|
|
Map checkOrderNo =null;
|
|
|
- if (in.getType() == 1) {
|
|
|
- //技术公出
|
|
|
- checkOrderNo = checkOrderNoDuration(in,my,1);
|
|
|
- boolean isValid = (boolean) checkOrderNo.get("code");
|
|
|
- if (isValid){
|
|
|
- in.setTechStartProcess(0);
|
|
|
- }else {
|
|
|
- in.setTechStartProcess(1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- publicReleaseMapper.insertSelective(in);
|
|
|
- if (in.getOrderNo()!=null){
|
|
|
- TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(in.getOrderNo());
|
|
|
- orderNewService.pushOrderPublicReleaseCount(tOrderNew);
|
|
|
- }
|
|
|
List<PublicReleaseDetails> prdList=new ArrayList<>();
|
|
|
List<User> users=new ArrayList<>();
|
|
|
StringBuilder str =new StringBuilder();
|
|
|
+ //判定是单独协单还是一起协单
|
|
|
+ if (in.getType()==0&&in.getAssist()==4){
|
|
|
+ String[] split = in.getAssistAid().split(",");
|
|
|
+ List<sendListBo> aidList = new ArrayList<>();
|
|
|
+ String userNames=null;
|
|
|
+ //每一个协单都是单独的一份
|
|
|
+ for (String s : split) {
|
|
|
+ Admin publicAdmin = adminMapper.selectByPrimaryKey(s);
|
|
|
+ in.setAid(s);
|
|
|
+ in.setMainName(my.getName());
|
|
|
+ in.setAssistProcess(1);
|
|
|
+ publicReleaseMapper.insertSelective(in);
|
|
|
+ addPRD(in, users, str, prdList);
|
|
|
+ addPublicReleaseDateClock(in);
|
|
|
+ userNames=str.substring(0,str.length()-1);
|
|
|
+ in.setUserNames(userNames);
|
|
|
+ PublicRelease updateName=new PublicRelease();
|
|
|
+ updateName.setId(in.getId());
|
|
|
+ updateName.setUserNames(userNames);
|
|
|
+ publicReleaseMapper.update(updateName);
|
|
|
+ addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起[仅技术协单公出]申请");
|
|
|
+ List<AdminPublicReviewerBo> adminPublicReviewerBos = adminPublicReviewerMapper.selectByAid(in.getAid());
|
|
|
+// pushNoticeAndSoucketAndEmail(my, in, date, admin, str, map);
|
|
|
+
|
|
|
+ //通知技术协单人审核人
|
|
|
+ sendNoticeAndSoucket(my.getId(),1, "["+my.getName()+"]发起["+userNames+"]的发起[仅技术协单公出]邀请。");
|
|
|
+ //
|
|
|
+ adminPublicReviewerBos=adminPublicReviewerBos.stream().filter(e -> e.getType() == 1).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (AdminPublicReviewerBo adminPublicReviewerBo : adminPublicReviewerBos) {
|
|
|
+ if (aidList.contains(adminPublicReviewerBo.getAid())==false){
|
|
|
+ sendListBo bo =new sendListBo(adminPublicReviewerBo.getAid(),
|
|
|
+ s,in.getId(),userNames);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ for (sendListBo e : aidList) {
|
|
|
+
|
|
|
+ Admin a = adminMapper.selectByPrimaryKey(e.getAid());
|
|
|
+ sendNoticeAndSoucket(e.getAid(),1, "["+my.getName()+"]发起["+userNames+"]仅技术协单公出申请,请及时审核。");
|
|
|
+ if (a.getOpenId() !=null) {
|
|
|
+ Integer res= weChatUtils.addNotice(a.getOpenId(), in.getStatus(), e.getPrid(), date, my.getName(),"["+ my.getName()+"]发起仅协单申请");
|
|
|
+ if (res!=0) {
|
|
|
+ sendEmail(my, a,1);
|
|
|
+ }
|
|
|
+ //返回微信错误码
|
|
|
+ map.put("code", res);
|
|
|
+ }else {
|
|
|
+ //返回没有绑定微信
|
|
|
+ sendEmail(my, a,1);
|
|
|
+ map.put("code", 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }else {
|
|
|
+ in.setAid(TokenManager.getAdminId());
|
|
|
+ if (in.getAssist()==1){
|
|
|
+// in.setAssistAidName(getAssistAidName(in.getAssistAid()));
|
|
|
+ in.setMainName(my.getName());
|
|
|
+ in.setAssistProcess(1);
|
|
|
+ }
|
|
|
+ if (in.getType() == 1) {
|
|
|
+ //技术公出
|
|
|
+ checkOrderNo = checkOrderNoDuration(in,my,1);
|
|
|
+ boolean isValid = (boolean) checkOrderNo.get("code");
|
|
|
+ if (isValid){
|
|
|
+ in.setTechStartProcess(0);
|
|
|
+ }else {
|
|
|
+ in.setTechStartProcess(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ publicReleaseMapper.insertSelective(in);
|
|
|
+ if (in.getType()==1&&in.getOrderNo()!=null){
|
|
|
+ TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(in.getOrderNo());
|
|
|
+ orderNewService.pushOrderPublicReleaseCount(tOrderNew);
|
|
|
+ }
|
|
|
+ addPRD(in, users, str, prdList);
|
|
|
+ addPublicReleaseDateClock(in);
|
|
|
+ String userNames=str.substring(0,str.length()-1);
|
|
|
+ in.setUserNames(userNames);
|
|
|
+ PublicRelease updateName=new PublicRelease();
|
|
|
+ updateName.setId(in.getId());
|
|
|
+ updateName.setUserNames(userNames);
|
|
|
+ publicReleaseMapper.update(updateName);
|
|
|
+ addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
|
|
|
+ pushPublicCarbonCopy(in, my, userNames);
|
|
|
+ return (Map<String, Object>) addPublicReleaseLog(my, in,userNames,date,users,checkOrderNo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addPRD(InputPublicRelease in, List<User> users, StringBuilder str, List<PublicReleaseDetails> prdList) {
|
|
|
if (in.getUids()!=null){
|
|
|
List<String> split = Arrays.asList(in.getUids().split(","));
|
|
|
int userCount=split.size();
|
|
|
@@ -175,16 +254,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
}
|
|
|
publicReleaseDetailsMapper.insertBatch(prdList);
|
|
|
}
|
|
|
- addPublicReleaseDateClock(in);
|
|
|
- String userNames=str.substring(0,str.length()-1);
|
|
|
- in.setUserNames(userNames);
|
|
|
- PublicRelease updateName=new PublicRelease();
|
|
|
- updateName.setId(in.getId());
|
|
|
- updateName.setUserNames(userNames);
|
|
|
- publicReleaseMapper.update(updateName);
|
|
|
- addpublicLog(in.getId(), PublicReleaseLog.states.fq.getCode(), "发起外出申请");
|
|
|
- pushPublicCarbonCopy(in, my, userNames);
|
|
|
- return (Map<String, Object>) addPublicReleaseLog(my, in,userNames,date,users,checkOrderNo);
|
|
|
}
|
|
|
|
|
|
private void pushPublicCarbonCopy(InputPublicRelease in, AdminListBo my, String userNames) {
|