Commit 6c00cf48 by zhouhaibao

Merge branch 'v5.5.1' of http://192.168.3.233:8090/dj/rpc-dj-pe-analysis into v5.5.1

# Conflicts:
#	rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessAnalysisService.java
2 parents d97c7deb 1f5d4594
Showing 44 changed files with 1076 additions and 368 deletions
...@@ -5,6 +5,8 @@ import lombok.Data; ...@@ -5,6 +5,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable;
/** /**
* 查询参数实体类 * 查询参数实体类
*/ */
...@@ -12,7 +14,7 @@ import lombok.ToString; ...@@ -12,7 +14,7 @@ import lombok.ToString;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
public class DataBizQueryParamsDTO { public class DataBizQueryParamsDTO implements Serializable {
/** /**
* 业务类型:1.延保 2.轻改 3.权益 4.二手车 必传 * 业务类型:1.延保 2.轻改 3.权益 4.二手车 必传
......
...@@ -5,7 +5,6 @@ import lombok.Data; ...@@ -5,7 +5,6 @@ import lombok.Data;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
...@@ -30,8 +29,7 @@ public class MerchantBiMatterAddDTO implements Serializable { ...@@ -30,8 +29,7 @@ public class MerchantBiMatterAddDTO implements Serializable {
private String storeName; private String storeName;
/** bi侧业务类型,1.延保 2.轻改 3.权益 4.二手车 */ /** bi侧业务类型,1.延保 2.轻改 3.权益 4.二手车 */
@NotBlank(message = "业务类型不能为空") @InList(values = {"1", "2", "3"}, message = "业务类型错误")
@InList(values = {"1", "2", "3", "4"}, message = "业务类型错误")
private String businessType; private String businessType;
/** 创建人 */ /** 创建人 */
...@@ -49,11 +47,11 @@ public class MerchantBiMatterAddDTO implements Serializable { ...@@ -49,11 +47,11 @@ public class MerchantBiMatterAddDTO implements Serializable {
/** 线上运营 */ /** 线上运营 */
@Valid @Valid
@NotEmpty(message = "线上运营不能为空") // @NotEmpty(message = "线上运营不能为空")
private List<MerchantBiMatterDTO.@Valid OperatorDTO> onlineOperator; private List<MerchantBiMatterDTO.@Valid OperatorDTO> onlineOperator;
/** 区域运营 */ /** 区域运营 */
@Valid @Valid
@NotEmpty(message = "区域运营不能为空") // @NotEmpty(message = "区域运营不能为空")
private List<MerchantBiMatterDTO.@Valid OperatorDTO> areaOperator; private List<MerchantBiMatterDTO.@Valid OperatorDTO> areaOperator;
} }
package cn.com.glsx.dj.peanalysis.dto.analysis;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* BI-获取指定店铺的区域运营与线上运营
* @author yangwei
* @version 1.0
* @since 2025/12/12 14:32
*/
@Data
public class MerchantOperatorDTO implements Serializable {
private static final long serialVersionUID = -6305914594430462509L;
@NotNull(message = "商户号不能为空")
private String storeNo;
/** bi侧业务类型,1.延保 2.轻改 3.权益,不传为全业务
* @see cn.com.glsx.dj.peanalysis.enums.BusinessTypeEnum
* */
private String businessType;
/** 指定业务类型下的业务方向,不传为全业务方向 */
private List<String> directorTypes;
}
package cn.com.glsx.dj.peanalysis.dto.analysis;
import com.google.common.collect.Lists;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* BI-获取指定店铺的区域运营与线上运营
* @author yangwei
* @version 1.0
* @since 2025/12/23 14:38
*/
@Data
public class MerchantOperatorDetailDTO implements Serializable {
private static final long serialVersionUID = -965245024707014296L;
/** 门店编号 */
private String storeNo;
/** 线上运营 */
private List<MerchantBiMatterDTO.OperatorDTO> onlineOperator = Lists.newArrayList();
/** 区域运营 */
private List<MerchantBiMatterDTO.OperatorDTO> areaOperator = Lists.newArrayList();
}
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.LinkedHashMap;
/** /**
* 门店毛利率导入实体 * 门店毛利率导入实体
...@@ -24,7 +24,7 @@ public class MerchantProfitRecordImportDTO implements Serializable { ...@@ -24,7 +24,7 @@ public class MerchantProfitRecordImportDTO implements Serializable {
* 导入数据 * 导入数据
*/ */
@NotEmpty(message = "导入数据不能为空") @NotEmpty(message = "导入数据不能为空")
private Map<Integer, MerchantProfitRecordImportDataDTO> data; private LinkedHashMap<Integer, MerchantProfitRecordImportDataDTO> data;
/** /**
* 操作人 * 操作人
......
package cn.com.glsx.dj.peanalysis.dto.analysis;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* BI-运营人员
*
* @author yangwei
* @since 2025/12/12 15:08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OperatorDTO implements Serializable {
private static final long serialVersionUID = 876528795009583617L;
/**
* 员工uuid
*/
@NotBlank(message = "员工uuid不能为空")
private String uuid;
/**
* 运营人员名称
*/
@NotBlank(message = "运营人员名称不能为空")
private String username;
}
\ No newline at end of file \ No newline at end of file
...@@ -74,4 +74,23 @@ public class BiRecord { ...@@ -74,4 +74,23 @@ public class BiRecord {
*/ */
private char deletedFlag; private char deletedFlag;
/**
* 根据业务类型取值
* @param bizs 1:全业务;2:延保;3:权益;4:轻改;5:二手车
*/
public Integer getStoreTypeByBizs(Integer bizs) {
switch (bizs){
case 2:
return this.extWarrantyStoreType;
case 3:
return this.benefitsStoreType;
case 4:
return this.lightModStoreType;
case 5:
return this.usedCarStoreType;
default:
return null;
}
}
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.peanalysis.dto.req.output; package cn.com.glsx.dj.peanalysis.dto.req.output;
import cn.com.glsx.dj.peanalysis.dto.DataBizQueryParamsDTO; import cn.com.glsx.dj.peanalysis.dto.DataBizQueryParamsDTO;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map;
@Data @Data
@Slf4j @Slf4j
...@@ -14,29 +16,97 @@ public class SceneBaseReq implements Serializable { ...@@ -14,29 +16,97 @@ public class SceneBaseReq implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty(notes = "排序:1-产值(默认),2-客单价,3-转化率") @ApiModelProperty(notes = "业务场景(0.会员权益,1.精品升级),必须,默认会员权益")
private Integer sortType; private Byte sceneType;
@ApiModelProperty(notes = "排序:1-降序(默认),2-升序") @ApiModelProperty(notes = "业务类型(1.延保 2.轻改 3.权益)")
private Integer bizs;
@ApiModelProperty(notes = "周期类型(1.按天,2.按周,3.按月,4.自定义,5.按年),必须", required = true)
private Integer cycleType;
@ApiModelProperty(notes = "开始时间", required = true)
private String startTime;
@ApiModelProperty(notes = "结束时间")
private String endTime;
@ApiModelProperty(notes = "车品牌ID")
private Integer carBrandId;
@ApiModelProperty(notes = "省份编码")
private String provinceId;
@ApiModelProperty(notes = "门店类型 1新店 2老店")
private Byte storeType;
@ApiModelProperty(notes = "经营品类 1单品类 2多品类")
private Byte businessCategory;
@ApiModelProperty(notes = "业务性质(1:直营4S店,2:合资收公司,3:服务商")
private Byte businessType;
@ApiModelProperty(notes = "排序")
private Integer orderBy; private Integer orderBy;
@ApiModelProperty(notes = "排序方式 1.Desc 2.asc")
private Integer orderType;
@ApiModelProperty(notes = "门店号列表") @ApiModelProperty(notes = "门店号列表")
private List<Integer> merchantIds; private List<Integer> merchantIds;
@ApiModelProperty(notes = "员工Id列表") @ApiModelProperty(notes = "门店号聚合")
private Map<String, List<Integer>> merchantMap;
@ApiModelProperty(notes = "员工编号列表")
private List<String> staffUuids; private List<String> staffUuids;
@ApiModelProperty(notes = "模糊搜索")
private String search;
@ApiModelProperty(notes = "指标查询参数") @ApiModelProperty(notes = "指标查询参数")
private DataBizQueryParamsDTO queryParams; private DataBizQueryParamsDTO queryParams;
@ApiModelProperty(notes = "周期类型(1.按天,2.按周,3.按月,4.自定义,5.按年),必须", required = true)
private Integer cycleType;
private String preStartDate; private String preStartDate;
private String preEndDate; private String preEndDate;
/** /**
* 转换指标参数
*/
public DataBizQueryParamsDTO getQueryParams() {
if (this.queryParams == null) {
this.queryParams = new DataBizQueryParamsDTO();
queryParams.setStartDate(startTime);
queryParams.setEndDate(endTime);
queryParams.setBizs(bizs);
queryParams.setDateType(convertQueryParamCycleType());
}
return queryParams;
}
/**
* 转换周期传参,适配指标传参
* permissionRequest.cycleType:request筛选参数:1.按天,2.按周,3.按月,4.自定义
* queryParams.dataType:指标参数:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
public Integer convertQueryParamCycleType() {
switch (cycleType) {
case 1:
case 4:
return 0;
case 2:
return 1;
case 3:
return 2;
case 5:
return 3;
default:
throw new RpcServiceException("不支持的周期类型");
}
}
/**
* *
* Bizs 1.延保 2.轻改 3.权益 4.二手车 * Bizs 1.延保 2.轻改 3.权益 4.二手车
* BusinessType 0:轻改,1:权益;2:延保 * BusinessType 0:轻改,1:权益;2:延保
......
...@@ -13,13 +13,13 @@ public class ContactRateAnalysisResponse implements Serializable { ...@@ -13,13 +13,13 @@ public class ContactRateAnalysisResponse implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("省份编码") @ApiModelProperty(notes = "省份编码")
private String provinceId; private Integer provinceId;
@ApiModelProperty("省份名称") @ApiModelProperty(notes = "省份名称")
private String provinceName; private String provinceName;
@ApiModelProperty("触客率") @ApiModelProperty(notes = "触客率")
private BigDecimal contactRate; private BigDecimal contactRate;
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,73 +15,73 @@ public class EmployeeDetailSummaryResponse implements Serializable { ...@@ -15,73 +15,73 @@ public class EmployeeDetailSummaryResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("总产值") @ApiModelProperty(notes = "总产值")
private BigDecimal totalOutputValue; private BigDecimal totalOutputValue;
@ApiModelProperty("总产值环比") @ApiModelProperty(notes = "总产值环比")
private BigDecimal totalOutputValueMom; private String totalOutputValueMom;
@ApiModelProperty("客单价") @ApiModelProperty(notes = "客单价")
private BigDecimal avgCustomerPrice; private BigDecimal avgCustomerPrice;
@ApiModelProperty("客单价环比") @ApiModelProperty(notes = "客单价环比")
private BigDecimal avgCustomerPriceMom; private String avgCustomerPriceMom;
@ApiModelProperty("日报完成率") @ApiModelProperty(notes = "日报完成率")
private BigDecimal dailyReportCompletionRate; private BigDecimal dailyReportCompletionRate;
@ApiModelProperty("售前触客数") @ApiModelProperty(notes = "售前触客数")
private BigDecimal preSalesContactCount; private BigDecimal preSalesContactCount;
@ApiModelProperty("售前触客数环比") @ApiModelProperty(notes = "售前触客数环比")
private BigDecimal preSalesContactCountMom; private String preSalesContactCountMom;
@ApiModelProperty("售后触客数") @ApiModelProperty(notes = "售后触客数")
private BigDecimal afterSalesContactCount; private BigDecimal afterSalesContactCount;
@ApiModelProperty("售后触客数环比") @ApiModelProperty(notes = "售后触客数环比")
private BigDecimal afterSalesContactCountMom; private String afterSalesContactCountMom;
@ApiModelProperty("总触客数") @ApiModelProperty(notes = "总触客数")
private BigDecimal totalContactCount; private BigDecimal totalContactCount;
@ApiModelProperty("总触客数环比") @ApiModelProperty(notes = "总触客数环比")
private BigDecimal totalContactCountMom; private String totalContactCountMom;
@ApiModelProperty("售前成交数") @ApiModelProperty(notes = "售前成交数")
private BigDecimal preSalesDealCount; private BigDecimal preSalesDealCount;
@ApiModelProperty("售前成交数环比") @ApiModelProperty(notes = "售前成交数环比")
private BigDecimal preSalesDealCountMom; private String preSalesDealCountMom;
@ApiModelProperty("售后成交数") @ApiModelProperty(notes = "售后成交数")
private BigDecimal afterSalesDealCount; private BigDecimal afterSalesDealCount;
@ApiModelProperty("售后成交数环比") @ApiModelProperty(notes = "售后成交数环比")
private BigDecimal afterSalesDealCountMom; private String afterSalesDealCountMom;
@ApiModelProperty("总成交数") @ApiModelProperty(notes = "总成交数")
private BigDecimal totalDealCount; private BigDecimal totalDealCount;
@ApiModelProperty("总成交数环比") @ApiModelProperty(notes = "总成交数环比")
private BigDecimal totalDealCountMom; private String totalDealCountMom;
@ApiModelProperty("售前转化率") @ApiModelProperty(notes = "售前转化率")
private BigDecimal preSalesConversionRate; private BigDecimal preSalesConversionRate;
@ApiModelProperty("售前转化率环比") @ApiModelProperty(notes = "售前转化率环比")
private BigDecimal preSalesConversionRateMom; private String preSalesConversionRateMom;
@ApiModelProperty("售后转化率") @ApiModelProperty(notes = "售后转化率")
private BigDecimal afterSalesConversionRate; private BigDecimal afterSalesConversionRate;
@ApiModelProperty("售后转化率环比") @ApiModelProperty(notes = "售后转化率环比")
private BigDecimal afterSalesConversionRateMom; private String afterSalesConversionRateMom;
@ApiModelProperty("转化率") @ApiModelProperty(notes = "转化率")
private BigDecimal conversionRate; private BigDecimal conversionRate;
@ApiModelProperty("转化率环比") @ApiModelProperty(notes = "转化率环比")
private BigDecimal conversionRateMom; private String conversionRateMom;
} }
...@@ -14,142 +14,142 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -14,142 +14,142 @@ public class GoodsCategorySummaryResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("新车交付数") @ApiModelProperty(notes = "新车交付数")
private BigDecimal newCarDeliveryCount; private BigDecimal newCarDeliveryCount;
@ApiModelProperty("整车延保-成交数") @ApiModelProperty(notes = "整车延保-成交数")
private BigDecimal vehicleWarrantyDealCount; private BigDecimal vehicleWarrantyDealCount;
@ApiModelProperty("整车延保-渗透率") @ApiModelProperty(notes = "整车延保-渗透率")
private BigDecimal vehicleWarrantyPenetrationRate; private BigDecimal vehicleWarrantyPenetrationRate;
@ApiModelProperty("整车延保-渗透率兜底目标") @ApiModelProperty(notes = "整车延保-渗透率兜底目标")
private BigDecimal vehicleWarrantyPenetrationBottomTarget; private BigDecimal vehicleWarrantyPenetrationBottomTarget;
@ApiModelProperty("整车延保-转化率") @ApiModelProperty(notes = "整车延保-转化率")
private BigDecimal vehicleWarrantyConversionRate; private BigDecimal vehicleWarrantyConversionRate;
@ApiModelProperty("整车延保-转化率兜底目标") @ApiModelProperty(notes = "整车延保-转化率兜底目标")
private BigDecimal vehicleWarrantyConversionBottomTarget; private BigDecimal vehicleWarrantyConversionBottomTarget;
@ApiModelProperty("整车延保-生态系数") @ApiModelProperty(notes = "整车延保-生态系数")
private BigDecimal vehicleWarrantyEcoCoefficient; private BigDecimal vehicleWarrantyEcoCoefficient;
@ApiModelProperty("安心包-成交数") @ApiModelProperty(notes = "安心包-成交数")
private BigDecimal safetyPackageDealCount; private BigDecimal safetyPackageDealCount;
@ApiModelProperty("安心包-渗透率") @ApiModelProperty(notes = "安心包-渗透率")
private BigDecimal safetyPackagePenetrationRate; private BigDecimal safetyPackagePenetrationRate;
@ApiModelProperty("安心包-渗透率兜底目标") @ApiModelProperty(notes = "安心包-渗透率兜底目标")
private BigDecimal safetyPackagePenetrationBottomTarget; private BigDecimal safetyPackagePenetrationBottomTarget;
@ApiModelProperty("安心包-转化率") @ApiModelProperty(notes = "安心包-转化率")
private BigDecimal safetyPackageConversionRate; private BigDecimal safetyPackageConversionRate;
@ApiModelProperty("安心包-转化率兜底目标") @ApiModelProperty(notes = "安心包-转化率兜底目标")
private BigDecimal safetyPackageConversionBottomTarget; private BigDecimal safetyPackageConversionBottomTarget;
@ApiModelProperty("安心包-生态系数") @ApiModelProperty(notes = "安心包-生态系数")
private BigDecimal safetyPackageEcoCoefficient; private BigDecimal safetyPackageEcoCoefficient;
@ApiModelProperty("电池延保-成交数") @ApiModelProperty(notes = "电池延保-成交数")
private BigDecimal batteryWarrantyDealCount; private BigDecimal batteryWarrantyDealCount;
@ApiModelProperty("电池延保-渗透率") @ApiModelProperty(notes = "电池延保-渗透率")
private BigDecimal batteryWarrantyPenetrationRate; private BigDecimal batteryWarrantyPenetrationRate;
@ApiModelProperty("电池延保-渗透率兜底目标") @ApiModelProperty(notes = "电池延保-渗透率兜底目标")
private BigDecimal batteryWarrantyPenetrationBottomTarget; private BigDecimal batteryWarrantyPenetrationBottomTarget;
@ApiModelProperty("电池延保-转化率") @ApiModelProperty(notes = "电池延保-转化率")
private BigDecimal batteryWarrantyConversionRate; private BigDecimal batteryWarrantyConversionRate;
@ApiModelProperty("电池延保-转化率兜底目标") @ApiModelProperty(notes = "电池延保-转化率兜底目标")
private BigDecimal batteryWarrantyConversionBottomTarget; private BigDecimal batteryWarrantyConversionBottomTarget;
@ApiModelProperty("电池延保-生态系数") @ApiModelProperty(notes = "电池延保-生态系数")
private BigDecimal batteryWarrantyEcoCoefficient; private BigDecimal batteryWarrantyEcoCoefficient;
@ApiModelProperty("轮胎延保-成交数") @ApiModelProperty(notes = "轮胎延保-成交数")
private BigDecimal tireWarrantyDealCount; private BigDecimal tireWarrantyDealCount;
@ApiModelProperty("轮胎延保-渗透率") @ApiModelProperty(notes = "轮胎延保-渗透率")
private BigDecimal tireWarrantyPenetrationRate; private BigDecimal tireWarrantyPenetrationRate;
@ApiModelProperty("轮胎延保-渗透率兜底目标") @ApiModelProperty(notes = "轮胎延保-渗透率兜底目标")
private BigDecimal tireWarrantyPenetrationBottomTarget; private BigDecimal tireWarrantyPenetrationBottomTarget;
@ApiModelProperty("轮胎延保-转化率") @ApiModelProperty(notes = "轮胎延保-转化率")
private BigDecimal tireWarrantyConversionRate; private BigDecimal tireWarrantyConversionRate;
@ApiModelProperty("轮胎延保-转化率兜底目标") @ApiModelProperty(notes = "轮胎延保-转化率兜底目标")
private BigDecimal tireWarrantyConversionBottomTarget; private BigDecimal tireWarrantyConversionBottomTarget;
@ApiModelProperty("轮胎延保-生态系数") @ApiModelProperty(notes = "轮胎延保-生态系数")
private BigDecimal tireWarrantyEcoCoefficient; private BigDecimal tireWarrantyEcoCoefficient;
@ApiModelProperty("车窗膜-成交数") @ApiModelProperty(notes = "车窗膜-成交数")
private BigDecimal windowFilmDealCount; private BigDecimal windowFilmDealCount;
@ApiModelProperty("车窗膜-单车采购产值") @ApiModelProperty(notes = "车窗膜-单车采购产值")
private BigDecimal windowFilmPerCarOutput; private BigDecimal windowFilmPerCarOutput;
@ApiModelProperty("车窗膜-渗透率") @ApiModelProperty(notes = "车窗膜-渗透率")
private BigDecimal windowFilmPenetrationRate; private BigDecimal windowFilmPenetrationRate;
@ApiModelProperty("车窗膜-渗透率兜底目标") @ApiModelProperty(notes = "车窗膜-渗透率兜底目标")
private BigDecimal windowFilmPenetrationBottomTarget; private BigDecimal windowFilmPenetrationBottomTarget;
@ApiModelProperty("车窗膜-转化率") @ApiModelProperty(notes = "车窗膜-转化率")
private BigDecimal windowFilmConversionRate; private BigDecimal windowFilmConversionRate;
@ApiModelProperty("车窗膜-转化率兜底目标") @ApiModelProperty(notes = "车窗膜-转化率兜底目标")
private BigDecimal windowFilmConversionBottomTarget; private BigDecimal windowFilmConversionBottomTarget;
@ApiModelProperty("车窗膜-生态系数") @ApiModelProperty(notes = "车窗膜-生态系数")
private BigDecimal windowFilmEcoCoefficient; private BigDecimal windowFilmEcoCoefficient;
@ApiModelProperty("车身膜-成交数") @ApiModelProperty(notes = "车身膜-成交数")
private BigDecimal carBodyFilmDealCount; private BigDecimal carBodyFilmDealCount;
@ApiModelProperty("车身膜-单车采购产值") @ApiModelProperty(notes = "车身膜-单车采购产值")
private BigDecimal carBodyFilmPerCarOutput; private BigDecimal carBodyFilmPerCarOutput;
@ApiModelProperty("车身膜-渗透率") @ApiModelProperty(notes = "车身膜-渗透率")
private BigDecimal carBodyFilmPenetrationRate; private BigDecimal carBodyFilmPenetrationRate;
@ApiModelProperty("车身膜-渗透率兜底目标") @ApiModelProperty(notes = "车身膜-渗透率兜底目标")
private BigDecimal carBodyFilmPenetrationBottomTarget; private BigDecimal carBodyFilmPenetrationBottomTarget;
@ApiModelProperty("车身膜-转化率") @ApiModelProperty(notes = "车身膜-转化率")
private BigDecimal carBodyFilmConversionRate; private BigDecimal carBodyFilmConversionRate;
@ApiModelProperty("车身膜-转化率兜底目标") @ApiModelProperty(notes = "车身膜-转化率兜底目标")
private BigDecimal carBodyFilmConversionBottomTarget; private BigDecimal carBodyFilmConversionBottomTarget;
@ApiModelProperty("车身膜-生态系数") @ApiModelProperty(notes = "车身膜-生态系数")
private BigDecimal carBodyFilmEcoCoefficient; private BigDecimal carBodyFilmEcoCoefficient;
@ApiModelProperty("精品附件-成交数") @ApiModelProperty(notes = "精品附件-成交数")
private BigDecimal accessoriesDealCount; private BigDecimal accessoriesDealCount;
@ApiModelProperty("精品附件-单车采购产值") @ApiModelProperty(notes = "精品附件-单车采购产值")
private BigDecimal accessoriesPerCarOutput; private BigDecimal accessoriesPerCarOutput;
@ApiModelProperty("精品附件-渗透率") @ApiModelProperty(notes = "精品附件-渗透率")
private BigDecimal accessoriesPenetrationRate; private BigDecimal accessoriesPenetrationRate;
@ApiModelProperty("精品附件-渗透率兜底目标") @ApiModelProperty(notes = "精品附件-渗透率兜底目标")
private BigDecimal accessoriesPenetrationBottomTarget; private BigDecimal accessoriesPenetrationBottomTarget;
@ApiModelProperty("精品附件-转化率") @ApiModelProperty(notes = "精品附件-转化率")
private BigDecimal accessoriesConversionRate; private BigDecimal accessoriesConversionRate;
@ApiModelProperty("精品附件-转化率兜底目标") @ApiModelProperty(notes = "精品附件-转化率兜底目标")
private BigDecimal accessoriesConversionBottomTarget; private BigDecimal accessoriesConversionBottomTarget;
@ApiModelProperty("精品附件-生态系数") @ApiModelProperty(notes = "精品附件-生态系数")
private BigDecimal accessoriesEcoCoefficient; private BigDecimal accessoriesEcoCoefficient;
} }
...@@ -12,16 +12,16 @@ import java.math.BigDecimal; ...@@ -12,16 +12,16 @@ import java.math.BigDecimal;
public class NewStoreAnalysisResponse implements Serializable { public class NewStoreAnalysisResponse implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("潜客数") @ApiModelProperty(notes = "潜客数")
private Integer potentialCustomerCount; private Integer potentialCustomerCount;
@ApiModelProperty("签约数") @ApiModelProperty(notes = "签约数")
private Integer signedCustomerCount; private Integer signedCustomerCount;
@ApiModelProperty("展业数") @ApiModelProperty(notes = "展业数")
private Integer newStoreCount; private Integer newStoreCount;
@ApiModelProperty("展业目标达成率(仅月周期展示)") @ApiModelProperty(notes = "展业目标达成率(仅月周期展示)")
private BigDecimal targetAchievementRate; private BigDecimal targetAchievementRate;
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(description = "区域分布响应") @ApiModel(description = "区域分布响应")
...@@ -13,12 +14,15 @@ public class RegionalDistributionResponse implements Serializable { ...@@ -13,12 +14,15 @@ public class RegionalDistributionResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("省份编码") @ApiModelProperty(notes = "省份编码")
private String provinceId; private Integer provinceId;
@ApiModelProperty("开单门店数") @ApiModelProperty(notes = "省份名称")
private String provinceName;
@ApiModelProperty(notes = "开单门店数")
private Integer storeCount; private Integer storeCount;
@ApiModelProperty("新车交付数总和") @ApiModelProperty(notes = "新车交付数总和")
private Integer deliveryCount; private BigDecimal deliveryCount;
} }
...@@ -13,13 +13,16 @@ import java.math.BigDecimal; ...@@ -13,13 +13,16 @@ import java.math.BigDecimal;
public class SceneOutputResponse implements Serializable { public class SceneOutputResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("目标产值") @ApiModelProperty(notes = "目标产值")
private BigDecimal targetOutputValue; private BigDecimal targetOutputValue;
@ApiModelProperty("产值") @ApiModelProperty(notes = "产值")
private BigDecimal outputValue; private BigDecimal outputValue;
@ApiModelProperty("达成率") @ApiModelProperty(notes = "产值环比")
private BigDecimal outputValueMon;
@ApiModelProperty(notes = "达成率")
private BigDecimal ratio; private BigDecimal ratio;
} }
...@@ -14,39 +14,39 @@ public class StoreAvgResponse implements Serializable { ...@@ -14,39 +14,39 @@ public class StoreAvgResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("店均产值") @ApiModelProperty(notes = "店均产值")
private BigDecimal avgStoreOutput; private BigDecimal avgStoreOutput;
@ApiModelProperty("店均产值环比") @ApiModelProperty(notes = "店均产值环比")
private BigDecimal avgStoreOutputMom; private BigDecimal avgStoreOutputMom;
@ApiModelProperty("平均触客率") @ApiModelProperty(notes = "平均触客率")
private BigDecimal avgCustomerContactRate; private BigDecimal avgCustomerContactRate;
@ApiModelProperty("平均触客率环比") @ApiModelProperty(notes = "平均触客率环比")
private BigDecimal avgCustomerContactRateMom; private BigDecimal avgCustomerContactRateMom;
@ApiModelProperty("平均渗透率") @ApiModelProperty(notes = "平均渗透率")
private BigDecimal avgPenetrationRate; private BigDecimal avgPenetrationRate;
@ApiModelProperty("平均渗透率环比") @ApiModelProperty(notes = "平均渗透率环比")
private BigDecimal avgPenetrationRateMom; private BigDecimal avgPenetrationRateMom;
@ApiModelProperty("平均转化率") @ApiModelProperty(notes = "平均转化率")
private BigDecimal avgConversionRate; private BigDecimal avgConversionRate;
@ApiModelProperty("平均转化率环比") @ApiModelProperty(notes = "平均转化率环比")
private BigDecimal avgConversionRateMom; private BigDecimal avgConversionRateMom;
@ApiModelProperty("平均客单价") @ApiModelProperty(notes = "平均客单价")
private BigDecimal avgCustomerPrice; private BigDecimal avgCustomerPrice;
@ApiModelProperty("平均客单价环比") @ApiModelProperty(notes = "平均客单价环比")
private BigDecimal avgCustomerPriceMom; private BigDecimal avgCustomerPriceMom;
@ApiModelProperty("升级客单价") @ApiModelProperty(notes = "升级客单价")
private BigDecimal upgradeCustomerPrice; private BigDecimal upgradeCustomerPrice;
@ApiModelProperty("升级客单价环比") @ApiModelProperty(notes = "升级客单价环比")
private BigDecimal upgradeCustomerPriceMom; private BigDecimal upgradeCustomerPriceMom;
} }
...@@ -17,112 +17,112 @@ public class StoreDetailSummaryResponse implements Serializable { ...@@ -17,112 +17,112 @@ public class StoreDetailSummaryResponse implements Serializable {
private String merchantId; private String merchantId;
@ApiModelProperty("所属服务商") @ApiModelProperty(notes = "所属服务商")
private String shopMerchantName; private String shopMerchantName;
@ApiModelProperty("所属服务商ID") @ApiModelProperty(notes = "所属服务商ID")
private String shopMerchantId; private String shopMerchantId;
@ApiModelProperty("销售") @ApiModelProperty(notes = "销售")
private String sellerUserName; private String sellerUserName;
@ApiModelProperty("销售ID") @ApiModelProperty(notes = "销售ID")
private String sellerUserId; private String sellerUserId;
@ApiModelProperty("区域运营") @ApiModelProperty(notes = "区域运营")
private String regionalOperationName; private String regionalOperationName;
@ApiModelProperty("区域运营ID") @ApiModelProperty(notes = "区域运营ID")
private String regionalOperationId; private String regionalOperationId;
@ApiModelProperty("线上运营") @ApiModelProperty(notes = "线上运营")
private String onlineOperationName; private String onlineOperationName;
@ApiModelProperty("线上运营ID") @ApiModelProperty(notes = "线上运营ID")
private String onlineOperationId; private String onlineOperationId;
@ApiModelProperty("总产值") @ApiModelProperty(notes = "总产值")
private BigDecimal totalOutputValue; private BigDecimal totalOutputValue;
@ApiModelProperty("总产值环比") @ApiModelProperty(notes = "总产值环比")
private BigDecimal totalOutputValueMom; private String totalOutputValueMom;
@ApiModelProperty("目标产值(仅月周期展示)") @ApiModelProperty(notes = "目标产值(仅月周期展示)")
private BigDecimal targetOutputValue; private BigDecimal targetOutputValue;
@ApiModelProperty("达成率(仅月周期展示)") @ApiModelProperty(notes = "达成率(仅月周期展示)")
private BigDecimal achievementRate; private BigDecimal achievementRate;
@ApiModelProperty("新车交付数") @ApiModelProperty(notes = "新车交付数")
private BigDecimal newCarDeliveryCount; private BigDecimal newCarDeliveryCount;
@ApiModelProperty("新车交付数环比") @ApiModelProperty(notes = "新车交付数环比")
private BigDecimal newCarDeliveryCountMom; private String newCarDeliveryCountMom;
@ApiModelProperty("售前触客数") @ApiModelProperty(notes = "售前触客数")
private BigDecimal preSalesContactCount; private BigDecimal preSalesContactCount;
@ApiModelProperty("售前触客数环比") @ApiModelProperty(notes = "售前触客数环比")
private BigDecimal preSalesContactCountMom; private String preSalesContactCountMom;
@ApiModelProperty("售后触客数") @ApiModelProperty(notes = "售后触客数")
private BigDecimal afterSalesContactCount; private BigDecimal afterSalesContactCount;
@ApiModelProperty("售后触客数环比") @ApiModelProperty(notes = "售后触客数环比")
private BigDecimal afterSalesContactCountMom; private String afterSalesContactCountMom;
@ApiModelProperty("总触客数") @ApiModelProperty(notes = "总触客数")
private BigDecimal totalContactCount; private BigDecimal totalContactCount;
@ApiModelProperty("总触客数环比") @ApiModelProperty(notes = "总触客数环比")
private BigDecimal totalContactCountMom; private String totalContactCountMom;
@ApiModelProperty("触客率") @ApiModelProperty(notes = "触客率")
private BigDecimal contactRate; private BigDecimal contactRate;
@ApiModelProperty("触客率环比") @ApiModelProperty(notes = "触客率环比")
private BigDecimal contactRateMom; private String contactRateMom;
@ApiModelProperty("售前成交数") @ApiModelProperty(notes = "售前成交数")
private BigDecimal preSalesDealCount; private BigDecimal preSalesDealCount;
@ApiModelProperty("售前成交数环比") @ApiModelProperty(notes = "售前成交数环比")
private BigDecimal preSalesDealCountMom; private String preSalesDealCountMom;
@ApiModelProperty("售后成交数") @ApiModelProperty(notes = "售后成交数")
private BigDecimal afterSalesDealCount; private BigDecimal afterSalesDealCount;
@ApiModelProperty("售后成交数环比") @ApiModelProperty(notes = "售后成交数环比")
private BigDecimal afterSalesDealCountMom; private String afterSalesDealCountMom;
@ApiModelProperty("总成交数") @ApiModelProperty(notes = "总成交数")
private BigDecimal totalDealCount; private BigDecimal totalDealCount;
@ApiModelProperty("总成交数环比") @ApiModelProperty(notes = "总成交数环比")
private BigDecimal totalDealCountMom; private String totalDealCountMom;
@ApiModelProperty("售前转化率") @ApiModelProperty(notes = "售前转化率")
private BigDecimal preSalesConversionRate; private BigDecimal preSalesConversionRate;
@ApiModelProperty("售前转化率环比") @ApiModelProperty(notes = "售前转化率环比")
private BigDecimal preSalesConversionRateMom; private String preSalesConversionRateMom;
@ApiModelProperty("售后转化率") @ApiModelProperty(notes = "售后转化率")
private BigDecimal afterSalesConversionRate; private BigDecimal afterSalesConversionRate;
@ApiModelProperty("售后转化率环比") @ApiModelProperty(notes = "售后转化率环比")
private BigDecimal afterSalesConversionRateMom; private String afterSalesConversionRateMom;
@ApiModelProperty("转化率") @ApiModelProperty(notes = "转化率")
private BigDecimal conversionRate; private BigDecimal conversionRate;
@ApiModelProperty("转化率环比") @ApiModelProperty(notes = "转化率环比")
private BigDecimal conversionRateMom; private String conversionRateMom;
@ApiModelProperty("渗透率") @ApiModelProperty(notes = "渗透率")
private BigDecimal penetrationRate; private BigDecimal penetrationRate;
@ApiModelProperty("渗透率环比") @ApiModelProperty(notes = "渗透率环比")
private BigDecimal penetrationRateMom; private String penetrationRateMom;
} }
...@@ -20,10 +20,10 @@ public class StoreEmployeeRankResponse implements Serializable { ...@@ -20,10 +20,10 @@ public class StoreEmployeeRankResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("员工列表") @ApiModelProperty(notes = "员工列表")
private List<EmployeeAnalysisItem> employeeList; private List<EmployeeAnalysisItem> employeeList;
@ApiModelProperty("门店汇总数据") @ApiModelProperty(notes = "门店汇总数据")
private StoreSummaryData storeSummary; private StoreSummaryData storeSummary;
@ApiModel("员工分析项") @ApiModel("员工分析项")
...@@ -33,31 +33,31 @@ public class StoreEmployeeRankResponse implements Serializable { ...@@ -33,31 +33,31 @@ public class StoreEmployeeRankResponse implements Serializable {
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public static class EmployeeAnalysisItem { public static class EmployeeAnalysisItem {
@ApiModelProperty("员工ID") @ApiModelProperty(notes = "员工ID")
private String employeeId; private String employeeId;
@ApiModelProperty("员工姓名") @ApiModelProperty(notes = "员工姓名")
private String employeeName; private String employeeName;
@ApiModelProperty("员工手机号") @ApiModelProperty(notes = "员工手机号")
private String employeePhone; private String employeePhone;
@ApiModelProperty("个人产值") @ApiModelProperty(notes = "个人产值")
private BigDecimal personalOutputValue; private BigDecimal personalOutputValue;
@ApiModelProperty("个人客单价") @ApiModelProperty(notes = "个人客单价")
private BigDecimal personalCustomerPrice; private BigDecimal personalCustomerPrice;
@ApiModelProperty("个人转化率") @ApiModelProperty(notes = "个人转化率")
private BigDecimal personalConversionRate; private BigDecimal personalConversionRate;
// @ApiModelProperty("个人成交客户数") // @ApiModelProperty(notes = "个人成交客户数")
// private Integer personalDealCustomerCount; // private Integer personalDealCustomerCount;
// //
// @ApiModelProperty("个人总触客数") // @ApiModelProperty(notes = "个人总触客数")
// private Integer personalTotalContactCount; // private Integer personalTotalContactCount;
@ApiModelProperty("排名") @ApiModelProperty(notes = "排名")
private Integer rank; private Integer rank;
public EmployeeAnalysisItem(DataBusinessDTO data) { public EmployeeAnalysisItem(DataBusinessDTO data) {
...@@ -69,22 +69,22 @@ public class StoreEmployeeRankResponse implements Serializable { ...@@ -69,22 +69,22 @@ public class StoreEmployeeRankResponse implements Serializable {
@Data @Data
public static class StoreSummaryData { public static class StoreSummaryData {
@ApiModelProperty("门店总产值") @ApiModelProperty(notes = "门店总产值")
private BigDecimal totalOutputValue; private BigDecimal totalOutputValue;
// @ApiModelProperty("门店总成交客户数") // @ApiModelProperty(notes = "门店总成交客户数")
// private Integer totalDealCustomerCount; // private Integer totalDealCustomerCount;
// //
// @ApiModelProperty("有效驻店人员数量") // @ApiModelProperty(notes = "有效驻店人员数量")
// private Integer effectiveStaffCount; // private Integer effectiveStaffCount;
@ApiModelProperty("平均产值") @ApiModelProperty(notes = "平均产值")
private BigDecimal averageOutputValue; private BigDecimal averageOutputValue;
@ApiModelProperty("平均客单价") @ApiModelProperty(notes = "平均客单价")
private BigDecimal averageCustomerPrice; private BigDecimal averageCustomerPrice;
@ApiModelProperty("平均转化率") @ApiModelProperty(notes = "平均转化率")
private BigDecimal averageConversionRate; private BigDecimal averageConversionRate;
} }
} }
...@@ -18,37 +18,38 @@ public class StoreListResponse implements Serializable { ...@@ -18,37 +18,38 @@ public class StoreListResponse implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@ApiModelProperty("门店名称") @ApiModelProperty(notes = "门店名称")
private String storeName; private String storeName;
@ApiModelProperty("门店id") @ApiModelProperty(notes = "门店id")
private Integer storeId; private Integer storeId;
@ApiModelProperty("产值") @ApiModelProperty(notes = "产值")
private BigDecimal outputValue; private BigDecimal outputValue;
@ApiModelProperty("达成率") @ApiModelProperty(notes = "达成率")
private BigDecimal achievementRate; private BigDecimal achievementRate;
@ApiModelProperty("触客率") @ApiModelProperty(notes = "触客率")
private BigDecimal customerContactRate; private BigDecimal customerContactRate;
@ApiModelProperty("渗透率") @ApiModelProperty(notes = "渗透率")
private BigDecimal penetrationRate; private BigDecimal penetrationRate;
@ApiModelProperty("转化率") @ApiModelProperty(notes = "转化率")
private BigDecimal conversionRate; private BigDecimal conversionRate;
@ApiModelProperty("升客价") @ApiModelProperty(notes = "升客价")
private BigDecimal upgradeCustomerPrice; private BigDecimal upgradeCustomerPrice;
@ApiModelProperty("客单价") @ApiModelProperty(notes = "客单价")
private BigDecimal avgCustomerPrice; private BigDecimal avgCustomerPrice;
@ApiModelProperty("门店状态 1:正常 2:兜底预警 3:生态指标预警 4:达成率不及预期") @ApiModelProperty(notes = "门店状态 1:正常 2:兜底预警 3:生态指标预警 4:达成率不及预期")
private List<String> storeStatus; private List<String> storeStatus;
public StoreListResponse(Integer storeId) { public StoreListResponse(Integer storeId, String storeName) {
this.storeId = storeId; this.storeId = storeId;
this.storeName = storeName;
} }
} }
...@@ -15,78 +15,78 @@ public class StoreSceneSummaryResponse implements Serializable { ...@@ -15,78 +15,78 @@ public class StoreSceneSummaryResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("总开单门店数") @ApiModelProperty(notes = "总开单门店数")
private Integer totalStores; private Integer totalStores;
@ApiModelProperty("总开单门店环比") @ApiModelProperty(notes = "总开单门店环比")
private BigDecimal totalStoresMom; private BigDecimal totalStoresMom;
@ApiModelProperty("新店数量") @ApiModelProperty(notes = "新店数量")
private Integer newStores; private Integer newStores;
@ApiModelProperty("新店占比") @ApiModelProperty(notes = "新店占比")
private BigDecimal newStoresRatio; private BigDecimal newStoresRatio;
@ApiModelProperty("新店商户号") @ApiModelProperty(notes = "新店商户号")
private List<Integer> newStoreIds; private List<Integer> newStoreIds;
@ApiModelProperty("新店环比") @ApiModelProperty(notes = "新店环比")
private BigDecimal newStoresMom; private BigDecimal newStoresMom;
@ApiModelProperty("老店数量") @ApiModelProperty(notes = "老店数量")
private Integer oldStores; private Integer oldStores;
@ApiModelProperty("老店占比") @ApiModelProperty(notes = "老店占比")
private BigDecimal oldStoresRatio; private BigDecimal oldStoresRatio;
@ApiModelProperty("老店环比") @ApiModelProperty(notes = "老店环比")
private BigDecimal oldStoresMom; private BigDecimal oldStoresMom;
@ApiModelProperty("老店商户号") @ApiModelProperty(notes = "老店商户号")
private List<Integer> oldStoreIds; private List<Integer> oldStoreIds;
@ApiModelProperty("多品类门店数量") @ApiModelProperty(notes = "多品类门店数量")
private Integer multiCategoryStores; private Integer multiCategoryStores;
@ApiModelProperty("多品类门店环比") @ApiModelProperty(notes = "多品类门店环比")
private BigDecimal multiCategoryStoresMom; private BigDecimal multiCategoryStoresMom;
@ApiModelProperty("多品类门店占比") @ApiModelProperty(notes = "多品类门店占比")
private BigDecimal multiCategoryStoresRatio; private BigDecimal multiCategoryStoresRatio;
@ApiModelProperty("多品类门店商户号") @ApiModelProperty(notes = "多品类门店商户号")
private List<Integer> multiCategoryStoreIds; private List<Integer> multiCategoryStoreIds;
@ApiModelProperty("单品类门店数量") @ApiModelProperty(notes = "单品类门店数量")
private Integer singleCategoryStores; private Integer singleCategoryStores;
@ApiModelProperty("单品类门店环比") @ApiModelProperty(notes = "单品类门店环比")
private BigDecimal singleCategoryStoresMom; private BigDecimal singleCategoryStoresMom;
@ApiModelProperty("单品类门店占比") @ApiModelProperty(notes = "单品类门店占比")
private BigDecimal singleCategoryStoresRatio; private BigDecimal singleCategoryStoresRatio;
@ApiModelProperty("多品类门店商户号") @ApiModelProperty(notes = "多品类门店商户号")
private List<Integer> singleCategoryStoreIds; private List<Integer> singleCategoryStoreIds;
@ApiModelProperty("流失门店") @ApiModelProperty(notes = "流失门店")
private Integer churnedStores; private Integer churnedStores;
@ApiModelProperty("流失率") @ApiModelProperty(notes = "流失率")
private BigDecimal churnRate; private BigDecimal churnRate;
@ApiModelProperty("流失门店商户号") @ApiModelProperty(notes = "流失门店商户号")
private List<Integer> churnedStoreIds; private List<Integer> churnedStoreIds;
@ApiModelProperty("兜底预警门店数量") @ApiModelProperty(notes = "兜底预警门店数量")
private Integer bottomLineWarningStores; private Integer bottomLineWarningStores;
@ApiModelProperty("兜底预警门店商户号") @ApiModelProperty(notes = "兜底预警门店商户号")
private List<Integer> bottomLineWarningStoreIds; private List<Integer> bottomLineWarningStoreIds;
@ApiModelProperty("生态指标预警门店数量") @ApiModelProperty(notes = "生态指标预警门店数量")
private Integer ecosystemWarningStores; private Integer ecosystemWarningStores;
@ApiModelProperty("生态指标预警门店商户号") @ApiModelProperty(notes = "生态指标预警门店商户号")
private List<Integer> ecosystemWarningStoreIds; private List<Integer> ecosystemWarningStoreIds;
} }
...@@ -11,28 +11,28 @@ import java.io.Serializable; ...@@ -11,28 +11,28 @@ import java.io.Serializable;
public class TrafficContributionRankResponse implements Serializable { public class TrafficContributionRankResponse implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("排名") @ApiModelProperty(notes = "排名")
private Integer rank; private Integer rank;
@ApiModelProperty("员工ID") @ApiModelProperty(notes = "员工ID")
private String employeeId; private String employeeId;
@ApiModelProperty("员工姓名") @ApiModelProperty(notes = "员工姓名")
private String employeeName; private String employeeName;
@ApiModelProperty("员工手机号") @ApiModelProperty(notes = "员工手机号")
private String employeePhone; private String employeePhone;
@ApiModelProperty("所属门店名称") @ApiModelProperty(notes = "所属门店名称")
private String storeName; private String storeName;
@ApiModelProperty("流量贡献总数") @ApiModelProperty(notes = "流量贡献总数")
private Integer totalTrafficContribution; private Integer totalTrafficContribution;
@ApiModelProperty("战败订单数") @ApiModelProperty(notes = "战败订单数")
private Integer defeatedOrderCount; private Integer defeatedOrderCount;
@ApiModelProperty("升级订单数") @ApiModelProperty(notes = "升级订单数")
private Integer upgradedOrderCount; private Integer upgradedOrderCount;
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,12 +14,12 @@ public class TrafficSummaryResponse implements Serializable { ...@@ -14,12 +14,12 @@ public class TrafficSummaryResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("月流量范围") @ApiModelProperty(notes = "月流量范围")
private String label; private String label;
@ApiModelProperty("流量数值") @ApiModelProperty(notes = "流量数值")
private BigDecimal value; private BigDecimal value;
@ApiModelProperty("占比") @ApiModelProperty(notes = "占比")
private BigDecimal ratio; private BigDecimal ratio;
} }
...@@ -13,12 +13,12 @@ import java.math.BigDecimal; ...@@ -13,12 +13,12 @@ import java.math.BigDecimal;
public class TrendOutputResponse implements Serializable { public class TrendOutputResponse implements Serializable {
private static final long serialVersionUID = -1; private static final long serialVersionUID = -1;
@ApiModelProperty("时间") @ApiModelProperty(notes = "时间")
private String time; private String time;
@ApiModelProperty("产值") @ApiModelProperty(notes = "产值")
private BigDecimal output; private BigDecimal output;
@ApiModelProperty("达成率") @ApiModelProperty(notes = "达成率")
private BigDecimal ratio; private BigDecimal ratio;
} }
...@@ -32,7 +32,17 @@ public enum BiErrorEnum implements ErrorEnum { ...@@ -32,7 +32,17 @@ public enum BiErrorEnum implements ErrorEnum {
BI_MATTER_HANDLED("10000007", "事项状态已处理,无法进行处理,请确认后重新操作"), BI_MATTER_HANDLED("10000007", "事项状态已处理,无法进行处理,请确认后重新操作"),
BI_MATTER_HANDLED_UNSUPPORTED_DEL("10000008", "事项状态已处理,无法删除!"), BI_MATTER_HANDLED_UNSUPPORTED_DEL("10000008", "事项状态已处理,无法删除!"),
;
BUSINESS_TYPE_NOT_EXIST("10000009", "业务类型不存在!"),
NOT_SUPPORT_BUSINESS_TYPE_ERROR("10000010", "不支持的业务类型!"),
NO_ONLINE_AREA_OPERATOR_ERROR("10000011", "无可跟进的线上运营或区域运营,请确认后重新操作;"),
SEND_MESSAGE_ERROR("10000012", "发送消息失败!"),
BI_MATTER_OPERATOR_NOT_EMPTY("10000013", "线上运营与区域运营不能同时为空!");
private final String value; private final String value;
......
package cn.com.glsx.dj.peanalysis.enums; package cn.com.glsx.dj.peanalysis.enums;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
...@@ -39,4 +40,13 @@ public enum BusinessTypeEnum { ...@@ -39,4 +40,13 @@ public enum BusinessTypeEnum {
} }
return null; return null;
} }
public static BusinessTypeEnum getByCode(String code) {
for (BusinessTypeEnum value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
throw new RpcServiceException(BiErrorEnum.BUSINESS_TYPE_NOT_EXIST);
}
} }
...@@ -79,4 +79,9 @@ public interface BiAnalyseBackgroundRemote { ...@@ -79,4 +79,9 @@ public interface BiAnalyseBackgroundRemote {
@ApiParam(name = "request", notes = "处理参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "request", notes = "处理参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("新增待跟进事项") @ApiResponse("新增待跟进事项")
RpcResponse<Boolean> merchantBiMatterAdd(MerchantBiMatterAddDTO request); RpcResponse<Boolean> merchantBiMatterAdd(MerchantBiMatterAddDTO request);
@ApiMethod("BI-获取指定店铺的区域运营与线上运营")
@ApiParam(name = "request", notes = "处理参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("获取指定店铺的区域运营与线上运营")
RpcResponse<MerchantOperatorDetailDTO> findMerchantOperator(MerchantOperatorDTO request);
} }
package cn.com.glsx.dj.peanalysis.remote; package cn.com.glsx.dj.peanalysis.remote;
import cn.com.glsx.dj.peanalysis.dto.job.BiRecord;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq; import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.*; import cn.com.glsx.dj.peanalysis.dto.res.output.*;
import cn.com.glsx.framework.core.annotation.ApiMethod; import cn.com.glsx.framework.core.annotation.ApiMethod;
...@@ -56,4 +57,7 @@ public interface BusinessSceneAnalysisRemote { ...@@ -56,4 +57,7 @@ public interface BusinessSceneAnalysisRemote {
@ApiMethod("商品品类分析") @ApiMethod("商品品类分析")
RpcResponse<GoodsCategorySummaryResponse> goodsSummary(SceneBaseReq req); RpcResponse<GoodsCategorySummaryResponse> goodsSummary(SceneBaseReq req);
@ApiMethod("查询BI统计信息中的门店")
RpcResponse<List<BiRecord>> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate);
} }
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
<version>5.5.1-SNAPSHOT</version> <version>5.5.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-smartcarlife-api</artifactId> <artifactId>rpc-dj-smartcarlife-api</artifactId>
<version>5.5.0-SNAPSHOT</version> <version>5.5.0-SNAPSHOT</version>
......
package cn.com.glsx.dj.peanalysis.config;
import cn.com.glsx.dj.mindworkplate.remote.BiAnalysisRemote;
import lombok.RequiredArgsConstructor;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* rpc-dj-mindworkplate dubbo 配置
* @author yangwei
* @version 1.0
* @since 2025/12/15 17:17
*/
@Configuration
@RequiredArgsConstructor
public class MindWorkPlateDubboConfig {
private final ReferenceBuilderFactory factory;
@Bean
public BiAnalysisRemote biAnalysisRemote(){
return factory
.builder(BiAnalysisRemote.class)
.check(false)
.timeout(30000)
.build();
}
}
...@@ -9,6 +9,6 @@ public class SmartCarLifeDubboConfig extends DubboConfig { ...@@ -9,6 +9,6 @@ public class SmartCarLifeDubboConfig extends DubboConfig {
@Bean @Bean
public MerchantOutputTargetConfigRemote merchantOutputTargetConfigRemote(){ public MerchantOutputTargetConfigRemote merchantOutputTargetConfigRemote(){
return factory.builder(MerchantOutputTargetConfigRemote.class).check(check).timeout(timeout).build(); return factory.builder(MerchantOutputTargetConfigRemote.class).version("1.0.0").check(check).timeout(timeout).build();
} }
} }
...@@ -126,7 +126,7 @@ public interface BusinessIntelligenceMapper { ...@@ -126,7 +126,7 @@ public interface BusinessIntelligenceMapper {
/** /**
* 查询二手车开店数量 * 查询二手车开店数量
*/ */
List<TrendChartRes> countUsedCarMerchants(@Param("statDateList") List<Pair<String, String>> statDateList); List<TrendChartRes> countUsedCarMerchants(@Param("statDateList") List<Pair<String, String>> statDateList, @Param("merchantIds") List<Integer> merchantIds);
List<Integer> getZyMerchantIds(@Param("property") String property); List<Integer> getZyMerchantIds(@Param("property") String property);
} }
\ No newline at end of file \ No newline at end of file
...@@ -12,5 +12,8 @@ import java.util.List; ...@@ -12,5 +12,8 @@ import java.util.List;
public interface GoodsOrderMapper extends OreMapper<GoodsOrder> { public interface GoodsOrderMapper extends OreMapper<GoodsOrder> {
List<TrafficContributionRankResponse> findTrafficRank(@Param("staffUuids") List<String> staffUuids, @Param("scene") Integer sceneType); List<TrafficContributionRankResponse> findTrafficRank(
@Param("merchantIds") List<Integer> merchantIds,
@Param("staffUuids") List<String> staffUuids,
@Param("scene") Integer sceneType);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.peanalysis.mapper; package cn.com.glsx.dj.peanalysis.mapper;
import cn.com.glsx.dj.peanalysis.dto.analysis.MerchantBiMatterBaseQryDTO; import cn.com.glsx.dj.peanalysis.dto.analysis.*;
import cn.com.glsx.dj.peanalysis.dto.analysis.MerchantBiMatterDTO;
import cn.com.glsx.dj.peanalysis.dto.analysis.MyMerchantBiMatterDTO;
import cn.com.glsx.dj.peanalysis.dto.analysis.MyMerchantBiMatterQryDTO;
import cn.com.glsx.dj.peanalysis.dto.req.MerchantBiMatterSearchReq; import cn.com.glsx.dj.peanalysis.dto.req.MerchantBiMatterSearchReq;
import cn.com.glsx.dj.peanalysis.model.MerchantBiMatter; import cn.com.glsx.dj.peanalysis.model.MerchantBiMatter;
import cn.com.glsx.dj.smartcarlife.model.ShopMerchantDirectorConfig;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -26,4 +24,6 @@ public interface MerchantBiMatterMapper extends OreMapper<MerchantBiMatter> { ...@@ -26,4 +24,6 @@ public interface MerchantBiMatterMapper extends OreMapper<MerchantBiMatter> {
List<MyMerchantBiMatterDTO> selectMyBiMatterList(MyMerchantBiMatterQryDTO condition); List<MyMerchantBiMatterDTO> selectMyBiMatterList(MyMerchantBiMatterQryDTO condition);
Integer selectMyBiMatterCount(String userUnique); Integer selectMyBiMatterCount(String userUnique);
List<ShopMerchantDirectorConfig> selectBiMerchantOperator(MerchantOperatorDTO request);
} }
\ No newline at end of file \ No newline at end of file
...@@ -278,4 +278,25 @@ public class BiAnalyseBackgroundRemoteImpl implements BiAnalyseBackgroundRemote ...@@ -278,4 +278,25 @@ public class BiAnalyseBackgroundRemoteImpl implements BiAnalyseBackgroundRemote
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
/**
* BI-获取指定店铺的区域运营与线上运营
* @author yangwei
* @since 2025/12/22 11:25
* @param request 详情请求参数
* @return cn.com.glsx.framework.core.beans.rpc.RpcResponse<cn.com.glsx.dj.peanalysis.dto.analysis.MerchantBiMatterDTO>
*/
@Override
public RpcResponse<MerchantOperatorDetailDTO> findMerchantOperator(MerchantOperatorDTO request) {
try {
MerchantOperatorDetailDTO merchantOperatorDetailDTO = biAnalyseBackgroundService.findMerchantOperator(request);
return RpcResponse.success(merchantOperatorDetailDTO);
} catch (RpcServiceException e) {
log.error("BI-获取指定店铺的区域运营与线上运营调用异常!", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("BI-获取指定店铺的区域运营与线上运营调用异常!", e);
return RpcResponse.error(e);
}
}
} }
package cn.com.glsx.dj.peanalysis.remote; package cn.com.glsx.dj.peanalysis.remote;
import cn.com.glsx.dj.peanalysis.dto.job.BiRecord;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq; import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.*; import cn.com.glsx.dj.peanalysis.dto.res.output.*;
import cn.com.glsx.dj.peanalysis.service.BusinessSceneAnalysisService; import cn.com.glsx.dj.peanalysis.service.BusinessSceneAnalysisService;
...@@ -200,4 +201,17 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem ...@@ -200,4 +201,17 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
} }
} }
@Override
public RpcResponse<List<BiRecord>> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate){
try {
return RpcResponse.success(businessSceneAnalysisService.getBiRecords(businessType, merchantIds, startDate, endDate));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("系统异常", e);
return RpcResponse.error(e);
}
}
} }
package cn.com.glsx.dj.peanalysis.service; package cn.com.glsx.dj.peanalysis.service;
import cn.com.glsx.dj.mindworkplate.dto.bianalyse.MatterAddPushWeChatMsgDTO;
import cn.com.glsx.dj.mindworkplate.remote.BiAnalysisRemote;
import cn.com.glsx.dj.peanalysis.constants.SymbolConstants; import cn.com.glsx.dj.peanalysis.constants.SymbolConstants;
import cn.com.glsx.dj.peanalysis.converter.MerchantProfitRecordConvert; import cn.com.glsx.dj.peanalysis.converter.MerchantProfitRecordConvert;
import cn.com.glsx.dj.peanalysis.dto.analysis.*; import cn.com.glsx.dj.peanalysis.dto.analysis.*;
import cn.com.glsx.dj.peanalysis.enums.ActionTypeEnum; import cn.com.glsx.dj.peanalysis.enums.*;
import cn.com.glsx.dj.peanalysis.enums.BiErrorEnum;
import cn.com.glsx.dj.peanalysis.enums.MerchantBiMatterOperatorRoleTypeEnum;
import cn.com.glsx.dj.peanalysis.enums.MerchantBiMatterStatusEnum;
import cn.com.glsx.dj.peanalysis.mapper.*; import cn.com.glsx.dj.peanalysis.mapper.*;
import cn.com.glsx.dj.peanalysis.model.*; import cn.com.glsx.dj.peanalysis.model.*;
import cn.com.glsx.dj.peanalysis.utils.DateUtils; import cn.com.glsx.dj.peanalysis.utils.DateUtils;
import cn.com.glsx.dj.peanalysis.utils.PageUtils; import cn.com.glsx.dj.peanalysis.utils.PageUtils;
import cn.com.glsx.dj.peanalysis.utils.validation.BeanValidationUtils; import cn.com.glsx.dj.peanalysis.utils.validation.BeanValidationUtils;
import cn.com.glsx.dj.peanalysis.validator.ValidationGroup; import cn.com.glsx.dj.peanalysis.validator.ValidationGroup;
import cn.com.glsx.dj.smartcarlife.enums.DirectorTypeEnum;
import cn.com.glsx.dj.smartcarlife.model.ShopMerchantDirectorConfig;
import cn.com.glsx.framework.core.beans.BaseModel; import cn.com.glsx.framework.core.beans.BaseModel;
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;
...@@ -26,6 +27,7 @@ import cn.hutool.core.collection.CollUtil; ...@@ -26,6 +27,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
...@@ -58,6 +60,7 @@ import java.util.stream.Stream; ...@@ -58,6 +60,7 @@ import java.util.stream.Stream;
public class BiAnalyseBackgroundService { public class BiAnalyseBackgroundService {
private final MerchantRemote merchantRemote; private final MerchantRemote merchantRemote;
private final BiAnalysisRemote biAnalysisRemote;
private final MerchantBiMatterMapper merchantBiMatterMapper; private final MerchantBiMatterMapper merchantBiMatterMapper;
private final ProvinceRganizationMapper provinceRganizationMapper; private final ProvinceRganizationMapper provinceRganizationMapper;
private final MerchantProfitRecordMapper merchantProfitRecordMapper; private final MerchantProfitRecordMapper merchantProfitRecordMapper;
...@@ -228,7 +231,9 @@ public class BiAnalyseBackgroundService { ...@@ -228,7 +231,9 @@ public class BiAnalyseBackgroundService {
// 如果有门店名称就要校验门店名称 // 如果有门店名称就要校验门店名称
Map<Integer, String> merchantIdMapName = MapUtil.<Integer, String>builder().build(); Map<Integer, String> merchantIdMapName = MapUtil.<Integer, String>builder().build();
if (values.stream().anyMatch(merchantProfitRecord -> StrUtil.isNotBlank(merchantProfitRecord.getStoreName()))) { if (values.stream().anyMatch(merchantProfitRecord -> StrUtil.isNotBlank(merchantProfitRecord.getStoreName()))) {
List<MerchantNameResponse> merchantNameResponses = searchMerchantName(values.stream().map(ele -> ele.getStoreId().intValue()).collect(Collectors.toList())); List<MerchantNameResponse> merchantNameResponses = searchMerchantName(values.stream()
.filter(ele -> ObjectUtil.isNotNull(ele.getStoreId()))
.map(ele -> ele.getStoreId().intValue()).collect(Collectors.toList()));
merchantIdMapName = merchantNameResponses.stream().collect( merchantIdMapName = merchantNameResponses.stream().collect(
Collectors.toMap(MerchantNameResponse::getMerchantId, MerchantNameResponse::getMerchantName, (pre, next) -> pre)); Collectors.toMap(MerchantNameResponse::getMerchantId, MerchantNameResponse::getMerchantName, (pre, next) -> pre));
} }
...@@ -250,6 +255,11 @@ public class BiAnalyseBackgroundService { ...@@ -250,6 +255,11 @@ public class BiAnalyseBackgroundService {
if (CollUtil.isEmpty(checks)) { if (CollUtil.isEmpty(checks)) {
return uniqueKeyMapMerchantProfitRecord; return uniqueKeyMapMerchantProfitRecord;
} }
// 唯一键不为空的才进行查询
checks = checks.stream().filter(ele -> ObjectUtil.isNotNull(ele.getStoreId())
&& StrUtil.isNotBlank(ele.getBusinessType())
&& StrUtil.isNotBlank(ele.getMonthYear()))
.collect(Collectors.toList());
// or 拼接sql不能过长,影响性能同时mysql对sql语句的字节大小存在限制,故需分批查询 // or 拼接sql不能过长,影响性能同时mysql对sql语句的字节大小存在限制,故需分批查询
List<MerchantProfitRecord> merchantProfitRecords = Lists.newArrayList(); List<MerchantProfitRecord> merchantProfitRecords = Lists.newArrayList();
...@@ -313,20 +323,26 @@ public class BiAnalyseBackgroundService { ...@@ -313,20 +323,26 @@ public class BiAnalyseBackgroundService {
List<String> errors = Lists.newArrayList(); List<String> errors = Lists.newArrayList();
// 月份校验 // 月份校验
if (merchantProfitRecordOperationDTO.getMonthYear().compareTo(nowMonth) > 0) { String monthYear = merchantProfitRecordOperationDTO.getMonthYear();
if (StrUtil.isNotBlank(monthYear)) {
if (monthYear.compareTo(nowMonth) > 0) {
errors.add("无效月份"); errors.add("无效月份");
} }
}
// 重复校验 // 重复校验
String uniqueKey = StrUtil.join(SymbolConstants.UNDERLINE, merchantProfitRecordOperationDTO.getStoreId(), Long storeId = merchantProfitRecordOperationDTO.getStoreId();
merchantProfitRecordOperationDTO.getBusinessType(), merchantProfitRecordOperationDTO.getMonthYear()); String businessType = merchantProfitRecordOperationDTO.getBusinessType();
if (ObjectUtil.isNotNull(storeId) && StrUtil.isNotBlank(businessType) && StrUtil.isNotBlank(monthYear)) {
String uniqueKey = StrUtil.join(SymbolConstants.UNDERLINE, storeId, businessType, monthYear);
if (uniqueKeyMapMerchantProfitRecord.containsKey(uniqueKey)) { if (uniqueKeyMapMerchantProfitRecord.containsKey(uniqueKey)) {
errors.add("已存在"); errors.add("已存在");
} }
}
// 无效商户 // 无效商户
String storeName = merchantProfitRecordOperationDTO.getStoreName(); String storeName = merchantProfitRecordOperationDTO.getStoreName();
if (StrUtil.isNotBlank(storeName)) { if (StrUtil.isNotBlank(storeName) && ObjectUtil.isNotNull(storeId)) {
String merchantName = merchantIdMapName.get(merchantProfitRecordOperationDTO.getStoreId().intValue()); String merchantName = merchantIdMapName.get(merchantProfitRecordOperationDTO.getStoreId().intValue());
if (StrUtil.isBlank(merchantName) || !StrUtil.equalsIgnoreCase(merchantName, storeName)) { if (StrUtil.isBlank(merchantName) || !StrUtil.equalsIgnoreCase(merchantName, storeName)) {
errors.add("无效商户"); errors.add("无效商户");
...@@ -415,7 +431,7 @@ public class BiAnalyseBackgroundService { ...@@ -415,7 +431,7 @@ public class BiAnalyseBackgroundService {
// 获取成功和失败数据 // 获取成功和失败数据
Map<Boolean, Map<Integer, MerchantProfitRecordImportDataDTO>> partitioning = data.entrySet().stream().collect(Collectors.partitioningBy(entry -> Map<Boolean, Map<Integer, MerchantProfitRecordImportDataDTO>> partitioning = data.entrySet().stream().collect(Collectors.partitioningBy(entry ->
CollUtil.isEmpty(entry.getValue().getErrors()), CollUtil.isEmpty(entry.getValue().getErrors()),
Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)) Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, () -> MapUtil.newHashMap(true)))
); );
Map<Integer, MerchantProfitRecordImportDataDTO> successData = partitioning.get(true); Map<Integer, MerchantProfitRecordImportDataDTO> successData = partitioning.get(true);
Map<Integer, MerchantProfitRecordImportDataDTO> failData = partitioning.get(false); Map<Integer, MerchantProfitRecordImportDataDTO> failData = partitioning.get(false);
...@@ -566,6 +582,9 @@ public class BiAnalyseBackgroundService { ...@@ -566,6 +582,9 @@ public class BiAnalyseBackgroundService {
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void merchantBiMatterAdd(MerchantBiMatterAddDTO request) { public void merchantBiMatterAdd(MerchantBiMatterAddDTO request) {
BeanValidationUtils.validateAndThrow(request, Default.class); BeanValidationUtils.validateAndThrow(request, Default.class);
if (CollUtil.isEmpty(request.getOnlineOperator()) && CollUtil.isEmpty(request.getAreaOperator())) {
throw new RpcServiceException(BiErrorEnum.BI_MATTER_OPERATOR_NOT_EMPTY);
}
Date now = new Date(); Date now = new Date();
MerchantBiMatter merchantBiMatter = BeanUtil.copyProperties(request, MerchantBiMatter.class); MerchantBiMatter merchantBiMatter = BeanUtil.copyProperties(request, MerchantBiMatter.class);
...@@ -582,7 +601,17 @@ public class BiAnalyseBackgroundService { ...@@ -582,7 +601,17 @@ public class BiAnalyseBackgroundService {
merchantBiMatterOperatorMapper.insertList(biMatterOperators); merchantBiMatterOperatorMapper.insertList(biMatterOperators);
// todo 向关联的区域运营和线上运营推送企微消息 // 推送微信消息
List<String> uuids = Stream.concat(request.getOnlineOperator().stream().map(MerchantBiMatterDTO.OperatorDTO::getUuid),
request.getAreaOperator().stream().map(MerchantBiMatterDTO.OperatorDTO::getUuid))
.collect(Collectors.toList());
MatterAddPushWeChatMsgDTO msg = MatterAddPushWeChatMsgDTO.builder().pushPerson(request.getCreator()).pushUuids(uuids).build();
log.info("开始推动消息,消息内容:{}", msg);
RpcResponse<Boolean> rpcResponse = biAnalysisRemote.matterAddPushWeChatMsg(msg);
if (rpcResponse.isFailed() || BooleanUtil.isFalse(rpcResponse.getResult())) {
log.error("推送微信消息失败,错误信息:{}", rpcResponse.getMessage());
throw new RpcServiceException(BiErrorEnum.SEND_MESSAGE_ERROR);
}
} }
/** /**
...@@ -725,4 +754,76 @@ public class BiAnalyseBackgroundService { ...@@ -725,4 +754,76 @@ public class BiAnalyseBackgroundService {
Integer unHandleCount = merchantBiMatterMapper.selectMyBiMatterCount(userUnique); Integer unHandleCount = merchantBiMatterMapper.selectMyBiMatterCount(userUnique);
return Optional.ofNullable(unHandleCount).orElse(0); return Optional.ofNullable(unHandleCount).orElse(0);
} }
/**
* 查询商户运营人员详情
* @author yangwei
* @since 2025/12/23 14:42
* @param request 请求参数
* @return cn.com.glsx.dj.peanalysis.dto.analysis.MerchantOperatorDetailDTO
*/
public MerchantOperatorDetailDTO findMerchantOperator(MerchantOperatorDTO request) {
BeanValidationUtils.validateAndThrow(request);
// 转换业务类型为运营方向类型
String businessType = request.getBusinessType();
List<DirectorTypeEnum> directorTypeEnums = convertBusinessType2DirectorType(businessType);
request.setDirectorTypes(directorTypeEnums.stream().map(ele -> ObjectUtil.toString(ele.getValue())).collect(Collectors.toList()));
List<ShopMerchantDirectorConfig> directorConfigs = merchantBiMatterMapper.selectBiMerchantOperator(request);
Map<Byte, List<MerchantBiMatterDTO.OperatorDTO>> directorTypeMapOperator = directorConfigs.stream()
.collect(Collectors.groupingBy(ShopMerchantDirectorConfig::getDirectorType,
Collectors.mapping(ele -> MerchantBiMatterDTO.OperatorDTO.builder()
.uuid(ele.getDirectorUserId())
.username(ele.getDirectorName())
.build(),
Collectors.toList())));
// 处理区域运营和线上运营
MerchantOperatorDetailDTO result = new MerchantOperatorDetailDTO();
result.setStoreNo(request.getStoreNo());
Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.DF_DIRECTOR_2_1.getValue()))
.ifPresent(r -> result.getOnlineOperator().addAll(r));
Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.DF_DIRECTOR.getValue()))
.ifPresent(r -> result.getOnlineOperator().addAll(r));
Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.AREA_SUPERVISION_2_1.getValue()))
.ifPresent(r -> result.getAreaOperator().addAll(r));
Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.AREA_SUPERVISION_1_1.getValue()))
.ifPresent(r -> result.getAreaOperator().addAll(r));
// 无关联的线上运营或区域运营,则无法提交并toast:无可跟进的线上运营或区域运营,请确认后重新操作;
if (CollUtil.isEmpty(result.getOnlineOperator()) && CollUtil.isEmpty(result.getAreaOperator())) {
throw new RpcServiceException(BiErrorEnum.NO_ONLINE_AREA_OPERATOR_ERROR);
}
return result;
}
/**
* 业务类型转换为运营方向类型
* @author yangwei
* @since 2025/12/23 14:49
* @param businessType 业务类型
* @return java.util.List<cn.com.glsx.dj.peanalysis.enums.DirectorTypeEnum>
*/
public List<DirectorTypeEnum> convertBusinessType2DirectorType(String businessType) {
if (StrUtil.isBlank(businessType)) {
return Lists.newArrayList(DirectorTypeEnum.DF_DIRECTOR_2_1,
DirectorTypeEnum.AREA_SUPERVISION_2_1,
DirectorTypeEnum.DF_DIRECTOR,
DirectorTypeEnum.AREA_SUPERVISION_1_1);
}
BusinessTypeEnum businessTypeEnum = BusinessTypeEnum.getByCode(businessType);
switch (businessTypeEnum) {
case BUSINESS_TYPE_1:
case BUSINESS_TYPE_3:
return Lists.newArrayList(DirectorTypeEnum.DF_DIRECTOR_2_1, DirectorTypeEnum.AREA_SUPERVISION_2_1);
case BUSINESS_TYPE_2:
return Lists.newArrayList(DirectorTypeEnum.DF_DIRECTOR, DirectorTypeEnum.AREA_SUPERVISION_1_1);
default:
throw new RpcServiceException(BiErrorEnum.NOT_SUPPORT_BUSINESS_TYPE_ERROR);
}
}
} }
...@@ -1886,19 +1886,21 @@ public class BusinessAnalysisService { ...@@ -1886,19 +1886,21 @@ public class BusinessAnalysisService {
public TotalOutputResponse getTotalOutput(List<DataBusinessDTO> content) { public TotalOutputResponse getTotalOutput(List<DataBusinessDTO> content) {
TotalOutputResponse result = new TotalOutputResponse(); TotalOutputResponse result = new TotalOutputResponse();
int i = 0; int i = 0;
BigDecimal totalOutput = result.getTotalOutput() == null ? BigDecimal.ZERO : result.getTotalOutput();
if (CollUtil.isNotEmpty(content)) { if (CollUtil.isNotEmpty(content)) {
for (DataBusinessDTO dataBusinessDTO : content) { for (DataBusinessDTO dataBusinessDTO : content) {
if (Objects.nonNull(dataBusinessDTO.getItemValue())) { if (Objects.nonNull(dataBusinessDTO.getItemValue())) {
result.setTotalOutput(result.getTotalOutput().add(dataBusinessDTO.getItemValue())); totalOutput = totalOutput.add(dataBusinessDTO.getItemValue());
i++; i++;
} }
} }
} }
result.setTotalOutput(totalOutput);
result.setStoreCount((long) i); result.setStoreCount((long) i);
return result; return result;
} }
private List<MerchantProvinceDTO> getProvinceByMerchantIdConcurrent(List<Integer> merchantIds) { public List<MerchantProvinceDTO> getProvinceByMerchantIdConcurrent(List<Integer> merchantIds) {
if (CollUtil.isEmpty(merchantIds)) { if (CollUtil.isEmpty(merchantIds)) {
return new ArrayList<>(); return new ArrayList<>();
} }
......
...@@ -22,9 +22,8 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -22,9 +22,8 @@ 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 cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest; import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.request.serviceCenter.SearchMerchantRpcRequest; import cn.com.glsx.merchants.model.response.MerchantProvinceDTO;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse; import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.model.response.merchant.MerchantNameResponse;
import cn.com.glsx.merchants.remote.MerchantRemote; import cn.com.glsx.merchants.remote.MerchantRemote;
import cn.com.glsx.merchants.remote.MerchantStaffRemote; import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
...@@ -48,6 +47,7 @@ import javax.annotation.Resource; ...@@ -48,6 +47,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -92,22 +92,25 @@ public class BusinessSceneAnalysisService { ...@@ -92,22 +92,25 @@ public class BusinessSceneAnalysisService {
@Resource @Resource
private DataStatsConfig dataStatsConfig; private DataStatsConfig dataStatsConfig;
/** /**
* 总产值、目标产值、达成率 * 总产值、目标产值、达成率
*/ */
public SceneOutputResponse sceneOutput(SceneBaseReq req) { public SceneOutputResponse sceneOutput(SceneBaseReq req) {
SceneOutputResponse res = new SceneOutputResponse(); SceneOutputResponse res = new SceneOutputResponse();
// 查询总产值 // 查询总产值
DataBizQueryParamsDTO queryParams = req.getQueryParams() == null ? new DataBizQueryParamsDTO() : req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId); queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
queryParams.setItemCodes(DataStatsConstants.ITEM_CODE_A036); queryParams.setItemCodes(DataStatsConstants.ITEM_CODE_A036);
TotalOutputResponse totalOutput = businessAnalysisService.getTotalOutput(queryParams); List<DataBusinessDTO> totalOutputList = businessAnalysisService.getTotalOutputGroupByMerchant(queryParams);
if (totalOutput == null) { if (CollectionUtils.isEmpty(totalOutputList)) {
log.warn("查询总产值返回空"); log.warn("查询总产值返回空");
return res; return res;
} }
log.info("查询总产值:{}", totalOutput); log.info("查询总产值:{}", totalOutputList);
res.setOutputValue(totalOutput.getTotalOutput()); DataBusinessDTO totalOutput = mergeDataList(totalOutputList);
res.setOutputValue(totalOutput.getItemValue());
res.setOutputValueMon(new BigDecimal(totalOutput.getRate()));
// 查询目标产值(周期=月时才展示) // 查询目标产值(周期=月时才展示)
Map<Integer, BigDecimal> storeTargetOutputMap = queryStoreTargetOutput(req); Map<Integer, BigDecimal> storeTargetOutputMap = queryStoreTargetOutput(req);
...@@ -125,9 +128,6 @@ public class BusinessSceneAnalysisService { ...@@ -125,9 +128,6 @@ public class BusinessSceneAnalysisService {
*/ */
private Map<Integer, BigDecimal> queryStoreTargetOutput(SceneBaseReq req) { private Map<Integer, BigDecimal> queryStoreTargetOutput(SceneBaseReq req) {
Map<Integer, BigDecimal> res = new HashMap<>(); Map<Integer, BigDecimal> res = new HashMap<>();
if (CollectionUtils.isEmpty(req.getMerchantIds())) {
return res;
}
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
// 仅当周期为月可查 // 仅当周期为月可查
...@@ -186,7 +186,6 @@ public class BusinessSceneAnalysisService { ...@@ -186,7 +186,6 @@ public class BusinessSceneAnalysisService {
if (CollectionUtils.isEmpty(req.getStaffUuids())) { if (CollectionUtils.isEmpty(req.getStaffUuids())) {
queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ",")); queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ","));
} }
queryParams.setMerchantIds(StringUtils.join(req.getMerchantIds(), ","));
List<DataBusinessDTO> trendOutputList = businessAnalysisService.getTotalOutputGroupByMerchant(queryParams); List<DataBusinessDTO> trendOutputList = businessAnalysisService.getTotalOutputGroupByMerchant(queryParams);
if (CollectionUtils.isEmpty(trendOutputList)) { if (CollectionUtils.isEmpty(trendOutputList)) {
log.warn("查询产值趋势及达成率返回空"); log.warn("查询产值趋势及达成率返回空");
...@@ -674,12 +673,53 @@ public class BusinessSceneAnalysisService { ...@@ -674,12 +673,53 @@ public class BusinessSceneAnalysisService {
} }
/** /**
* 区域分布
* 区域省份的:开单门店数、新车交付数总和 * 区域省份的:开单门店数、新车交付数总和
* 仅统计区域=全部且使用角色=管理层及总部运营、区域运营大区经理、销售大区经理时,才展示该模块 * 仅统计区域=全部且使用角色=管理层及总部运营、区域运营大区经理、销售大区经理时,才展示该模块
*/ */
public List<RegionalDistributionResponse> regionalDistribution(SceneBaseReq req) { public List<RegionalDistributionResponse> regionalDistribution(SceneBaseReq req) {
// todo List<RegionalDistributionResponse> res = new ArrayList<>();
return null;
// 查询指标
DataBizQueryParamsDTO queryParams = req.getQueryParams();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
queryParams.setExts("merchantIds");
queryParams.setItemCodes(DataStatsConstants.ITEM_CODE_A062);
DataResp<List<DataBusinessDTO>> dataResp = getDataStatsService.getListDataResp(JSON.toJSONString(queryParams));
if (CollectionUtils.isEmpty(dataResp.getContent())) {
log.info("查询指标返回空, req:{}, res:{}", queryParams, dataResp);
return res;
}
Map<Integer, List<DataBusinessDTO>> dataMerchantMap = dataResp.getContent().stream()
.collect(Collectors.groupingBy(p -> p.getMerchantId()));
// 查询区域
List<MerchantProvinceDTO> provinceList = businessAnalysisService.getProvinceByMerchantIdConcurrent(new ArrayList<>(dataMerchantMap.keySet()));
if (CollectionUtils.isEmpty(provinceList)) {
log.info("查询区域返回空, req:{}, res:{}", queryParams, provinceList);
return res;
}
provinceList.stream()
.filter(p -> p.getProvinceCode() != null)
.collect(Collectors.groupingBy(p -> p.getProvinceCode()))
.forEach((provinceCode, merchants) -> {
RegionalDistributionResponse item = new RegionalDistributionResponse();
item.setProvinceId(provinceCode);
item.setProvinceName(merchants.get(0).getProvinceName());
AtomicInteger storeCount = new AtomicInteger();
merchants.stream()
.filter(p -> dataMerchantMap.containsKey(p.getMerchantId()))
.forEach(p -> {
List<DataBusinessDTO> dataList = dataMerchantMap.get(p.getMerchantId());
DataBusinessDTO data = mergeDataList(dataList);
item.setDeliveryCount(data.getItemValue());
storeCount.getAndIncrement();
});
item.setStoreCount(storeCount.get());
res.add(item);
});
return res;
} }
/** /**
...@@ -706,7 +746,7 @@ public class BusinessSceneAnalysisService { ...@@ -706,7 +746,7 @@ public class BusinessSceneAnalysisService {
.build() .build()
) )
); );
res.setPotentialCustomerCount( res.setSignedCustomerCount(
salePotentialCustomersMapper.countStoreSummary( salePotentialCustomersMapper.countStoreSummary(
SalePotentialCustomersReq.builder() SalePotentialCustomersReq.builder()
.merchantIds(req.getMerchantIds()) .merchantIds(req.getMerchantIds())
...@@ -716,7 +756,7 @@ public class BusinessSceneAnalysisService { ...@@ -716,7 +756,7 @@ public class BusinessSceneAnalysisService {
.build() .build()
) )
); );
res.setPotentialCustomerCount( res.setNewStoreCount(
salePotentialCustomersMapper.countStoreSummary( salePotentialCustomersMapper.countStoreSummary(
SalePotentialCustomersReq.builder() SalePotentialCustomersReq.builder()
.merchantIds(req.getMerchantIds()) .merchantIds(req.getMerchantIds())
...@@ -729,7 +769,8 @@ public class BusinessSceneAnalysisService { ...@@ -729,7 +769,8 @@ public class BusinessSceneAnalysisService {
// 展业目标达成率=(展业数/展业目标)*100% // 展业目标达成率=(展业数/展业目标)*100%
// 展业目标=系统中全部广联销售用户(账户中心“广联数科(内部使用)”商户下,角色=广联销售且有效状态)*2 // 展业目标=系统中全部广联销售用户(账户中心“广联数科(内部使用)”商户下,角色=广联销售且有效状态)*2
Integer glskMerchantId = env.getProperty("glsk.merchantId", Integer.class, 1); if (res.getNewStoreCount() > 0) {
Integer glskMerchantId = env.getProperty("glsk.merchantId", Integer.class, 44205577);
String saleRoleName = env.getProperty("glsk.sale.roleName", String.class, "广联销售"); String saleRoleName = env.getProperty("glsk.sale.roleName", String.class, "广联销售");
RpcPagination<MerchantStaffRequest> staffReq = new RpcPagination<>(); RpcPagination<MerchantStaffRequest> staffReq = new RpcPagination<>();
staffReq.setPageSize(Integer.MAX_VALUE); staffReq.setPageSize(Integer.MAX_VALUE);
...@@ -750,6 +791,7 @@ public class BusinessSceneAnalysisService { ...@@ -750,6 +791,7 @@ public class BusinessSceneAnalysisService {
.multiply(new BigDecimal("100")) .multiply(new BigDecimal("100"))
.divide(new BigDecimal(staffCount * 2), 2, RoundingMode.HALF_UP); .divide(new BigDecimal(staffCount * 2), 2, RoundingMode.HALF_UP);
res.setTargetAchievementRate(targetAchievementRate); res.setTargetAchievementRate(targetAchievementRate);
}
return res; return res;
} }
...@@ -759,8 +801,45 @@ public class BusinessSceneAnalysisService { ...@@ -759,8 +801,45 @@ public class BusinessSceneAnalysisService {
* 展示全部省份, 按触客率(A064)大小进行排序 * 展示全部省份, 按触客率(A064)大小进行排序
*/ */
public List<ContactRateAnalysisResponse> touchRateSummary(SceneBaseReq req) { public List<ContactRateAnalysisResponse> touchRateSummary(SceneBaseReq req) {
// todo List<ContactRateAnalysisResponse> res = new ArrayList<>();
return null;
// 查询指标
DataBizQueryParamsDTO queryParams = req.getQueryParams();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
queryParams.setExts("merchantIds");
queryParams.setItemCodes(DataStatsConstants.ITEM_CODE_A064);
DataResp<List<DataBusinessDTO>> dataResp = getDataStatsService.getListDataResp(JSON.toJSONString(queryParams));
if (CollectionUtils.isEmpty(dataResp.getContent())) {
log.info("查询指标返回空, req:{}, res:{}", queryParams, dataResp);
return res;
}
Map<Integer, List<DataBusinessDTO>> dataMerchantMap = dataResp.getContent().stream()
.collect(Collectors.groupingBy(p -> p.getMerchantId()));
// 查询区域
List<MerchantProvinceDTO> provinceList = businessAnalysisService.getProvinceByMerchantIdConcurrent(new ArrayList<>(dataMerchantMap.keySet()));
if (CollectionUtils.isEmpty(provinceList)) {
log.info("查询区域返回空, req:{}, res:{}", queryParams, provinceList);
return res;
}
provinceList.stream()
.filter(p -> p.getProvinceCode() != null)
.collect(Collectors.groupingBy(p -> p.getProvinceCode()))
.forEach((provinceCode, merchants) -> {
ContactRateAnalysisResponse item = new ContactRateAnalysisResponse();
item.setProvinceId(provinceCode);
item.setProvinceName(merchants.get(0).getProvinceName());
merchants.stream()
.filter(p -> dataMerchantMap.containsKey(p.getMerchantId()))
.forEach(p -> {
List<DataBusinessDTO> dataList = dataMerchantMap.get(p.getMerchantId());
DataBusinessDTO data = mergeDataList(dataList);
item.setContactRate(data.getItemValue());
});
res.add(item);
});
return res;
} }
/** /**
...@@ -771,10 +850,7 @@ public class BusinessSceneAnalysisService { ...@@ -771,10 +850,7 @@ public class BusinessSceneAnalysisService {
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
// 计算上一周期用于计算环比((本周期统计值-上周期统计值)/上周期统计值)*100%,保留百分比两位小数) // 计算上一周期用于计算环比((本周期统计值-上周期统计值)/上周期统计值)*100%,保留百分比两位小数)
String startDate = queryParams.getStartDate(); Pair<String, String> lastPeriodDates = DateUtils.getLastPeriodDates(queryParams.getStartDate(), queryParams.getEndDate(), req.getCycleType());
String endDate = queryParams.getEndDate();
Integer dateType = queryParams.getDateType();
Pair<String, String> lastPeriodDates = DateUtils.getLastPeriodDates(startDate, endDate, dateType);
if (lastPeriodDates.getKey().isEmpty()) { if (lastPeriodDates.getKey().isEmpty()) {
log.info("自定义周期无需计算环比"); log.info("自定义周期无需计算环比");
return res; return res;
...@@ -795,10 +871,10 @@ public class BusinessSceneAnalysisService { ...@@ -795,10 +871,10 @@ public class BusinessSceneAnalysisService {
* 计算环比 * 计算环比
*/ */
public BigDecimal computeMon(BigDecimal current, BigDecimal last) { public BigDecimal computeMon(BigDecimal current, BigDecimal last) {
if (last == null) { if (last == null || last.compareTo(BigDecimal.ZERO) == 0) {
return null; return null;
} }
return current.subtract(last).divide(last, 2, RoundingMode.HALF_UP); return current.subtract(last).divide(last, 4, RoundingMode.HALF_UP);
} }
/** /**
...@@ -813,9 +889,12 @@ public class BusinessSceneAnalysisService { ...@@ -813,9 +889,12 @@ public class BusinessSceneAnalysisService {
return dataList.get(0); return dataList.get(0);
} }
res.setItemValue(dataList.stream().map(p -> p.getItemValue()).reduce(BigDecimal.ZERO, BigDecimal::add)); res.setItemValue(dataList.stream().map(p -> p.getItemValue()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
res.setPreValue(dataList.stream().map(p -> p.getPreValue()).reduce(BigDecimal.ZERO, BigDecimal::add)); res.setPreValue(dataList.stream().map(p -> p.getPreValue()).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
res.setRate(computeMon(res.getItemValue(), res.getPreValue()).toString()); BigDecimal rate = computeMon(res.getItemValue(), res.getPreValue());
if (rate != null) {
res.setRate(rate.toString());
}
return res; return res;
} }
...@@ -908,20 +987,6 @@ public class BusinessSceneAnalysisService { ...@@ -908,20 +987,6 @@ public class BusinessSceneAnalysisService {
* 行数据:产值、达成率、触客率、转化率、渗透率、升级客单价、平均客单价、门店状态 * 行数据:产值、达成率、触客率、转化率、渗透率、升级客单价、平均客单价、门店状态
*/ */
public List<StoreListResponse> storeList(SceneBaseReq req) { public List<StoreListResponse> storeList(SceneBaseReq req) {
Map<Integer, StoreListResponse> resMap = req.getMerchantIds().stream().collect(Collectors.toMap(p -> p, StoreListResponse::new));
// 查询商户名称
SearchMerchantRpcRequest merchantReq = new SearchMerchantRpcRequest();
merchantReq.setMerchantNoList(req.getMerchantIds());
RpcResponse<List<MerchantNameResponse>> merchantResp = merchantRemote.searchMerchantNameRemote(merchantReq);
if (merchantResp.hasResult()) {
Map<Integer, String> merchantNameMap = merchantResp.getResult().stream()
.collect(Collectors.toMap(p -> p.getMerchantId(), p -> p.getMerchantName(), (p1, p2) -> p2));
resMap.values().forEach(p -> p.setStoreName(merchantNameMap.get(p.getStoreId())));
} else {
log.warn("查询商户名称异常. req: {}", JSON.toJSONString(merchantReq));
}
// 查询各个指标 // 查询各个指标
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId); queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
...@@ -932,26 +997,39 @@ public class BusinessSceneAnalysisService { ...@@ -932,26 +997,39 @@ public class BusinessSceneAnalysisService {
DataStatsConstants.ITEM_CODE_A085, DataStatsConstants.ITEM_CODE_A077, DataStatsConstants.ITEM_CODE_A085, DataStatsConstants.ITEM_CODE_A077,
DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A095 DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A095
); );
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> dataByItemCodes = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { if (MapUtils.isEmpty(dataByItemCodes)) {
log.warn("查询门店列表指标异常. req: {}, itemCodes: {}", JSON.toJSONString(queryParams), itemCodes);
return Collections.emptyList();
}
// 根据指标结果构建返回值
List<DataBusinessDTO> merchantData = dataByItemCodes.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
Map<Integer, StoreListResponse> resMap = merchantData.stream()
.collect(Collectors.toMap(p -> p.getMerchantId(), p -> new StoreListResponse(p.getMerchantId(), p.getMerchantName()), (p1, p2) -> p1));
if (MapUtils.isEmpty(resMap)) {
log.warn("查询门店列表指标异常. res: {}", dataByItemCodes);
return Collections.emptyList();
}
dataByItemCodes.forEach((code, dataList) -> {
switch (code) { switch (code) {
case DataStatsConstants.ITEM_CODE_A036: case DataStatsConstants.ITEM_CODE_A036:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setOutputValue(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setOutputValue(data.getItemValue()));
break; break;
case DataStatsConstants.ITEM_CODE_A064: case DataStatsConstants.ITEM_CODE_A064:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setCustomerContactRate(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setCustomerContactRate(data.getItemValue()));
break; break;
case DataStatsConstants.ITEM_CODE_A085: case DataStatsConstants.ITEM_CODE_A085:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setConversionRate(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setConversionRate(data.getItemValue()));
break; break;
case DataStatsConstants.ITEM_CODE_A077: case DataStatsConstants.ITEM_CODE_A077:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setPenetrationRate(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setPenetrationRate(data.getItemValue()));
break; break;
case DataStatsConstants.ITEM_CODE_A076: case DataStatsConstants.ITEM_CODE_A076:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setUpgradeCustomerPrice(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setUpgradeCustomerPrice(data.getItemValue()));
break; break;
case DataStatsConstants.ITEM_CODE_A095: case DataStatsConstants.ITEM_CODE_A095:
dataList.forEach(data -> resMap.get(data.getMerchantId()).setAvgCustomerPrice(data.getItemValue())); dataList.stream().filter(data -> resMap.containsKey(data.getMerchantId())).forEach(data -> resMap.get(data.getMerchantId()).setAvgCustomerPrice(data.getItemValue()));
break; break;
} }
}); });
...@@ -959,6 +1037,9 @@ public class BusinessSceneAnalysisService { ...@@ -959,6 +1037,9 @@ public class BusinessSceneAnalysisService {
// 计算达成率 // 计算达成率
queryStoreTargetOutput(req).forEach((merchantId, outputTargetValue) -> { queryStoreTargetOutput(req).forEach((merchantId, outputTargetValue) -> {
StoreListResponse item = resMap.get(merchantId); StoreListResponse item = resMap.get(merchantId);
if (item == null) {
return;
}
item.setAchievementRate(computeOutputRatio(item.getOutputValue(), outputTargetValue)); item.setAchievementRate(computeOutputRatio(item.getOutputValue(), outputTargetValue));
}); });
...@@ -976,6 +1057,8 @@ public class BusinessSceneAnalysisService { ...@@ -976,6 +1057,8 @@ public class BusinessSceneAnalysisService {
* 售前触客数、售后触客数、总触客数、触客率、 * 售前触客数、售后触客数、总触客数、触客率、
* 售前成交数、售后成交数、总成交数、 * 售前成交数、售后成交数、总成交数、
* 售前转化率、售后转化率、转化率、 * 售前转化率、售后转化率、转化率、
* <p>
* 需要指定门店传参
*/ */
public StoreDetailSummaryResponse storeDetailSummary(SceneBaseReq req) { public StoreDetailSummaryResponse storeDetailSummary(SceneBaseReq req) {
StoreDetailSummaryResponse res = new StoreDetailSummaryResponse(); StoreDetailSummaryResponse res = new StoreDetailSummaryResponse();
...@@ -997,58 +1080,61 @@ public class BusinessSceneAnalysisService { ...@@ -997,58 +1080,61 @@ public class BusinessSceneAnalysisService {
DataStatsConstants.ITEM_CODE_A063, DataStatsConstants.ITEM_CODE_A096, DataStatsConstants.ITEM_CODE_A063, DataStatsConstants.ITEM_CODE_A096,
DataStatsConstants.ITEM_CODE_A097, DataStatsConstants.ITEM_CODE_A098, DataStatsConstants.ITEM_CODE_A097, DataStatsConstants.ITEM_CODE_A098,
DataStatsConstants.ITEM_CODE_A0104, DataStatsConstants.ITEM_CODE_A0105); DataStatsConstants.ITEM_CODE_A0104, DataStatsConstants.ITEM_CODE_A0105);
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> dataMap = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { if (MapUtils.isEmpty(dataMap)) {
log.warn("查询门店分析指标异常. req: {}, itemCodes: {}", JSON.toJSONString(queryParams), itemCodes);
return res;
}
dataMap.forEach((code, dataList) -> {
DataBusinessDTO data = mergeDataList(dataList); DataBusinessDTO data = mergeDataList(dataList);
switch (code) { switch (code) {
case DataStatsConstants.ITEM_CODE_A036: case DataStatsConstants.ITEM_CODE_A036:
res.setTotalOutputValue(data.getItemValue()); res.setTotalOutputValue(data.getItemValue());
res.setTotalOutputValueMom(new BigDecimal(data.getRate())); res.setTotalOutputValueMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A062: case DataStatsConstants.ITEM_CODE_A062:
res.setNewCarDeliveryCount(data.getItemValue()); res.setNewCarDeliveryCount(data.getItemValue());
res.setNewCarDeliveryCountMom(new BigDecimal(data.getRate())); res.setNewCarDeliveryCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A085: case DataStatsConstants.ITEM_CODE_A085:
res.setConversionRate(data.getItemValue()); res.setConversionRate(data.getItemValue());
res.setConversionRateMom(new BigDecimal(data.getRate())); res.setConversionRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A077: case DataStatsConstants.ITEM_CODE_A077:
res.setPenetrationRate(data.getItemValue()); res.setPenetrationRate(data.getItemValue());
res.setPenetrationRateMom(new BigDecimal(data.getRate())); res.setPenetrationRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A064: case DataStatsConstants.ITEM_CODE_A064:
res.setContactRate(data.getItemValue()); res.setContactRate(data.getItemValue());
res.setContactRateMom(new BigDecimal(data.getRate())); res.setContactRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A063: case DataStatsConstants.ITEM_CODE_A063:
res.setPreSalesContactCount(data.getItemValue()); res.setPreSalesContactCount(data.getItemValue());
res.setPreSalesContactCountMom(new BigDecimal(data.getRate())); res.setPreSalesContactCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A096: case DataStatsConstants.ITEM_CODE_A096:
res.setAfterSalesContactCount(data.getItemValue()); res.setAfterSalesContactCount(data.getItemValue());
res.setAfterSalesContactCountMom(new BigDecimal(data.getRate())); res.setAfterSalesContactCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A097: case DataStatsConstants.ITEM_CODE_A097:
res.setPreSalesDealCount(data.getItemValue()); res.setPreSalesDealCount(data.getItemValue());
res.setPreSalesDealCountMom(new BigDecimal(data.getRate())); res.setPreSalesDealCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A098: case DataStatsConstants.ITEM_CODE_A098:
res.setAfterSalesDealCount(data.getItemValue()); res.setAfterSalesDealCount(data.getItemValue());
res.setAfterSalesDealCountMom(new BigDecimal(data.getRate())); res.setAfterSalesDealCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A0104: case DataStatsConstants.ITEM_CODE_A0104:
res.setPreSalesConversionRate(data.getItemValue()); res.setPreSalesConversionRate(data.getItemValue());
res.setPreSalesConversionRateMom(new BigDecimal(data.getRate())); res.setPreSalesConversionRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A0105: case DataStatsConstants.ITEM_CODE_A0105:
res.setAfterSalesConversionRate(data.getItemValue()); res.setAfterSalesConversionRate(data.getItemValue());
res.setAfterSalesConversionRateMom(new BigDecimal(data.getRate())); res.setAfterSalesConversionRateMom(data.getRate());
break; break;
} }
}); });
// 查询达成率 // 查询达成率
Map<Integer, BigDecimal> storeTargetOutputMap = queryStoreTargetOutput(req); Map<Integer, BigDecimal> storeTargetOutputMap = queryStoreTargetOutput(req);
storeTargetOutputMap.forEach((merchantId, outputTargetValue) -> { storeTargetOutputMap.forEach((merchantId, outputTargetValue) -> {
...@@ -1061,6 +1147,8 @@ public class BusinessSceneAnalysisService { ...@@ -1061,6 +1147,8 @@ public class BusinessSceneAnalysisService {
/** /**
* 门店员工排行 * 门店员工排行
* <p>
* 需要指定门店传参
*/ */
public StoreEmployeeRankResponse storeEmployeeRank(SceneBaseReq req) { public StoreEmployeeRankResponse storeEmployeeRank(SceneBaseReq req) {
StoreEmployeeRankResponse res = new StoreEmployeeRankResponse(); StoreEmployeeRankResponse res = new StoreEmployeeRankResponse();
...@@ -1074,38 +1162,47 @@ public class BusinessSceneAnalysisService { ...@@ -1074,38 +1162,47 @@ public class BusinessSceneAnalysisService {
queryParams.setMerchantIds(StringUtils.join(req.getMerchantIds(), ",")); queryParams.setMerchantIds(StringUtils.join(req.getMerchantIds(), ","));
queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ",")); queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ","));
List<String> itemCodes = Lists.newArrayList(DataStatsConstants.ITEM_CODE_A036, DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A085); List<String> itemCodes = Lists.newArrayList(DataStatsConstants.ITEM_CODE_A036, DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A085);
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> staffDataMap = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { staffDataMap.forEach((code, dataList) -> {
Map<String, DataBusinessDTO> dataMap = dataList.stream().collect(Collectors.toMap(p -> p.getStaffId(), p -> p, (p1, p2) -> p2)); Map<String, DataBusinessDTO> dataMap = dataList.stream().collect(Collectors.toMap(p -> p.getStaffId(), p -> p, (p1, p2) -> p2));
switch (code) { switch (code) {
case DataStatsConstants.ITEM_CODE_A036: case DataStatsConstants.ITEM_CODE_A036:
dataMap.forEach((staffId, data) -> empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data)) dataMap.forEach((staffId, data) -> {
.setPersonalOutputValue(data.getItemValue())); StoreEmployeeRankResponse.EmployeeAnalysisItem item = empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data));
item.setPersonalOutputValue(data.getItemValue());
empMap.put(data.getStaffId(), item);
});
break; break;
case DataStatsConstants.ITEM_CODE_A076: case DataStatsConstants.ITEM_CODE_A076:
dataMap.forEach((staffId, data) -> empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data)) dataMap.forEach((staffId, data) -> {
.setPersonalCustomerPrice(data.getItemValue())); StoreEmployeeRankResponse.EmployeeAnalysisItem item = empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data));
item.setPersonalCustomerPrice(data.getItemValue());
empMap.put(data.getStaffId(), item);
});
break; break;
case DataStatsConstants.ITEM_CODE_A085: case DataStatsConstants.ITEM_CODE_A085:
dataMap.forEach((staffId, data) -> empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data)) dataMap.forEach((staffId, data) -> {
.setPersonalConversionRate(data.getItemValue())); StoreEmployeeRankResponse.EmployeeAnalysisItem item = empMap.getOrDefault(staffId, new StoreEmployeeRankResponse.EmployeeAnalysisItem(data));
item.setPersonalConversionRate(data.getItemValue());
empMap.put(data.getStaffId(), item);
});
break; break;
} }
}); });
// 查询指标(门店维度) // 查询指标(门店维度)
queryParams.setExts("merchantIds"); queryParams.setExts("");
queryParams.setStaffIds(null); queryParams.setStaffIds(null);
itemCodes = Lists.newArrayList(DataStatsConstants.ITEM_CODE_A036, DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A085); itemCodes = Lists.newArrayList(DataStatsConstants.ITEM_CODE_A036, DataStatsConstants.ITEM_CODE_A076, DataStatsConstants.ITEM_CODE_A085);
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> merchantDataMap = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { merchantDataMap.forEach((code, dataList) -> {
DataBusinessDTO merchantData = dataList.get(0); DataBusinessDTO merchantData = mergeDataList(dataList);
switch (code) { switch (code) {
case DataStatsConstants.ITEM_CODE_A036: case DataStatsConstants.ITEM_CODE_A036:
storeSummary.setTotalOutputValue(merchantData.getItemValue()); storeSummary.setTotalOutputValue(merchantData.getItemValue());
int empCount = empMap.values().size(); int empCount = empMap.values().size();
if (empCount > 0) { if (empCount > 0) {
storeSummary.setAverageOutputValue(merchantData.getItemValue() storeSummary.setAverageOutputValue(merchantData.getItemValue()
.divide(BigDecimal.valueOf(empCount), 2, RoundingMode.HALF_UP)); .divide(BigDecimal.valueOf(empCount), 4, RoundingMode.HALF_UP));
} }
break; break;
case DataStatsConstants.ITEM_CODE_A076: case DataStatsConstants.ITEM_CODE_A076:
...@@ -1129,12 +1226,10 @@ public class BusinessSceneAnalysisService { ...@@ -1129,12 +1226,10 @@ public class BusinessSceneAnalysisService {
public List<TrafficContributionRankResponse> storeTrafficRank(SceneBaseReq req) { public List<TrafficContributionRankResponse> storeTrafficRank(SceneBaseReq req) {
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
List<String> staffUuids = req.getStaffUuids(); List<String> staffUuids = req.getStaffUuids();
if (CollectionUtils.isEmpty(staffUuids)) { List<Integer> merchantIds = req.getMerchantIds();
return Collections.emptyList();
}
Integer sceneType = req.convertToSceneType(queryParams.getBizs()); Integer sceneType = req.convertToSceneType(queryParams.getBizs());
List<TrafficContributionRankResponse> res = goodsOrderMapper.findTrafficRank(req.getStaffUuids(), sceneType); List<TrafficContributionRankResponse> res = goodsOrderMapper.findTrafficRank(merchantIds, staffUuids, sceneType);
if (CollectionUtils.isEmpty(res)) { if (CollectionUtils.isEmpty(res)) {
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -1151,6 +1246,9 @@ public class BusinessSceneAnalysisService { ...@@ -1151,6 +1246,9 @@ public class BusinessSceneAnalysisService {
return res; return res;
} }
/**
* 员工分析
*/
public EmployeeDetailSummaryResponse storeEmployeeSummary(SceneBaseReq req) { public EmployeeDetailSummaryResponse storeEmployeeSummary(SceneBaseReq req) {
EmployeeDetailSummaryResponse res = new EmployeeDetailSummaryResponse(); EmployeeDetailSummaryResponse res = new EmployeeDetailSummaryResponse();
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
...@@ -1162,53 +1260,57 @@ public class BusinessSceneAnalysisService { ...@@ -1162,53 +1260,57 @@ public class BusinessSceneAnalysisService {
DataStatsConstants.ITEM_CODE_A063, DataStatsConstants.ITEM_CODE_A096, DataStatsConstants.ITEM_CODE_A084, DataStatsConstants.ITEM_CODE_A063, DataStatsConstants.ITEM_CODE_A096, DataStatsConstants.ITEM_CODE_A084,
DataStatsConstants.ITEM_CODE_A097, DataStatsConstants.ITEM_CODE_A098, DataStatsConstants.ITEM_CODE_A075, DataStatsConstants.ITEM_CODE_A097, DataStatsConstants.ITEM_CODE_A098, DataStatsConstants.ITEM_CODE_A075,
DataStatsConstants.ITEM_CODE_A0104, DataStatsConstants.ITEM_CODE_A0105, DataStatsConstants.ITEM_CODE_A085); DataStatsConstants.ITEM_CODE_A0104, DataStatsConstants.ITEM_CODE_A0105, DataStatsConstants.ITEM_CODE_A085);
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> dataMap = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { if (MapUtils.isEmpty(dataMap)) {
log.error("员工分析指标查询失败,参数:{}", queryParams);
return res;
}
dataMap.forEach((code, dataList) -> {
DataBusinessDTO data = mergeDataList(dataList); DataBusinessDTO data = mergeDataList(dataList);
switch (code) { switch (code) {
case DataStatsConstants.ITEM_CODE_A036: case DataStatsConstants.ITEM_CODE_A036:
res.setTotalOutputValue(data.getItemValue()); res.setTotalOutputValue(data.getItemValue());
res.setTotalOutputValueMom(new BigDecimal(data.getRate())); res.setTotalOutputValueMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A076: case DataStatsConstants.ITEM_CODE_A076:
res.setAvgCustomerPrice(data.getItemValue()); res.setAvgCustomerPrice(data.getItemValue());
res.setAvgCustomerPriceMom(new BigDecimal(data.getRate())); res.setAvgCustomerPriceMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A063: case DataStatsConstants.ITEM_CODE_A063:
res.setPreSalesContactCount(data.getItemValue()); res.setPreSalesContactCount(data.getItemValue());
res.setPreSalesContactCountMom(new BigDecimal(data.getRate())); res.setPreSalesContactCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A096: case DataStatsConstants.ITEM_CODE_A096:
res.setAfterSalesContactCount(data.getItemValue()); res.setAfterSalesContactCount(data.getItemValue());
res.setAfterSalesContactCountMom(new BigDecimal(data.getRate())); res.setAfterSalesContactCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A084: case DataStatsConstants.ITEM_CODE_A084:
res.setTotalContactCount(data.getItemValue()); res.setTotalContactCount(data.getItemValue());
res.setTotalContactCountMom(new BigDecimal(data.getRate())); res.setTotalContactCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A097: case DataStatsConstants.ITEM_CODE_A097:
res.setPreSalesDealCount(data.getItemValue()); res.setPreSalesDealCount(data.getItemValue());
res.setPreSalesDealCountMom(new BigDecimal(data.getRate())); res.setPreSalesDealCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A098: case DataStatsConstants.ITEM_CODE_A098:
res.setAfterSalesDealCount(data.getItemValue()); res.setAfterSalesDealCount(data.getItemValue());
res.setAfterSalesDealCountMom(new BigDecimal(data.getRate())); res.setAfterSalesDealCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A075: case DataStatsConstants.ITEM_CODE_A075:
res.setTotalDealCount(data.getItemValue()); res.setTotalDealCount(data.getItemValue());
res.setTotalDealCountMom(new BigDecimal(data.getRate())); res.setTotalDealCountMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A0104: case DataStatsConstants.ITEM_CODE_A0104:
res.setPreSalesConversionRate(data.getItemValue()); res.setPreSalesConversionRate(data.getItemValue());
res.setPreSalesConversionRateMom(new BigDecimal(data.getRate())); res.setPreSalesConversionRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A0105: case DataStatsConstants.ITEM_CODE_A0105:
res.setAfterSalesConversionRate(data.getItemValue()); res.setAfterSalesConversionRate(data.getItemValue());
res.setAfterSalesConversionRateMom(new BigDecimal(data.getRate())); res.setAfterSalesConversionRateMom(data.getRate());
break; break;
case DataStatsConstants.ITEM_CODE_A085: case DataStatsConstants.ITEM_CODE_A085:
res.setConversionRate(data.getItemValue()); res.setConversionRate(data.getItemValue());
res.setConversionRateMom(new BigDecimal(data.getRate())); res.setConversionRateMom(data.getRate());
break; break;
} }
}); });
...@@ -1234,20 +1336,24 @@ public class BusinessSceneAnalysisService { ...@@ -1234,20 +1336,24 @@ public class BusinessSceneAnalysisService {
DataBizQueryParamsDTO queryParams = req.getQueryParams(); DataBizQueryParamsDTO queryParams = req.getQueryParams();
Integer bizs = queryParams.getBizs(); Integer bizs = queryParams.getBizs();
queryParams.setBrandIds(dataStatsConfig.defaultBrandId); queryParams.setBrandIds(dataStatsConfig.defaultBrandId);
String aggregateType = "merchantIds";
if (CollectionUtils.isNotEmpty(req.getMerchantIds())) { if (CollectionUtils.isNotEmpty(req.getMerchantIds())) {
queryParams.setExts("merchantIds");
queryParams.setMerchantIds(StringUtils.join(req.getMerchantIds(), ",")); queryParams.setMerchantIds(StringUtils.join(req.getMerchantIds(), ","));
} }
if (CollectionUtils.isNotEmpty(req.getStaffUuids())) { if (CollectionUtils.isNotEmpty(req.getStaffUuids())) {
queryParams.setExts("staffIds"); aggregateType = "staffIds";
queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ",")); queryParams.setStaffIds(StringUtils.join(req.getStaffUuids(), ","));
} }
// 权益、延保 // 权益、延保
List<String> itemCodes = DataStatsConstants.getGoodsItemCodes(bizs, queryParams.getExts()); List<String> itemCodes = DataStatsConstants.getGoodsItemCodes(bizs, aggregateType);
itemCodes.add(DataStatsConstants.ITEM_CODE_A062); itemCodes.add(DataStatsConstants.ITEM_CODE_A062);
getDataStatsService.parallelCallListMap(itemCodes, queryParams) Map<String, List<DataBusinessDTO>> dataMap = getDataStatsService.parallelCallListMap(itemCodes, queryParams);
.forEach((code, dataList) -> { if (MapUtils.isEmpty(dataMap)) {
log.error("品类分析指标查询失败,参数:{}", queryParams);
return res;
}
dataMap.forEach((code, dataList) -> {
DataBusinessDTO data = mergeDataList(dataList); DataBusinessDTO data = mergeDataList(dataList);
switch (code) { switch (code) {
// 新车交付数 // 新车交付数
...@@ -1337,7 +1443,7 @@ public class BusinessSceneAnalysisService { ...@@ -1337,7 +1443,7 @@ public class BusinessSceneAnalysisService {
}); });
// 计算单车采购产值 // 计算单车采购产值
BigDecimal rate = queryParams.getExts().equals("staffIds") ? BigDecimal.ONE : BigDecimal.valueOf(0.35); BigDecimal rate = aggregateType.equals("staffIds") ? BigDecimal.ONE : BigDecimal.valueOf(0.35);
res.setCarBodyFilmPerCarOutput(computeSingleVehiclePurchaseOutput(res.getCarBodyFilmPerCarOutput(), res.getNewCarDeliveryCount(), rate)); res.setCarBodyFilmPerCarOutput(computeSingleVehiclePurchaseOutput(res.getCarBodyFilmPerCarOutput(), res.getNewCarDeliveryCount(), rate));
res.setAccessoriesPerCarOutput(computeSingleVehiclePurchaseOutput(res.getAccessoriesPerCarOutput(), res.getNewCarDeliveryCount(), rate)); res.setAccessoriesPerCarOutput(computeSingleVehiclePurchaseOutput(res.getAccessoriesPerCarOutput(), res.getNewCarDeliveryCount(), rate));
res.setWindowFilmPerCarOutput(computeSingleVehiclePurchaseOutput(res.getWindowFilmPerCarOutput(), res.getNewCarDeliveryCount(), rate)); res.setWindowFilmPerCarOutput(computeSingleVehiclePurchaseOutput(res.getWindowFilmPerCarOutput(), res.getNewCarDeliveryCount(), rate));
...@@ -1354,4 +1460,8 @@ public class BusinessSceneAnalysisService { ...@@ -1354,4 +1460,8 @@ public class BusinessSceneAnalysisService {
} }
return value.multiply(rate).divide(count, 2, RoundingMode.HALF_UP); return value.multiply(rate).divide(count, 2, RoundingMode.HALF_UP);
} }
public List<BiRecord> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate) {
return businessIntelligenceMapper.getBiRecords(businessType, merchantIds, startDate, endDate);
}
} }
...@@ -505,7 +505,7 @@ public class UsedCarDataStatsService { ...@@ -505,7 +505,7 @@ public class UsedCarDataStatsService {
} else { } else {
// 总开单门店 // 总开单门店
// 查询bi业务表 // 查询bi业务表
List<TrendChartRes> trendChartList = businessIntelligenceMapper.countUsedCarMerchants(previousPeriodsIncludingCurrent); List<TrendChartRes> trendChartList = businessIntelligenceMapper.countUsedCarMerchants(previousPeriodsIncludingCurrent, merchantIds);
trendChartList.forEach(item -> item.setDatePair(item.getDatePairInfo())); trendChartList.forEach(item -> item.setDatePair(item.getDatePairInfo()));
// trendChartRes根据datePair分组 // trendChartRes根据datePair分组
Map<Pair<String, String>, TrendChartRes> trendChartResMap = trendChartList.stream().collect(Collectors.toMap(TrendChartRes::getDatePair, item -> item)); Map<Pair<String, String>, TrendChartRes> trendChartResMap = trendChartList.stream().collect(Collectors.toMap(TrendChartRes::getDatePair, item -> item));
......
...@@ -764,6 +764,12 @@ ...@@ -764,6 +764,12 @@
LEFT JOIN dj_smartcarlife.dj_car_life_service_merchant_bi m LEFT JOIN dj_smartcarlife.dj_car_life_service_merchant_bi m
ON m.stat_date BETWEEN p.start_date AND p.end_date ON m.stat_date BETWEEN p.start_date AND p.end_date
AND m.has_used_car = 1 AND m.has_used_car = 1
<if test="merchantIds != null and merchantIds.size > 0">
AND m.merchant_id IN
<foreach item="item" index="index" collection="merchantIds" separator="," open="(" close=")">
#{item}
</foreach>
</if>
GROUP BY p.start_date, p.end_date GROUP BY p.start_date, p.end_date
</select> </select>
<select id="getZyMerchantIds" resultType="java.lang.Integer"> <select id="getZyMerchantIds" resultType="java.lang.Integer">
......
...@@ -155,6 +155,12 @@ ...@@ -155,6 +155,12 @@
deleted_flag = 'N' deleted_flag = 'N'
and user_id is not null and user_id is not null
and status in (2, 4, 6) and status in (2, 4, 6)
<if test="merchantIds != null and merchantIds.size() > 0">
and merchant_id in
<foreach collection="merchantIds" item="uuid" open="(" close=")" separator=",">
#{uuid}
</foreach>
</if>
<if test="staffUuids != null and staffUuids.size() > 0"> <if test="staffUuids != null and staffUuids.size() > 0">
and user_id in and user_id in
<foreach collection="staffUuids" item="uuid" open="(" close=")" separator=","> <foreach collection="staffUuids" item="uuid" open="(" close=")" separator=",">
......
...@@ -128,4 +128,21 @@ ...@@ -128,4 +128,21 @@
and status = 1 and status = 1
</select> </select>
<select id="selectBiMerchantOperator"
resultType="cn.com.glsx.dj.smartcarlife.model.ShopMerchantDirectorConfig">
select
director_type as directorType,
director_user_id as directorUserId,
director_name as directorName
from dj_car_life_shop_merchant_director_config
where merchant_id = #{storeNo} and deleted_flag = 'N'
<if test="directorTypes != null and directorTypes.size() > 0">
and director_type in
<foreach collection="directorTypes" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ public class BusinessIntelligenceMapperTest extends BaseServiceTest { ...@@ -22,7 +22,7 @@ public class BusinessIntelligenceMapperTest extends BaseServiceTest {
statDateList.add(new Pair<>("2025-05-01", "2025-07-01")); statDateList.add(new Pair<>("2025-05-01", "2025-07-01"));
statDateList.add(new Pair<>("2025-08-01", "2025-09-01")); statDateList.add(new Pair<>("2025-08-01", "2025-09-01"));
statDateList.add(new Pair<>("2025-10-01", "2025-12-01")); statDateList.add(new Pair<>("2025-10-01", "2025-12-01"));
List<TrendChartRes> trendChartRes = businessIntelligenceMapper.countUsedCarMerchants(statDateList); List<TrendChartRes> trendChartRes = businessIntelligenceMapper.countUsedCarMerchants(statDateList, null);
trendChartRes.forEach(item -> item.setDatePair(item.getDatePair())); trendChartRes.forEach(item -> item.setDatePair(item.getDatePair()));
trendChartRes.forEach(System.out::println); trendChartRes.forEach(System.out::println);
System.out.println(trendChartRes); System.out.println(trendChartRes);
......
...@@ -50,22 +50,22 @@ public class BiAnalyseBackgroundServiceTest extends BaseRemoteTest { ...@@ -50,22 +50,22 @@ public class BiAnalyseBackgroundServiceTest extends BaseRemoteTest {
public void merchantBiMatterAddTest() { public void merchantBiMatterAddTest() {
MerchantBiMatterAddDTO params = new MerchantBiMatterAddDTO(); MerchantBiMatterAddDTO params = new MerchantBiMatterAddDTO();
params.setStoreNo("44211668"); params.setStoreNo("44211227");
params.setStoreName("明明长岭4s店B222"); params.setStoreName("明明崇文4s店A");
params.setBusinessType("1"); params.setBusinessType("1");
params.setDescription("当个事做,上报联合国"); params.setDescription("i am iron man2");
params.setCreator("王强"); params.setCreator("王强");
params.setCreatorUnique("687c85dc445611ecb088000c29c0b837"); params.setCreatorUnique("687c85dc445611ecb088000c29c0b837");
ArrayList<MerchantBiMatterDTO.OperatorDTO> online = Lists.newArrayList( ArrayList<MerchantBiMatterDTO.OperatorDTO> online = Lists.newArrayList(
// "8104840424a0455db573c5fb84ab7383" // "8104840424a0455db573c5fb84ab7383"
new MerchantBiMatterDTO.OperatorDTO("8104840424a0455db573c5fb84ab7383", "区域督导天天"), // new MerchantBiMatterDTO.OperatorDTO("c76164900b104472ba47b084b0d3e0e8", "周海宝"),
new MerchantBiMatterDTO.OperatorDTO("17f70bc28c8f40ef9c260d05dbe28787", "陈希") new MerchantBiMatterDTO.OperatorDTO("d0b8bcc8372c4e8d992bd767bf97eb17", "督导天明a")
); );
params.setOnlineOperator(online); params.setOnlineOperator(online);
ArrayList<MerchantBiMatterDTO.OperatorDTO> area = Lists.newArrayList( ArrayList<MerchantBiMatterDTO.OperatorDTO> area = Lists.newArrayList(
// c359e4838e2547aaa140d9a67ec0b165 // c359e4838e2547aaa140d9a67ec0b165在·
new MerchantBiMatterDTO.OperatorDTO("c359e4838e2547aaa140d9a67ec0b165", "狗蛋") // new MerchantBiMatterDTO.OperatorDTO("c76164900b104472ba47b084b0d3e0e8", "周海宝")
); );
params.setAreaOperator(area); params.setAreaOperator(area);
biAnalyseBackgroundService.merchantBiMatterAdd(params); biAnalyseBackgroundService.merchantBiMatterAdd(params);
......
package cn.com.glsx.dj.peanalysis.service;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.remote.BaseRemoteTest;
import com.google.common.collect.Lists;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Autowired
private BusinessSceneAnalysisService service;
@Test
public void sceneOutput() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(3);
req.setStartTime("2025-11-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.sceneOutput(req);
System.out.println(res);
}
@Test
public void queryStoreTargetOutput() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.trendOutput(req);
System.out.println(res);
}
@Test
public void trafficSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.trafficSummary(req);
System.out.println(res);
}
@Test
public void regionalDistribution() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.regionalDistribution(req);
System.out.println(res);
}
@Test
public void newStoreSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.newStoreSummary(req);
System.out.println(res);
}
@Test
public void touchRateSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.touchRateSummary(req);
System.out.println(res);
}
@Test
public void storeAvgList() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeAvgList(req);
System.out.println(res);
}
@Test
public void storeList() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeList(req);
System.out.println(res);
}
@Test
public void storeDetailSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeDetailSummary(req);
System.out.println(res);
}
@Test
public void storeEmployeeRank() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeEmployeeRank(req);
System.out.println(res);
}
@Test
public void storeTrafficRank() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.storeTrafficRank(req);
System.out.println(res);
}
@Test
public void storeEmployeeSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.storeEmployeeSummary(req);
System.out.println(res);
}
@Test
public void goodsSummary() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.goodsSummary(req);
System.out.println(res);
}
}
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    1. 类型不一致

    • 问题描述:
      • RegionalOutputDetailReq 和 TotalOutputReq 中 provinceId 的类型从 String 改为 Integer,但在 ProviceOutputReq 和 BaseReq 中没有相应更改。
    • 影响:
      • 可能导致数据类型不一致的问题,尤其是在不同类之间传递数据时。
    • 优化建议:
      • 统一所有类中的 provinceId 类型为 Integer,以保持一致性。

    2. 常量值不一致

    • 问题描述:
      • TotalOutputReq 中 cycleType 的注释从 "1-天 2-周 3-月 4-自定义" 改为 "0-天 1-周 2-月 3.年 4-自定义"。
    • 影响:
      • 这可能导致前端或后端在解析 cycleType 值时出现错误。
    • 优化建议:
      • 确认并统一 cycleType 的取值范围和含义,确保前后端一致。

    3. 日志记录

    • 问题描述:
      • GetDataStatsService 中新增的日志记录语句 log.info("jsonBody: {}", jsonBody);。
    • 影响:
      • 该日志记录有助于调试,但需要确保不会泄露敏感信息。
    • 优化建议:
      • 检查 jsonBody 是否包含敏感信息,避免记录敏感数据。

    4. Dubbo 配置硬编码

    • 问题描述:
      • MerchantDubboConfig 中直接硬编码了 Dubbo 的 URL。
    • 影响:
      • 硬编码的 URL 不利于配置管理和环境切换。
    • 优化建议:
      • 使用配置文件(如 application.properties 或 application.yml)来管理 Dubbo 的 URL。

    评分明细

    1. 功能实现的正确性与健壮性(40分):

      • 得分:30分
      • 原因:代码逻辑基本正确,但存在类型不一致和常量值不一致的问题,需要进一步修正。
    2. 安全性与潜在风险(30分):

      • 得分:25分
      • 原因:新增的日志记录需要注意敏感信息的泄露,Dubbo URL 的硬编码也存在一定的风险。
    3. 是否符合最佳实践(20分):

      • 得分:18分
      • 原因:代码结构和命名规范较好,但缺少对敏感信息的保护措施,Dubbo URL 的配置方式不够灵活。
    4. 性能与资源利用效率(5分):

      • 得分:5分
      • 原因:当前代码未发现明显的性能瓶颈。
    5. Commits信息的清晰性与准确性(5分):

      • 得分:2分
      • 原因:提交信息不够清晰,没有详细描述具体修改内容。

    总分: 80分


    此报告基于代码审查标准进行了全面评估,希望上述建议能够帮助改进代码质量。如有任何疑问或需要进一步讨论,请随时联系。

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!