提交 eabe9622 作者: 沈振路

Merge branch 'customer_service_SZlu'

<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="80" name="Java" />
</Languages>
</inspection_tool>
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
......
package com.yaoyaozw.customer.constants;
import java.util.regex.Pattern;
/**
* @author darker
* @date 2022/9/20 14:54
......@@ -22,4 +25,10 @@ public class CrowdPackageCommonConstant {
public static final String GROUP_OR = "group_or";
public static final Integer STATIC_CONDITION = 1;
public static final Integer NUN_STATIC_CONDITION = 0;
public static final Pattern NUMBER_COMPILE = Pattern.compile("[\\d]");
}
......@@ -29,7 +29,7 @@ public class CrowdPackageController {
@ApiOperation("新增人群包")
@GetMapping("/insertPackage")
public GenericsResult<CrowdPackageCommonIdVO> insertCrowdPackage(@RequestParam Long id, @RequestParam String name) {
public GenericsResult<CrowdPackageCommonIdVO> insertCrowdPackage(@RequestParam(required = false) Long id, @RequestParam(required = false) String name) {
return crowdPackageService.insertCrowdPackage(id, name);
}
......
......@@ -15,6 +15,9 @@ import java.util.List;
@ApiModel("人群包条件保存实体")
public class CrowdPackageConditionDTO implements Serializable {
@ApiModelProperty("关联Id")
private Long matchId;
@ApiModelProperty("条件Id")
private Long conditionId;
......@@ -27,7 +30,7 @@ public class CrowdPackageConditionDTO implements Serializable {
@ApiModelProperty("设置的条件值")
private String conditionValue;
@ApiModelProperty("设置的条件值")
@ApiModelProperty("多选选项")
private List<String> multipleOptions;
}
package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch;
import org.springframework.stereotype.Repository;
......@@ -8,6 +9,7 @@ import org.springframework.stereotype.Repository;
* @author darker
* @date 2022/9/21 15:08
*/
@DS("material")
@Repository
public interface CrowdPackageConditionMatchMapper extends BaseMapper<CrowdPackageConditionMatch> {
public interface MaterialCrowdConditionMatchMapper extends BaseMapper<CrowdPackageConditionMatch> {
}
package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.entity.CrowdPackageCondition;
import org.springframework.stereotype.Repository;
......@@ -8,6 +9,7 @@ import org.springframework.stereotype.Repository;
* @author darker
* @date 2022/9/20 14:46
*/
@DS("material")
@Repository
public interface MaterialCrowdPackageConditionMapper extends BaseMapper<CrowdPackageCondition> {
}
package com.yaoyaozw.customer.schedules;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yaoyaozw.customer.constants.CrowdPackageCommonConstant;
import com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO;
import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import com.yaoyaozw.customer.service.CrowdPackageService;
import com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* @author darker
* @date 2022/9/23 10:18
*/
@Component
public class CrowdPackageSchedule {
private final static Logger LOCAL_LOG = LoggerFactory.getLogger(CrowdPackageSchedule.class);
@Autowired
private CrowdPackageService crowdPackageService;
@Autowired
private CrowdPackageConditionMatchService matchService;
/**
* 计算人群包用户人数
*/
// @Scheduled(cron = "0 0 10 * * ?")
public void calCrowdPackageHumanNum() {
LOCAL_LOG.info("获取人群包列表");
CrowdPackageQueryDTO crowdPackageQuery = new CrowdPackageQueryDTO();
List<CrowdPackageListVO> crowdPackageList = crowdPackageService.pageList(crowdPackageQuery).getData();
// 没有人群包
if (CollectionUtil.isEmpty(crowdPackageList)) {
LOCAL_LOG.info("未找到符合条件的人群包");
return;
}
LOCAL_LOG.info("共获得人群包 {} 条", crowdPackageList.size());
// 遍历人群包,依次处理
for (CrowdPackageListVO crowdPackageVo : crowdPackageList) {
LOCAL_LOG.info("当前处理人群包: 【{}】", crowdPackageVo.getPackageName());
// 获取人群包下的条件
List<CrowdPackageConditionMatch> packageConditionList = matchService.list(new QueryWrapper<CrowdPackageConditionMatch>().eq("package_id", crowdPackageVo.getId()));
LOCAL_LOG.info("共获取人群包下条件 {} 条", packageConditionList.size());
}
}
}
......@@ -2,7 +2,7 @@ package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch;
import com.yaoyaozw.customer.mapper.CrowdPackageConditionMatchMapper;
import com.yaoyaozw.customer.mapper.MaterialCrowdConditionMatchMapper;
import com.yaoyaozw.customer.service.CrowdPackageConditionMatchService;
import org.springframework.stereotype.Service;
......@@ -11,5 +11,5 @@ import org.springframework.stereotype.Service;
* @date 2022/9/21 15:09
*/
@Service
public class CrowdPackageConditionMatchServiceImpl extends ServiceImpl<CrowdPackageConditionMatchMapper, CrowdPackageConditionMatch> implements CrowdPackageConditionMatchService {
public class CrowdPackageConditionMatchServiceImpl extends ServiceImpl<MaterialCrowdConditionMatchMapper, CrowdPackageConditionMatch> implements CrowdPackageConditionMatchService {
}
package com.yaoyaozw.customer.vo.crowd;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author darker
* @date 2022/9/22 18:09
*/
@Data
@ApiModel("人群包条件匹配实体")
public class CrowdPackageConditionMatchVO implements Serializable {
/**
* 主键
*/
@ApiModelProperty("匹配主键")
private Long id;
/**
* 人群包ID
*/
@ApiModelProperty("人群包ID")
private Long packageId;
/**
* 条件表主键ID
*/
@ApiModelProperty("条件表主键ID")
private Long conditionId;
/**
* 条件描述
*/
@ApiModelProperty("条件描述")
private String operatorDescription;
public String getConditionId() {
if (ObjectUtil.isNull(this.conditionId)) {
return null;
}
return conditionId.toString();
}
}
......@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
......@@ -15,6 +16,7 @@ import java.util.List;
*/
@Data
@ApiModel("人群包详情页回显实体")
@NoArgsConstructor
public class CrowdPackageDetailVO implements Serializable {
@ApiModelProperty("人群包主键")
......@@ -25,6 +27,10 @@ public class CrowdPackageDetailVO implements Serializable {
private String packageName;
@ApiModelProperty("已配置的人群包条件")
private List<CrowdPackageConditionVO> conditionList;
private List<CrowdPackageConditionMatchVO> conditionList;
public CrowdPackageDetailVO(Long packageId, String packageName) {
this.packageId = packageId;
this.packageName = packageName;
}
}
......@@ -26,6 +26,9 @@ public class CrowdPackageListVO implements Serializable {
@ApiModelProperty("人群包中的人数")
private Integer numOfCrowdInPackage;
@ApiModelProperty("最后一次统计时间")
private Integer lastCountTime;
@ApiModelProperty("创建时间")
private String createTime;
......
......@@ -18,6 +18,7 @@
<select id="getPageList" resultType="com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO">
select
cpm.id, cpm.package_name as packageName,
cpm.crowd_num as numOfCrowdInPackage, cpm.last_count_time as lastCountTime,
cpm.create_time as createTime, cpm.modified_time as modifiedTime,
cau.nick_name as createUser, mau.nick_name as modifiedUser
from crowd_package_main cpm
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论