From 1c20c8231980a8d4b91688ff8641a06d3b2f68ab Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 14 十月 2025 16:34:22 +0800
Subject: [PATCH] 改bug

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java |   81 ++++++++++++++++++++++------------------
 1 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
index 8eff348..b352a5e 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
@@ -286,6 +286,7 @@
                                 Constants.equalsInteger(i.getUserId(),memberId)
                                 &&Constants.equalsInteger(i.getStatus(),Constants.ZERO)
                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
+                                        &&StringUtils.equals(i.getParam2(),"0")
                         ).count()
                 );
                 //宸插鐞嗘暟鎹�
@@ -302,7 +303,7 @@
                         noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,memberId))
                 );
                 //鎶勯�佹垜鐨勬暟鎹�
-                 internalHomeVO.setNoticeCopyNum(
+                internalHomeVO.setNoticeCopyNum(
                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId)
                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE)
                                 &&Constants.equalsInteger(i.getReaded(),Constants.ZERO)
@@ -335,6 +336,7 @@
                     noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId())
                             &&Constants.equalsInteger(i.getStatus(),Constants.ZERO)
                             &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
+                            &&StringUtils.equals(i.getParam2(),"0")
                     ).count()
             );
             internalHomeVO.setNoticeDealNum(
@@ -493,7 +495,7 @@
         approveList.add(createUserApprove);
 
         //鏌ヨ鎵�鏈夊緟澶勭悊浜�
-        String token = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode();
+//        String token = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode();
         //瀹℃壒涓氬姟鏁版嵁
         for (int i = 0; i < approveParamList.size(); i++) {
             ApproveParam approveParam = approveParamList.get(i);
@@ -519,22 +521,25 @@
                         title = this.createNoticesData(noticeType,businessId,title,jsonMap);
                     }
                     if(j==0){
-                        //榛樿鐢熸垚涓�鏉� 鐢宠浜虹殑鏁版嵁 鏍囪鍒犻櫎鐘舵�佺敤浜庡鐞嗗埌 浠诲姟涓績锛堟垜鍙戣捣锛変娇鐢�
-                        Notices notices = new Notices();
-                        notices.setCreateDate(new Date());
-                        notices.setIsdeleted(Constants.ONE);
-                        notices.setObjId(businessId);
-                        notices.setObjType(noticeType);
-                        notices.setType(noticeType);
-                        notices.setTitle(title);
-                        notices.setParam1(JSONObject.toJSONString(jsonMap));
-                        notices.setStatus(Constants.ZERO);
-                        notices.setReaded(Constants.ZERO);
-                        notices.setSendacopy(Constants.ZERO);
-                        notices.setParam2("0");
-                        notices.setParam3(createMember.getId().toString());
-                        notices.setInfo("澶勭悊涓�");
-                        noticesJoinMapper.insert(notices);
+                        //璁垮浜哄憳涓嶇敓鎴愭璁板綍
+                       if(!(Constants.equalsInteger(noticeType,Constants.noticesObjectType.visit)&&Constants.equalsInteger(applyMember.getType(),Constants.ONE))){
+                            //榛樿鐢熸垚涓�鏉� 鐢宠浜虹殑鏁版嵁 鏍囪鍒犻櫎鐘舵�佺敤浜庡鐞嗗埌 浠诲姟涓績锛堟垜鍙戣捣锛変娇鐢�
+                            Notices notices = new Notices();
+                            notices.setCreateDate(new Date());
+                            notices.setIsdeleted(Constants.ONE);
+                            notices.setObjId(businessId);
+                            notices.setObjType(noticeType);
+                            notices.setType(noticeType);
+                            notices.setTitle(title);
+                            notices.setParam1(JSONObject.toJSONString(jsonMap));
+                            notices.setStatus(Constants.ZERO);
+                            notices.setReaded(Constants.ZERO);
+                            notices.setSendacopy(Constants.ZERO);
+                            notices.setParam2("0");
+                            notices.setParam3(createMember.getId().toString());
+                            notices.setInfo("澶勭悊涓�");
+                            noticesJoinMapper.insert(notices);
+                        }
                     }
                     if(CollectionUtils.isEmpty(memberList)){
                         throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌瀹℃壒浜轰俊鎭�");
@@ -597,8 +602,7 @@
                             wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz,
                                     wxNoticeConfigMapper,
                                     platformBooksMapper.selectById(businessId),
-                                    WxPlatConstants.platformBookContent.platformBookWaitAudit,
-                                    token,
+                                    WxPlatConstants.platformBookContent.platformBookWaitAudit, 
                                     Arrays.asList(member.getSystemOpenid().split(",")),
                                     Constants.ONE);
                         }
@@ -614,7 +618,6 @@
                         if(StringUtils.isNotBlank(member.getSystemOpenid())){
                             wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                                     wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitContent.visitWaitAudit,
-                                    token,
                                     Arrays.asList(member.getSystemOpenid().split(","))
                             );
                         }
@@ -629,7 +632,6 @@
                         if(StringUtils.isNotBlank(member.getSystemOpenid())){
                             wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                                     wxNoticeConfigMapper,visitsMapper.selectById(businessId), WxPlatConstants.visitReportContent.visitReportWaitAudit,
-                                    token,
                                     Arrays.asList(member.getSystemOpenid().split(","))
                             );
                         }
@@ -651,7 +653,6 @@
                                             wxNoticeConfigMapper,
                                             carUseBookMapper.selectById(businessId),
                                             WxPlatConstants.carUseBookContent.carUseBookWaitAudit,
-                                            token,
                                             Arrays.asList(member.getSystemOpenid().split(",")),
                                             Constants.ONE);
                                 }
@@ -720,13 +721,23 @@
             if(Objects.isNull(platformBooks)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌涓氬姟鏁版嵁淇℃伅");
             }
-            title = "[鐗╂祦杞﹀叆鍥绾鐢宠浜�-" + platformBooks.getDriverName();
-            jsonMap.put("inType", "鍏ュ簱绫诲瀷锛�"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"鏁存墭鐩�":"浠剁儫"));
-            jsonMap.put("totalNum", "鎬昏繍杈撻噺锛�"+platformBooks.getTotalNum()+"涓囨敮");
-            jsonMap.put("arriveDate", "鍒板満鏃堕棿锛�" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm"));
-            jsonMap.put("carNum", "杞︾墝鐓э細"+platformBooks.getCarCodeFront());
+            title = ApproveServiceImpl.creatPlatformBookNotice(platformBooks,jsonMap);
+//            title = "[鐗╂祦杞﹀叆鍥绾鐢宠浜�-" + platformBooks.getDriverName();
+//            jsonMap.put("inType", "鍏ュ簱绫诲瀷锛�"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"鏁存墭鐩�":"浠剁儫"));
+//            jsonMap.put("totalNum", "鎬昏繍杈撻噺锛�"+platformBooks.getTotalNum()+"涓囨敮");
+//            jsonMap.put("arriveDate", "鍒板満鏃堕棿锛�" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm"));
+//            jsonMap.put("carNum", "杞︾墝鐓э細"+platformBooks.getCarCodeFront());
         }
         return title;
+    }
+
+    public static String creatPlatformBookNotice(PlatformBooks platformBooks,Map<String,Object> jsonMap){
+        jsonMap.put("inType", "浣滀笟绫诲瀷锛�"+(Constants.equalsInteger(platformBooks.getInType(),Constants.ZERO)?"鏁存墭鐩�":"浠剁儫"));
+        jsonMap.put("totalNum", "鎬昏繍杈撻噺锛�"+platformBooks.getTotalNum()+"涓囨敮");
+        jsonMap.put("arriveDate", "鍒板満鏃堕棿锛�" + DateUtil.DateToStr(platformBooks.getArriveDate() , "yyyy-MM-dd HH:mm"));
+        jsonMap.put("carNum", "杞︾墝鐓э細"+platformBooks.getCarCodeFront());
+        return  "[鐗╂祦杞﹀叆鍥绾鐢宠浜�-" + platformBooks.getDriverName() ;
+
     }
 
 
@@ -1207,8 +1218,10 @@
                 || Objects.isNull(approveDTO.getLoginUserInfo())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
-        if(approveDTO.getStatus().equals(Constants.THREE)&&StringUtils.isBlank(approveDTO.getCheckInfo())){
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇疯緭鍏ユ嫆缁濊鏄�");
+        if(!(Constants.equalsInteger(approveDTO.getObjType(),Constants.THREE)||Constants.equalsInteger(approveDTO.getObjType(),Constants.FOUR))){
+            if(approveDTO.getStatus().equals(Constants.THREE)&&StringUtils.isBlank(approveDTO.getCheckInfo())){
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇疯緭鍏ユ嫆缁濊鏄�");
+            }
         }
         Approve approve = approveMapper.selectOne(new QueryWrapper<Approve>()
                 .lambda()
@@ -1441,7 +1454,6 @@
                         wxNoticeConfigMapper,
                         platformBooksMapper.selectById(approveDTO.getObjId()),
                         WxPlatConstants.platformBookContent.platformBookWaitAudit,
-                        systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                         openIdList,
                         Constants.ONE);
             }
@@ -1465,8 +1477,7 @@
                         //鍙戦�佸井淇″叕浼楀彿閫氱煡
                         wxPlatNotice.sendCarUseBookTemplateNotice(systemDictDataBiz,
                                 wxNoticeConfigMapper,carUseBook,
-                                WxPlatConstants.carUseBookContent.carUseBookWaitAudit,
-                                systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+                                WxPlatConstants.carUseBookContent.carUseBookWaitAudit, 
                                 openIdList,1);
                     }
                 }
@@ -1492,7 +1503,6 @@
                         wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                                 wxNoticeConfigMapper,visitsMapper.selectById(approveDTO.getObjId()),
                                 approveDTO.getObjType().equals(Constants.approveObjectType.visitReporting)?WxPlatConstants.visitReportContent.visitReportWaitAudit:WxPlatConstants.visitContent.visitWaitAudit,
-                                systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                                 openIdList
                         );
                     }
@@ -1749,7 +1759,6 @@
                 if(Objects.nonNull(visits) && StringUtils.isNotBlank(visits.getOpenid())){
                     wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                             wxNoticeConfigMapper,visits, objCode,
-                            systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                             Arrays.asList(visits.getOpenid().split(","))
                     );
                 }
@@ -1776,7 +1785,6 @@
                     wxPlatNotice.sendCarUseBookTemplateNotice(systemDictDataBiz,
                             wxNoticeConfigMapper,carUseBook,
                             Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?WxPlatConstants.carUseBookContent.carUseBookAuditSuccess: WxPlatConstants.carUseBookContent.carUseBookAuditFail,
-                            systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                             Arrays.asList(systemUser.getOpenid().split(",")),0);
                 }
             }
@@ -1847,7 +1855,6 @@
                 wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz,
                         wxNoticeConfigMapper, platformBooks,
                         Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)?WxPlatConstants.platformBookContent.platformBookAuditSuccess: WxPlatConstants.platformBookContent.platformBookAuditFail,
-                        systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                         Arrays.asList(driver.getOpenid().split(",")),0);
             }
 

--
Gitblit v1.9.3