Commit 27cbdb73 by 崔彦峰

refactor(daily-report): 重构日报数据服务中的今日汇总逻辑

- 移除不再使用的 DateUtil 和 DateUtils 导入
- 修改 buildTodaySummary 方法签名,添加 reportDate 参数
- 修改 buildExtendedWarrantyLanTuTodaySummary 方法签名,添加 reportDate 参数
- 将硬编码的当前日期替换为传入的 reportDate 参数
- 更新方法调用以传递正确的参数
1 parent 8cf5afc0
......@@ -18,13 +18,11 @@ import cn.com.glsx.dj.smartcarlife.enums.BaseSceneEnum;
import cn.com.glsx.dj.smartcarlife.remote.GoodsOrderRemote;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
......@@ -96,7 +94,7 @@ public class DailyReportDataService {
result.setMerchantName(latestRecord.getMerchantName());
result.setReportDate(latestRecord.getReportDate());
result.setYearMonth(getMonthText(latestRecord.getReportDate()));
result.setTodayData(buildTodaySummary(latestRecord.getId(), fieldDataMap, subformDataMap,merchantId));
result.setTodayData(buildTodaySummary(latestRecord.getId(), fieldDataMap, subformDataMap, merchantId, endDate));
result.setMonthData(buildMonthSummary(recordList, fieldDataMap, subformDataMap,startDate, endDate, merchantId));
result.setSalesRows(buildSalesRows(latestRecord, recordList, subformDataMap));
result.setDeliveryRows(buildDeliveryRows(latestRecord, recordList, subformDataMap));
......@@ -189,7 +187,7 @@ public class DailyReportDataService {
result.setMerchantName(latestRecord.getMerchantName());
result.setReportDate(latestRecord.getReportDate());
result.setYearMonth(getMonthText(latestRecord.getReportDate()));
result.setTodaySummary(buildExtendedWarrantyLanTuTodaySummary(latestRecord, fieldDataMap, subformDataMap));
result.setTodaySummary(buildExtendedWarrantyLanTuTodaySummary(latestRecord, fieldDataMap, subformDataMap, endDate));
result.setMonthSummary(buildExtendedWarrantyLanTuMonthSummary(latestRecord, recordList, fieldDataMap, subformDataMap, startDate, endDate));
result.setDataStatisticsRows(buildExtendedWarrantyLanTuDataStatisticsRows(latestRecord, recordList, subformDataMap));
result.setAfterSaleReferralRows(buildExtendedWarrantyLanTuAfterSaleReferralRows(latestRecord, recordList, subformDataMap));
......@@ -367,15 +365,16 @@ public class DailyReportDataService {
* 今日汇总
*/
private LightChangeDailyReportData.DailyReportSummary buildTodaySummary(Integer recordId,
Map<Integer, List<DailyReportFieldData>> fieldDataMap,
Map<Integer, List<DailyReportSubformData>> subformDataMap,
Integer merchantId) {
Map<Integer, List<DailyReportFieldData>> fieldDataMap,
Map<Integer, List<DailyReportSubformData>> subformDataMap,
Integer merchantId,
String reportDate) {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
queryCopy.setBizs(2);
queryCopy.setDateType(4);
queryCopy.setStartDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
queryCopy.setEndDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
queryCopy.setStartDate(reportDate);
queryCopy.setEndDate(reportDate);
queryCopy.setItemCodes("A036");
queryCopy.setMerchantIds(merchantId.toString());
......@@ -572,14 +571,15 @@ public class DailyReportDataService {
*/
private ExtendedWarrantyDailyReportData.DailyReportSummary buildExtendedWarrantyLanTuTodaySummary(DailyReportRecord latestRecord,
Map<Integer, List<DailyReportFieldData>> fieldDataMap,
Map<Integer, List<DailyReportSubformData>> subformDataMap) {
Map<Integer, List<DailyReportSubformData>> subformDataMap,
String reportDate) {
Integer lanTuThreeYearDealCount = null;
GoodsOrderDTO goodsOrderDTO = new GoodsOrderDTO();
goodsOrderDTO.setMerchantId(latestRecord.getMerchantId());
goodsOrderDTO.setBaseSceneCodeList(Arrays.asList(BaseSceneEnum.PRE_EXTEND_WARRANTY.getBaseSceneCode(),BaseSceneEnum.POST_EXTEND_WARRANTY.getBaseSceneCode()));
// goodsOrderDTO.setPaySuccessStartDate(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
goodsOrderDTO.setPaySuccessStartDate(DateUtils.formatDate(new Date(), "yyyy-MM-dd") + " 00:00:00");
goodsOrderDTO.setPaySuccessEndDate((DateUtils.formatDate(new Date(), "yyyy-MM-dd") + " 23:59:59"));
goodsOrderDTO.setPaySuccessStartDate(reportDate + " 00:00:00");
goodsOrderDTO.setPaySuccessEndDate(reportDate + " 23:59:59");
RpcResponse<Integer> integerRpcResponse = goodsOrderRemote.countOrderServiceYears(goodsOrderDTO);
if (integerRpcResponse.isSuccess()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!