Commit fe6eb9fb by zhouhaibao

Merge branch 'v5.6.0' of http://192.168.3.233:8090/dj/rpc-dj-strategy into v5.6.0

# Conflicts:
#	rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/StrategyInfoService.java
2 parents 9d9e7fcb bad5ec52
...@@ -9,13 +9,13 @@ import java.math.BigDecimal; ...@@ -9,13 +9,13 @@ import java.math.BigDecimal;
@Data @Data
public class StaffSummaryDTO implements Serializable { public class StaffSummaryDTO implements Serializable {
@ApiModelProperty(value = "驻店时长") @ApiModelProperty(notes = "驻店时长")
private Integer stayDuration; private Integer stayDuration;
@ApiModelProperty(value = "学习时长") @ApiModelProperty(notes = "学习时长")
private BigDecimal studyDuration; private BigDecimal studyDuration;
@ApiModelProperty(value = "学习率") @ApiModelProperty(notes = "学习率")
private BigDecimal studyRate; private BigDecimal studyRate;
} }
...@@ -49,6 +49,15 @@ public class StrategyStaffRel implements Serializable { ...@@ -49,6 +49,15 @@ public class StrategyStaffRel implements Serializable {
private Integer userPosition; private Integer userPosition;
/** /**
* 北森人员id
*/
@ApiModelProperty(notes = "北森人员id")
@Column(name = "beisen_userid")
private Integer beisenUserId;
/**
* 创建人 * 创建人
*/ */
@Column(name = "created_by") @Column(name = "created_by")
......
...@@ -15,6 +15,15 @@ ...@@ -15,6 +15,15 @@
<packaging>war</packaging> <packaging>war</packaging>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.6.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.oreframework</groupId>
<artifactId>ore-jms</artifactId>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj.strategy</groupId> <groupId>cn.com.glsx.dj.strategy</groupId>
<artifactId>rpc-dj-strategy-api</artifactId> <artifactId>rpc-dj-strategy-api</artifactId>
<version>5.6.0-SNAPSHOT</version> <version>5.6.0-SNAPSHOT</version>
...@@ -55,6 +64,11 @@ ...@@ -55,6 +64,11 @@
<artifactId>rpc-dj-pe-analysis-api</artifactId> <artifactId>rpc-dj-pe-analysis-api</artifactId>
<version>5.6.1-SNAPSHOT</version> <version>5.6.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId>
<version>5.6.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.config; package cn.com.glsx.dj.strategy.config;
import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
import cn.com.glsx.dj.mindworkplate.remote.PadMessageBoxRemote;
import cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote; import cn.com.glsx.dj.peanalysis.remote.BusinessSceneAnalysisRemote;
import cn.com.glsx.dj.riskmanage.remote.LearningCenterCourseRemote; import cn.com.glsx.dj.riskmanage.remote.LearningCenterCourseRemote;
import cn.com.glsx.dj.smartcarlife.remote.MerchantGoodsInfoRemote; import cn.com.glsx.dj.smartcarlife.remote.MerchantGoodsInfoRemote;
...@@ -60,4 +62,16 @@ public class DubboConfig { ...@@ -60,4 +62,16 @@ public class DubboConfig {
return factory.builder(LearningCenterCourseRemote.class).check(check).timeout(timeout).build(); return factory.builder(LearningCenterCourseRemote.class).check(check).timeout(timeout).build();
} }
@Bean
public PadMessageBoxRemote padMessageBoxRemote() {
return factory.builder(PadMessageBoxRemote.class).check(check).timeout(timeout).build();
}
@Bean
public MonitoringRemote monitoringRemote() {
return factory.builder(MonitoringRemote.class).check(check).version("1.0.0").timeout(timeout).build();
}
} }
package cn.com.glsx.dj.strategy.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* Kafka主题配置
*/
@Data
@Component
public class KafkaTopicConfig {
/**
* 策略推送主题
*/
@Value("${kafka.topic.strategy-push-topic:STRATEGY_PUSH_TOPIC}")
private String strategyPushTopic;
/**
* 未完成策略主题
*/
@Value("${kafka.topic.unfinished-strategy-staff-topic:UNFINISHED_STRATEGY_STAFF_TOPIC}")
private String unfinishedStrategyStaffTopic;
}
\ No newline at end of file \ No newline at end of file
...@@ -13,17 +13,22 @@ import org.springframework.context.annotation.Configuration; ...@@ -13,17 +13,22 @@ import org.springframework.context.annotation.Configuration;
*/ */
@Configuration @Configuration
@RequiredArgsConstructor @RequiredArgsConstructor
public class MerchantDubboConfig { public class MerchantDubboConfig extends DubboConfig {
private final ReferenceBuilderFactory factory;
// @Bean
// public MerchantStaffRemote merchantStaffRemote() {
// return factory
// .builder(MerchantStaffRemote.class)
// .check(false)
// .timeout(30000)
// .build();
// }
@Bean @Bean
public MerchantStaffRemote merchantStaffRemote() { public MerchantStaffRemote merchantStaffRemote() {
return factory return factory.builder(MerchantStaffRemote.class).version("2.0.0").check(check).timeout(timeout).build();
.builder(MerchantStaffRemote.class)
.check(false)
.timeout(30000)
.build();
} }
} }
package cn.com.glsx.dj.strategy.job;
import cn.com.glsx.dj.strategy.service.StrategyInfoService;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Title: 策略下发定时任务
* @Description: 每分钟第32秒执行,查询符合条件的策略并推送MQ消息
* @Author
* @Date
**/
@Service
@Slf4j
@ElasticJobConf(name = "StrategyPushJob", cron = "32 * * * * ?", description = "策略下发定时任务", overwrite = false)
public class StrategyPushJob implements SimpleJob {
@Autowired
private StrategyInfoService strategyInfoService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("策略下发定时任务开始执行");
try {
// 查询符合条件的策略:执行策略类型(0-学习类,1-优秀录音分享类,3-任务型)并且下发标识是未推送并且时间等于start_date
List<Integer> strategyIds = strategyInfoService.queryStrategyIdsForPush();
for (Integer strategyId : strategyIds) {
try {
log.info("准备推送策略ID: {}", strategyId);
strategyInfoService.sendStrategyPushMessage(strategyId);
log.info("策略ID {} 推送消息发送成功", strategyId);
} catch (Exception e) {
log.error("策略ID {} 推送消息发送失败: {}", strategyId, e.getMessage(), e);
}
}
log.info("策略下发定时任务执行完成,共处理 {} 条策略", strategyIds.size());
} catch (Exception e) {
log.error("策略下发定时任务执行异常: {}", e.getMessage(), e);
}
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.job;
import cn.com.glsx.dj.strategy.service.StrategyInfoService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Title: 未完成策略任务定时查询任务
* @Description: 每分钟第32秒执行,查询未完成策略任务的策略-人员ID集合
* @Author
* @Date
**/
@Service
@Slf4j
@ElasticJobConf(name = "UnfinishedStrategyTaskJob", cron = "32 * * * * ?", description = "未完成策略任务定时查询任务", overwrite = false)
public class UnfinishedStrategyTaskJob implements SimpleJob {
@Autowired
private StrategyInfoService strategyInfoService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("未完成策略任务定时查询任务开始执行");
try {
// 查询未完成策略任务的策略-人员ID集合
List<Integer> unfinishedTasks = strategyInfoService.queryUnfinishedStrategyStaffList();
log.info("查询到未完成策略任务的策略-人员数量: {}", unfinishedTasks.size());
// 遍历处理未完成的任务
for (Integer task : unfinishedTasks) {
try {
strategyInfoService.sendUnfinishedStrategyStaffMessage(task);
} catch (Exception e) {
// TODO
}
}
log.info("未完成策略任务定时查询任务执行完成,共处理 {} 条记录", unfinishedTasks.size());
} catch (Exception e) {
log.error("未完成策略任务定时查询任务执行异常: {}", e.getMessage(), e);
}
}
}
\ No newline at end of file \ No newline at end of file
...@@ -69,4 +69,20 @@ public interface StrategyInfoMapper extends OreMapper<StrategyInfo> { ...@@ -69,4 +69,20 @@ public interface StrategyInfoMapper extends OreMapper<StrategyInfo> {
* @return cn.com.glsx.dj.strategy.dto.MerchantStrategyStatisticsRespDTO * @return cn.com.glsx.dj.strategy.dto.MerchantStrategyStatisticsRespDTO
*/ */
List<MerchantStrategyStatisticsRespDTO> findStrategyStatisticsGroupMerchantNo(MerchantStrategyStatisticsReqDTO request); List<MerchantStrategyStatisticsRespDTO> findStrategyStatisticsGroupMerchantNo(MerchantStrategyStatisticsReqDTO request);
/**
* 查询需要推送的策略ID列表
* 条件:执行策略类型(0-学习类,1-优秀录音分享类,3-任务型)并且下发标识是未推送并且时间等于start_date(精确到分钟)
* 注意:“3-任务型”策略只查询定时推送类
*
* @return 策略ID列表
*/
List<Integer> selectStrategyIdsForPush();
/**
* 查询未完成策略任务的策略-人员ID集合
*
* @return 未完成策略任务的策略-人员信息列表
*/
List<Integer> selectUnfinishedStrategyStaffList();
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.mqlistener;
import cn.com.glsx.dj.mindworkplate.enums.messagebox.ReminderTypeEnums;
import cn.com.glsx.dj.strategy.config.KafkaTopicConfig;
import cn.com.glsx.dj.strategy.model.StrategyStaffRel;
import cn.com.glsx.dj.strategy.service.StrategyInfoService;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.jms.kafka.consumer.KafkaConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 策略推送 kafka消息消费
* 监听策略推送消息,处理策略下发逻辑
*/
@Slf4j
@Component
public class StrategyPushConsumer extends KafkaConsumer {
@Autowired
private StrategyInfoService strategyInfoService;
public StrategyPushConsumer(@Autowired KafkaTopicConfig kafkaTopicConfig) {
super(kafkaTopicConfig.getStrategyPushTopic(), false);
}
@Override
public void processMessage(Object o) {
String message = new String(getMessage());
log.info("策略推送kafka消息消费,处理开始,msg:{}", message);
Integer strategyId;
try {
strategyId = Integer.parseInt(message);
} catch (NumberFormatException e) {
log.error("策略推送消息格式错误,无法解析策略ID: {}", message, e);
return;
}
List<StrategyStaffRel> strategyStaffRels = strategyInfoService.queryStrategyStaffRelList(strategyId);
for (StrategyStaffRel strategyStaffRel : strategyStaffRels) {
try {
strategyInfoService.processStrategyPushWithLock(strategyStaffRel, ReminderTypeEnums.FIRST_REMINDER.getCode());
} catch (Exception e) {
log.error("策略推送处理失败 strategyId:{}", strategyId, e);
}
}
log.info("策略推送kafka消息消费,处理结束,msg:{}", message);
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.mqlistener;
import cn.com.glsx.dj.mindworkplate.enums.messagebox.ReminderTypeEnums;
import cn.com.glsx.dj.strategy.model.StrategyStaffRel;
import cn.com.glsx.dj.strategy.service.StrategyInfoService;
import cn.com.glsx.dj.strategy.service.StrategyStaffRelService;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.jms.kafka.consumer.KafkaConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import cn.com.glsx.dj.strategy.config.KafkaTopicConfig;
import org.springframework.stereotype.Component;
/**
* 未完成策略任务 kafka消息消费
* 监听未完成策略任务消息,处理未完成策略提醒逻辑
*/
@Slf4j
@Component
public class UnfinishedStrategyStaffConsumer extends KafkaConsumer {
@Autowired
private StrategyInfoService strategyInfoService;
@Autowired
private StrategyStaffRelService strategyStaffRelService;
public UnfinishedStrategyStaffConsumer(@Autowired KafkaTopicConfig kafkaTopicConfig) {
super(kafkaTopicConfig.getUnfinishedStrategyStaffTopic(), false);
}
@Override
public void processMessage(Object o) {
String message = new String(getMessage());
log.info("未完成策略任务kafka消息消费,处理开始,msg:{}", message);
try {
Integer strategyStaffId = Integer.parseInt(message);
StrategyStaffRel strategyStaffRel = strategyStaffRelService.selectByPrimaryKey(strategyStaffId);
strategyInfoService.processStrategyPushWithLock(strategyStaffRel, ReminderTypeEnums.PROGRESS_REMINDER.getCode());
} catch (Exception e) {
log.error("处理未完成策略任务消息失败: {}", message, e);
}
log.info("未完成策略任务kafka消息消费,处理结束,msg:{}", message);
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.strategy.service; package cn.com.glsx.dj.strategy.service;
import cn.com.glsx.dj.mindworkplate.dto.ConversationBatchDTO;
import cn.com.glsx.dj.mindworkplate.model.warning.LearningEffectAnalysisRequest;
import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
import cn.com.glsx.dj.strategy.enums.StrategyTypeEnum; import cn.com.glsx.dj.strategy.enums.StrategyTypeEnum;
import cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper; import cn.com.glsx.dj.strategy.mapper.StrategyInfoMapper;
import cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper; import cn.com.glsx.dj.strategy.mapper.StrategyStaffMessageMapper;
import cn.com.glsx.dj.strategy.model.StrategyInfo; import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.model.StrategyRecordingRel;
import cn.com.glsx.dj.strategy.model.StrategyStaffMessage; import cn.com.glsx.dj.strategy.model.StrategyStaffMessage;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
public class StrategyStaffMessageService { public class StrategyStaffMessageService {
...@@ -20,6 +29,12 @@ public class StrategyStaffMessageService { ...@@ -20,6 +29,12 @@ public class StrategyStaffMessageService {
@Autowired @Autowired
private StrategyInfoMapper strategyInfoMapper; private StrategyInfoMapper strategyInfoMapper;
@Autowired
private MonitoringRemote monitoringRemote;
@Autowired
private StrategyRecordingRelService strategyRecordingRelService;
/** /**
* 根据消息盒子ID和手机号更新业务消息记录的已读状态 * 根据消息盒子ID和手机号更新业务消息记录的已读状态
* @param messageId 消息盒子ID * @param messageId 消息盒子ID
...@@ -56,6 +71,29 @@ public class StrategyStaffMessageService { ...@@ -56,6 +71,29 @@ public class StrategyStaffMessageService {
if (StrategyTypeEnum.TASK.equals(strategyInfo.getStrategyType())) { if (StrategyTypeEnum.TASK.equals(strategyInfo.getStrategyType())) {
return strategyInfo; return strategyInfo;
} else if (StrategyTypeEnum.EXCELLENT_RECORDING_SHARE.equals(strategyInfo.getStrategyType())) {
// 查询策略关联的全部录音
List<StrategyRecordingRel> strategyRecordingRels = strategyRecordingRelService.queryStrategyRecordingRelList(strategyId);
LearningEffectAnalysisRequest condition = new LearningEffectAnalysisRequest();
condition.setStaffPhone(staffMessage.getPhone());
condition.setRecordIdList(strategyRecordingRels.stream().map(StrategyRecordingRel::getRecordingId).collect(Collectors.toList()));
RpcPagination<LearningEffectAnalysisRequest> request = new RpcPagination<>();
request.setPageNum(1);
request.setPageSize(condition.getRecordIdList().size());
request.setCondition(condition);
RpcResponse<RpcPagination<ConversationBatchDTO>> recordPageListByCondition = monitoringRemote.getRecordPageListByCondition(request);
if (recordPageListByCondition.isSuccess()) {
return recordPageListByCondition.getResult().getList();
} else {
log.warn("查询录音详情失败,messageId:{}", messageId);
return null;
}
} else if (StrategyTypeEnum.LEARNING.equals(strategyInfo.getStrategyType())) {
return null;
} else { } else {
// 其他类型,返回null TODO 待实现 0-学习类,1-优秀录音分享类,剩余类型暂时无推送消息 // 其他类型,返回null TODO 待实现 0-学习类,1-优秀录音分享类,剩余类型暂时无推送消息
return null; return null;
......
...@@ -3,6 +3,13 @@ package cn.com.glsx.dj.strategy.service; ...@@ -3,6 +3,13 @@ package cn.com.glsx.dj.strategy.service;
import cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper; import cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper;
import cn.com.glsx.dj.strategy.model.StrategyInfo; import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.model.StrategyStaffRel; import cn.com.glsx.dj.strategy.model.StrategyStaffRel;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListRequestDTO;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListResonseDTO;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum; import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -11,9 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,9 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
@Service @Service
@Slf4j @Slf4j
...@@ -21,6 +27,9 @@ public class StrategyStaffRelService { ...@@ -21,6 +27,9 @@ public class StrategyStaffRelService {
@Autowired @Autowired
private StrategyStaffRelMapper strategyStaffRelMapper; private StrategyStaffRelMapper strategyStaffRelMapper;
@Autowired
private MerchantStaffRemote merchantStaffRemote;
/** /**
* 批量插入策略人员关联关系 * 批量插入策略人员关联关系
* @param strategyInfoList * @param strategyInfoList
...@@ -29,6 +38,14 @@ public class StrategyStaffRelService { ...@@ -29,6 +38,14 @@ public class StrategyStaffRelService {
*/ */
public int batchInsert(List<StrategyInfo> strategyInfoList, List<StrategyStaffRel> staffList) { public int batchInsert(List<StrategyInfo> strategyInfoList, List<StrategyStaffRel> staffList) {
if (CollectionUtils.isEmpty(staffList)) return 0; if (CollectionUtils.isEmpty(staffList)) return 0;
//根据手机号,查询北森人员userId
List<String> phoneList = staffList.stream().map(StrategyStaffRel::getUserPhone).collect(Collectors.toList());
List<BeiSenEmployeeListResonseDTO> employeeList = listEmployeeInfoByStaffPhone(phoneList);
Map<String, Integer> phoneUserIdMap = Collections.EMPTY_MAP;
if (CollectionUtils.isNotEmpty(employeeList)) {
//构建map
phoneUserIdMap = employeeList.stream().collect(Collectors.toMap(BeiSenEmployeeListResonseDTO::getMobilePhone, BeiSenEmployeeListResonseDTO::getUserID));
}
//构建对象,遍历2个对象创建新StrategyStaffRel //构建对象,遍历2个对象创建新StrategyStaffRel
List<StrategyStaffRel> all = new ArrayList<>(); List<StrategyStaffRel> all = new ArrayList<>();
for (StrategyInfo strategyInfo : strategyInfoList) { for (StrategyInfo strategyInfo : strategyInfoList) {
...@@ -42,6 +59,7 @@ public class StrategyStaffRelService { ...@@ -42,6 +59,7 @@ public class StrategyStaffRelService {
rel.setCreatedBy(strategyInfo.getCreatedBy()); rel.setCreatedBy(strategyInfo.getCreatedBy());
rel.setCreatedDate(strategyInfo.getCreatedDate()); rel.setCreatedDate(strategyInfo.getCreatedDate());
rel.setDeletedFlag(DeleteFlagEnum.N.getValue()); rel.setDeletedFlag(DeleteFlagEnum.N.getValue());
rel.setBeisenUserId(phoneUserIdMap.get(staff.getUserPhone()));
all.add(rel); all.add(rel);
} }
} }
...@@ -75,4 +93,25 @@ public class StrategyStaffRelService { ...@@ -75,4 +93,25 @@ public class StrategyStaffRelService {
.andEqualTo("deletedFlag", DeleteFlagEnum.N.getValue()); .andEqualTo("deletedFlag", DeleteFlagEnum.N.getValue());
return strategyStaffRelMapper.selectByExample(example); return strategyStaffRelMapper.selectByExample(example);
} }
public StrategyStaffRel selectByPrimaryKey(Integer strategyStaffId) {
return strategyStaffRelMapper.selectByPrimaryKey(strategyStaffId);
}
public List<BeiSenEmployeeListResonseDTO> listEmployeeInfoByStaffPhone(List<String> phoneList) {
RpcAssert.assertNotEmpty(phoneList, DefaultErrorEnum.PARAMETER_NULL, "员工手机号不能为空");
RpcPagination<BeiSenEmployeeListRequestDTO> pagination = new RpcPagination<>();
BeiSenEmployeeListRequestDTO condition = new BeiSenEmployeeListRequestDTO();
pagination.setCondition(condition);
pagination.setPageNum(1);
pagination.setPageSize(phoneList.size());
condition.setMobilePhoneList(phoneList);
RpcResponse<RpcPagination<BeiSenEmployeeListResonseDTO>> rpcRes = merchantStaffRemote.getBeisenUserWithConditions(pagination);
RpcPagination<BeiSenEmployeeListResonseDTO> result = rpcRes.getResult();
if (result == null || CollectionUtils.isEmpty(result.getList())) {
return null;
}
return result.getList();
}
} }
...@@ -154,4 +154,68 @@ ...@@ -154,4 +154,68 @@
</if> </if>
group by merchant_id order by strategyCount desc group by merchant_id order by strategyCount desc
</select> </select>
<select id="selectStrategyIdsForPush" resultType="java.lang.Integer">
SELECT id
FROM dj_car_life_strategy_info
WHERE deleted_flag = 'N'
AND push_flag = 0
AND DATE_FORMAT(start_date, '%Y-%m-%d %H:%i') = DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i')
AND (
strategy_type IN (0, 1)
OR (
strategy_type = 3
AND push_type = 0
)
)
</select>
<select id="selectUnfinishedStrategyStaffList" resultType="java.lang.Integer">
select
ssr.id
from dj_car_life_strategy_info si
INNER JOIN dj_car_life_strategy_staff_rel ssr ON CAST(si.id AS CHAR) = CAST(ssr.strategy_id AS CHAR)
INNER JOIN dj_car_life_strategy_course_rel scor ON CAST(ssr.strategy_id AS CHAR) = CAST(scor.strategy_id AS CHAR)
LEFT JOIN dj_beisen_course_staff bcs ON CAST(bcs.course_id AS CHAR) = CAST(scor.course_id AS CHAR) AND CAST(bcs.user_id AS CHAR) = CAST(ssr.beisen_userid AS CHAR)
where si.deleted_flag = 'N'
and si.push_flag = 1
and si.strategy_type = 0
and si.end_date is not null
and si.end_date >= now()
and (
TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 1440
or TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 720
or TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 360
)
AND ssr.deleted_flag = 'N'
AND scor.deleted_flag = 'N'
AND (
bcs.learn_status IS NULL
OR bcs.learn_status IN ('10', '20', '30', '40', '60')
)
group by ssr.id
union all
SELECT
ssr.id
FROM dj_car_life_strategy_info si
INNER JOIN dj_car_life_strategy_staff_rel ssr ON CAST(si.id AS CHAR) = CAST(ssr.strategy_id AS CHAR)
INNER JOIN dj_car_life_strategy_recording_rel srr ON CAST(si.id AS CHAR) = CAST(srr.strategy_id AS CHAR)
LEFT JOIN dj_car_life_learning_record l ON CAST(srr.recording_id AS CHAR) = CAST(l.recording_id AS CHAR) AND CAST(ssr.user_uuid AS CHAR) = CAST(l.user_uuid AS CHAR)
where si.deleted_flag = 'N'
and si.push_flag = 1
and si.strategy_type = 1
and si.end_date is not null
and si.end_date >= now()
and (
TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 1440
or TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 720
or TIMESTAMPDIFF(MINUTE, si.end_date, NOW()) = 360
)
AND ssr.deleted_flag = 'N'
AND srr.deleted_flag = 'N'
AND l.id IS NULL
group by ssr.id
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -61,9 +61,9 @@ public class StrategyInfoServiceTest extends BaseServiceTest { ...@@ -61,9 +61,9 @@ public class StrategyInfoServiceTest extends BaseServiceTest {
batchInsertStrategyInfo.setStrategyInfo(strategyInfo); batchInsertStrategyInfo.setStrategyInfo(strategyInfo);
List<StrategyStaffRel> staffList = new ArrayList<>(); List<StrategyStaffRel> staffList = new ArrayList<>();
StrategyStaffRel strategyStaffRel = new StrategyStaffRel(); StrategyStaffRel strategyStaffRel = new StrategyStaffRel();
strategyStaffRel.setUserUuid("c359e4838e2547aaa140d9a67ec0b165"); strategyStaffRel.setUserUuid("45b08bd283f441bcb3ebbf5048eab1a0");
strategyStaffRel.setUserName("狗蛋"); strategyStaffRel.setUserName("测试小胡");
strategyStaffRel.setUserPhone("13568974654"); strategyStaffRel.setUserPhone("15946151312");
strategyStaffRel.setUserPosition(9); strategyStaffRel.setUserPosition(9);
staffList.add(strategyStaffRel); staffList.add(strategyStaffRel);
batchInsertStrategyInfo.setStaffList(staffList); batchInsertStrategyInfo.setStaffList(staffList);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!