From 7a0a3d837365330be38699894ce0167bade1de58 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期三, 07 十二月 2022 15:00:26 +0800
Subject: [PATCH] 1、优化报修通知信息2、优化缴费审核3、优化发布公告信息4、优化页面显示性问题

---
 service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java |  226 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 155 insertions(+), 71 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java b/service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java
index b93f05c..95305af 100755
--- a/service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java
+++ b/service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java
@@ -15,6 +15,7 @@
 import com.java110.dto.logSystemError.LogSystemErrorDto;
 import com.java110.dto.notice.NoticeDto;
 import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.owner.OwnerRoomRelDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.dto.smallWechatAttr.SmallWechatAttrDto;
@@ -29,6 +30,7 @@
 import com.java110.intf.store.ISmallWeChatInnerServiceSMO;
 import com.java110.intf.store.ISmallWechatAttrInnerServiceSMO;
 import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
+import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
 import com.java110.intf.user.IWechatSubscribeV1InnerServiceSMO;
 import com.java110.job.quartz.TaskSystemQuartz;
@@ -64,6 +66,7 @@
     private static Logger logger = LoggerFactory.getLogger(WeChatPushMessageTemplate.class);
 
     public static final int DEFAULT_THREAD_NUM = 20;
+
     public static final int DEFAULT_SUBSCRIBE_PERSON = 100;
 
     public static final int DEFAULT_QUERY_APP_OWNER_COUNT = 50;
@@ -85,6 +88,7 @@
 
     @Autowired
     private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl;
+
     @Autowired
     private ISaveTransactionLogSMO saveTransactionLogSMOImpl;
 
@@ -97,23 +101,26 @@
     @Autowired
     private IWechatSubscribeV1InnerServiceSMO wechatSubscribeV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
+    @Autowired
+    private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMO;
+
     //妯℃澘淇℃伅鎺ㄩ�佸湴鍧�
     private static String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
+
     private static String getUser = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN";
 
     private Java110ThreadPoolFactory<PublicWeChatPushMessageTemplate> publicWeChatPushMessageTemplateJava110ThreadPoolFactory = null;
 
-
     @Override
     protected void process(TaskDto taskDto) {
         logger.debug("寮�濮嬫墽琛屽井淇℃ā鏉夸俊鎭帹閫�" + taskDto.toString());
-
         //鍒涘缓杩炴帴姹�
         publicWeChatPushMessageTemplateJava110ThreadPoolFactory = Java110ThreadPoolFactory.getInstance().createThreadPool(DEFAULT_THREAD_NUM);
-
         // 鑾峰彇灏忓尯
         List<CommunityDto> communityDtos = getAllCommunity();
-
         for (CommunityDto communityDto : communityDtos) {
             try {
                 publishMsg(taskDto, communityDto);
@@ -126,53 +133,41 @@
                 logger.error("鎺ㄩ�佹秷鎭け璐�", e);
             }
         }
-
         publicWeChatPushMessageTemplateJava110ThreadPoolFactory.stop();
     }
 
     private void publishMsg(TaskDto taskDto, CommunityDto communityDto) throws Exception {
-
         //鏌ヨ鍏紬鍙烽厤缃�
         SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
         smallWeChatDto.setWeChatType("1100");
         smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
         smallWeChatDto.setObjId(communityDto.getCommunityId());
         List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
-
         if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) {
             logger.info("鏈厤缃井淇″叕浼楀彿淇℃伅,瀹氭椂浠诲姟鎵ц缁撴潫");
             return;
         }
         SmallWeChatDto weChatDto = smallWeChatDtos.get(0);
-
-
         SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto();
         smallWechatAttrDto.setCommunityId(communityDto.getCommunityId());
         smallWechatAttrDto.setWechatId(weChatDto.getWeChatId());
         smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_TEMPLATE);
         List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto);
-
         if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) {
             logger.info("鏈厤缃井淇″叕浼楀彿娑堟伅妯℃澘");
             return;
         }
-
         String templateId = smallWechatAttrDtos.get(0).getValue();
-
         String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret());
-
         if (accessToken == null || accessToken == "") {
             logger.info("鎺ㄩ�佸井淇℃ā鏉�,鑾峰彇accessToken澶辫触:{}", accessToken);
             return;
         }
-
-        //
+        //澶勭悊閫氱煡
         List<NoticeDto> noticeDtos = getNotices(communityDto.getCommunityId());
-
         if (noticeDtos == null || noticeDtos.size() < 1) {
             return;
         }
-
         for (NoticeDto tmpNotice : noticeDtos) {
             try {
                 doSentWechat(tmpNotice, templateId, accessToken, weChatDto);
@@ -185,7 +180,6 @@
                 logger.error("閫氱煡寮傚父", e);
             }
         }
-
     }
 
     @Java110Synchronized(value = "communityId")
@@ -197,7 +191,6 @@
         noticeDto.setState(NoticeDto.STATE_WAIT);
         noticeDto.setNoticeTypeCd(NoticeDto.NOTICE_TYPE_OWNER_WECHAT);
         List<NoticeDto> noticeDtos = noticeInnerServiceSMOImpl.queryNotices(noticeDto);
-
         //鏇存柊涓哄彂閫佷腑
         for (NoticeDto noticeDto1 : noticeDtos) {
             noticeDto = new NoticeDto();
@@ -206,72 +199,71 @@
             noticeDto.setCommunityId(communityId);
             noticeInnerServiceSMOImpl.updateNotice(noticeDto);
         }
-
         return noticeDtos;
     }
 
     private void doSentWechat(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) throws Exception {
-
-//        Date startTime = DateUtil.getDateFromString(noticeDto.getStartTime(), DateUtil.DATE_FORMATE_STRING_A);
-//        Date nowTime = DateUtil.getCurrentDate();
-//        if (startTime.getTime() > nowTime.getTime()) { //杩樻病鏈夊埌鏃堕棿
-//            return;
-//        }
-
-
         String objType = noticeDto.getObjType();
-
         switch (objType) {
-            case NoticeDto.OBJ_TYPE_ALL:
-                sendAllOwner(noticeDto, templateId, accessToken, weChatDto);
+            case NoticeDto.OBJ_TYPE_ALL: //鍏ㄩ儴鎺ㄩ��
+                sendAllOwners(noticeDto, templateId, accessToken, weChatDto);
                 break;
-            case NoticeDto.OBJ_TYPE_FLOOR:
+            case NoticeDto.OBJ_TYPE_FLOOR: //妤兼爧
                 sendFloorOwner(noticeDto, templateId, accessToken, weChatDto);
                 break;
-            case NoticeDto.OBJ_TYPE_UNIT:
+            case NoticeDto.OBJ_TYPE_UNIT: //鍗曞厓
                 sendUnitOwner(noticeDto, templateId, accessToken, weChatDto);
                 break;
-            case NoticeDto.OBJ_TYPE_ROOM:
+            case NoticeDto.OBJ_TYPE_ROOM: //鎴垮眿
                 sendRoomOwner(noticeDto, templateId, accessToken, weChatDto);
                 break;
-            case NoticeDto.OBJ_TYPE_COMMUNITY:
+            case NoticeDto.OBJ_TYPE_COMMUNITY: //灏忓尯
                 sendCommunityOwner(noticeDto, templateId, accessToken, weChatDto);
                 break;
         }
-
         NoticeDto tmpNoticeDto = new NoticeDto();
         tmpNoticeDto.setNoticeId(noticeDto.getNoticeId());
         tmpNoticeDto.setState(NoticeDto.STATE_FINISH);
         noticeInnerServiceSMOImpl.updateNotice(tmpNoticeDto);
-
     }
 
+    /**
+     * 灏忓尯鎺ㄩ��
+     *
+     * @param noticeDto
+     * @param templateId
+     * @param accessToken
+     * @param weChatDto
+     */
     private void sendCommunityOwner(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
         OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
         ownerAppUserDto.setAppType(OwnerAppUserDto.APP_TYPE_WECHAT);
         ownerAppUserDto.setCommunityId(noticeDto.getCommunityId());
         int count = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsersCount(ownerAppUserDto);
-
-        double maxPage = Math.ceil(count/DEFAULT_QUERY_APP_OWNER_COUNT)+1;
-
-        for(int page = 0; page < maxPage; page++){
-            ownerAppUserDto.setPage(page+1);
+        double maxPage = Math.ceil(count / DEFAULT_QUERY_APP_OWNER_COUNT) + 1;
+        for (int page = 0; page < maxPage; page++) {
+            ownerAppUserDto.setPage(page + 1);
             ownerAppUserDto.setRow(DEFAULT_QUERY_APP_OWNER_COUNT);
             List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
             doSend(ownerAppUserDtos, noticeDto, templateId, accessToken, weChatDto);
         }
-//
 //        List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
 //        doSend(ownerAppUserDtos, noticeDto, templateId, accessToken, weChatDto);
     }
 
+    /**
+     * 妤兼爧鎺ㄩ��
+     *
+     * @param noticeDto
+     * @param templateId
+     * @param accessToken
+     * @param weChatDto
+     */
     private void sendFloorOwner(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
-
         RoomDto roomDto = new RoomDto();
         roomDto.setCommunityId(noticeDto.getCommunityId());
         roomDto.setFloorId(noticeDto.getObjId());
         List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
-
         for (RoomDto tmpRoomDto : roomDtos) {
             if (!RoomDto.STATE_SELL.equals(tmpRoomDto.getState())) {
                 continue;
@@ -279,7 +271,6 @@
             OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
             ownerRoomRelDto.setRoomId(tmpRoomDto.getRoomId());
             List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-
             if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
                 continue;
             }
@@ -291,13 +282,19 @@
         }
     }
 
+    /**
+     * 鍗曞厓鎺ㄩ��
+     *
+     * @param noticeDto
+     * @param templateId
+     * @param accessToken
+     * @param weChatDto
+     */
     private void sendUnitOwner(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
-
         RoomDto roomDto = new RoomDto();
         roomDto.setCommunityId(noticeDto.getCommunityId());
         roomDto.setUnitId(noticeDto.getObjId());
         List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
-
         for (RoomDto tmpRoomDto : roomDtos) {
             if (!RoomDto.STATE_SELL.equals(tmpRoomDto.getState())) {
                 continue;
@@ -305,7 +302,6 @@
             OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
             ownerRoomRelDto.setRoomId(tmpRoomDto.getRoomId());
             List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-
             if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
                 continue;
             }
@@ -317,21 +313,26 @@
         }
     }
 
+    /**
+     * 鎴垮眿鎺ㄩ��
+     *
+     * @param noticeDto
+     * @param templateId
+     * @param accessToken
+     * @param weChatDto
+     */
     private void sendRoomOwner(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
-
         RoomDto roomDto = new RoomDto();
         roomDto.setCommunityId(noticeDto.getCommunityId());
         roomDto.setRoomId(noticeDto.getObjId());
         List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
-
         for (RoomDto tmpRoomDto : roomDtos) {
-            if (!RoomDto.STATE_SELL.equals(tmpRoomDto.getState())) {
+            if (RoomDto.STATE_FREE.equals(tmpRoomDto.getState())) { //涓嶇粰鏈攢鍞姸鎬佺殑鎴垮眿鎺ㄩ��(鏈叆浣忕殑鎺ㄩ�侊紝涓氫富鏈叆浣忓彲鑳界粦瀹氫簡鎴垮眿)
                 continue;
             }
             OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
             ownerRoomRelDto.setRoomId(tmpRoomDto.getRoomId());
             List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-
             if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
                 continue;
             }
@@ -348,9 +349,7 @@
         WechatSubscribeDto wechatSubscribeDto = new WechatSubscribeDto();
         wechatSubscribeDto.setAppId(weChatDto.getAppId());
         wechatSubscribeDto.setOpenType(WechatSubscribeDto.OPEN_TYPE_WECHAT);
-
         int count = wechatSubscribeV1InnerServiceSMOImpl.queryWechatSubscribesCount(wechatSubscribeDto);
-
         //鍙兘鍏紬鍙� 宸茬粡 浣跨敤浜嗗ソ涔� 浣嗘槸 绋嬪簭鍙兘鍒氬紑濮嬬敤
         if (count < DEFAULT_SUBSCRIBE_PERSON) {
             //doSendToOpenId(noticeDto, templateId, accessToken, "", weChatDto);
@@ -359,22 +358,18 @@
             wechatSubscribeV1InnerServiceSMOImpl.deleteWechatSubscribe(tmpWechatSubscribePo);
             getAllOpenId(accessToken, "", weChatDto);
         }
-
         List<WechatSubscribeDto> wechatSubscribeDtos = wechatSubscribeV1InnerServiceSMOImpl.queryDistinctWechatSubscribes(wechatSubscribeDto);
-
         if (wechatSubscribeDtos == null || wechatSubscribeDtos.size() < 1) {
             return;
         }
-
         String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL");
         Miniprogram miniprogram = null;
         if (wechatUrl.startsWith("https://") || wechatUrl.startsWith("http://")) {
-
+            miniprogram = new Miniprogram();
         } else {
             miniprogram = new Miniprogram();
             miniprogram.setAppid(wechatUrl);
         }
-
         String sendTemplate = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.SEND_TEMPLATE_URL);
         if (StringUtil.isEmpty(sendTemplate)) {
             sendTemplate = sendMsgUrl;
@@ -404,7 +399,7 @@
                 //骞跺彂澶勭悊
                 PushWechatTemplateMessageThread pushWechatTemplateMessageThread = new PushWechatTemplateMessageThread(outRestTemplate, sendTemplate + accessToken, JSON.toJSONString(templateMessage));
                 publicWeChatPushMessageTemplateJava110ThreadPoolFactory.submit(pushWechatTemplateMessageThread);
-                //responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class);
+                responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class);
             } catch (Exception e) {
                 LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
                 logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
@@ -414,6 +409,95 @@
                 logger.error("鍙戦�佸け璐�", e);
             } finally {
                 doSaveLog(startTime, DateUtil.getCurrentDate(), "/pages/notice/detail/detail", JSON.toJSONString(templateMessage), responseEntity, wechatSubscribeDto1.getOpenId());
+            }
+        }
+    }
+
+    /**
+     * 缁欏叧娉ㄧ敤鎴锋帹閫�
+     *
+     * @param noticeDto
+     * @param templateId
+     * @param accessToken
+     * @param weChatDto
+     */
+    private void sendAllOwners(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
+        //鏌ヨ鍏紬鍙烽厤缃�
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setWeChatType("1100");
+        smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY);
+        smallWeChatDto.setObjId(noticeDto.getObjId());
+        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
+        if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) {
+            logger.info("鏈厤缃井淇″叕浼楀彿淇℃伅,瀹氭椂浠诲姟鎵ц缁撴潫");
+            return;
+        }
+        SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto();
+        smallWechatAttrDto.setCommunityId(noticeDto.getObjId());
+        smallWechatAttrDto.setWechatId(weChatDto.getWeChatId());
+        smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_WORK_ORDER_REMIND_TEMPLATE);
+        List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto);
+        if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) {
+            logger.info("鏈厤缃井淇″叕浼楀彿娑堟伅妯℃澘");
+            return;
+        }
+        if (StringUtil.isEmpty(accessToken)) {
+            logger.info("鎺ㄩ�佸井淇℃ā鏉�,鑾峰彇accessToken澶辫触:{}", accessToken);
+            return;
+        }
+        OwnerDto ownerDto = new OwnerDto();
+        ownerDto.setCommunityId(noticeDto.getObjId());
+        List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+        String sendTemplate = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.SEND_TEMPLATE_URL);
+        if (StringUtil.isEmpty(sendTemplate)) {
+            sendTemplate = sendMsgUrl;
+        }
+        ResponseEntity<String> responseEntity = null;
+        if (ownerDtos != null && ownerDtos.size() > 0) {
+            for (OwnerDto owner : ownerDtos) {
+                OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
+                ownerAppUserDto.setMemberId(owner.getMemberId());
+                ownerAppUserDto.setAppType("WECHAT");
+                //鏌ヨ缁戝畾涓氫富
+                List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMO.queryOwnerAppUsers(ownerAppUserDto);
+                if (ownerAppUserDtos.size() > 0) {
+                    //鑾峰彇openId
+                    String openId = ownerAppUserDtos.get(0).getOpenId();
+                    Date startTime = DateUtil.getCurrentDate();
+                    Data data = new Data();
+                    PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage();
+                    try {
+                        templateMessage.setTemplate_id(templateId);
+                        templateMessage.setTouser(openId);
+                        data.setFirst(new Content(noticeDto.getTitle()));
+                        data.setKeyword1(new Content(noticeDto.getTitle()));
+                        data.setKeyword2(new Content(noticeDto.getStartTime()));
+                        data.setKeyword3(new Content(StringUtil.delHtmlTag(noticeDto.getContext())));
+                        data.setRemark(new Content("濡傛湁鐤戦棶璇疯仈绯荤浉鍏崇墿涓氫汉鍛�"));
+                        templateMessage.setData(data);
+                        //鑾峰彇涓氫富鍏紬鍙峰湴鍧�
+                        String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL");
+                        if (!StringUtil.isEmpty(wechatUrl) && wechatUrl.contains("?")) {
+                            wechatUrl += ("&wAppId=" + weChatDto.getAppId());
+                        } else {
+                            wechatUrl += ("?wAppId=" + weChatDto.getAppId());
+                        }
+                        templateMessage.setUrl(wechatUrl);
+                        //骞跺彂澶勭悊
+                        PushWechatTemplateMessageThread pushWechatTemplateMessageThread = new PushWechatTemplateMessageThread(outRestTemplate, sendTemplate + accessToken, JSON.toJSONString(templateMessage));
+                        publicWeChatPushMessageTemplateJava110ThreadPoolFactory.submit(pushWechatTemplateMessageThread);
+                        responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class);
+                    } catch (Exception e) {
+                        LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
+                        logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
+                        logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_NOTICE);
+                        logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e));
+                        saveSystemErrorSMOImpl.saveLog(logSystemErrorPo);
+                        logger.error("鍙戦�佸け璐�", e);
+                    } finally {
+                        doSaveLog(startTime, DateUtil.getCurrentDate(), "/pages/notice/detail/detail", JSON.toJSONString(templateMessage), responseEntity, openId);
+                    }
+                }
             }
         }
     }
@@ -428,18 +512,14 @@
             url += ("&next_openid=" + nextOpenid);
         }
         ResponseEntity<String> paramOut = outRestTemplate.getForEntity(url, String.class);
-
         logger.info("鑾峰彇鐢ㄦ埛杩斿洖:{}", paramOut);
-
         if (paramOut.getStatusCode() != HttpStatus.OK) {
             throw new IllegalArgumentException(paramOut.getBody());
         }
-
         JSONObject paramOutObj = JSONObject.parseObject(paramOut.getBody());
         if (paramOutObj.containsKey("errcode")) {
             throw new IllegalArgumentException(paramOut.getBody());
         }
-
         if (!paramOutObj.containsKey("data")) {
             return;
         }
@@ -456,11 +536,9 @@
             wechatSubscribePo.setOpenType(WechatSubscribeDto.OPEN_TYPE_WECHAT);
             wechatSubscribePos.add(wechatSubscribePo);
         }
-
         if (wechatSubscribePos.size() > 0) {
             wechatSubscribeV1InnerServiceSMOImpl.saveWechatSubscribes(wechatSubscribePos);
         }
-
         //锛堝叧娉ㄨ�呭垪琛ㄥ凡杩斿洖瀹屾椂锛岃繑鍥瀗ext_openid涓虹┖锛�
         if (!StringUtil.isEmpty(nextOpenid)) {
             getAllOpenId(accessToken, nextOpenid, weChatDto);
@@ -474,6 +552,7 @@
         if (StringUtil.isEmpty(sendTemplate)) {
             sendTemplate = sendMsgUrl;
         }
+        List<String> ownerAppUserList = new ArrayList<>();
         for (OwnerAppUserDto appUserDto : ownerAppUserDtos) {
             Date startTime = DateUtil.getCurrentDate();
             PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage();
@@ -489,9 +568,9 @@
                 templateMessage.setData(data);
                 templateMessage.setUrl(wechatUrl + noticeDto.getNoticeId() + "&wAppId=" + weChatDto.getAppId() + "&communityId=" + noticeDto.getCommunityId());
                 logger.info("鍙戦�佹ā鏉挎秷鎭唴瀹�:{}", JSON.toJSONString(templateMessage));
-                //responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class);
-                PushWechatTemplateMessageThread pushWechatTemplateMessageThread = new PushWechatTemplateMessageThread(outRestTemplate, sendTemplate + accessToken, JSON.toJSONString(templateMessage));
-                publicWeChatPushMessageTemplateJava110ThreadPoolFactory.submit(pushWechatTemplateMessageThread);
+                responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class);
+//                PushWechatTemplateMessageThread pushWechatTemplateMessageThread = new PushWechatTemplateMessageThread(outRestTemplate, sendTemplate + accessToken, JSON.toJSONString(templateMessage));
+//                publicWeChatPushMessageTemplateJava110ThreadPoolFactory.submit(pushWechatTemplateMessageThread);
                 logger.info("寰俊妯℃澘杩斿洖鍐呭:{}", responseEntity);
             } catch (Exception e) {
                 LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
@@ -503,6 +582,12 @@
             } finally {
                 doSaveLog(startTime, DateUtil.getCurrentDate(), "/pages/notice/detail/detail", JSON.toJSONString(templateMessage), responseEntity, appUserDto.getOpenId());
             }
+            if (!StringUtil.isEmpty(noticeDto.getObjType()) && noticeDto.getObjType().equals("004")) { //鎴垮眿
+                if (ownerAppUserList.contains(appUserDto.getAppUserName())) {
+                    continue;
+                }
+            }
+            ownerAppUserList.add(appUserDto.getAppUserName());
         }
     }
 
@@ -527,5 +612,4 @@
             logger.error("瀛樻棩蹇楀け璐�", e);
         }
     }
-
 }

--
Gitblit v1.8.0