old mode 100644
new mode 100755
| | |
| | | import com.java110.job.quartz.TaskSystemQuartz; |
| | | import com.java110.po.transactionLog.TransactionLogPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.WechatConstant; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | |
| | | String objType = noticeDto.getObjType(); |
| | | |
| | | switch (objType) { |
| | | case NoticeDto.OBJ_TYPE_COMMUNITY: |
| | | case NoticeDto.OBJ_TYPE_ALL: |
| | | sendAllOwner(noticeDto, templateId, accessToken, weChatDto); |
| | | break; |
| | | case NoticeDto.OBJ_TYPE_FLOOR: |
| | |
| | | case NoticeDto.OBJ_TYPE_ROOM: |
| | | sendRoomOwner(noticeDto, templateId, accessToken, weChatDto); |
| | | break; |
| | | case NoticeDto.OBJ_TYPE_COMMUNITY: |
| | | sendCommunityOwner(noticeDto, templateId, accessToken, weChatDto); |
| | | break; |
| | | } |
| | | |
| | | NoticeDto tmpNoticeDto = new NoticeDto(); |
| | |
| | | tmpNoticeDto.setState(NoticeDto.STATE_FINISH); |
| | | noticeInnerServiceSMOImpl.updateNotice(tmpNoticeDto); |
| | | |
| | | } |
| | | |
| | | 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()); |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | doSend(ownerAppUserDtos, noticeDto, templateId, accessToken, weChatDto); |
| | | } |
| | | |
| | | private void sendFloorOwner(NoticeDto noticeDto, String templateId, String accessToken, SmallWeChatDto weChatDto) { |
| | |
| | | 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="; |
| | | ResponseEntity<String> responseEntity = null; |
| | | String sendTemplate = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN,WechatConstant.SEND_TEMPLATE_URL); |
| | | if(StringUtil.isEmpty(sendTemplate)){ |
| | | sendTemplate = sendMsgUrl; |
| | | } |
| | | for (OwnerAppUserDto appUserDto : ownerAppUserDtos) { |
| | | Date startTime = DateUtil.getCurrentDate(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | |
| | | templateMessage.setData(data); |
| | | templateMessage.setUrl(wechatUrl + noticeDto.getNoticeId() + "&wAppId=" + weChatDto.getAppId()); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | responseEntity = outRestTemplate.postForEntity(sendMsgUrl + accessToken, JSON.toJSONString(templateMessage), String.class); |
| | | responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } catch (Exception e) { |
| | | logger.error("发送失败", e); |
| | |
| | | } |
| | | |
| | | private void doSendToOpenId(NoticeDto noticeDto, String templateId, String accessToken, String nextOpenid, SmallWeChatDto weChatDto) { |
| | | String url = getUser.replace("ACCESS_TOKEN", accessToken); |
| | | String url = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN,WechatConstant.GET_USER_URL); |
| | | if(StringUtil.isEmpty(url)){ |
| | | url = getUser; |
| | | } |
| | | url = url.replace("ACCESS_TOKEN", accessToken); |
| | | if (!StringUtil.isEmpty(nextOpenid)) { |
| | | url += ("&next_openid=" + nextOpenid); |
| | | } |
| | |
| | | miniprogram = new Miniprogram(); |
| | | miniprogram.setAppid(wechatUrl); |
| | | } |
| | | |
| | | String sendTemplate = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN,WechatConstant.SEND_TEMPLATE_URL); |
| | | if(StringUtil.isEmpty(sendTemplate)){ |
| | | sendTemplate = sendMsgUrl; |
| | | } |
| | | ResponseEntity<String> responseEntity = null; |
| | | for (int openIndex = 0; openIndex < openids.size(); openIndex++) { |
| | | Date startTime = DateUtil.getCurrentDate(); |
| | |
| | | } |
| | | } |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | responseEntity = outRestTemplate.postForEntity(sendMsgUrl + accessToken, JSON.toJSONString(templateMessage), String.class); |
| | | responseEntity = outRestTemplate.postForEntity(sendTemplate + accessToken, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } catch (Exception e) { |
| | | logger.error("发送失败", e); |