Commit 9dcc24b3 by 张富康

Merge remote-tracking branch 'origin/v5.6.0' into v5.6.0

2 parents f520cbc7 d8478728
......@@ -3,6 +3,7 @@ package cn.com.glsx.dj.staff.dto.perfSalary;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
......@@ -10,13 +11,17 @@ public class EffectiveReferralCountDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键id")
@NotNull(message = "主键id不能为空")
private Integer id;
@ApiModelProperty(value = "品牌类型:0-问界 1-智界 2-享界 3-尊界 4-尚界 5-其它品牌")
private Integer brandType;
@ApiModelProperty(value = "品牌名称,例如:问界、智界...")
@ApiModelProperty(value = "品牌名称,例如:问界、智界...(前端无须传)")
private String brandName;
@ApiModelProperty(value = "交车数")
@ApiModelProperty(value = "交车数(前端无须传)")
private Integer deliveryCount;
@ApiModelProperty(value = "有效引荐数")
......
package cn.com.glsx.dj.staff.dto.perfSalary;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class StoreEffectiveReferralSubmitDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "1-草稿,2-已提交")
private Integer status;
@ApiModelProperty(value = "凭证Url 以,分隔")
private String imageUrls;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "品牌有效引荐数DTOs")
private List<EffectiveReferralCountDTO> effectiveReferralCountDTOS;
@ApiModelProperty(value = "操作人")
private String updatedBy;
}
......@@ -30,5 +30,17 @@ public class PerformanceConfigApproveDetailDTO {
@ApiModelProperty(notes = "生效月份(格式:yyyy-MM)")
private String effectiveMonth;
@ApiModelProperty(name = "approveConfigList", notes = "审批人查阅人配置列表")
private List<PerformanceApproveConfigDTO> approveConfigList;
@ApiModelProperty(notes = "审批说明")
private String approveRemark;
@ApiModelProperty(notes = "附图说明,多个用英文逗号分隔")
private String attachment_imgs;
@ApiModelProperty(name = "approveOperationRecordList", notes = "审批人审批记录")
private List<PerformanceConfigApproveOperationRecordDTO> approveOperationRecordList;
}
......@@ -16,7 +16,7 @@ public class PerformanceConfigPageByMerchantDTO {
private Integer merchantId;
@ApiModelProperty(notes = "方案名称, 多个以逗号分隔")
private String schemeName;
private String schemeNames;
@ApiModelProperty(notes = "门店名称")
private String merchantNames;
......
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.math.BigDecimal;
/**
* 考核因子枚举
*/
public enum AssessmentFactorEnum implements BaseEnum<Byte, String> {
PERSONAL_MONTHLY_TOTAL_OUTPUT_VALUE((byte) 1, "个人月度总产值"),
PERSONAL_MONTHLY_SINGLE_STORE_OUTPUT_VALUE((byte) 2, "个人月度单店产值"),
PERSONAL_CUSTOMER_PENETRATION_RATE((byte) 3, "个人客户渗透率"),
PERSONAL_SINGLE_PRODUCT_PENETRATION_RATE((byte) 4, "个人单品渗透率"),
HIGH_CUSTOMER_UNIT_PRICE((byte) 5, "高客单价"),
TOTAL_CUSTOMER_CONTACT_UNIT_PRICE((byte) 6, "总触客客单价(适用园区店)"),
CUSTOMER_CONTACT_UNIT_PRICE((byte) 7, "触客客单价"),
UPGRADE_UNIT_PRICE((byte) 8, "升级客单价"),
DELIVERY_UNIT_PRICE((byte) 9, "交车客单价"),
STORE_CUSTOMER_CONTACT_RATE_DELIVERY((byte) 10, "门店触客率(交车)"),
STORE_CUSTOMER_CONTACT_RATE_EFFECTIVE_REFERRAL((byte) 11, "门店触客率(有效引荐)"),
UPGRADE_ORDER_QUANTITY((byte) 12, "升级订单数");
@AllArgsConstructor
@Getter
public enum AssessmentFactorEnum{
PERSONAL_MONTHLY_TOTAL_OUTPUT_VALUE((byte) 1, "个人月度总产值", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
PERSONAL_MONTHLY_SINGLE_STORE_OUTPUT_VALUE((byte) 2, "个人月度单店产值", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
PERSONAL_CUSTOMER_PENETRATION_RATE((byte) 3, "个人客户渗透率", BigDecimal.ZERO, BigDecimal.valueOf(100)),
PERSONAL_SINGLE_PRODUCT_PENETRATION_RATE((byte) 4, "个人单品渗透率", BigDecimal.ZERO, BigDecimal.valueOf(100)),
HIGH_CUSTOMER_UNIT_PRICE((byte) 5, "高客单价", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
TOTAL_CUSTOMER_CONTACT_UNIT_PRICE((byte) 6, "总触客客单价(适用园区店)", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
CUSTOMER_CONTACT_UNIT_PRICE((byte) 7, "触客客单价", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
UPGRADE_UNIT_PRICE((byte) 8, "升级客单价", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
DELIVERY_UNIT_PRICE((byte) 9, "交车客单价", BigDecimal.ZERO, BigDecimal.valueOf(9999999)),
STORE_CUSTOMER_CONTACT_RATE_DELIVERY((byte) 10, "门店触客率(交车)", BigDecimal.ZERO, BigDecimal.valueOf(100)),
STORE_CUSTOMER_CONTACT_RATE_EFFECTIVE_REFERRAL((byte) 11, "门店触客率(有效引荐)", BigDecimal.ZERO, BigDecimal.valueOf(100)),
UPGRADE_ORDER_QUANTITY((byte) 12, "升级订单数", BigDecimal.ZERO, BigDecimal.valueOf(9999999));
private final Byte code;
private final String desc;
AssessmentFactorEnum(Byte code, String desc) {
this.code = code;
this.desc = desc;
}
@Override
public Byte getCode() {
return code;
}
@Override
public String getDesc() {
return desc;
}
private final BigDecimal min;
private final BigDecimal max;
public static AssessmentFactorEnum getByCode(Byte code) {
if (code == null) {
return null;
......@@ -46,4 +39,17 @@ public enum AssessmentFactorEnum implements BaseEnum<Byte, String> {
}
return null;
}
// 检测区间
public static boolean check(Byte code, BigDecimal start, BigDecimal end) {
AssessmentFactorEnum assessmentFactorEnum = getByCode(code);
if (assessmentFactorEnum == null) {
return false;
}
return start.doubleValue() < end.doubleValue()
&& start.doubleValue() >= assessmentFactorEnum.getMin().doubleValue()
&& start.doubleValue() <= assessmentFactorEnum.getMax().doubleValue()
&& end.doubleValue() >= assessmentFactorEnum.getMin().doubleValue()
&& end.doubleValue() <= assessmentFactorEnum.getMax().doubleValue();
}
}
\ No newline at end of file
......@@ -15,4 +15,13 @@ public enum CommissionBaseEnum {
private final String code;
private final String desc;
public static CommissionBaseEnum getByCode(String code) {
for (CommissionBaseEnum value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
}
\ No newline at end of file
......@@ -3,16 +3,38 @@ package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.math.BigDecimal;
/**
* 提成方式枚举
*/
@AllArgsConstructor
@Getter
public enum CommissionMethodEnum {
BL("BL", "比例"),
XS("XS", "系数"),
GDJE("GDJE", "固定金额");
BL("BL", "比例", BigDecimal.ZERO, BigDecimal.valueOf(100)),
XS("XS", "系数", BigDecimal.ONE, BigDecimal.valueOf(10)),
GDJE("GDJE", "固定金额", BigDecimal.ZERO, BigDecimal.valueOf(9999999));
private final String code;
private final String desc;
private final BigDecimal min;
private final BigDecimal max;
public static CommissionMethodEnum getByCode(String code) {
for (CommissionMethodEnum value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
// 检测区间
public static boolean check(String code, BigDecimal value) {
CommissionMethodEnum commissionMethodEnum = getByCode(code);
if (commissionMethodEnum == null) {
return false;
}
return value.doubleValue() >= commissionMethodEnum.getMin().doubleValue() && value.doubleValue() <= commissionMethodEnum.getMax().doubleValue();
}
}
\ No newline at end of file
......@@ -24,22 +24,22 @@ public enum PerformanceTimeCycleCodeEnum {
/**
* T3:门店考勤申诉周期
*/
T3("T3", "5. 申诉工资异议,包含考勤天数、订单数、日报平账抗议"),
T3("T3", "5. 申诉工资异议,包含考勤天数、订单数、日报平板扣罚"),
/**
* T4:工资异议处理周期
*/
T4("T4", "6. 接受申诉,处理违章修正考勤、订单数、日报平账抗议"),
T4("T4", "6. 接受申诉,处理违章修正考勤、订单数、日报平板扣罚"),
/**
* T5:绩效评分申诉周期
*/
T5("T5", "7. 申诉提佣、减免,修订提成部分个人渗透率等评分,涉及重新计算员工提成"),
T5("T5", "7. 申诉提佣、减免,修订提成部分个人渗透率等评分,涉及重新计算员工提成8. 补充应发和扣减工资"),
/**
* T6:薪资最终核算周期
*/
T6("T6", "8. 补充应发和扣减;9. 基于确定的薪资、扣减、补发放提成,系统重新运算最终工资数据"),
T6("T6", "9. 基于确定的、扣减、补发放提成,系统重新运算最终工资数据"),
/**
* T7:工资锁定周期
......
......@@ -78,9 +78,9 @@ public class EffectiveReferralReview implements Serializable {
private String remark;
/**
* 状态:0-未保存过,1-待提交(草稿),2-待复核
* 状态:0-未提交,1-草稿,2-已提交
*/
@ApiModelProperty(notes = "状态:0-未保存过,1-待提交(草稿),2-待复核")
@ApiModelProperty(notes = "状态:0-未提交,1-草稿,2-已提交")
@Column(name = "status")
private Integer status;
......@@ -106,9 +106,9 @@ public class EffectiveReferralReview implements Serializable {
private Byte sceneType;
/**
* 是否需要总部复核:1-需要
* 是否需要总部复核:0-否 1-是
*/
@ApiModelProperty(notes = "是否需要总部复核:1-需要")
@ApiModelProperty(notes = "是否需要总部复核:0-否 1-是")
@Column(name = "is_need_reviewed")
private Integer isNeedReviewed;
......
package cn.com.glsx.dj.staff.remote.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralDetailDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralSubmitDTO;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import javax.validation.constraints.NotNull;
......@@ -29,5 +28,5 @@ public interface EffectiveReferralReviewMiniProgramRemote {
@ApiMethod("门店有效引荐数提交")
@ApiParam(name = "dto", notes = "提交信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提交结果")
RpcResponse<Boolean> effectiveReferralStoreSubmit(@NotNull EffectiveReferralReviewDTO dto);
RpcResponse<Boolean> effectiveReferralStoreSubmit(@NotNull StoreEffectiveReferralSubmitDTO dto);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package cn.com.glsx.dj.staff.remote.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralDetailDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.StoreEffectiveReferralSubmitDTO;
import cn.com.glsx.dj.staff.service.perfSalary.EffectiveReferralReviewMiniProgramService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
......@@ -41,7 +42,7 @@ public class EffectiveReferralReviewMiniProgramRemoteImpl implements EffectiveRe
}
@Override
public RpcResponse<Boolean> effectiveReferralStoreSubmit(EffectiveReferralReviewDTO dto) {
public RpcResponse<Boolean> effectiveReferralStoreSubmit(StoreEffectiveReferralSubmitDTO dto) {
try{
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreSubmit(dto));
}catch(Exception e){
......
package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.merchant.CarBrandDTO;
import cn.com.glsx.dj.smartcarlife.response.ServiceStaffRopResponse;
import cn.com.glsx.dj.staff.dto.perfSalary.*;
import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveReferralBrandTypeEnum;
import cn.com.glsx.dj.staff.enums.perfSalary.EffectiveReferralSceneEnum;
import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.scrm.proxy.enums.ProxyRequestSourceEnum;
import cn.com.glsx.scrm.proxy.model.CommonProxyRequest;
import cn.com.glsx.scrm.proxy.model.ProxyBaseResponse;
import cn.com.glsx.scrm.proxy.remote.CommonProxyRemote;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
......@@ -28,6 +40,9 @@ public class EffectiveReferralReviewMiniProgramService {
@Resource
private EffectiveReferralReviewMapper effectiveReferralReviewMapper;
@Autowired
private CommonProxyRemote commonProxyRemote;
public List<EffectiveReferralReviewCommonDTO> effectiveReferralStoreList(EffectiveReferralReviewCommonDTO request) {
//筛选项:门店名字(模糊搜索),状态:未提交、已提交,月份:2026-01,
//特殊逻辑:根据商户门店id去重,根据门店首字母倒序。要根据门店的不同业务场景的数据判断是否已提交和未提交。
......@@ -78,9 +93,17 @@ public class EffectiveReferralReviewMiniProgramService {
return new StoreEffectiveReferralDetailDTO();
}
//2、查询其它品牌名称
String otherBrandName = "";
List<EffectiveReferralReviewCommonDTO> otherBrandEffectiveReferrals =
referralReviewCommonDTOS.stream().filter(item -> item.getBrandId() == -1).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(otherBrandEffectiveReferrals)) {
Map<Integer, String> merchantBandInfoMap = this.batchQueryMerchantBandInfo(Lists.newArrayList(merchantId));
otherBrandName = this.filterDistinctBrandName(merchantBandInfoMap.get(merchantId), "鸿蒙智行");
}
//3、封装各业务场景引荐数(特殊逻辑品牌类型为其他的时候要去找路奇确认)
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = getSceneTypeEffectiveReferralDTOS(referralReviewCommonDTOS);
//3、封装各业务场景引荐数
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = getSceneTypeEffectiveReferralDTOS(referralReviewCommonDTOS, otherBrandName);
//4、封装返回参数
StoreEffectiveReferralDetailDTO detailDTO = new StoreEffectiveReferralDetailDTO();
......@@ -95,7 +118,7 @@ public class EffectiveReferralReviewMiniProgramService {
* @param referralReviewCommonDTOS
* @return
*/
private static List<SceneTypeEffectiveReferralDTO> getSceneTypeEffectiveReferralDTOS(List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS) {
private List<SceneTypeEffectiveReferralDTO> getSceneTypeEffectiveReferralDTOS(List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS, String otherBrandName) {
//1、根据业务场景分组
List<EffectiveReferralReviewCommonDTO> lightModificationList = referralReviewCommonDTOS.stream().filter(effectiveReferralReview -> Objects.equals(effectiveReferralReview.getSceneType(), EffectiveReferralSceneEnum.PREMIUM_UPGRADE.getCode())).collect(Collectors.toList());
List<EffectiveReferralReviewCommonDTO> memberRightList = referralReviewCommonDTOS.stream().filter(effectiveReferralReview -> Objects.equals(effectiveReferralReview.getSceneType(), EffectiveReferralSceneEnum.MEMBER_RIGHTS.getCode())).collect(Collectors.toList());
......@@ -103,11 +126,11 @@ public class EffectiveReferralReviewMiniProgramService {
//2、封装各业务场景有效引荐数
List<SceneTypeEffectiveReferralDTO> lightModificationDTOS =
getEffectiveReferralDTOSBySceneType(lightModificationList, EffectiveReferralSceneEnum.PREMIUM_UPGRADE.getCode());
getEffectiveReferralDTOSBySceneType(lightModificationList, EffectiveReferralSceneEnum.PREMIUM_UPGRADE.getCode(), otherBrandName);
List<SceneTypeEffectiveReferralDTO> memberRightsDTOS =
getEffectiveReferralDTOSBySceneType(memberRightList, EffectiveReferralSceneEnum.MEMBER_RIGHTS.getCode());
getEffectiveReferralDTOSBySceneType(memberRightList, EffectiveReferralSceneEnum.MEMBER_RIGHTS.getCode(), otherBrandName);
List<SceneTypeEffectiveReferralDTO> singleExtendedWarrantyDTOS =
getEffectiveReferralDTOSBySceneType(singleExtendedWarrantyList, EffectiveReferralSceneEnum.SINGLE_EXTENDED_WARRANTY.getCode());
getEffectiveReferralDTOSBySceneType(singleExtendedWarrantyList, EffectiveReferralSceneEnum.SINGLE_EXTENDED_WARRANTY.getCode(), otherBrandName);
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = new ArrayList<>();
sceneTypeEffectiveReferrals.addAll(lightModificationDTOS);
......@@ -123,39 +146,200 @@ public class EffectiveReferralReviewMiniProgramService {
* @param sceneType
* @return
*/
private static List<SceneTypeEffectiveReferralDTO> getEffectiveReferralDTOSBySceneType(List<EffectiveReferralReviewCommonDTO> effectiveReferralList, Byte sceneType) {
private List<SceneTypeEffectiveReferralDTO> getEffectiveReferralDTOSBySceneType(List<EffectiveReferralReviewCommonDTO> effectiveReferralList, Byte sceneType, String otherBrandName) {
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = new ArrayList<>();
if (CollectionUtils.isNotEmpty(effectiveReferralList)) {
SceneTypeEffectiveReferralDTO referralDTO = new SceneTypeEffectiveReferralDTO();
referralDTO.setSceneType(sceneType);
referralDTO.setRemark(effectiveReferralList.get(0).getRemark());
referralDTO.setImageUrls(effectiveReferralList.get(0).getImageUrls());
//1、封装各品牌有效引荐数
List<EffectiveReferralCountDTO> effectiveReferralCountDTOS = new ArrayList<>();
effectiveReferralList.forEach(
item -> {
EffectiveReferralCountDTO countDTO = new EffectiveReferralCountDTO();
countDTO.setId(item.getId());
countDTO.setBrandName(item.getBrandName());
//todo 根据品牌id去路奇确认
if (item.getBrandId() == -1) {
countDTO.setBrandName(item.getBrandName());
if (item.getBrandId() == -1 && StringUtils.isNotBlank(otherBrandName)) {
countDTO.setBrandName(otherBrandName);
}
countDTO.setBrandType(EffectiveReferralBrandTypeEnum.getCodeByDescription(item.getBrandName()));
countDTO.setDeliveryCount(item.getTotalDeliveryCount());
countDTO.setEffectiveReferralCount(item.getAreaEffectiveCount());
effectiveReferralCountDTOS.add(countDTO);
}
);
//2、封装返回参数
EffectiveReferralReviewCommonDTO referralReviewDTO = effectiveReferralList.get(0);
SceneTypeEffectiveReferralDTO referralDTO = new SceneTypeEffectiveReferralDTO();
referralDTO.setSceneType(sceneType);
referralDTO.setRemark(referralReviewDTO.getRemark());
referralDTO.setImageUrls(referralReviewDTO.getImageUrls());
referralDTO.setEffectiveReferralCountDTOS(effectiveReferralCountDTOS);
sceneTypeEffectiveReferrals.add(referralDTO);
}
return sceneTypeEffectiveReferrals;
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean effectiveReferralStoreSubmit(EffectiveReferralReviewDTO dto) {
// 核心业务逻辑暂不实现
effectiveReferralReviewMapper.updateByPrimaryKeySelective(dto);
public Boolean effectiveReferralStoreSubmit(StoreEffectiveReferralSubmitDTO dto) {
//根据id更新引荐数、上传凭证、备注、状态
dto.getEffectiveReferralCountDTOS().forEach(
item -> {
EffectiveReferralReview review = new EffectiveReferralReview();
review.setId(item.getId());
if (item.getEffectiveReferralCount() != null) {
review.setAreaEffectiveCount(item.getEffectiveReferralCount());
}
if (StringUtils.isNotBlank(dto.getImageUrls())) {
review.setImageUrls(dto.getImageUrls());
}
if (StringUtils.isNotBlank(dto.getRemark())) {
review.setRemark(dto.getRemark());
}
review.setStatus(dto.getStatus());
review.setUpdatedBy(dto.getUpdatedBy());
review.setUpdatedDate(new Date());
effectiveReferralReviewMapper.updateByPrimaryKeySelective(review);
}
);
return true;
}
/**
* @description: 获取商户一级品牌Map
* @param: [merchantIdList]
* @return: java.util.Map<java.lang.Integer,java.lang.String>
* @author: lqWang
* @date: 2024/11/29 18:11
*/
private Map<Integer, String> batchQueryMerchantBandInfo(List<Integer> merchantIdList) {
if(CollectionUtils.isEmpty(merchantIdList)){
return new HashMap<>();
}
//1.获取所有商户的品牌信息
List<ServiceStaffRopResponse> merchantBrandList = this.getMerchantIdList(merchantIdList);
log.info("获取到的商户品牌信息为:{}", merchantBrandList);
List<CarBrandDTO> carBrandTree = this.getCarBrandTree();
Map<Integer, String> brandMap = carBrandTree.stream().collect(Collectors.toMap(CarBrandDTO::getId, CarBrandDTO::getLabel));
//2.整合品牌树信息
Map<Integer, String> brandCarInfoMap = new HashMap<>();
for (ServiceStaffRopResponse brandInfo : merchantBrandList) {
StringBuffer sb = new StringBuffer();
String merchantBrandCars = brandInfo.getMerchantBrandCars();
if(StringUtils.isBlank(merchantBrandCars)){
continue;
}
String[] brandIdCollection = merchantBrandCars.split(";");
for (String brandId : brandIdCollection) {
String brandName = brandMap.get(Integer.parseInt(brandId));
sb.append(brandName+"/");
}
//删除最后一个符号/
String brandNameStr = buildBrandInfoStr(sb, "/");
brandCarInfoMap.put(brandInfo.getMerchantNo(),brandNameStr);
}
log.info("生成的品牌Map为:{}",brandCarInfoMap);
return brandCarInfoMap;
}
/**
* @description: 获取所有的品牌数
* @return: java.util.List<cn.com.glsx.dj.smartcarlife.dto.merchant.CarBrandDTO>
*/
private List<CarBrandDTO> getCarBrandTree(){
final String requestMethod = "merchants.api.merchantCommon.getCarbrandTree";
CommonProxyRequest proxyRequest = new CommonProxyRequest();
LinkedMultiValueMap<String, String> params = new LinkedMultiValueMap<>();
proxyRequest.setRequestMethod(requestMethod);
proxyRequest.setRequestSource(ProxyRequestSourceEnum.MERCHANT.getSource());
proxyRequest.setParams(params);
RpcResponse<ProxyBaseResponse> response = commonProxyRemote.proxyRequest(proxyRequest);
log.info("查询车品牌信息结果:{}", response.isSuccess());
if (response.isFailed()) {
log.error("查询车品牌信息失败, message:{}", response.getMessage());
}
return response.getResult().getList(CarBrandDTO.class);
}
/**
* @description: 根据商户id查询车品牌信息
* @param: [merchantIdList]
* @return: java.util.List<cn.com.glsx.dj.smartcarlife.response.ServiceStaffRopResponse>
* @author: lqWang
* @date: 2024/11/29 18:09
*/
private List<ServiceStaffRopResponse> getMerchantIdList(List<Integer> merchantIdList) {
RpcAssert.assertIsTrue(CollectionUtils.isNotEmpty(merchantIdList), DefaultErrorEnum.DATA_NULL,"merchantIdList not be empty");
final String requestMethod = "merchants.api.open.findMerchantList";
CommonProxyRequest proxyRequest = new CommonProxyRequest();
LinkedMultiValueMap<String, String> params = new LinkedMultiValueMap<>();
String merchantNoStr = merchantIdList.stream().map(String::valueOf).collect(Collectors.joining(","));
params.add("merchantNoStr", merchantNoStr);
proxyRequest.setRequestMethod(requestMethod);
proxyRequest.setRequestSource(ProxyRequestSourceEnum.MERCHANT.getSource());
proxyRequest.setParams(params);
RpcResponse<ProxyBaseResponse> response = commonProxyRemote.proxyRequest2(proxyRequest);
log.info("查询账户中心商户信息返回:{}", response);
if (response.isFailed()) {
log.error("查询账户中心商户信息失败, message:{}", response.getMessage());
// throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "查询账户中心商户信息失败");
}
return response.getResult().getList(ServiceStaffRopResponse.class);
}
/**
* @description: 删除字符串最后一个 flag
* @author: lqWang
* @date: 2024/6/12 16:03
*/
private String buildBrandInfoStr(StringBuffer sb, String flag) {
String str = sb.toString();
int lastIndex = str.lastIndexOf(flag);
if (lastIndex >= 0) {
str = str.substring(0, lastIndex) + str.substring(lastIndex + 1);
}
return str;
}
/**
* @description: 去除掉字符串中的filterStr字段,并去重后用/拼接
* @param: [input, filterStr]
* @return: java.lang.String
* @author: lqWang
* @date: 2025/5/22 19:35
*/
private String filterDistinctBrandName(String input,String filterStr) {
if(StringUtils.isBlank(input) || StringUtils.isBlank(filterStr)) {
return StringUtils.EMPTY;
}
// 1. 按 "/" 分割字符串为字段数组
String[] parts = input.split("/");
List<String> filteredParts = new ArrayList<>();
// 2. 过滤所有值为 "filterStr" 的字段
for (String part : parts) {
if (!filterStr.equals(part)) {
filteredParts.add(part);
}
}
// 3. 去重(保留原始顺序)
Set<String> uniqueParts = new LinkedHashSet<>(filteredParts);
List<String> deduplicated = new ArrayList<>(uniqueParts);
// 处理空结果
if (deduplicated.isEmpty()) return "";
// 4. 拼接结果
if (deduplicated.size() > 3) {
return String.join("/", deduplicated.subList(0, 3));
} else {
return String.join("/", deduplicated);
}
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@
<resultMap id="MerchantPerformanceResultMap"
type="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageByMerchantDTO">
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR"/>
<result column="merchant_name" property="merchantNames" jdbcType="VARCHAR"/>
<result column="scheme_names" property="schemeNames" jdbcType="VARCHAR"/>
<result column="brand_names" property="brandNames" jdbcType="VARCHAR"/>
<result column="business_types" property="businessTypes" jdbcType="VARCHAR"/>
......@@ -112,7 +112,7 @@
</select>
<select id="listByMerchant"
parameterType="cn.com.glsx.dj.staff.dto.MerchantPerformanceQueryDTO"
parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageByMerchantDTO"
resultMap="MerchantPerformanceResultMap">
SELECT
ref.merchant_id AS merchant_id,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!