Commit 6e6b0ec6 by 王璐琦

fix(daily-report): 修改日报推送获取记录逻辑并调整延保报表导出

- 修改推送方法中查询最新提交记录时增加场景类型参数
- 更换延保其他品牌报表导出中用到的Excel模板及方法
- 优化人员统计解析方法,新增JSON数组长度解析逻辑
- 新增延保其他品牌交付部数据统计与洽谈明细VO及相关导出方法
- 调整SmartCarLife模块GoodsOrder查询逻辑,添加关联子订单条件及字段
1 parent 6d7bbdbb
package cn.com.glsx.dj.daily.report.dto;
import lombok.Data;
import org.oreframework.commons.office.easyexcel.annotation.ExcelMergeRow;
import java.io.Serializable;
import java.util.List;
/**
* 延保权益-其他品牌交付部数据统计导出VO
* <p>list.xxx = 每行一个交付专员的数据;无前缀 = 跨行合并展示</p>
*/
@Data
public class ExtendedWarrantyOtherDeliveryStatisticsExportVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 交付部行数据列表 */
private List<ExtendedWarrantyOtherDeliveryStatisticsVO> list;
@ExcelMergeRow(columIndex = 11)
private String referralRateTotalOfMonth;
@ExcelMergeRow(columIndex = 12)
private String touchToCloseRateOfMonth;
@ExcelMergeRow(columIndex = 13)
private String salesOrderCountOfMonth;
@ExcelMergeRow(columIndex = 14)
private String systemDmsDeliveryCount;
@ExcelMergeRow(columIndex = 15)
private String systemDmsPenetrationRate;
}
package cn.com.glsx.dj.daily.report.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 延保权益-其他品牌交付部数据统计行VO
*/
@Data
public class ExtendedWarrantyOtherDeliveryStatisticsVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 部门(非模板列) */
private String departmentName;
/** 交付专员 (col1) */
private String deliverySpecialist;
/** 今日交付数 (col2, col5) */
private Integer deliveryCountOfToday;
/** 今日有效引荐数 (col3) */
private Integer validReferralsOfToday;
/** 今日触客数 (col4) */
private Integer presalesCustomerContactCountOfToday;
/** 本月交付数 (col6, col9) */
private Integer deliveryCountOfMonth;
/** 本月有效引荐数 (col7) */
private Integer validReferralsOfMonth;
/** 本月触客数 (col8) */
private Integer presalesCustomerContactCountOfMonth;
/** 本月推荐率 (col10) */
private String referralRateOfMonth;
/** 本月转化率 (col11) */
private String conversionRateOfMonth;
}
package cn.com.glsx.dj.daily.report.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 延保权益-其他品牌洽谈明细行VO
*/
@Data
public class ExtendedWarrantyOtherNegotiationDetailVO implements Serializable {
private static final long serialVersionUID = 1L;
/** 交车日期 */
private String deliveryDate;
/** 部门 */
private String departmentName;
/** 推荐人 */
private String referrer;
/** 客户姓名 */
private String customerName;
/** 客户手机号(脱敏) */
private String phone;
/** 车型配置 */
private String vehicleConfiguration;
/** 车架号 */
private String vin;
/** 驻店人员 */
private String storeSales;
/** 触客时间 */
private String customerContactTime;
/** 成交日期 */
private String transactionDate;
/** 成交产品 */
private String purchasedProduct;
/** 延保成交金额 */
private BigDecimal extendedWarrantyDealAmount;
/** 权益成交金额 */
private BigDecimal productContractTerm;
/** 未成交原因 */
private String lostReason;
/** 备注 */
private String remark;
}
...@@ -63,6 +63,12 @@ public class ExtendedWarrantyDailyReportData implements Serializable { ...@@ -63,6 +63,12 @@ public class ExtendedWarrantyDailyReportData implements Serializable {
/** 洽谈明细(延保+问界/鸿蒙) */ /** 洽谈明细(延保+问界/鸿蒙) */
private List<ExtendedWarrantyNegotiationDetailVO> negotiationDetailRows; private List<ExtendedWarrantyNegotiationDetailVO> negotiationDetailRows;
/** 交付部统计表(延保+其他品牌) */
private List<ExtendedWarrantyOtherDeliveryStatisticsExportVO> otherDeliveryStatisticsRows;
/** 洽谈明细(延保+其他品牌) */
private List<ExtendedWarrantyOtherNegotiationDetailVO> otherNegotiationDetailRows;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
......
...@@ -90,7 +90,7 @@ public class DailyReportPushService { ...@@ -90,7 +90,7 @@ public class DailyReportPushService {
public void pushLightChangeDailyReport(Integer merchantId) { public void pushLightChangeDailyReport(Integer merchantId) {
log.info("pushLightChangeDailyReport start, merchantId:{}", merchantId); log.info("pushLightChangeDailyReport start, merchantId:{}", merchantId);
try { try {
DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId); DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId, SceneTypeEnum.SCENE1_1.getValue());
if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) { if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) {
log.info("pushLightChangeDailyReport no latest record, merchantId:{}", merchantId); log.info("pushLightChangeDailyReport no latest record, merchantId:{}", merchantId);
return; return;
...@@ -157,7 +157,7 @@ public class DailyReportPushService { ...@@ -157,7 +157,7 @@ public class DailyReportPushService {
public void pushExtendedWarrantyWjDailyReport(Integer merchantId) { public void pushExtendedWarrantyWjDailyReport(Integer merchantId) {
log.info("pushExtendedWarrantyWjDailyReport start, merchantId:{}", merchantId); log.info("pushExtendedWarrantyWjDailyReport start, merchantId:{}", merchantId);
try { try {
DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId); DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId, SceneTypeEnum.SCENE1_0.getValue());
if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) { if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) {
log.info("pushExtendedWarrantyWjDailyReport no latest record, merchantId:{}", merchantId); log.info("pushExtendedWarrantyWjDailyReport no latest record, merchantId:{}", merchantId);
return; return;
...@@ -220,7 +220,7 @@ public class DailyReportPushService { ...@@ -220,7 +220,7 @@ public class DailyReportPushService {
public void pushExtendedWarrantyNotWjDailyReport(Integer merchantId) { public void pushExtendedWarrantyNotWjDailyReport(Integer merchantId) {
log.info("pushExtendedWarrantyNotWjDailyReport start, merchantId:{}", merchantId); log.info("pushExtendedWarrantyNotWjDailyReport start, merchantId:{}", merchantId);
try { try {
DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId); DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId, SceneTypeEnum.SCENE1_0.getValue());
if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) { if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) {
log.info("pushExtendedWarrantyNotWjDailyReport no latest record, merchantId:{}", merchantId); log.info("pushExtendedWarrantyNotWjDailyReport no latest record, merchantId:{}", merchantId);
return; return;
...@@ -272,7 +272,7 @@ public class DailyReportPushService { ...@@ -272,7 +272,7 @@ public class DailyReportPushService {
public void pushExtendedWarrantyLanTuDailyReport(Integer merchantId) { public void pushExtendedWarrantyLanTuDailyReport(Integer merchantId) {
log.info("pushExtendedWarrantyLanTuDailyReport start, merchantId:{}", merchantId); log.info("pushExtendedWarrantyLanTuDailyReport start, merchantId:{}", merchantId);
try { try {
DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId); DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId, SceneTypeEnum.SCENE1_0.getValue());
if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) { if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) {
log.info("pushExtendedWarrantyLanTuDailyReport no latest record, merchantId:{}", merchantId); log.info("pushExtendedWarrantyLanTuDailyReport no latest record, merchantId:{}", merchantId);
return; return;
...@@ -318,7 +318,7 @@ public class DailyReportPushService { ...@@ -318,7 +318,7 @@ public class DailyReportPushService {
public void pushExtendedWarrantyOtherDailyReport(Integer merchantId) { public void pushExtendedWarrantyOtherDailyReport(Integer merchantId) {
log.info("pushExtendedWarrantyOtherDailyReport start, merchantId:{}", merchantId); log.info("pushExtendedWarrantyOtherDailyReport start, merchantId:{}", merchantId);
try { try {
DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId); DailyReportRecord latestRecord = dailyReportDataService.queryLatestSubmittedRecord(merchantId, SceneTypeEnum.SCENE1_0.getValue());
if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) { if (latestRecord == null || StringUtils.isBlank(latestRecord.getReportDate())) {
log.info("pushExtendedWarrantyOtherDailyReport no latest record, merchantId:{}", merchantId); log.info("pushExtendedWarrantyOtherDailyReport no latest record, merchantId:{}", merchantId);
return; return;
...@@ -339,12 +339,10 @@ public class DailyReportPushService { ...@@ -339,12 +339,10 @@ public class DailyReportPushService {
return; return;
} }
List<Map<String, String>> negotiationRows = dailyReportDataService.queryExtendedWarrantyOtherNegotiationRows(merchantId, latestRecord.getReportDate());
String textMessage = buildExtendedWarrantyOtherTextMessage(data); String textMessage = buildExtendedWarrantyOtherTextMessage(data);
String dataStatisticsUrl = extendedWarrantyExcelService.fillOtherDataStatisticsExcelAndGetOssUrl(data); String dataStatisticsUrl = extendedWarrantyExcelService.fillOtherDeliveryStatisticsExcelAndGetOssUrl(data);
String afterSaleUrl = extendedWarrantyExcelService.fillOtherAfterSaleExcelAndGetOssUrl(data); String afterSaleUrl = extendedWarrantyExcelService.fillOtherAfterSaleReferralStatisticsExcelAndGetOssUrl(data);
String negotiationUrl = extendedWarrantyExcelService.fillOtherNegotiationExcelAndGetOssUrl(negotiationRows); String negotiationUrl = extendedWarrantyExcelService.fillOtherNegotiationDetailExcelAndGetOssUrl(data);
sendExtendedWarrantyOtherTextMessage(config, textMessage); sendExtendedWarrantyOtherTextMessage(config, textMessage);
sendExtendedWarrantyOtherLinkMessage(config, excelUtils.excel2Img(dataStatisticsUrl)); sendExtendedWarrantyOtherLinkMessage(config, excelUtils.excel2Img(dataStatisticsUrl));
......
...@@ -26,6 +26,7 @@ import cn.com.glsx.framework.core.enums.DefaultErrorEnum; ...@@ -26,6 +26,7 @@ import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum; import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -1335,7 +1336,7 @@ public class DailyReportRecordService { ...@@ -1335,7 +1336,7 @@ public class DailyReportRecordService {
Example fieldExample = new Example(DailyReportFieldData.class); Example fieldExample = new Example(DailyReportFieldData.class);
fieldExample.createCriteria() fieldExample.createCriteria()
.andEqualTo("deletedFlag", DeleteFlagEnum.N.getValue()) .andEqualTo("deletedFlag", DeleteFlagEnum.N.getValue())
.andEqualTo("fieldKey", DailyReportFieldEnum.F2_2.getValue()) .andEqualTo("fieldKey", DailyReportFieldEnum.F2_101.getValue())
.andIn("reportRecordId", recordIds); .andIn("reportRecordId", recordIds);
List<DailyReportFieldData> fieldDataList = dailyReportFieldDataMapper.selectByExample(fieldExample); List<DailyReportFieldData> fieldDataList = dailyReportFieldDataMapper.selectByExample(fieldExample);
if (CollectionUtils.isEmpty(fieldDataList)) { if (CollectionUtils.isEmpty(fieldDataList)) {
...@@ -1346,7 +1347,7 @@ public class DailyReportRecordService { ...@@ -1346,7 +1347,7 @@ public class DailyReportRecordService {
.filter(fd -> StringUtils.isNotBlank(fd.getFieldValue())) .filter(fd -> StringUtils.isNotBlank(fd.getFieldValue()))
.collect(Collectors.toMap( .collect(Collectors.toMap(
DailyReportFieldData::getReportRecordId, DailyReportFieldData::getReportRecordId,
fd -> Integer.valueOf(fd.getFieldValue()), fd -> parseStaffCount(fd.getFieldValue()),
(v1, v2) -> v2)); (v1, v2) -> v2));
for (DailyReportRecordDTO dto : dtoList) { for (DailyReportRecordDTO dto : dtoList) {
...@@ -1354,6 +1355,19 @@ public class DailyReportRecordService { ...@@ -1354,6 +1355,19 @@ public class DailyReportRecordService {
} }
} }
private int parseStaffCount(String fieldValue) {
String trimmed = fieldValue == null ? "" : fieldValue.trim();
if (trimmed.isEmpty() || !trimmed.startsWith("[")) {
return 0;
}
try {
return JSONUtil.parseArray(trimmed).size();
} catch (Exception e) {
log.warn("populateStaffCount 解析员工人数失败, fieldValue:{}", fieldValue);
return 0;
}
}
/** /**
* @description: 门店日报上报 * @description: 门店日报上报
* @param: [dailyReportRecordDTO] * @param: [dailyReportRecordDTO]
......
...@@ -55,6 +55,7 @@ public class ExtendedWarrantyExcelService { ...@@ -55,6 +55,7 @@ public class ExtendedWarrantyExcelService {
private static final String OTHER_DATA_STATISTICS_TEMPLATE = "延保权益-其他品牌数据统计表.xlsx"; private static final String OTHER_DATA_STATISTICS_TEMPLATE = "延保权益-其他品牌数据统计表.xlsx";
private static final String OTHER_AFTER_SALE_TEMPLATE = "延保权益-其他品牌售后引荐表.xlsx"; private static final String OTHER_AFTER_SALE_TEMPLATE = "延保权益-其他品牌售后引荐表.xlsx";
private static final String OTHER_NEGOTIATION_TEMPLATE = "延保权益-其他品牌洽谈明细表.xlsx"; private static final String OTHER_NEGOTIATION_TEMPLATE = "延保权益-其他品牌洽谈明细表.xlsx";
private static final String OTHER_DELIVERY_TEMPLATE = "延保权益-其他品牌交付部数据统计表.xlsx";
private static final int DATA_START_ROW_INDEX = 2; private static final int DATA_START_ROW_INDEX = 2;
private static final int NEGOTIATION_DATA_START_ROW_INDEX = 1; private static final int NEGOTIATION_DATA_START_ROW_INDEX = 1;
...@@ -168,6 +169,28 @@ public class ExtendedWarrantyExcelService { ...@@ -168,6 +169,28 @@ public class ExtendedWarrantyExcelService {
Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_DIR + HM_AFTER_SALE_TEMPLATE), DATA_START_ROW_INDEX); Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_DIR + HM_AFTER_SALE_TEMPLATE), DATA_START_ROW_INDEX);
} }
public String fillOtherDeliveryStatisticsExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) {
if (data == null || CollectionUtils.isEmpty(data.getOtherDeliveryStatisticsRows())) return null;
return EasyExcelUtil.exportExcelNoDateFormat(data.getOtherDeliveryStatisticsRows(),
"extended-warranty-other-delivery-" + UUID.randomUUID().toString().substring(0, 8),
new HashMap<String, String>() {{
put("merchantName", data.getMerchantName());
put("yearMonth", data.getYearMonth());
}},
Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_DIR + OTHER_DELIVERY_TEMPLATE), DATA_START_ROW_INDEX);
}
public String fillOtherAfterSaleReferralStatisticsExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) {
if (data == null || CollectionUtils.isEmpty(data.getAfterSaleReferralStatisticsRows())) return null;
return EasyExcelUtil.exportExcelNoDateFormat(data.getAfterSaleReferralStatisticsRows(),
"extended-warranty-other-after-sale-" + UUID.randomUUID().toString().substring(0, 8),
new HashMap<String, String>() {{
put("merchantName", data.getMerchantName());
put("yearMonth", data.getYearMonth());
}},
Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_DIR + OTHER_AFTER_SALE_TEMPLATE), DATA_START_ROW_INDEX);
}
public String fillNegotiationDetailExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) { public String fillNegotiationDetailExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) {
if (data == null || CollectionUtils.isEmpty(data.getNegotiationDetailRows())) return null; if (data == null || CollectionUtils.isEmpty(data.getNegotiationDetailRows())) return null;
return EasyExcelUtil.exportExcelNoDateFormat(data.getNegotiationDetailRows(), return EasyExcelUtil.exportExcelNoDateFormat(data.getNegotiationDetailRows(),
...@@ -200,6 +223,16 @@ public class ExtendedWarrantyExcelService { ...@@ -200,6 +223,16 @@ public class ExtendedWarrantyExcelService {
DATA_START_ROW_INDEX); DATA_START_ROW_INDEX);
} }
public String fillOtherNegotiationDetailExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) {
if (data == null || CollectionUtils.isEmpty(data.getOtherNegotiationDetailRows())) return null;
return EasyExcelUtil.exportExcelNoDateFormat(data.getOtherNegotiationDetailRows(),
"extended-warranty-other-negotiation-" + UUID.randomUUID().toString().substring(0, 8),
new HashMap<String, String>() {{
put("merchantName", data.getMerchantName());
}},
Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_DIR + OTHER_NEGOTIATION_TEMPLATE), DATA_START_ROW_INDEX);
}
public String fillLanTuDataStatisticsExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) { public String fillLanTuDataStatisticsExcelAndGetOssUrl(ExtendedWarrantyDailyReportData data) {
return buildExcelOssUrl(data, LANTU_DATA_STATISTICS_TEMPLATE, "extended-warranty-lantu-data-statistics", return buildExcelOssUrl(data, LANTU_DATA_STATISTICS_TEMPLATE, "extended-warranty-lantu-data-statistics",
data == null ? null : data.getDataStatisticsRows(), data == null ? null : data.getDataStatisticsRows(),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!