Commit b4a8ae93 by 谢海旭

202601月底版本 策略中心:兜底目标、策略列表

1 parent 00ee072a
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.*;
import cn.com.glsx.dj.mindworkplate.dto.warning.EarlyWarningThresholdConfigHistoryDTO;
import cn.com.glsx.dj.mindworkplate.model.warning.WarningMsg;
import cn.com.glsx.dj.mindworkplate.model.warning.WarningMsgResponse;
import cn.com.glsx.framework.core.annotation.ApiMethod;
......@@ -76,4 +77,9 @@ public interface EarlyWarningMsgRemote {
@ApiParam(name="month",notes="月份 格式yyyy-mm",dataType= ApiParam.DataTypeEnum.OBJECT, required=true)
@ApiResponse("查询月份内中的门店的预警明细 1.兜底预警 2.丢店预警(展业预警)")
RpcResponse<Map<Integer, List<WarningMsgResponse>>> findWarnMsgListByMonth(MerchantDdWarningMsgRequestDTO merchantDdWarningMsgRequestDTO);
@ApiMethod("策略中心-门店分析-历史兜底指标")
@ApiParam(name="merchantNo",notes="商户号",dataType= ApiParam.DataTypeEnum.STRING,required=true)
@ApiResponse("返回门店历史兜底指标数据")
RpcResponse<List<EarlyWarningThresholdConfigHistoryDTO>> listMerchantAnalysisIndexHistory(String merchantNo);
}
......@@ -3,6 +3,9 @@ package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.EarlyWarningThresholdConfigHistory;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface EarlyWarningThresholdConfigHistoryMapper extends OreMapper<EarlyWarningThresholdConfigHistory> {
......@@ -12,4 +15,12 @@ public interface EarlyWarningThresholdConfigHistoryMapper extends OreMapper<Earl
* @return 插入条数
*/
int backupConfigToHistory();
/**
* 根据商户号查询历史指标数据,按月份倒序排列
*
* @param merchantNo 商户号
* @return 历史指标数据列表
*/
List<EarlyWarningThresholdConfigHistory> selectByMerchantNoOrderByMonthDesc(@Param("merchantNo") String merchantNo);
}
package cn.com.glsx.dj.mindworkplate.remote;
import cn.com.glsx.dj.mindworkplate.dto.*;
import cn.com.glsx.dj.mindworkplate.dto.warning.EarlyWarningThresholdConfigHistoryDTO;
import cn.com.glsx.dj.mindworkplate.model.warning.WarningMsg;
import cn.com.glsx.dj.mindworkplate.model.warning.WarningMsgResponse;
import cn.com.glsx.dj.mindworkplate.service.EarlyWarningThresholdConfigService;
import cn.com.glsx.dj.mindworkplate.service.warning.WarningMsgService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -29,6 +31,9 @@ public class EarlyWarningMsgRemoteImpl implements EarlyWarningMsgRemote{
@Autowired
private WarningMsgService warningMsgService;
@Autowired
private EarlyWarningThresholdConfigService earlyWarningThresholdConfigService;
@Override
public RpcResponse<RpcPagination<EarlyWarningMsgDTO>> listStaffWaringMsgWithPage(RpcPagination<EarlyWarningMsgDTO> pagination) {
try{
......@@ -151,4 +156,18 @@ public class EarlyWarningMsgRemoteImpl implements EarlyWarningMsgRemote{
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<List<EarlyWarningThresholdConfigHistoryDTO>> listMerchantAnalysisIndexHistory(String merchantNo) {
try{
List<EarlyWarningThresholdConfigHistoryDTO> result = earlyWarningThresholdConfigService.listMerchantAnalysisIndexHistory(merchantNo);
return RpcResponse.success(result);
}catch(RpcServiceException e){
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}catch(Exception e){
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
}
package cn.com.glsx.dj.mindworkplate.service;
import cn.com.glsx.dj.mindworkplate.dto.warning.EarlyWarningThresholdConfigHistoryDTO;
import cn.com.glsx.dj.mindworkplate.mapper.EarlyWarningThresholdConfigHistoryMapper;
import cn.com.glsx.dj.mindworkplate.mapper.EarlyWarningThresholdConfigMapper;
import cn.com.glsx.dj.mindworkplate.mapper.EarlyWarningThresholdRangeConfigMapper;
import cn.com.glsx.dj.mindworkplate.model.EarlyWarningThresholdConfig;
import cn.com.glsx.dj.mindworkplate.model.EarlyWarningThresholdConfigHistory;
import cn.com.glsx.dj.mindworkplate.model.EarlyWarningThresholdRangeConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Slf4j
@Service
......@@ -104,4 +109,36 @@ public class EarlyWarningThresholdConfigService {
throw new RuntimeException("备份门店指标记录失败: " + e.getMessage(), e);
}
}
/**
* 查询门店历史兜底指标
*
* @param merchantNo 请求参数
* @return 历史指标数据列表
*/
public List<EarlyWarningThresholdConfigHistoryDTO> listMerchantAnalysisIndexHistory(String merchantNo) {
// 查询历史指标数据,按月份倒序排列
List<EarlyWarningThresholdConfigHistory> historyList = earlyWarningThresholdConfigHistoryMapper.selectByMerchantNoOrderByMonthDesc(merchantNo);
// 转换为DTO并设置月份显示格式
List<EarlyWarningThresholdConfigHistoryDTO> dtoList = new ArrayList<>();
for (EarlyWarningThresholdConfigHistory history : historyList) {
EarlyWarningThresholdConfigHistoryDTO dto = new EarlyWarningThresholdConfigHistoryDTO();
BeanUtils.copyProperties(history, dto);
// 将月份格式转换为 yyyy年MM月 格式
String recordYearMonth = history.getRecordYearMonth();
if (recordYearMonth != null && recordYearMonth.length() >= 7) {
String year = recordYearMonth.substring(0, 4);
String month = recordYearMonth.substring(5, 7);
String displayMonth = year + "年" + month + "月";
dto.setRecordYearMonth(displayMonth);
}
dtoList.add(dto);
}
return dtoList;
}
}
......@@ -53,4 +53,14 @@
FROM early_warning_threshold_config
WHERE deleted_flag = 'N'
</insert>
<!-- 根据商户号查询历史指标数据,按月份倒序排列 -->
<select id="selectByMerchantNoOrderByMonthDesc" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM early_warning_threshold_config_history
WHERE merchant_no = #{merchantNo,jdbcType=VARCHAR}
AND deleted_flag = 'N'
ORDER BY record_year_month DESC
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!