|
|
@ -26,12 +26,14 @@ import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.UserMessageConstans; |
|
|
|
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.PaCustomerDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.*; |
|
|
@ -140,6 +142,13 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
if (!(msgList.size() > NumConstant.ZERO)) { |
|
|
|
throw new RenException("待发送消息不能为空"); |
|
|
|
} |
|
|
|
//2021.1.19 根据客户类型判断是否允许推送微信消息【兼容泸州】 sun start
|
|
|
|
PaCustomerDTO pc = thirdCustomer(msgList.get(NumConstant.ZERO).getCustomerId()); |
|
|
|
if (!pc.getType().equals(UserMessageConstans.MINI)) { |
|
|
|
logger.warn(String.format("当前客户不允许推送微信消息,客户Id->%s", msgList.get(NumConstant.ZERO).getCustomerId())); |
|
|
|
return; |
|
|
|
} |
|
|
|
//2021.1.19 end
|
|
|
|
int succecssCount = 0; |
|
|
|
// 获取templateId
|
|
|
|
CustomerTemplateListFormDTO customerTemplateListFormDTO = new CustomerTemplateListFormDTO(); |
|
|
@ -337,6 +346,13 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
if (msgList.size() == 0){ |
|
|
|
return; |
|
|
|
} |
|
|
|
//2021.1.19 根据客户类型判断是否允许推送微信消息【兼容泸州】 sun start
|
|
|
|
PaCustomerDTO pc = thirdCustomer(msgList.get(NumConstant.ZERO).getCustomerId()); |
|
|
|
if (!pc.getType().equals(UserMessageConstans.MINI)) { |
|
|
|
logger.warn(String.format("当前客户不允许推送微信消息,客户Id->%s", msgList.get(NumConstant.ZERO).getCustomerId())); |
|
|
|
return; |
|
|
|
} |
|
|
|
//2021.1.19 end
|
|
|
|
// 获取templateId
|
|
|
|
TemplateListV2FormDTO templateListV2FormDTO = new TemplateListV2FormDTO(); |
|
|
|
templateListV2FormDTO.setCustomerId(msgList.get(0).getCustomerId()); |
|
|
@ -873,8 +889,33 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
if(msgSubscribeStatusDao.updateUserSubscribe(formDTO)<NumConstant.ONE){ |
|
|
|
throw new RenException("重新激活订阅操作失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @return |
|
|
|
* @Description 根据客户Id获取客户基础数据 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
private PaCustomerDTO thirdCustomer(String customerId) { |
|
|
|
String url = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/" + customerId; |
|
|
|
Result<String> data = HttpClientManager.getInstance().sendGet(url, null); |
|
|
|
logger.info("WxmpMessageServiceImpl.thirdCustomer:httpclient->url:" + url + ",结果->" + data); |
|
|
|
if (!data.success()) { |
|
|
|
logger.error(String.format("调用third服务查询客户基础数据失败,客户Id->%s", customerId)); |
|
|
|
throw new RenException(data.getCode(), data.getInternalMsg()); |
|
|
|
} |
|
|
|
JSONObject toResult = JSON.parseObject(data.getData()); |
|
|
|
Result result = ConvertUtils.mapToEntity(toResult, Result.class); |
|
|
|
if (null != toResult.get("code")) { |
|
|
|
result.setCode(((Integer) toResult.get("code")).intValue()); |
|
|
|
} |
|
|
|
if (!result.success()) { |
|
|
|
throw new RenException(result.getCode()); |
|
|
|
} |
|
|
|
Object RegisterResult = result.getData(); |
|
|
|
JSONObject jsonObject = JSON.parseObject(RegisterResult.toString()); |
|
|
|
PaCustomerDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, PaCustomerDTO.class); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|