From 51a15a882223cf002efc7ef9b201988563174ebd Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 23 Oct 2020 14:37:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B2=E7=AA=81=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxmpMessageServiceImpl.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java index be44604e64..90e455ce8a 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java @@ -19,25 +19,28 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.WxMsgTemplateSubscribeStatus; import com.epmet.constant.WxmpMessageConstant; import com.epmet.dao.WxmpResiUserSubscribeDao; import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; +import com.epmet.dao.WxmpUserSubscribeRecordDao; import com.epmet.dao.WxmpWorkUserSubscribeDao; import com.epmet.dto.form.GetTemplateListFormDTO; import com.epmet.dto.form.StaffBasicInfoFormDTO; import com.epmet.dto.form.UserBasicInfoFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.result.GetTemplateListResultDTO; -import com.epmet.entity.WxmpMsgSendRecordEntity; -import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity; +import com.epmet.dto.result.StaffBasicInfo; +import com.epmet.dto.result.UserBasicInfo; +import com.epmet.dto.result.WxMsgAuthInfoResultDTO; +import com.epmet.entity.*; import com.epmet.exception.WxSubscribeException; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.WxmpMessageRedis; @@ -50,9 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -88,12 +89,6 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { @Autowired private WxmpUserSubscribeRecordDao subscribeRecordDao; - @Autowired - private WxmpResiUserSubscribeDao resiUserSubscribeDao; - - @Autowired - private EpmetUserOpenFeignClient userOpenFeignClient; - /** * @Description 保存系统授权信息 * @return void @@ -389,7 +384,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { */ private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, String openId) { - WxmpResiUserSubscribeEntity wxResiSubscribe = resiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId); + WxmpResiUserSubscribeEntity wxResiSubscribe = wxmpResiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId); if (wxResiSubscribe == null) { WxmpResiUserSubscribeEntity insert = new WxmpResiUserSubscribeEntity(); insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0); @@ -402,9 +397,9 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { } if (WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus)) { - resiUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId); + wxmpResiUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId); } else { - resiUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId); + wxmpResiUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId); } } @@ -445,7 +440,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { public String getResiOpenId(String userId) { UserBasicInfoFormDTO bif = new UserBasicInfoFormDTO(); bif.setUserId(userId); - Result result = userOpenFeignClient.getUserBasicInfo(bif); + Result result = epmetUserOpenFeignClient.getUserBasicInfo(bif); if (!result.success()) { throw new RenException(String.format("查询居民OpenId失败,userId:%s,错误信息:%s",userId , result.getInternalMsg())); } @@ -465,7 +460,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { public String getWorkOpenId(String userId) { StaffBasicInfoFormDTO form = new StaffBasicInfoFormDTO(); form.setStaffId(userId); - Result result = userOpenFeignClient.getStaffBasicInfo(form); + Result result = epmetUserOpenFeignClient.getStaffBasicInfo(form); if (!result.success()) { throw new RenException(String.format("查询工作人员OpenId失败,userId:%s,错误信息:%s",userId , result.getInternalMsg())); }