Browse Source

Merge remote-tracking branch 'origin/dev' into release

dev_shibei_match
zxc 5 years ago
parent
commit
66d1bd9fa0
  1. 45
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/InitPointRuleResultDTO.java
  2. 11
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java
  3. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml
  4. 8
      epmet-module/epmet-point/epmet-point-server/pom.xml
  5. 27
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java
  6. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java
  7. 33
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDefaultDao.java
  8. 97
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java
  9. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java
  10. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java
  11. 40
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  12. 64
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  13. 5
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java
  14. 41
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/RuleCycleEnum.java
  15. 4
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql
  16. 5
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml
  17. 27
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDefaultDao.xml
  18. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  19. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  20. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java
  21. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  22. 9
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  23. 5
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  24. 2
      epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
  25. 2
      epmet-module/oper-crm/oper-crm-server/pom.xml
  26. 9
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  27. 7
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
  28. 5
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
  29. 6
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  30. 8
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml

45
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/InitPointRuleResultDTO.java

@ -0,0 +1,45 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 初始化客户规则
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Data
public class InitPointRuleResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户总数
*/
private Integer customerTotal;
/**
* 已经初始化总数
*/
private Integer initedTotal;
}

11
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java

@ -53,7 +53,7 @@ public class PointRuleFormDTO implements Serializable {
@NotBlank(message = "是否开启不能为空", groups = {UpdateGroup.class})
private String enabledFlag;
/**
* 是否启用
* 积分上限不能为空
*/
@NotNull(message = "积分上限不能为空", groups = {UpdateGroup.class})
private Integer upLimit;
@ -62,6 +62,15 @@ public class PointRuleFormDTO implements Serializable {
* 积分上限描述
*/
private String upLimitDesc;
/**
* 积分上限前缀
*/
private String upLimitPrefix;
/**
* 上限积分计算周期
*/
private String rulePeriod;
//=======系统添加时的属性======
/**

2
epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-point-server:
container_name: epmet-point-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.23
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.25
ports:
- "8112:8112"
network_mode: host # 使用现有网络

8
epmet-module/epmet-point/epmet-point-server/pom.xml

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.23</version>
<version>0.0.25</version>
<parent>
<artifactId>epmet-point</artifactId>
<groupId>com.epmet</groupId>
@ -81,6 +81,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

27
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java

@ -5,6 +5,7 @@ import com.epmet.common.enu.PointUnitEnum;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.dto.InitPointRuleResultDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.service.PointRuleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author jianjun liu
* @date 2020-06-04 20:39
@ -24,18 +27,32 @@ public class BackDoorController {
private PointRuleService pointRuleService;
/**
* desc:添加规则
* desc:批量添加规则
*
* @param formDTO
* @param list
* @return
*/
@PostMapping(value = "addpointrule")
public Result<Boolean> add(@RequestBody PointRuleFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
pointRuleService.add(null, formDTO);
public Result<Boolean> add(@RequestBody List<PointRuleFormDTO> list) {
for (PointRuleFormDTO formDTO:list){
ValidatorUtils.validateEntity(list, AddGroup.class);
pointRuleService.add(null, formDTO);
}
return new Result<Boolean>().ok(true);
}
/**
* desc:批量添加规则
*
* @param list
* @return
*/
@PostMapping(value = "initpointrule")
public Result<InitPointRuleResultDTO> initPointRule() {
InitPointRuleResultDTO resultDTO = pointRuleService.initPointRule();
return new Result<InitPointRuleResultDTO>().ok(resultDTO);
}
public static void main(String[] args) {
PointRuleFormDTO formDTO = new PointRuleFormDTO();
formDTO.setPoint(0);

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java

@ -22,7 +22,6 @@ import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.entity.PointRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@ -54,4 +53,7 @@ public interface PointRuleDao extends BaseDao<PointRuleEntity> {
int updateByCustomerId(PointRuleEntity entity);
PointRuleEntity selectByEventCodeAndCustomerId(@Param("customerId") String customerId, @Param("eventCode") String eventCode);
List<String> selectCustomerIds();
}

33
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDefaultDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.PointRuleDefaultEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 积分规则表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Mapper
public interface PointRuleDefaultDao extends BaseDao<PointRuleDefaultEntity> {
}

97
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java

@ -0,0 +1,97 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 积分规则表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("point_rule_default")
public class PointRuleDefaultEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 规则名称 与事件名称保持一致即可
*/
private String ruleName;
/**
* 规则说明 事件说明
*/
private String ruleDesc;
/**
* 事件CODE 来自事件表
*/
private String eventCode;
/**
* 功能分组Id
*/
private String functionId;
/**
* 操作类型 加积分:add;减积分:subtract
*/
private String operateType;
/**
* 积分上限
*/
private Integer upLimit;
/**
* 积分上限描述
*/
private String upLimitDesc;
/**
* 积分示例中 积分上限前缀
*/
private String upLimitPrefix;
/**
* 上限积分计算周期不限unlimit首次firstdayweekmonthyear
*/
private String rulePeriod;
/**
* 获得积分值
*/
private Integer point;
/**
* 获得积分单位 time分钟minute小时hour
*/
private String pointUnit;
/**
* 是否启用 0-1-
*/
private String enabledFlag;
}

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java

@ -116,6 +116,8 @@ public class PointRuleEntity extends BaseEpmetEntity {
Objects.equals(operateType, entity.operateType) &&
Objects.equals(upLimit, entity.upLimit) &&
Objects.equals(upLimitDesc, entity.upLimitDesc) &&
Objects.equals(upLimitPrefix, entity.upLimitPrefix) &&
Objects.equals(rulePeriod, entity.rulePeriod) &&
Objects.equals(point, entity.point) &&
Objects.equals(pointUnit, entity.pointUnit) &&
Objects.equals(enabledFlag, entity.enabledFlag);
@ -123,6 +125,6 @@ public class PointRuleEntity extends BaseEpmetEntity {
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, functionId, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag);
return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, functionId, operateType, upLimit, upLimitDesc, upLimitPrefix, rulePeriod, point, pointUnit, enabledFlag);
}
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.InitPointRuleResultDTO;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
@ -66,4 +67,6 @@ public interface PointRuleService extends BaseService<PointRuleEntity> {
* @date 2020.07.31 14:54
**/
PointRuleEntity getByEventCodeAndCustomerId(String customerId,String eventCode);
InitPointRuleResultDTO initPointRule();
}

40
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -30,8 +30,11 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointRuleDao;
import com.epmet.dao.PointRuleDefaultDao;
import com.epmet.dao.RuleOperateLogDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.InitPointRuleResultDTO;
import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
@ -40,9 +43,11 @@ import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.entity.PointRuleDefaultEntity;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.RuleOperateLogEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.PointRuleService;
import lombok.extern.slf4j.Slf4j;
@ -71,6 +76,10 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private RuleOperateLogDao ruleOperateLogDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private PointRuleDefaultDao pointRuleDefaultDao;
@Override
public List<CustomerFunctionResultDTO> getFunctionList(String customerId) {
@ -171,16 +180,43 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
}
/**
* @Description 根据evetCode和客户Id查找积分规则详情
* @param customerId
* @param eventCode
* @return
* @Description 根据evetCode和客户Id查找积分规则详情
* @author wangc
* @date 2020.07.31 14:54
**/
@Override
public PointRuleEntity getByEventCodeAndCustomerId(String customerId, String eventCode) {
return baseDao.selectByEventCodeAndCustomerId(customerId,eventCode);
return baseDao.selectByEventCodeAndCustomerId(customerId, eventCode);
}
@Override
public InitPointRuleResultDTO initPointRule() {
Result<List<CustomerDTO>> customerListResult = operCrmOpenFeignClient.getAllCustomerList();
if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) {
log.error("获取所有客户列表失败");
}
List<CustomerDTO> customerDTOList = customerListResult.getData();
List<PointRuleDefaultEntity> ruleDefaultEntities = pointRuleDefaultDao.selectList(null);
List<String> haveInitCustomerIds = baseDao.selectCustomerIds();
List<PointRuleEntity> insertList = new ArrayList<>();
ruleDefaultEntities.forEach(defaultRule -> {
for (CustomerDTO customerDTO : customerDTOList) {
if (haveInitCustomerIds.contains(customerDTO.getId())) {
continue;
}
PointRuleEntity entity = ConvertUtils.sourceToTarget(defaultRule, PointRuleEntity.class);
entity.setCustomerId(customerDTO.getId());
insertList.add(entity);
}
});
this.insertBatch(insertList, 100);
InitPointRuleResultDTO result = new InitPointRuleResultDTO();
result.setCustomerTotal(customerDTOList.size());
result.setInitedTotal(insertList.size());
return result;
}
private void insertOperateRecord(TokenDto tokenDTO, PointRuleEntity entityNew, PointRuleEntity entityDB, String opType) {

64
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -28,6 +28,7 @@ import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.UserPointActionLogDTO;
@ -43,6 +44,7 @@ import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.epmet.utils.RuleCycleEnum;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;
import dto.form.SendPointFormDTO;
@ -55,6 +57,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -193,23 +196,57 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
PointRuleEntity ruleInfo = pointRuleService.getByEventCodeAndCustomerId(event.getCustomerId(),eventCode);
if(null != ruleInfo && StringUtils.equals(NumConstant.ONE_STR,ruleInfo.getEnabledFlag())){
Date dateCheck = null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
//先判断周期,是否超过限值
RuleCycleEnum cycle = RuleCycleEnum.getEnum(ruleInfo.getRulePeriod());
switch(cycle){
//当周期为首次或无限制时,不需要传时间参数
// case UNLIMITED:
// break;
// case FIRST:
// break;
case DAILY:
//今天零点
dateCheck = calendar.getTime();
break;
case WEEKLY:
//本周第一天零点
calendar.add(Calendar.WEEK_OF_MONTH, 0);
calendar.set(Calendar.DAY_OF_WEEK, 2);
dateCheck = calendar.getTime();
break;
case MONTHLY:
//本月第一天零点
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
dateCheck = calendar.getTime();
break;
case YEARLY:
//本年第一天零点
int dayOfYear = Calendar.getInstance().get(Calendar.DAY_OF_YEAR);
calendar.add(Calendar.DAY_OF_YEAR, -dayOfYear + 1);
dateCheck = calendar.getTime();
break;
default:
}
//判断积分规则的积分单位 次、天、分钟、小时
if(StringUtils.equals(ModuleConstant.POINT_UNIT_TIME,ruleInfo.getPointUnit())){
//次
}else if(StringUtils.equals(ModuleConstant.POINT_UNIT_DAY,ruleInfo.getPointUnit())){
//天
//在selectSumByEvent时要校验时间区间
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
dateCheck = calendar.getTime();
}else{
if(!StringUtils.equals(ModuleConstant.POINT_UNIT_TIME,ruleInfo.getPointUnit()) && !StringUtils.equals(ModuleConstant.POINT_UNIT_DAY,ruleInfo.getPointUnit())){
//其余积分单位
//TODO..
logger.warn(String.format("当前规则属于按%s计分,系统尚不支持响应此类积分规则的事件"),ruleInfo.getPointUnit());
return ;
}
//校验是否达到上限
if(ruleInfo.getUpLimit() > NumConstant.ZERO){
//不按照sourceId查询,查询指定日期内的相关积分规则的总和
@ -325,7 +362,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
action.setPoint(grantPoint.getPoint());
action.setEventStatement(grantPoint.getRemark());
action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc());
action.setEventId(EventEnum.ACTIVE_INSERT_LIVE.getEventTag());
action.setEventId(ModuleConstant.COMMON_EVENT_ID);
action.setActionFlag(grantPoint.getActionFlag());
action.setUserId(grantPoint.getUserId());
action.setCreatedBy(grantPoint.getOperatorId());
@ -355,4 +392,5 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
userPointTotalService.insertOrUpdate(point);
}
}

5
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -120,4 +120,9 @@ public interface ModuleConstant extends Constant {
String EVENT_NAME_PARTICIPATED_ACT = "参与活动";
String EVENT_NAME_ADD_LIVE = "添加活动实况";
/**
* 通用事件不走规则但也是事件所以在用户积分行为记录表中的eventId中要有值与积分调整积分兑换分开
* */
String COMMON_EVENT_ID = "COMMON";
}

41
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/RuleCycleEnum.java

@ -0,0 +1,41 @@
package com.epmet.utils;
/**
* 系统支持的规则周期枚举类
*
* @author wangc
* @date 2020-07-03 11:14
**/
public enum RuleCycleEnum {
UNLIMITED("unlimit","不限制"),
FIRST("first","首次"),
DAILY("day","每日"),
WEEKLY("week","每周"),
MONTHLY("month","每月"),
YEARLY("year","每年")
;
private String key;
private String desc;
RuleCycleEnum(String key,String desc){
this.key = key;
this.desc = desc;
}
public static RuleCycleEnum getEnum(String key){
RuleCycleEnum[] values = RuleCycleEnum.values();
for (RuleCycleEnum value : values) {
if (null != key && value.getKey().equals(key)) {
return value;
}
}
return null;
}
public String getKey(){ return key;}
public String getValue(){ return desc;}
}

4
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql

@ -40,5 +40,5 @@ CREATE TABLE rule_operate_log(
PRIMARY KEY (ID)
) COMMENT = '积分规则操作记录表';
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', '3ef7e4bb195eb9e622d68b52509aa940', '注册志愿者', '首次注册志愿者获得积分 ', 'register_volunteer', '43addd0735230c01eedbb38d721076b0', 'plus', 0, '', '', 7, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', '3ef7e4bb195eb9e622d68b52509aa940', '添加实况', '添加活动实况获得积分', 'active_insert_live', '43addd0735230c01eedbb38d721076b0', 'plus', 30, '每日该项所得积分总和上限,为0时表示没有积分上限', '每日获得积分上限', 20, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', '3ef7e4bb195eb9e622d68b52509aa940', '注册志愿者', '首次注册志愿者获得积分 ', 'register_volunteer', '43addd0735230c01eedbb38d721076b0', 'plus', 0, '', '', 'first', 7, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', '3ef7e4bb195eb9e622d68b52509aa940', '添加实况', '添加活动实况获得积分', 'active_insert_live', '43addd0735230c01eedbb38d721076b0', 'plus', 30, '每日该项所得积分总和上限,为0时表示没有积分上限', '每日获得积分上限', 'day', 20, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');

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

@ -40,11 +40,14 @@
</update>
<select id="selectByEventCodeAndCustomerId" resultType="com.epmet.entity.PointRuleEntity">
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG,UP_LIMIT,OPERATE_TYPE
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG,UP_LIMIT,OPERATE_TYPE,RULE_PERIOD
FROM point_rule
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND EVENT_CODE = #{eventCode,jdbcType=VARCHAR}
</select>
<select id="selectCustomerIds" resultType="java.lang.String">
SELECT DISTINCT CUSTOMER_ID FROM point_rule WHERE DEL_FLAG = '0'
</select>
</mapper>

27
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDefaultDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.PointRuleDefaultDao">
<resultMap type="com.epmet.entity.PointRuleDefaultEntity" id="pointRuleMap">
<result property="id" column="ID"/>
<result property="ruleName" column="RULE_NAME"/>
<result property="ruleDesc" column="RULE_DESC"/>
<result property="eventCode" column="EVENT_CODE"/>
<result property="operateType" column="OPERATE_TYPE"/>
<result property="upLimit" column="UP_LIMIT"/>
<result property="upLimitDesc" column="UP_LIMIT_DESC"/>
<result property="upLimitPrefix" column="UP_LIMIT_PREFIX"/>
<result property="rulePeriod" column="RULE_PERIOD"/>
<result property="point" column="POINT"/>
<result property="pointUnit" column="POINT_UNIT"/>
<result property="enabledFlag" column="ENABLED_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

2
epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.99
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.100
ports:
- "8110:8110"
network_mode: host # 使用现有网络

2
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.99</version>
<version>0.0.100</version>
<parent>
<groupId>com.epmet</groupId>

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java

@ -82,4 +82,8 @@ public interface PaConstant {
* 更新客户Id信息失败
*/
String UPDATE_CUSTOMER_EXCEPTION = "更新客户Id信息失败";
/**
* 更新客户初始化状态失败
*/
String UPDATE_ISINITIALIZE_EXCEPTION = "更新客户初始化状态失败";
}

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java

@ -90,6 +90,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
private CustomerMpService customerMpService;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private PaCustomerDao paCustomerDao;
@Override
public PageData<PaCustomerDTO> page(Map<String, Object> params) {
@ -533,6 +535,15 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
throw new RenException(PaConstant.UPDATE_CUSTOMER_EXCEPTION);
}
//5.修改pa_customer表初始化状态
PaCustomerDTO paCustomer = new PaCustomerDTO();
paCustomer.setIsInitialize(NumConstant.ONE);
paCustomer.setId(formDTO.getNewCustomerId());
if (paCustomerDao.updateCustomerById(paCustomer) < NumConstant.ONE){
logger.error(String.format("修改pa_customer表初始化状态失败,待修改初始化状态的客户Id为->%s", paCustomer.getId()));
throw new RenException(PaConstant.UPDATE_ISINITIALIZE_EXCEPTION);
}
}
}

9
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java

@ -53,4 +53,13 @@ public interface OperCrmOpenFeignClient {
*/
@PostMapping("/oper/crm/customer/addmanager")
Result addManager(@RequestBody CustomerManagerFormDTO form);
/**
* 获取客户李彪
* @author zhaoqifeng
* @date 2020/8/3 15:24
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/oper/crm/customer/getalllist")
Result<List<CustomerDTO>> getAllCustomerList();
}

5
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java

@ -45,4 +45,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result addManager(CustomerManagerFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "CustomerManagerFormDTO", form);
}
@Override
public Result<List<CustomerDTO>> getAllCustomerList() {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllCustomerList", null);
}
}

2
epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
oper-crm-server:
container_name: oper-crm-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.59
image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.60
ports:
- "8090:8090"
network_mode: host # 使用现有网络

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

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.59</version>
<version>0.3.60</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>oper-crm</artifactId>

9
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java

@ -247,4 +247,13 @@ public class CustomerController {
return new Result();
}
/**
* desc:获取所有未删除的客户
* @return
*/
@PostMapping("getalllist")
public Result<List<CustomerDTO>> getAllList() {
return new Result<List<CustomerDTO>>().ok(customerService.getAllList());
}
}

7
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java

@ -67,4 +67,11 @@ public interface CustomerDao extends BaseDao<CustomerEntity> {
* @Description 查询有效客户数据(不区分是否在有效期内)按名称模糊查询
**/
List<CustomerResultDTO> selectCustomerList(@Param("customerName") String customerName);
/**
* desc获取未删除的所有用户
* @return
*/
List<CustomerEntity> getAllList();
}

5
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java

@ -169,4 +169,9 @@ public interface CustomerService extends BaseService<CustomerEntity> {
**/
void init(CustomerInitFormDTO formDTO);
/**
* desc获取所有客户列表
* @return
*/
List<CustomerDTO> getAllList();
}

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

@ -520,4 +520,10 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
}
@Override
public List<CustomerDTO> getAllList() {
List<CustomerEntity> list = baseDao.getAllList();
return ConvertUtils.sourceToTarget(list,CustomerDTO.class);
}
}

8
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml

@ -70,4 +70,12 @@
AND customer_name LIKE concat('%', trim(#{customerName}), '%')
</if>
</select>
<select id="getAllList" resultMap="customerMap">
SELECT
id,customer_name,title,organizationNumber,organizationImg,validityTime,customerAdmin,
organizationLevel,logo
FROM customer
WHERE
del_flag = '0'
</select>
</mapper>

Loading…
Cancel
Save