java110
2023-08-21 cb921ad901790925db64afc1bcbafb678e8a12b6
service-job/src/main/java/com/java110/job/task/wechat/WeChatPushMessageTemplate.java
@@ -9,22 +9,22 @@
import com.java110.core.factory.WechatFactory;
import com.java110.core.log.LoggerFactory;
import com.java110.core.smo.ISaveTransactionLogSMO;
import com.java110.dto.RoomDto;
import com.java110.dto.room.RoomDto;
import com.java110.dto.app.AppDto;
import com.java110.dto.community.CommunityDto;
import com.java110.dto.logSystemError.LogSystemErrorDto;
import com.java110.dto.log.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;
import com.java110.dto.wechat.SmallWeChatDto;
import com.java110.dto.wechat.SmallWechatAttrDto;
import com.java110.dto.task.TaskDto;
import com.java110.dto.wechatSubscribe.WechatSubscribeDto;
import com.java110.entity.wechat.Content;
import com.java110.entity.wechat.Data;
import com.java110.entity.wechat.Miniprogram;
import com.java110.entity.wechat.PropertyFeeTemplateMessage;
import com.java110.dto.wechat.WechatSubscribeDto;
import com.java110.dto.wechat.Content;
import com.java110.dto.wechat.Data;
import com.java110.dto.wechat.Miniprogram;
import com.java110.dto.wechat.PropertyFeeTemplateMessage;
import com.java110.intf.community.INoticeInnerServiceSMO;
import com.java110.intf.community.IRoomInnerServiceSMO;
import com.java110.intf.store.ISmallWeChatInnerServiceSMO;
@@ -34,12 +34,14 @@
import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
import com.java110.intf.user.IWechatSubscribeV1InnerServiceSMO;
import com.java110.job.quartz.TaskSystemQuartz;
import com.java110.po.logSystemError.LogSystemErrorPo;
import com.java110.po.transactionLog.TransactionLogPo;
import com.java110.po.wechatSubscribe.WechatSubscribePo;
import com.java110.po.log.LogSystemErrorPo;
import com.java110.po.log.TransactionLogPo;
import com.java110.po.wechat.WechatSubscribePo;
import com.java110.service.smo.ISaveSystemErrorSMO;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.cache.UrlCache;
import com.java110.utils.constant.WechatConstant;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.DateUtil;
import com.java110.utils.util.ExceptionUtil;
import com.java110.utils.util.StringUtil;
@@ -206,7 +208,8 @@
        String objType = noticeDto.getObjType();
        switch (objType) {
            case NoticeDto.OBJ_TYPE_ALL: //全部推送
                sendAllOwners(noticeDto, templateId, accessToken, weChatDto);
                sendAllOwner(noticeDto, templateId, accessToken, weChatDto);
                //sendAllOwners(noticeDto, templateId, accessToken, weChatDto);
                break;
            case NoticeDto.OBJ_TYPE_FLOOR: //楼栋
                sendFloorOwner(noticeDto, templateId, accessToken, weChatDto);
@@ -362,10 +365,10 @@
        if (wechatSubscribeDtos == null || wechatSubscribeDtos.size() < 1) {
            return;
        }
        String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL");
        String wechatUrl = UrlCache.getOwnerUrl();
        Miniprogram miniprogram = null;
        if (wechatUrl.startsWith("https://") || wechatUrl.startsWith("http://")) {
            miniprogram = new Miniprogram();
            //miniprogram = new Miniprogram();
        } else {
            miniprogram = new Miniprogram();
            miniprogram.setAppid(wechatUrl);
@@ -387,7 +390,8 @@
                data.setKeyword2(new Content(noticeDto.getStartTime()));
                data.setKeyword3(new Content(StringUtil.delHtmlTag(noticeDto.getContext())));
                data.setRemark(new Content("如有疑问请联系相关物业人员"));
                templateMessage.setData(data);
                templateMessage.setData(BeanConvertUtil.beanCovertJson(data));
                if (!StringUtil.isEmpty(wechatUrl)) {
                    if (miniprogram == null) {
                        templateMessage.setUrl(wechatUrl + "/#/pages/notice/detail/detail?noticeId=" + noticeDto.getNoticeId() + "&wAppId=" + weChatDto.getAppId() + "&communityId=" + noticeDto.getCommunityId());
@@ -474,9 +478,10 @@
                        data.setKeyword2(new Content(noticeDto.getStartTime()));
                        data.setKeyword3(new Content(StringUtil.delHtmlTag(noticeDto.getContext())));
                        data.setRemark(new Content("如有疑问请联系相关物业人员"));
                        templateMessage.setData(data);
                        templateMessage.setData(BeanConvertUtil.beanCovertJson(data));
                        //获取业主公众号地址
                        String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL");
                        String wechatUrl = UrlCache.getOwnerUrl();
                        if (!StringUtil.isEmpty(wechatUrl) && wechatUrl.contains("?")) {
                            wechatUrl += ("&wAppId=" + weChatDto.getAppId());
                        } else {
@@ -546,7 +551,7 @@
    }
    private void doSend(List<OwnerAppUserDto> ownerAppUserDtos, NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) {
        String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL") + "/#/pages/notice/detail/detail?noticeId=";
        String wechatUrl = UrlCache.getOwnerUrl() + "/#/pages/notice/detail/detail?noticeId=";
        ResponseEntity<String> responseEntity = null;
        String sendTemplate = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.SEND_TEMPLATE_URL);
        if (StringUtil.isEmpty(sendTemplate)) {
@@ -565,7 +570,8 @@
                data.setKeyword2(new Content(noticeDto.getStartTime()));
                data.setKeyword3(new Content(StringUtil.delHtmlTag(noticeDto.getContext())));
                data.setRemark(new Content("如有疑问请联系相关物业人员"));
                templateMessage.setData(data);
                templateMessage.setData(BeanConvertUtil.beanCovertJson(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);