Commit fab99cb6 by 张富康

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

2 parents 2d2fdecb 840c658b
Showing 16 changed files with 793 additions and 13 deletions
package cn.com.glsx.dj.staff.dto.perfSalary;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class EffectiveReferralCountDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "品牌类型:0-问界 1-智界 2-享界 3-尊界 4-尚界 5-其它品牌")
private Integer brandType;
@ApiModelProperty(value = "品牌名称,例如:问界、智界...")
private String brandName;
@ApiModelProperty(value = "交车数")
private Integer deliveryCount;
@ApiModelProperty(value = "有效引荐数")
private Integer effectiveReferralCount;
}
package cn.com.glsx.dj.staff.dto.perfSalary;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* 有效引荐数表
*/
@Data
public class EffectiveReferralReviewCommonDTO extends EffectiveReferralReview {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "门店名称")
private String merchantName;
@ApiModelProperty(value = "提交状态:0-未提交 1-已提交")
private Integer submitStatus;
@ApiModelProperty(value = "单延保提交状态:0-未提交,1-草稿,2-已提交")
private Integer singleExtendedWarrantySubmitStatus;
@ApiModelProperty(value = "广联权益提交状态:0-未提交,1-草稿,2-已提交")
private Integer interestSubmitStatus;
@ApiModelProperty(value = "轻改状态:0-未提交,1-草稿,2-已提交")
private Integer lightModificationSubmitStatus;
@ApiModelProperty(value = "商户号集合,无须前端传")
private List<Integer> merchantIds;
}
\ No newline at end of file
package cn.com.glsx.dj.staff.dto.perfSalary;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
......@@ -16,5 +17,4 @@ import lombok.experimental.SuperBuilder;
@EqualsAndHashCode(callSuper=false)
public class EffectiveReferralReviewDTO extends EffectiveReferralReview {
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
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 SceneTypeEffectiveReferralDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "业务场景:1-精品升级(轻改);2-会员权益(广联权益);3-单延保;")
private Byte sceneType;
@ApiModelProperty(value = "品牌有效引荐数DTOs")
private List<EffectiveReferralCountDTO> effectiveReferralCountDTOS;
@ApiModelProperty(value = "凭证Url 以,分隔")
private String imageUrls;
@ApiModelProperty(value = "备注")
private String remark;
}
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 StoreEffectiveReferralDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "门店名称")
private String merchantName;
@ApiModelProperty(value = "业务场景引荐数列表")
private List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals;
}
package cn.com.glsx.dj.staff.enums.perfSalary;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
/**
* 品牌类型枚举
*/
@Getter
@AllArgsConstructor
public enum EffectiveReferralBrandTypeEnum {
ASKING_WORLD(0, "问界"),
SMART_WORLD(1, "智界"),
ENJOY_WORLD(2, "享界"),
RESPECT_WORLD(3, "尊界"),
NOBLE_WORLD(4, "尚界"),
OTHER_BRAND(5, "其它品牌");
/**
* 品牌类型编码
*/
private final Integer code;
/**
* 品牌类型描述
*/
private final String description;
/**
* 根据编码获取枚举
*
* @param code 编码
* @return 对应的枚举,找不到时返回null
*/
public static EffectiveReferralBrandTypeEnum getByCode(Integer code) {
if (code == null) {
return null;
}
for (EffectiveReferralBrandTypeEnum type : EffectiveReferralBrandTypeEnum.values()) {
if (type.getCode().equals(code)) {
return type;
}
}
return null;
}
/**
* 根据编码获取描述
*
* @param code 编码
* @return 描述,找不到时返回null
*/
public static String getDescriptionByCode(Integer code) {
EffectiveReferralBrandTypeEnum type = getByCode(code);
return type != null ? type.getDescription() : null;
}
/**
* 根据描述获取枚举
*
* @param description 描述
* @return 对应的枚举,找不到时返回null
*/
public static EffectiveReferralBrandTypeEnum getByDescription(String description) {
if (StringUtils.isBlank(description)) {
return null;
}
for (EffectiveReferralBrandTypeEnum type : EffectiveReferralBrandTypeEnum.values()) {
if (type.getDescription().equals(description)) {
return type;
}
}
return null;
}
/**
* 根据描述获取编码
*
* @param description 描述
* @return 编码,找不到时返回null
*/
public static Integer getCodeByDescription(String description) {
EffectiveReferralBrandTypeEnum type = getByDescription(description);
return type != null ? type.getCode() : null;
}
/**
* 检查编码是否有效
*
* @param code 编码
* @return 是否有效
*/
public static boolean isValid(Integer code) {
return getByCode(code) != null;
}
}
\ No newline at end of file
package cn.com.glsx.dj.staff.enums.perfSalary;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 有效转介场景枚举
*/
@Getter
@AllArgsConstructor
public enum EffectiveReferralSceneEnum {
/**
* 精品升级(轻改)
*/
PREMIUM_UPGRADE((byte) 1, "精品升级(轻改)"),
/**
* 会员权益(广联权益)
*/
MEMBER_RIGHTS((byte) 2, "会员权益(广联权益)"),
/**
* 单延保
*/
SINGLE_EXTENDED_WARRANTY((byte) 3, "单延保");
/**
* 场景编码
*/
private final Byte code;
/**
* 场景描述
*/
private final String description;
private static final Map<Byte, EffectiveReferralSceneEnum> CODE_MAP =
Arrays.stream(values())
.collect(Collectors.toMap(
EffectiveReferralSceneEnum::getCode,
Function.identity()
));
/**
* 根据编码获取枚举实例
*
* @param code 场景编码
* @return 枚举实例,如果不存在则返回null
*/
public static EffectiveReferralSceneEnum getByCode(Byte code) {
return CODE_MAP.get(code);
}
/**
* 根据编码获取枚举实例(带默认值)
*
* @param code 场景编码
* @param defaultValue 默认值
* @return 枚举实例,如果不存在则返回默认值
*/
public static EffectiveReferralSceneEnum getByCodeOrDefault(Byte code, EffectiveReferralSceneEnum defaultValue) {
return CODE_MAP.getOrDefault(code, defaultValue);
}
/**
* 检查编码是否存在
*
* @param code 场景编码
* @return 是否存在
*/
public static boolean contains(Byte code) {
return CODE_MAP.containsKey(code);
}
/**
* 获取所有编码的描述映射
*
* @return 编码-描述映射
*/
public static Map<Byte, String> getAllCodeDescMap() {
return Arrays.stream(values())
.collect(Collectors.toMap(
EffectiveReferralSceneEnum::getCode,
EffectiveReferralSceneEnum::getDescription
));
}
/**
* 判断是否为指定编码
*
* @param code 待判断的编码
* @return 是否相等
*/
public boolean isCode(Byte code) {
return this.code.equals(code);
}
}
\ No newline at end of file
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.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;
import java.util.List;
@ApiService(value = "小程序有效引荐接口", owner = "team", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
public interface EffectiveReferralReviewMiniProgramRemote {
@ApiMethod("门店有效引荐数列表")
@ApiParam(name = "pagination", notes = "分页查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("门店有效引荐数分页")
RpcResponse<List<EffectiveReferralReviewCommonDTO>> effectiveReferralStoreList(@NotNull EffectiveReferralReviewCommonDTO request);
@ApiMethod("门店有效引荐数详情")
@ApiParam(name = "id", notes = "门店有效引荐记录id", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiResponse("门店有效引荐数详情")
RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(Integer id);
@ApiMethod("门店有效引荐数提交")
@ApiParam(name = "dto", notes = "提交信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提交结果")
RpcResponse<Boolean> effectiveReferralStoreSubmit(@NotNull EffectiveReferralReviewDTO dto);
}
\ No newline at end of file
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.EffectiveReferralReviewCommonDTO;
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;
@ApiService(value = "有效引荐接口", owner = "team", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
public interface EffectiveReferralReviewRemote {
@ApiMethod("店铺设置-有效引荐列表")
@ApiParam(name = "pagination", notes = "分页查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("有效引荐分页")
RpcResponse<RpcPagination<EffectiveReferralReviewCommonDTO>> effectiveReferralPage(@NotNull RpcPagination<EffectiveReferralReviewCommonDTO> pagination);
@ApiMethod("订单管理-有效引荐数复核列表")
@ApiParam(name = "pagination", notes = "分页查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("有效引荐复核分页")
RpcResponse<RpcPagination<EffectiveReferralReviewCommonDTO>> effectiveReferralAuditPage(@NotNull RpcPagination<EffectiveReferralReviewCommonDTO> pagination);
@ApiMethod("有效引荐详情")
@ApiParam(name = "id", notes = "有效引荐记录id", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiResponse("有效引荐详情")
RpcResponse<EffectiveReferralReviewCommonDTO> effectiveReferralDetail(Integer id);
@ApiMethod("有效引荐数-复核")
@ApiParam(name = "dto", notes = "复核信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("复核结果")
RpcResponse<Boolean> effectiveReferralAudit(@NotNull EffectiveReferralReviewCommonDTO dto);
@ApiMethod("web端有效引荐导出数据查询")
@ApiParam(name = "pagination", notes = "分页查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("导出数据列表")
RpcResponse<String> effectiveReferralExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination);
@ApiMethod("web端有效引荐复核导出数据查询")
@ApiParam(name = "pagination", notes = "分页查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("复核导出数据列表")
RpcResponse<String> effectiveReferralAuditExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper.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.model.perfSalary.EffectiveReferralReview;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface EffectiveReferralReviewMapper extends OreMapper<EffectiveReferralReview> {
......@@ -15,4 +18,21 @@ public interface EffectiveReferralReviewMapper extends OreMapper<EffectiveReferr
* @return 记录
*/
EffectiveReferralReviewDTO selectOneByQuery(EffectiveReferralReviewDTO query);
/**
* 查询门店列表
*
* @param query 查询条件
* @return 门店列表
*/
List<EffectiveReferralReviewCommonDTO> selectStoreList(EffectiveReferralReviewCommonDTO query);
/**
* 查询门店有效数列表
*
* @param query 查询条件
* @return 门店列表
*/
List<EffectiveReferralReviewCommonDTO> selectStoreEffectiveReferralList(EffectiveReferralReviewCommonDTO query);
}
\ No newline at end of file
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.service.perfSalary.EffectiveReferralReviewMiniProgramService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(version = "1.0.0", validation = "true")
public class EffectiveReferralReviewMiniProgramRemoteImpl implements EffectiveReferralReviewMiniProgramRemote {
@Autowired
private EffectiveReferralReviewMiniProgramService effectiveReferralReviewMiniprogramService;
@Override
public RpcResponse<List<EffectiveReferralReviewCommonDTO>> effectiveReferralStoreList(EffectiveReferralReviewCommonDTO request) {
try{
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreList(request));
}catch(RpcServiceException e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<StoreEffectiveReferralDetailDTO> effectiveReferralStoreDetail(Integer merchantId) {
try{
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreDetail(merchantId));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> effectiveReferralStoreSubmit(EffectiveReferralReviewDTO dto) {
try{
return RpcResponse.success(effectiveReferralReviewMiniprogramService.effectiveReferralStoreSubmit(dto));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
}
\ No newline at end of file
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.service.perfSalary.EffectiveReferralReviewService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@DubboService(version = "1.0.0", validation = "true")
public class EffectiveReferralReviewRemoteImpl implements EffectiveReferralReviewRemote {
@Autowired
private EffectiveReferralReviewService effectiveReferralReviewService;
@Override
public RpcResponse<RpcPagination<EffectiveReferralReviewCommonDTO>> effectiveReferralPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
try{
return RpcResponse.success(effectiveReferralReviewService.effectiveReferralPage(pagination));
}catch(RpcServiceException e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<RpcPagination<EffectiveReferralReviewCommonDTO>> effectiveReferralAuditPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
try{
return RpcResponse.success(effectiveReferralReviewService.effectiveReferralAuditPage(pagination));
}catch(RpcServiceException e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<EffectiveReferralReviewCommonDTO> effectiveReferralDetail(Integer id) {
try{
return RpcResponse.success(effectiveReferralReviewService.effectiveReferralDetail(id));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> effectiveReferralAudit(EffectiveReferralReviewCommonDTO dto) {
try{
effectiveReferralReviewService.effectiveReferralAudit(dto);
return RpcResponse.success(true);
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<String> effectiveReferralExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
try{
return RpcResponse.success(effectiveReferralReviewService.effectiveReferralExportData(pagination));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<String> effectiveReferralAuditExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
try{
return RpcResponse.success(effectiveReferralReviewService.effectiveReferralAuditExportData(pagination));
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
}
\ No newline at end of file
package cn.com.glsx.dj.staff.service.perfSalary;
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.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
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.stream.Collectors;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class EffectiveReferralReviewMiniProgramService {
@Resource
private EffectiveReferralReviewMapper effectiveReferralReviewMapper;
public List<EffectiveReferralReviewCommonDTO> effectiveReferralStoreList(EffectiveReferralReviewCommonDTO request) {
//筛选项:门店名字(模糊搜索),状态:未提交、已提交,月份:2026-01,
//特殊逻辑:根据商户门店id去重,根据门店首字母倒序。要根据门店的不同业务场景的数据判断是否已提交和未提交。
//不同业务场景`scene_type` '业务场景:1-精品升级(轻改);2-会员权益(广联权益);3-单延保 状态`status` '状态:0-未提交,1-草稿,2-已提交',全部为已提交时,总的提交状态submitStatus才是已提交。
//注意:要跟服务商户表dj_car_life_service_merchant根据`merchant_id`关联,用于筛选项门店搜索,sal_effective_referral_review作为主表
List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreList(request);
if (CollectionUtils.isEmpty(list)) {
return list;
}
//赋值不同业务提交状态
fillSceneTypeSubmitStatus(list);
return list;
}
/**
* 赋值不同业务场景的提交状态
*
* @param list
*/
private void fillSceneTypeSubmitStatus(List<EffectiveReferralReviewCommonDTO> list) {
list.forEach(item -> {
Example example = new Example(EffectiveReferralReview.class);
example.createCriteria()
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name())
.andEqualTo("merchantId", item.getMerchantId());
List<EffectiveReferralReview> effectiveReferralReviews = effectiveReferralReviewMapper.selectByExample(example);
List<EffectiveReferralReview> lightModificationList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 1).collect(Collectors.toList());
List<EffectiveReferralReview> interestList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 2).collect(Collectors.toList());
List<EffectiveReferralReview> singleExtendedWarrantyList = effectiveReferralReviews.stream().filter(effectiveReferralReview -> effectiveReferralReview.getSceneType() == 3).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(lightModificationList)) {
item.setLightModificationSubmitStatus(lightModificationList.get(0).getStatus());
}
if (CollectionUtils.isNotEmpty(interestList)) {
item.setInterestSubmitStatus(interestList.get(0).getStatus());
}
if (CollectionUtils.isNotEmpty(singleExtendedWarrantyList)) {
item.setSingleExtendedWarrantySubmitStatus(singleExtendedWarrantyList.get(0).getStatus());
}
});
}
public StoreEffectiveReferralDetailDTO effectiveReferralStoreDetail(Integer merchantId) {
//1、根据门店id获取门店所有数据
EffectiveReferralReviewCommonDTO commonDTO = new EffectiveReferralReviewCommonDTO();
commonDTO.setMerchantId(merchantId);
List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(commonDTO);
if (CollectionUtils.isEmpty(referralReviewCommonDTOS)) {
return new StoreEffectiveReferralDetailDTO();
}
//3、封装各业务场景引荐数(特殊逻辑品牌类型为其他的时候要去找路奇确认)
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = getSceneTypeEffectiveReferralDTOS(referralReviewCommonDTOS);
//4、封装返回参数
StoreEffectiveReferralDetailDTO detailDTO = new StoreEffectiveReferralDetailDTO();
detailDTO.setMerchantName(referralReviewCommonDTOS.get(0).getMerchantName());
detailDTO.setSceneTypeEffectiveReferrals(sceneTypeEffectiveReferrals);
return detailDTO;
}
/**
* 根据业务场景获取各业务场景引荐数
*
* @param referralReviewCommonDTOS
* @return
*/
private static List<SceneTypeEffectiveReferralDTO> getSceneTypeEffectiveReferralDTOS(List<EffectiveReferralReviewCommonDTO> referralReviewCommonDTOS) {
//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());
List<EffectiveReferralReviewCommonDTO> singleExtendedWarrantyList = referralReviewCommonDTOS.stream().filter(effectiveReferralReview -> Objects.equals(effectiveReferralReview.getSceneType(), EffectiveReferralSceneEnum.SINGLE_EXTENDED_WARRANTY.getCode())).collect(Collectors.toList());
//2、封装各业务场景有效引荐数
List<SceneTypeEffectiveReferralDTO> lightModificationDTOS =
getEffectiveReferralDTOSBySceneType(lightModificationList, EffectiveReferralSceneEnum.PREMIUM_UPGRADE.getCode());
List<SceneTypeEffectiveReferralDTO> memberRightsDTOS =
getEffectiveReferralDTOSBySceneType(memberRightList, EffectiveReferralSceneEnum.MEMBER_RIGHTS.getCode());
List<SceneTypeEffectiveReferralDTO> singleExtendedWarrantyDTOS =
getEffectiveReferralDTOSBySceneType(singleExtendedWarrantyList, EffectiveReferralSceneEnum.SINGLE_EXTENDED_WARRANTY.getCode());
List<SceneTypeEffectiveReferralDTO> sceneTypeEffectiveReferrals = new ArrayList<>();
sceneTypeEffectiveReferrals.addAll(lightModificationDTOS);
sceneTypeEffectiveReferrals.addAll(memberRightsDTOS);
sceneTypeEffectiveReferrals.addAll(singleExtendedWarrantyDTOS);
return sceneTypeEffectiveReferrals;
}
/**
* 获取各业务场景有效引荐数
*
* @param effectiveReferralList
* @param sceneType
* @return
*/
private static List<SceneTypeEffectiveReferralDTO> getEffectiveReferralDTOSBySceneType(List<EffectiveReferralReviewCommonDTO> effectiveReferralList, Byte sceneType) {
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());
List<EffectiveReferralCountDTO> effectiveReferralCountDTOS = new ArrayList<>();
effectiveReferralList.forEach(
item -> {
EffectiveReferralCountDTO countDTO = new EffectiveReferralCountDTO();
countDTO.setBrandName(item.getBrandName());
//todo 根据品牌id去路奇确认
if (item.getBrandId() == -1) {
countDTO.setBrandName(item.getBrandName());
}
countDTO.setBrandType(EffectiveReferralBrandTypeEnum.getCodeByDescription(item.getBrandName()));
countDTO.setDeliveryCount(item.getTotalDeliveryCount());
effectiveReferralCountDTOS.add(countDTO);
}
);
referralDTO.setEffectiveReferralCountDTOS(effectiveReferralCountDTOS);
sceneTypeEffectiveReferrals.add(referralDTO);
}
return sceneTypeEffectiveReferrals;
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean effectiveReferralStoreSubmit(EffectiveReferralReviewDTO dto) {
// 核心业务逻辑暂不实现
effectiveReferralReviewMapper.updateByPrimaryKeySelective(dto);
return true;
}
}
\ No newline at end of file
package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
......@@ -18,19 +24,39 @@ public class EffectiveReferralReviewService {
@Resource
private EffectiveReferralReviewMapper effectiveReferralReviewMapper;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void test(String test) {
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
List<EffectiveReferralReviewCommonDTO> list = null;
Page<EffectiveReferralReviewCommonDTO> page = (Page<EffectiveReferralReviewCommonDTO>) list;
pagination = RpcPagination.copyPage(page);
return pagination;
}
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralAuditPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
List<EffectiveReferralReviewCommonDTO> list = null;
Page<EffectiveReferralReviewCommonDTO> page = (Page<EffectiveReferralReviewCommonDTO>) list;
pagination = RpcPagination.copyPage(page);
return pagination;
}
public EffectiveReferralReviewCommonDTO effectiveReferralDetail(Integer id) {
return (EffectiveReferralReviewCommonDTO) effectiveReferralReviewMapper.selectByPrimaryKey(id);
}
/**
* 根据条件查询单条有效引荐数记录
*
* @param query 查询参数
* @return 记录
*/
public EffectiveReferralReviewDTO queryEffectiveReferralReview(EffectiveReferralReviewDTO query) {
return effectiveReferralReviewMapper.selectOneByQuery(query);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void effectiveReferralAudit(EffectiveReferralReviewCommonDTO dto) {
// 核心业务逻辑暂不实现
effectiveReferralReviewMapper.updateByPrimaryKeySelective(dto);
}
public String effectiveReferralExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
return null;
}
public String effectiveReferralAuditExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
return null;
}
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.enums.AssessmentFactorEnum;
import cn.com.glsx.dj.staff.mapper.StaffPerformanceCalMapper;
import cn.com.glsx.dj.staff.service.perfSalary.EffectiveReferralReviewService;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
......
......@@ -34,6 +34,11 @@
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO" extends="BaseResultMap">
</resultMap>
<resultMap id="CommonDTOResultMap" type="cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO" extends="BaseResultMap">
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
<result column="submit_status" jdbcType="INTEGER" property="submitStatus"/>
</resultMap>
<sql id="Base_Column_List">
id, merchant_id, total_delivery_count, area_effective_count,
reviewed_effective_count, review_month, image_urls, remark,
......@@ -65,5 +70,53 @@
LIMIT
1
</select>
<select id="selectStoreList" resultMap="CommonDTOResultMap">
SELECT
serr.merchant_id,
MIN(dclsm.merchant_name) AS merchant_name,
serr.review_month,
CASE
WHEN MAX(CASE WHEN serr.status IN (0, 1) THEN 1 ELSE 0 END) = 1
THEN 0
ELSE 1
END AS submit_status
FROM sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N'
and serr.merchant_id in
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="merchantName != null and merchantName != ''">
AND dclsm.merchant_name LIKE CONCAT('%', #{merchantName}, '%')
</if>
<if test="createdDate != null and createdDate != ''">
AND DATE_FORMAT(serr.created_date, '%Y-%m') = #{createdDate}
</if>
GROUP BY serr.merchant_id
<if test="submitStatus != null">
HAVING
CASE
WHEN MAX(CASE WHEN serr.status IN (0, 1) THEN 1 ELSE 0 END) = 1
THEN 0
ELSE 1
END = #{submitStatus}
</if>
ORDER BY
CONVERT(MIN(dclsm.merchant_name) USING gbk) DESC
</select>
<select id="selectStoreEffectiveReferralList" resultMap="CommonDTOResultMap">
SELECT
serr.*,
dclsm.merchant_name
FROM sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N'
AND serr.merchant_id = #{merchantId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!