Browse Source

Merge remote-tracking branch 'origin/dev_jcet' into dev_jcet

dev_shibei_match
wxz 5 years ago
parent
commit
4de75be633
  1. 10
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java
  2. 43
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java
  3. 17
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdConstant.java
  4. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java
  5. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  6. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java
  7. 3
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.12__alter_pa_customer.sql
  8. 17
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

10
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java

@ -8,4 +8,14 @@ package com.epmet.constant;
public interface UserMessageConstans {
String READ = "read";
String UNREAD = "unread";
/**
* 小程序
*/
String MINI = "mini";
/**
* 第三方app
*/
String APP = "app";
}

43
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java

@ -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;
}
}

17
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdConstant.java

@ -0,0 +1,17 @@
package com.epmet.constant;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/1/19 9:43
*/
public interface ThirdConstant {
/**
* 小程序
*/
String MINI = "mini";
/**
* 第三方app
*/
String APP = "app";
}

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java

@ -48,6 +48,11 @@ public class PaCustomerDTO implements Serializable {
*/
private Integer isInitialize;
/**
* 客户类型 mini 微信小程序客户 app 第三方app客户
*/
private String type;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java

@ -6,6 +6,8 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerMpDTO;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.*;
@ -35,6 +37,12 @@ public class PaCustomerController {
@Autowired
private CustomerMpService customerMpService;
@GetMapping("{id}")
public Result<PaCustomerDTO> get(@PathVariable("id") String id){
PaCustomerDTO data = paCustomerService.get(id);
return new Result<PaCustomerDTO>().ok(data);
}
/**
* @param formDTO
* @return

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java

@ -48,6 +48,11 @@ public class PaCustomerEntity extends BaseEpmetEntity {
*/
private Integer isInitialize;
/**
* 客户类型 mini 微信小程序客户 app 第三方app客户
*/
private String type;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/

3
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.12__alter_pa_customer.sql

@ -0,0 +1,3 @@
ALTER TABLE `pa_customer`
ADD COLUMN `TYPE` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'mini'
COMMENT '客户类型 mini 微信小程序客户 app 第三方app客户' AFTER `IS_INITIALIZE`;

17
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.constant.ThirdConstant;
import com.epmet.constant.UserWorkType;
import com.epmet.dao.CustomerDao;
import com.epmet.dto.*;
@ -520,13 +521,15 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
throw new RenException(customerResult.getCode(), customerResult.getInternalMsg());
}
//7.设置服务器域名,业务域名
String domainUrl = "https://epmet-cloud.elinkservice.cn/api/third/code/setdomain/" + formDTO.getCustomerId();
String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, null).getData();
JSONObject domainObject = JSON.parseObject(domainData);
Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class);
if (!domainResult.success()) {
throw new RenException(domainResult.getCode(), domainResult.getInternalMsg());
//7.为微信小程序客户设置服务器域名,业务域名
if (ThirdConstant.MINI.equals(paCustomer.getType())) {
String domainUrl = "https://epmet-cloud.elinkservice.cn/api/third/code/setdomain/" + formDTO.getCustomerId();
String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, null).getData();
JSONObject domainObject = JSON.parseObject(domainData);
Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class);
if (!domainResult.success()) {
throw new RenException(domainResult.getCode(), domainResult.getInternalMsg());
}
}
}

Loading…
Cancel
Save