Browse Source

Merge branch 'dev_bugfix_point_rank_page' into dev_temp

# Conflicts:
#	epmet-commons/pom.xml
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
master
wangchao 5 years ago
parent
commit
90ef5171ad
  1. 6
      epmet-auth/pom.xml
  2. 15
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  3. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java
  4. 2
      epmet-commons/pom.xml
  5. 9
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  6. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  7. 8
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java
  8. 6
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java
  9. 1
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java
  10. 7
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml
  11. 5
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml
  12. 12
      epmet-module/oper-crm/oper-crm-server/pom.xml
  13. 21
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  14. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

6
epmet-auth/pom.xml

@ -341,9 +341,9 @@
</dingTalk.robot.secret>
<!--第三方平台,酒城e通-->
<!--<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret>-->
<thirdplat.jcet.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>2cy0a9lA</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.appsecret>
</properties>
</profile>
</profiles>

15
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java

@ -11,6 +11,8 @@ import com.epmet.commons.thirdplat.properties.JcetThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
@ -18,6 +20,8 @@ import java.util.Map;
public class JcetApiService extends AbstractApiService {
Logger logger = LoggerFactory.getLogger(getClass());
private JcetThirdplatProps jcetThirdplatProps;
public JcetApiService(ThirdplatProps props) {
@ -32,6 +36,10 @@ public class JcetApiService extends AbstractApiService {
* @date 2021.01.19 10:26
*/
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket(ticket);
@ -42,6 +50,13 @@ public class JcetApiService extends AbstractApiService {
JSON.toJSONString(ssoTicket),
getHeaders(ssoTicket));
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
} catch (Exception e) {
//e.printStackTrace();
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java

@ -7,7 +7,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.EventClassDto;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.enums.MqMethodPathEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ValidateException;
@ -32,7 +31,7 @@ public class SendMqMsgUtils {
private static MqConfig mqConfig;
/**
* desc:发送mq消息
* desc:发送mq消息(如果失败重试1次)
*
* @return
*/
@ -40,7 +39,7 @@ public class SendMqMsgUtils {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
log.debug("sendMsg param:{}", JSON.toJSONString(msg));
log.info("sendMsg param:{}", JSON.toJSONString(msg));
try {
// TODO
ValidatorUtils.validateEntity(msg, DefaultGroup.class);
@ -51,8 +50,14 @@ public class SendMqMsgUtils {
msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqConfig.getToken());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.debug("sendMsg result:{}", JSON.toJSONString(result));
int retryTime = 0;
Result<String> result = null;
do {
retryTime++;
result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.info("sendMsg retryTime:{},result:{}", retryTime, JSON.toJSONString(result));
} while ((!result.success()) && retryTime < 2);
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
@ -68,7 +73,7 @@ public class SendMqMsgUtils {
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
log.error("sendMsg exception", e);
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
@ -90,7 +95,7 @@ public class SendMqMsgUtils {
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param));
log.debug("getEventClassList result:{}", JSON.toJSONString(result));
log.info("getEventClassList result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
@ -106,7 +111,7 @@ public class SendMqMsgUtils {
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
log.error("sendMsg exception", e);
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}

2
epmet-commons/pom.xml

@ -23,8 +23,8 @@
<module>epmet-commons-tools-wx-mp</module>
<module>epmet-commons-service-call</module>
<module>epmet-commons-extapp-auth</module>
<module>epmet-commons-rocketmq</module>
<module>epmet-commons-thirdplat</module>
<module>epmet-commons-rocketmq</module>
</modules>
</project>

9
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -7,6 +7,7 @@ import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
@ -227,4 +228,12 @@ public interface DataStatisticalOpenFeignClient {
**/
@PostMapping("/data/stats/screenextract/extractmonthlyall")
Result extractMonthlyAll(ExtractScreenFormDTO extractScreenFormDTO);
/**
* @Description 新客户初始化评价指标 权重
* @author sun
*/
@PostMapping(value = "/data/stats/indexdict/initCustomerIndex")
Result<Boolean> initCustomerIndex(@RequestBody InitCustomerIndexForm formDTO);
}

6
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -8,6 +8,7 @@ import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.stereotype.Component;
@ -224,4 +225,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result extractMonthlyAll(ExtractScreenFormDTO extractScreenFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "screenExtractMonthly", extractScreenFormDTO);
}
@Override
public Result<Boolean> initCustomerIndex(InitCustomerIndexForm formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "initCustomerIndex", formDTO);
}
}

8
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java

@ -2,6 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.InitPointRuleResultDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.feign.fallback.EpmetPointOpenFeignClientFallback;
@ -26,4 +27,11 @@ public interface EpmetPointOpenFeignClient {
**/
@PostMapping("/point/resi/point/mypoint")
Result<ResiPointDetailResultDTO> myPoint(CommonUserFormDTO param);
/**
* @Description 新客户初始化积分规则
* @author sun
**/
@PostMapping("/point/opback/initpointrule")
Result<InitPointRuleResultDTO> initPointRule();
}

6
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java

@ -3,6 +3,7 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.InitPointRuleResultDTO;
import com.epmet.dto.form.CommonUserFormDTO;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.feign.EpmetPointOpenFeignClient;
@ -20,4 +21,9 @@ public class EpmetPointOpenFeignClientFallback implements EpmetPointOpenFeignCli
public Result<ResiPointDetailResultDTO> myPoint(CommonUserFormDTO param) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_POINT_SERVER, "myPoint",param);
}
@Override
public Result<InitPointRuleResultDTO> initPointRule() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_POINT_SERVER, "initPointRule");
}
}

1
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

@ -199,7 +199,6 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao
}
//将假分页结果替换到rankList
rankList = rankList.subList(fromIndex,toIndex);
}
List<String> userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList());

7
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml

@ -25,6 +25,8 @@
<!-- 查询客户下周/月度用户积分排行榜 传参:客户Id | 维度 | 维度值 -->
<!-- user_point_statistical_daily中的action_flag有三种key值,plus(获取),exchange(积分兑换),minus(调整、惩罚),当action_flag为minus时,point_change为负值,其余均为正数 -->
<select id="selectPointRankWithinTimeZone" resultType="com.epmet.dto.result.ResiPointRankResultDTO">
select * from (
SELECT IF ( @point > point.TOTAL_POINT,
@rank := @rank + 1,
@rank := @rank + 0
@ -38,7 +40,8 @@
total.USER_ID,
IF
( IFNULL( SUM( daily.POINT_CHANGE ), 0 ) <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS TOTAL_POINT
( IFNULL( SUM( daily.POINT_CHANGE ), 0 ) <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS
TOTAL_POINT
FROM
user_point_total total
LEFT JOIN user_point_statistical_daily daily ON daily.USER_ID = total.USER_ID
@ -61,6 +64,8 @@
TOTAL_POINT DESC
) point,
( SELECT @point := NULL, @rank := 1 ) a
) temp
</select>
<!-- 查询有无指定日期的积分日统计 userId dateId actionFlag-->

5
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

@ -48,6 +48,9 @@
<!-- 查询客户下的用户积分排行,分页 传参:customerId -->
<select id="selectUserPointRank" resultType="com.epmet.dto.result.ResiPointRankResultDTO">
select * from (
SELECT
IF ( @point > point.total_point, @rank := @rank + 1, @rank := @rank + 0 ) AS rank,
point.user_id,
@ -57,6 +60,8 @@
FROM
( SELECT * FROM user_point_total WHERE CUSTOMER_ID = #{customerId} ORDER BY total_point DESC ) point,
( SELECT @point := NULL, @rank := 1 ) a
) temp
</select>
<!-- 根据userId查找是否存在数据 -->

12
epmet-module/oper-crm/oper-crm-server/pom.xml

@ -99,6 +99,18 @@
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-point-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>data-statistical-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -40,6 +40,7 @@ import com.epmet.dao.CustomerDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.entity.CustomerEntity;
import com.epmet.feign.*;
import com.epmet.redis.CustomerRedis;
@ -85,6 +86,10 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private EpmetPointOpenFeignClient epmetPointOpenFeignClient;
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public PageData<CustomerDTO> page(Map<String, Object> params) {
@ -550,6 +555,22 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
}
}
//2021.1.25 sun 新增初始化客户积分规则和评价指标权重 start
//8.客户初始化已有的积分规则
Result<InitPointRuleResultDTO> resultPoint = epmetPointOpenFeignClient.initPointRule();
if (!resultPoint.success()) {
throw new RenException(resultPoint.getCode(), resultPoint.getInternalMsg());
}
//9.新客户初始化评价指标 权重
InitCustomerIndexForm indexForm = new InitCustomerIndexForm();
indexForm.setCustomerId(formDTO.getCustomerId());
Result<Boolean> resultData = dataStatisticalOpenFeignClient.initCustomerIndex(indexForm);
if (!resultData.success()) {
throw new RenException(resultData.getCode(), resultData.getInternalMsg());
}
//2021.1.25 end
}
private InitCustomerMQMsg.InitCustomerStaff constructStaffInfo4CustomerInit(String agencyId, PaUserDTO paUser) {

8
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -333,12 +333,12 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
}
@Override
public Result initGovStaffRolesForCustomer(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId);
public Result<UserDTO> saveUserInfo(UserInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInfo", formDTO);
}
@Override
public Result<UserDTO> saveUserInfo(UserInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInfo", formDTO);
public Result initGovStaffRolesForCustomer(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId);
}
}

Loading…
Cancel
Save