Commit 00ee072a by zhouhaibao

[+]新增预警管理,录音查询

1 parent 2cbd5ee5
...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.mindworkplate.model.warning; ...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.mindworkplate.model.warning;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
/** /**
...@@ -18,6 +19,7 @@ public class LearningEffectAnalysisRequest implements Serializable { ...@@ -18,6 +19,7 @@ public class LearningEffectAnalysisRequest implements Serializable {
* 14 -> 两周 * 14 -> 两周
* 30 -> 一月 * 30 -> 一月
*/ */
@NotNull
private Integer analysisPeriodDays; // 必填 private Integer analysisPeriodDays; // 必填
/** /**
...@@ -33,16 +35,19 @@ public class LearningEffectAnalysisRequest implements Serializable { ...@@ -33,16 +35,19 @@ public class LearningEffectAnalysisRequest implements Serializable {
/** /**
* 可选:开始日期(若不传,则自动计算为当前时间往前推 analysisPeriodDays) * 可选:开始日期(若不传,则自动计算为当前时间往前推 analysisPeriodDays)
*/ */
@NotNull
private String startDate; // 格式: yyyy-MM-dd private String startDate; // 格式: yyyy-MM-dd
/** /**
* 可选:结束日期 * 可选:结束日期
*/ */
@NotNull
private String endDate; // 格式: yyyy-MM-dd private String endDate; // 格式: yyyy-MM-dd
/** /**
* 业务类型:2.轻改(,3.权益,4.延保 * 业务类型:1.延保 2.轻改 3.权益
*/ */
@NotNull
private Integer businessType; private Integer businessType;
/** /**
......
...@@ -16,6 +16,7 @@ import cn.com.glsx.framework.core.annotation.ApiService; ...@@ -16,6 +16,7 @@ import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotNull;
@ApiService(value = "策略中心", owner = "zhouhb") @ApiService(value = "策略中心", owner = "zhouhb")
public interface MonitoringRemote { public interface MonitoringRemote {
...@@ -27,7 +28,7 @@ public interface MonitoringRemote { ...@@ -27,7 +28,7 @@ public interface MonitoringRemote {
@ApiMethod("查询所有预警类型") @ApiMethod("查询所有预警类型")
@ApiResponse("预警类型") @ApiResponse("预警类型")
RpcResponse<List<MonitorTypeDict>> findMonitorTypeDictList(); RpcResponse<List<MonitorTypeDict>> findMonitorTypeDictList(@NotNull Integer businessType);
@ApiMethod("查询预警") @ApiMethod("查询预警")
@ApiParam(name="request",notes="入参",dataType= DataTypeEnum.OBJECT,required=true) @ApiParam(name="request",notes="入参",dataType= DataTypeEnum.OBJECT,required=true)
......
...@@ -155,5 +155,11 @@ ...@@ -155,5 +155,11 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>cn.com.glsx.merchants</groupId>
<artifactId>platform-merchants-api</artifactId>
<version>5.6.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,7 @@ import cn.com.glsx.dj.beisen.remote.BeiSenDynamicRecordRemote; ...@@ -7,6 +7,7 @@ import cn.com.glsx.dj.beisen.remote.BeiSenDynamicRecordRemote;
import cn.com.glsx.dj.smartcarlife.remote.*; import cn.com.glsx.dj.smartcarlife.remote.*;
import cn.com.glsx.entmicro.remote.BatchMessagingRemote; import cn.com.glsx.entmicro.remote.BatchMessagingRemote;
import cn.com.glsx.entmicro.remote.EntmicroStaffRemote; import cn.com.glsx.entmicro.remote.EntmicroStaffRemote;
import cn.com.glsx.merchants.remote.MerchantRemote;
import cn.com.glsx.merchants.remote.MerchantStaffRemote; import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote; import cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote;
import cn.com.glsx.scrm.equity.remote.ServicePackageRemote; import cn.com.glsx.scrm.equity.remote.ServicePackageRemote;
...@@ -176,6 +177,10 @@ public class DubboConfig { ...@@ -176,6 +177,10 @@ public class DubboConfig {
public ContentManagerTaskRemote getContentManagerTaskRemote() { public ContentManagerTaskRemote getContentManagerTaskRemote() {
return factory.builder(ContentManagerTaskRemote.class).check(false).version("1.0.0").timeout(30000).build(); return factory.builder(ContentManagerTaskRemote.class).check(false).version("1.0.0").timeout(30000).build();
} }
@Bean
public MerchantRemote getMerchantRemote() {
return factory.builder(MerchantRemote.class).check(false).version("2.0.0").timeout(30000).build();
}
} }
...@@ -70,7 +70,7 @@ public interface ConversationBatchMapper extends OreMapper<ConversationBatch> { ...@@ -70,7 +70,7 @@ public interface ConversationBatchMapper extends OreMapper<ConversationBatch> {
void updatReviewFlag(@Param("batchId") Integer batchId); void updatReviewFlag(@Param("batchId") Integer batchId);
Page<ConversationBatchDTO> getRecordPageListByCondition(LearningEffectAnalysisRequest request); Page<ConversationBatchDTO> getRecordPageListByCondition(@Param("condition") LearningEffectAnalysisRequest request);
ConversationBatchDTO getRecordStaticByCondition(LearningEffectAnalysisRequest request); ConversationBatchDTO getRecordStaticByCondition(@Param("condition")LearningEffectAnalysisRequest request);
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,10 +3,13 @@ package cn.com.glsx.dj.mindworkplate.mapper; ...@@ -3,10 +3,13 @@ package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.MonitorTypeDict; import cn.com.glsx.dj.mindworkplate.model.MonitorTypeDict;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper @Mapper
public interface MonitorTypeDictMapper extends OreMapper<MonitorTypeDict> { public interface MonitorTypeDictMapper extends OreMapper<MonitorTypeDict> {
List<MonitorTypeDict> findMonitorTypeDictList(); List<MonitorTypeDict> findMonitorTypeDictList(@Param("bussinessType") Integer businessType);
List<Integer> findMerchantIdsByUUidAndType(@Param("uuid") String uuid,@Param("typeValue") byte typeValue);
} }
\ No newline at end of file \ No newline at end of file
...@@ -48,9 +48,9 @@ public class MonitoringRemoteImpl implements MonitoringRemote{ ...@@ -48,9 +48,9 @@ public class MonitoringRemoteImpl implements MonitoringRemote{
} }
@Override @Override
public RpcResponse<List<MonitorTypeDict>> findMonitorTypeDictList() { public RpcResponse<List<MonitorTypeDict>> findMonitorTypeDictList(Integer businessType) {
try { try {
return RpcResponse.success(monitoringService.findMonitorTypeDictList()); return RpcResponse.success(monitoringService.findMonitorTypeDictList(businessType));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return RpcResponse.error(e); return RpcResponse.error(e);
......
...@@ -516,8 +516,14 @@ public class ConversationBatchService { ...@@ -516,8 +516,14 @@ public class ConversationBatchService {
convertLearningEffectAnalysis(request.getCondition()); convertLearningEffectAnalysis(request.getCondition());
return conversationBatchMapper.getRecordPageListByCondition(request.getCondition()); Page<ConversationBatchDTO> recordPageListByCondition = conversationBatchMapper.getRecordPageListByCondition(
request.getCondition());
for (ConversationBatchDTO conversationBatchDTO : recordPageListByCondition){
conversationBatchDTO.setDuration(convertMillisecondsToHoursMinutesSeconds( conversationBatchDTO.getDuration() == null ? 0 : Long.parseLong(conversationBatchDTO.getDuration())));
} }
return recordPageListByCondition;
}
/** /**
* 转换学习效果分析的开始时间和结束时间 * 转换学习效果分析的开始时间和结束时间
...@@ -551,6 +557,10 @@ public class ConversationBatchService { ...@@ -551,6 +557,10 @@ public class ConversationBatchService {
*/ */
public ConversationBatchDTO getRecordStaticByCondition(LearningEffectAnalysisRequest request){ public ConversationBatchDTO getRecordStaticByCondition(LearningEffectAnalysisRequest request){
convertLearningEffectAnalysis(request); convertLearningEffectAnalysis(request);
return conversationBatchMapper.getRecordStaticByCondition(request); ConversationBatchDTO recordStaticByCondition = conversationBatchMapper.getRecordStaticByCondition(
request);
// 查询ai导师建议
//recordStaticByCondition.setAiTutorSuggest(inspectionDefenceService.getAiTutorSuggest(request));
return recordStaticByCondition;
} }
} }
...@@ -25,10 +25,20 @@ import cn.com.glsx.dj.mindworkplate.service.warning.DateService.QueryParams; ...@@ -25,10 +25,20 @@ import cn.com.glsx.dj.mindworkplate.service.warning.DateService.QueryParams;
import cn.com.glsx.dj.mindworkplate.service.warning.PrefixStrategy; import cn.com.glsx.dj.mindworkplate.service.warning.PrefixStrategy;
import cn.com.glsx.dj.mindworkplate.service.warning.PrefixType; import cn.com.glsx.dj.mindworkplate.service.warning.PrefixType;
import cn.com.glsx.dj.mindworkplate.service.warning.condition.RuleEvaluator; import cn.com.glsx.dj.mindworkplate.service.warning.condition.RuleEvaluator;
import cn.com.glsx.dj.smartcarlife.enums.DirectorTypeEnum;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.dto.merchant.CarBrandRequestDTO;
import cn.com.glsx.merchants.model.response.MerchantProvinceDTO;
import cn.com.glsx.merchants.model.response.MerchantSimpleResponse;
import cn.com.glsx.merchants.remote.MerchantRemote;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
...@@ -37,6 +47,7 @@ import java.util.concurrent.CompletableFuture; ...@@ -37,6 +47,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.persistence.criteria.CriteriaBuilder.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -81,10 +92,14 @@ public class MonitoringService { ...@@ -81,10 +92,14 @@ public class MonitoringService {
@Autowired @Autowired
private DateService dateService; private DateService dateService;
@Autowired
private MerchantRemote merchantRemote;
public List<StoreItemResponse> findMonitorListPage(MonitorFilterRequest request){ public List<StoreItemResponse> findMonitorListPage(MonitorFilterRequest request){
List<Integer> merchantIds = getSearchMerchantIds(request); List<Integer> merchantIds = getSearchMerchantIds(request);
request.setMerchantIds(merchantIds); request.setMerchantIds(merchantIds);
request.setBusinessType(convertToInternalBusinessType(request.getBusinessType()));
// 获取到盯店规则 // 获取到盯店规则
List<MonitoringMsgDTO> monitorListByCondition = getMonitorListByCondition(request); List<MonitoringMsgDTO> monitorListByCondition = getMonitorListByCondition(request);
...@@ -94,42 +109,29 @@ public class MonitoringService { ...@@ -94,42 +109,29 @@ public class MonitoringService {
// 转化成StoreItemResponse对象 // 转化成StoreItemResponse对象
Set<Integer> merchantList = warningsByMerchant.keySet(); Set<Integer> merchantList = warningsByMerchant.keySet();
Map<Integer, StoreItemResponse> merchantInfoMap = batchGetMerchantInfo(merchantList);
// 3. 转换为 StoreItemResponse 列表 // 3. 转换为 StoreItemResponse 列表
List<StoreItemResponse> storeResponses = warningsByMerchant.entrySet().stream() List<StoreItemResponse> storeResponses = warningsByMerchant.entrySet().stream()
.map(entry -> { .map(entry -> {
Integer merchantId = entry.getKey(); Integer merchantId = entry.getKey();
List<MonitoringMsgDTO> value = entry.getValue();
List<MonitoringMsgDTO> warnings = entry.getValue(); List<MonitoringMsgDTO> warnings = entry.getValue();
// 获取门店主数据(品牌、运营人员等) // 获取门店主数据(品牌、运营人员等)
StoreItemResponse info = merchantInfoMap.get(merchantId); StoreItemResponse info = new StoreItemResponse();
if (info == null) { info.setMerchantNo(merchantId+"");
// 可选:跳过或记录日志 info.setStoreName(value.get(0).getMerchantName4s());
return null;
}
StoreItemResponse resp = new StoreItemResponse();
resp.setStoreName(info.getStoreName());
resp.setMainBrands(info.getMainBrands());
// 线上运营 & 区域运营(假设已按当前业务过滤)
String onlineOps = String.join("/", info.getOnlineOperators());
String regionalOps = String.join("/", info.getRegionalOperators());
resp.setOnlineOperators(onlineOps);
resp.setRegionalOperators(regionalOps);
// 预警摘要:取前2条 // 预警摘要:取前2条
List<String> summary = warnings.stream() List<String> summary = warnings.stream()
.limit(2) .limit(2)
.map(MonitoringMsgDTO::getWarningText) .map(MonitoringMsgDTO::getWarningText)
.collect(Collectors.toList()); .collect(Collectors.toList());
resp.setWarningSummary(summary); info.setWarningSummary(summary);
// 预警总数 // 预警总数
resp.setWarningTotalCount(warnings.size()); info.setWarningTotalCount(warnings.size());
return resp; return info;
}) })
.filter(Objects::nonNull) // 过滤掉主数据缺失的门店 .filter(Objects::nonNull) // 过滤掉主数据缺失的门店
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -137,6 +139,7 @@ public class MonitoringService { ...@@ -137,6 +139,7 @@ public class MonitoringService {
} }
public List<MonitoringMsgDTO> getMonitorListByCondition(MonitorBaseRequest request) { public List<MonitoringMsgDTO> getMonitorListByCondition(MonitorBaseRequest request) {
request.setBusinessType(convertToInternalBusinessType(request.getBusinessType()));
List<Rule> rules = ruleMapper.selectByTypeAndMetricType(request.getBusinessType(),request.getMonitorType(),request.getMetricTypeId()); List<Rule> rules = ruleMapper.selectByTypeAndMetricType(request.getBusinessType(),request.getMonitorType(),request.getMetricTypeId());
if (CollectionUtils.isEmpty(rules)){ if (CollectionUtils.isEmpty(rules)){
return new ArrayList<>(); return new ArrayList<>();
...@@ -228,9 +231,18 @@ public class MonitoringService { ...@@ -228,9 +231,18 @@ public class MonitoringService {
} }
} }
// TODO 过滤掉生态系数预警不是鸿蒙品牌的
}
}
// 过滤掉生态系数预警不是鸿蒙品牌的
CarBrandRequestDTO carBrandRequestDTO = new CarBrandRequestDTO();
carBrandRequestDTO.setFirstBrandIdList(Arrays.asList(env.getProperty("hmzx.carbrandId")==null?2695:Integer.parseInt(env.getProperty("hmzx.carbrandId"))));
RpcResponse<List<MerchantSimpleResponse>> merchantListByBrandIds = merchantRemote.findMerchantListByBrandIds(
carBrandRequestDTO);
if (merchantListByBrandIds.isSuccess()) {
List<MerchantSimpleResponse> merchantList = merchantListByBrandIds.getResult();
allWarnings = allWarnings.stream().filter(warning -> !("生态系数").equals(warning.getRuleType()) || ((("生态系数").equals(warning.getRuleType())) && merchantList.stream().anyMatch(merchant -> merchant.getMerchantNo().equals(warning.getMerchantId4s())))).collect(
Collectors.toList());
}
return allWarnings; return allWarnings;
} }
...@@ -244,24 +256,107 @@ public class MonitoringService { ...@@ -244,24 +256,107 @@ public class MonitoringService {
return itemCode + "_" + mid + "_" + sid; return itemCode + "_" + mid + "_" + sid;
} }
/**
* TODO 批量获取门店信息
*
* @param merchantList 门店列表
* @return
*/
private Map<Integer, StoreItemResponse> batchGetMerchantInfo(Set<Integer> merchantList) {
return null;
}
/** /**
* TODO 获取门店或者员工列表 * 获取门店或者员工列表
* *
* @param request 筛选参数 * @param request 筛选参数
* @return * @return
*/ */
private List<Integer> getSearchMerchantIds(MonitorFilterRequest request) { private List<Integer> getSearchMerchantIds(MonitorFilterRequest request) {
return null; List<Integer> merchantIds = new ArrayList<>();
List<Integer> brandmerchantIds= new ArrayList<>();
List<Integer> regmerchantIds= new ArrayList<>();
List<Integer> onlinemerchantIds= new ArrayList<>();
List<Integer> regionalmerchantIds= new ArrayList<>();
if (CollectionUtils.isNotEmpty(request.getFirstbrandIds()) || CollectionUtils.isNotEmpty(request.getTwoBrandIds())) {
CarBrandRequestDTO carBrandRequestDTO = new CarBrandRequestDTO();
carBrandRequestDTO.setFirstBrandIdList(request.getFirstbrandIds());
carBrandRequestDTO.setSecBrandIdList(request.getTwoBrandIds());
RpcResponse<List<MerchantSimpleResponse>> merchantListByBrandIds = merchantRemote.findMerchantListByBrandIds(
carBrandRequestDTO);
if (merchantListByBrandIds.isSuccess()){
List<MerchantSimpleResponse> result = merchantListByBrandIds.getResult();
if (CollectionUtils.isNotEmpty(result)) {
brandmerchantIds = merchantListByBrandIds.getResult().stream()
.map(MerchantSimpleResponse::getMerchantNo)
.collect(Collectors.toList());
}else {
brandmerchantIds = Arrays.asList(-1);
}
}else{
throw new RpcServiceException("查询品牌门店失败");
}
}
if (request.getRegionId()!=null){
RpcResponse<List<MerchantProvinceDTO>> merchantProvinceListByIds = merchantRemote.findMerchantProvinceListByIds(
Arrays.asList(request.getRegionId()));
if (merchantProvinceListByIds.isSuccess()){
List<MerchantProvinceDTO> result = merchantProvinceListByIds.getResult();
if (CollectionUtils.isNotEmpty(result)) {
regmerchantIds = merchantProvinceListByIds.getResult().stream()
.map(MerchantProvinceDTO::getMerchantId)
.collect(Collectors.toList());
}else {
regmerchantIds = Arrays.asList(-1);
}
}else{
throw new RpcServiceException("查询区域门店失败");
}
}
if (request.getOnlineOperatorId()!=null){
byte typeValue=DirectorTypeEnum.DF_DIRECTOR_2_1.getValue();
if (request.getBusinessType().intValue()==1 || request.getBusinessType().intValue()==3){
typeValue = DirectorTypeEnum.DF_DIRECTOR_2_1.getValue();
}else if (request.getBusinessType().intValue()==2){
typeValue = DirectorTypeEnum.DF_DIRECTOR.getValue();
}
onlinemerchantIds = monitorTypeDictMapper.findMerchantIdsByUUidAndType(request.getOnlineOperatorId(),typeValue);
if (CollectionUtils.isEmpty(onlinemerchantIds)){
onlinemerchantIds = Arrays.asList(-1);
}
}
if (request.getRegionalOperatorId()!=null){
byte typeValue=DirectorTypeEnum.AREA_SUPERVISION_2_1.getValue();
if (request.getBusinessType().intValue()==1 || request.getBusinessType().intValue()==3){
typeValue = DirectorTypeEnum.AREA_SUPERVISION_2_1.getValue();
}else if (request.getBusinessType().intValue()==2){
typeValue = DirectorTypeEnum.AREA_SUPERVISION_1_1.getValue();
}
regionalmerchantIds = monitorTypeDictMapper.findMerchantIdsByUUidAndType(request.getRegionalOperatorId(),typeValue);
if (CollectionUtils.isEmpty(regionalmerchantIds)){
regionalmerchantIds = Arrays.asList(-1);
}
}
// 取四个集合的交集,如果集合是null的,不处理为空的集合
List<Collection<Integer>> collections = Arrays.asList(
brandmerchantIds,
regmerchantIds,
regionalmerchantIds,
onlinemerchantIds
).stream()
.filter(Objects::nonNull) // 跳过 null
.collect(Collectors.toList());
if (collections.isEmpty()) {
// 所有集合都为 null → 返回空集合
merchantIds = Collections.emptyList();
} else if (collections.size() == 1) {
// 只有一个有效集合 → 直接返回其副本
merchantIds = new ArrayList<>(collections.get(0));
} else {
// 依次求交集
merchantIds = new ArrayList<>(collections.get(0));
for (int i = 1; i < collections.size(); i++) {
merchantIds = (List<Integer>) CollectionUtils.intersection(merchantIds, collections.get(i));
// 如果交集已为空,可提前退出(可选优化)
if (merchantIds.isEmpty()) {
break;
}
}
}
return merchantIds;
} }
...@@ -393,8 +488,8 @@ public class MonitoringService { ...@@ -393,8 +488,8 @@ public class MonitoringService {
* *
* @return * @return
*/ */
public List<MonitorTypeDict> findMonitorTypeDictList() { public List<MonitorTypeDict> findMonitorTypeDictList(Integer businessType) {
return monitorTypeDictMapper.findMonitorTypeDictList(); return monitorTypeDictMapper.findMonitorTypeDictList(convertToInternalBusinessType(businessType));
} }
/** /**
...@@ -471,6 +566,23 @@ public class MonitoringService { ...@@ -471,6 +566,23 @@ public class MonitoringService {
return monMetricsDTO; return monMetricsDTO;
} }
/**
* 将外部业务类型ID转换为系统内部标准ID
* 映射关系:1→4(延保),2→2(轻改),3→3(权益)
*
* @param externalId 外部业务类型ID(1=延保, 2=轻改, 3=权益)
* @return 系统内部业务类型ID(2=轻改, 3=权益, 4=延保),无效输入返回 null
*/
public static Integer convertToInternalBusinessType(Integer externalId) {
if (externalId == null) {
return null;
}
switch (externalId) {
case 1: return 4; // 延保
case 2: return 2; // 轻改
case 3: return 3; // 权益
default: return null; // 无效值
}
}
} }
...@@ -283,6 +283,7 @@ public interface ConditionStrategy { ...@@ -283,6 +283,7 @@ public interface ConditionStrategy {
} }
if(monitorType.intValue()==2){ if(monitorType.intValue()==2){
queryParams.setExts("merchantIds"); queryParams.setExts("merchantIds");
queryParams.setMerchantIds(earlyWarningRuleCondition.getMerchantIds());
} }
} }
......
...@@ -502,20 +502,20 @@ ...@@ -502,20 +502,20 @@
left join reception_customer_info t4 on t4.id=t1.reception_id left join reception_customer_info t4 on t4.id=t1.reception_id
left join dj_car_life_staff_info t5 on t5.staff_uuid =t4.staff_uuid left join dj_car_life_staff_info t5 on t5.staff_uuid =t4.staff_uuid
where t1.deleted_flag = 'N' and t4.id is not null where t1.deleted_flag = 'N' and t4.id is not null
<if test="condition.startTime != null"> <if test="condition.startDate != null">
and date_format (t1.start_time,'%Y-%m-%d') &gt;= #{condition.startTime} and date_format (t1.recording_start_time,'%Y-%m-%d') &gt;= #{condition.startDate}
</if> </if>
<if test="condition.endTime != null"> <if test="condition.endDate != null">
and date_format (t1.start_time,'%Y-%m-%d') &lt;= #{condition.endTime} and date_format (t1.recording_start_time,'%Y-%m-%d') &lt;= #{condition.endDate}
</if> </if>
<if test="condition.bussinessType != null"> <if test="condition.businessType != null">
and t1.check_type = #{condition.bussinessType} and t1.check_type = #{condition.businessType}
</if> </if>
<if test="condition.merchantNo != null"> <if test="condition.merchantId != null">
and t4.merchant_id= #{condition.merchantNo} and t4.merchant_id= #{condition.merchantId}
</if> </if>
<if test="condition.staffUUid != null"> <if test="condition.staffId != null">
and t4.staff_uuid= #{condition.staffUUid} and t4.staff_uuid= #{condition.staffId}
</if> </if>
<if test="condition.recordIdList != null "> <if test="condition.recordIdList != null ">
and t2.id in and t2.id in
...@@ -524,7 +524,7 @@ ...@@ -524,7 +524,7 @@
</foreach> </foreach>
/> />
</if> </if>
order by t1.start_time desc order by t1.recording_start_time desc
</select> </select>
<select id="getRecordStaticByCondition" <select id="getRecordStaticByCondition"
resultType="cn.com.glsx.dj.mindworkplate.dto.ConversationBatchDTO"> resultType="cn.com.glsx.dj.mindworkplate.dto.ConversationBatchDTO">
...@@ -544,21 +544,20 @@ ...@@ -544,21 +544,20 @@
left join reception_customer_info t4 on t4.id=t1.reception_id left join reception_customer_info t4 on t4.id=t1.reception_id
left join dj_car_life_staff_info t5 on t5.staff_uuid =t4.staff_uuid left join dj_car_life_staff_info t5 on t5.staff_uuid =t4.staff_uuid
where t1.deleted_flag = 'N' and t4.id is not null where t1.deleted_flag = 'N' and t4.id is not null
<if test="condition.startTime != null"> <if test="condition.startDate != null">
and date_format (t1.start_time,'%Y-%m-%d') &gt;= #{condition.startTime} and date_format (t1.recording_start_time,'%Y-%m-%d') &gt;= #{condition.startDate}
</if> </if>
<if test="condition.endTime != null"> <if test="condition.endDate != null">
and date_format (t1.start_time,'%Y-%m-%d') &lt;= #{condition.endTime} and date_format (t1.recording_start_time,'%Y-%m-%d') &lt;= #{condition.endDate}
</if> </if>
<if test="condition.bussinessType != null"> <if test="condition.businessType != null">
and t1.check_type = #{condition.bussinessType} and t1.check_type = #{condition.businessType}
</if> </if>
<if test="condition.merchantNo != null"> <if test="condition.merchantId != null">
and t4.merchant_id= #{condition.merchantNo} and t4.merchant_id= #{condition.merchantId}
</if> </if>
<if test="condition.staffUUid != null"> <if test="condition.staffId != null">
and t4.staff_uuid= #{condition.staffUUid} and t4.staff_uuid= #{condition.staffId}
</if> </if>
group by t1.id
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
from monitor_type_dict t1 from monitor_type_dict t1
left join early_warning_rule t2 on t1.type_code = t2.monitor_type_dict_id left join early_warning_rule t2 on t1.type_code = t2.monitor_type_dict_id
where t1.enabled = 1 and t2.deleted_flag ='N' where t1.enabled = 1 and t2.deleted_flag ='N'
<if test="bussinessType!=null">
and t2.business_type = #{bussinessType}
</if>
order by t1.sort_order order by t1.sort_order
</select> </select>
<select id="findMerchantIdsByUUidAndType" resultType="java.lang.Integer">
select merchant_id from merchant_monitor_type_dict where uuid = #{uuid} and type_code = #{typeCode}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.mindworkplate.service; package cn.com.glsx.dj.mindworkplate.service;
import cn.com.glsx.dj.mindworkplate.dto.*; import cn.com.glsx.dj.mindworkplate.dto.*;
import cn.com.glsx.dj.mindworkplate.model.warning.LearningEffectAnalysisRequest;
import cn.com.glsx.dj.mindworkplate.response.warning.WarningMsgStaffRes; import cn.com.glsx.dj.mindworkplate.response.warning.WarningMsgStaffRes;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -157,4 +158,38 @@ public class ConversationBatchServiceTest extends BaseServiceTest { ...@@ -157,4 +158,38 @@ public class ConversationBatchServiceTest extends BaseServiceTest {
System.out.println(s); System.out.println(s);
} }
@Test
public void getRecordPageListByCondition() {
RpcPagination req=new RpcPagination();
req.setPageNum(1);
req.setPageSize(20);
LearningEffectAnalysisRequest request = new LearningEffectAnalysisRequest();
request.setBusinessType(1);
request.setStartDate("2025-06-15");
request.setEndDate("2025-06-20");
request.setLearningEffectType(1);
request.setAnalysisPeriodDays(7);
req.setCondition(request);
Page<ConversationBatchDTO> res = conversationBatchService
.getRecordPageListByCondition(req);
System.out.println(JSONObject.toJSONString( res));
}
@Test
public void getRecordStaticByCondition() {
LearningEffectAnalysisRequest request = new LearningEffectAnalysisRequest();
request.setBusinessType(1);
request.setStartDate("2025-06-15");
request.setEndDate("2025-06-20");
request.setLearningEffectType(2);
request.setAnalysisPeriodDays(7);
ConversationBatchDTO recordStaticByCondition = conversationBatchService.getRecordStaticByCondition(
request);
System.out.println(JSONObject.toJSONString( recordStaticByCondition));
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -144,7 +144,7 @@ public class EarlyWarningTest extends BaseServiceTest{ ...@@ -144,7 +144,7 @@ public class EarlyWarningTest extends BaseServiceTest{
@Test @Test
public void findMonitorTypeDictList() throws ParseException { public void findMonitorTypeDictList() throws ParseException {
List<MonitorTypeDict> monitorTypeDictList = monitoringService.findMonitorTypeDictList(); List<MonitorTypeDict> monitorTypeDictList = monitoringService.findMonitorTypeDictList(1);
System.out.println("aa"+JSONObject.toJSONString(monitorTypeDictList)); System.out.println("aa"+JSONObject.toJSONString(monitorTypeDictList));
} }
...@@ -152,8 +152,11 @@ public class EarlyWarningTest extends BaseServiceTest{ ...@@ -152,8 +152,11 @@ public class EarlyWarningTest extends BaseServiceTest{
@Test @Test
public void findLearningEffectAnalysis() throws ParseException { public void findLearningEffectAnalysis() throws ParseException {
LearningEffectAnalysisRequest request=new LearningEffectAnalysisRequest(); LearningEffectAnalysisRequest request=new LearningEffectAnalysisRequest();
request.setStartDate("2024-11-01"); request.setStartDate("2025-11-01");
request.setEndDate("2024-11-18"); request.setEndDate("2025-11-18");
request.setBusinessType(1);
request.setAnalysisPeriodDays(7);
request.setMerchantId(44210895);
LearningEffectAnalysisDTO learningEffectAnalysis = monitoringService.findLearningEffectAnalysis(request); LearningEffectAnalysisDTO learningEffectAnalysis = monitoringService.findLearningEffectAnalysis(request);
System.out.println("aa"+JSONObject.toJSONString(learningEffectAnalysis)); System.out.println("aa"+JSONObject.toJSONString(learningEffectAnalysis));
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!