Commit 65ad02a4 by 章家宝

提成方案:提成构成自测联调兼bug修复

1 parent 47cfb2e5
...@@ -8,7 +8,7 @@ import lombok.experimental.SuperBuilder; ...@@ -8,7 +8,7 @@ import lombok.experimental.SuperBuilder;
* 员工绩效计算结果DTO * 员工绩效计算结果DTO
*/ */
// @AllArgsConstructor // @AllArgsConstructor
// @NoArgsConstructor @NoArgsConstructor
@SuperBuilder @SuperBuilder
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
......
...@@ -7,6 +7,7 @@ import lombok.Data; ...@@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Set;
@Data @Data
public class StaffPerformanceGetDTO implements Serializable { public class StaffPerformanceGetDTO implements Serializable {
...@@ -24,6 +25,12 @@ public class StaffPerformanceGetDTO implements Serializable { ...@@ -24,6 +25,12 @@ public class StaffPerformanceGetDTO implements Serializable {
@ApiModelProperty(notes = "门店名称") @ApiModelProperty(notes = "门店名称")
private String merchantName; private String merchantName;
@ApiModelProperty(notes = "业务类型[0,1,2]")
private Set<Byte> businessList;
@ApiModelProperty(notes = "子品牌名称[]")
private Set<String> childBrandList;
@ApiModelProperty(notes = "有效引荐量") @ApiModelProperty(notes = "有效引荐量")
private Integer effectiveReferralQuantity; private Integer effectiveReferralQuantity;
......
...@@ -299,37 +299,69 @@ public class StaffProductPerformanceService { ...@@ -299,37 +299,69 @@ public class StaffProductPerformanceService {
} }
public List<StaffPerformanceGetDTO> getPerformanceCommissionCompositionForStaff(StaffPerformanceGetDTO dto) { public List<StaffPerformanceGetDTO> getPerformanceCommissionCompositionForStaff(StaffPerformanceGetDTO dto) {
StaffProductPerformanceDTO query = StaffProductPerformanceDTO.builder().staffPhone(dto.getStaffPhone()).month(dto.getMonth()).build(); // 1. 构建查询条件
StaffProductPerformanceDTO query = StaffProductPerformanceDTO.builder()
.staffPhone(dto.getStaffPhone())
.month(dto.getMonth())
.build();
// 2. 查询员工产品绩效列表
List<StaffProductPerformanceDTO> staffProductPerformanceDTOList = staffProductPerformanceMapper.listStaffPerformance(query); List<StaffProductPerformanceDTO> staffProductPerformanceDTOList = staffProductPerformanceMapper.listStaffPerformance(query);
if (staffProductPerformanceDTOList.isEmpty()) { if (staffProductPerformanceDTOList.isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
StaffPerformanceDTO staffPerformanceDTO = StaffPerformanceDTO.builder().staffPhone(dto.getStaffPhone()).month(dto.getMonth()).build();
// 3. 查询员工整体绩效列表
StaffPerformanceDTO staffPerformanceDTO = StaffPerformanceDTO.builder()
.staffPhone(dto.getStaffPhone())
.month(dto.getMonth())
.build();
List<StaffPerformanceDTO> staffPerformanceDTOList = staffPerformanceService.listStaffPerformance(staffPerformanceDTO); List<StaffPerformanceDTO> staffPerformanceDTOList = staffPerformanceService.listStaffPerformance(staffPerformanceDTO);
Map<Integer, List<StaffProductPerformanceDTO>> map = staffProductPerformanceDTOList.stream().collect(Collectors.groupingBy(StaffProductPerformanceDTO::getMerchantId)); Map<Integer, List<StaffProductPerformanceDTO>> map = staffProductPerformanceDTOList.stream()
.filter(item -> item.getMerchantId() != null) // 过滤merchantId为null的对象
.collect(Collectors.groupingBy(StaffProductPerformanceDTO::getMerchantId));
List<StaffPerformanceGetDTO> staffPerformanceGetDTOList = new ArrayList<>(); List<StaffPerformanceGetDTO> staffPerformanceGetDTOList = new ArrayList<>();
for (List<StaffProductPerformanceDTO> value : map.values()) { for (List<StaffProductPerformanceDTO> value : map.values()) {
Set<Byte> businessList = new HashSet<>();
Set<String> childBrandList = new HashSet<>();
StaffProductPerformanceDTO staffProductPerformanceDTO = value.get(0); StaffProductPerformanceDTO staffProductPerformanceDTO = value.get(0);
StaffPerformanceGetDTO staffPerformanceGetDTO = new StaffPerformanceGetDTO(); StaffPerformanceGetDTO staffPerformanceGetDTO = new StaffPerformanceGetDTO();
staffPerformanceGetDTOList.add(staffPerformanceGetDTO); staffPerformanceGetDTOList.add(staffPerformanceGetDTO);
staffPerformanceGetDTO.setStaffName(staffProductPerformanceDTO.getStaffName()); staffPerformanceGetDTO.setStaffName(staffProductPerformanceDTO.getStaffName());
staffPerformanceGetDTO.setMerchantId(staffProductPerformanceDTO.getMerchantId()); staffPerformanceGetDTO.setMerchantId(staffProductPerformanceDTO.getMerchantId());
int effectiveReferralQuantity = 0; int effectiveReferralQuantity = 0;
int touchNumber = 0; int touchNumber = 0;
BigDecimal totalPerformanceAmount = BigDecimal.ZERO; BigDecimal totalPerformanceAmount = BigDecimal.ZERO;
for (StaffPerformanceDTO performanceDTO : staffPerformanceDTOList) { for (StaffPerformanceDTO performanceDTO : staffPerformanceDTOList) {
if (performanceDTO.getMerchantId().equals(staffProductPerformanceDTO.getMerchantId())) { if (performanceDTO.getMerchantId() != null && performanceDTO.getMerchantId().equals(staffProductPerformanceDTO.getMerchantId())) {
effectiveReferralQuantity += performanceDTO.getEffectiveReferralQuantity(); effectiveReferralQuantity += performanceDTO.getEffectiveReferralQuantity();
touchNumber += performanceDTO.getTouchNumber(); touchNumber += performanceDTO.getTouchNumber();
if (performanceDTO.getBusinessType() != null) {
businessList.add(performanceDTO.getBusinessType());
}
if (performanceDTO.getChildBrandName() != null) {
childBrandList.add(performanceDTO.getChildBrandName());
}
} }
} }
for (StaffProductPerformanceDTO productPerformanceDTO : value) { for (StaffProductPerformanceDTO productPerformanceDTO : value) {
totalPerformanceAmount = totalPerformanceAmount.add(productPerformanceDTO.getPerformanceAmount()); if (productPerformanceDTO.getPerformanceAmount() != null) {
totalPerformanceAmount = totalPerformanceAmount.add(productPerformanceDTO.getPerformanceAmount());
}
} }
staffPerformanceGetDTO.setEffectiveReferralQuantity(effectiveReferralQuantity); staffPerformanceGetDTO.setEffectiveReferralQuantity(effectiveReferralQuantity);
staffPerformanceGetDTO.setTouchNumber(touchNumber); staffPerformanceGetDTO.setTouchNumber(touchNumber);
staffPerformanceGetDTO.setStaffPerformanceList(value); staffPerformanceGetDTO.setStaffPerformanceList(value);
staffPerformanceGetDTO.setBusinessList(businessList);
staffPerformanceGetDTO.setChildBrandList(childBrandList);
} }
return staffPerformanceGetDTOList; return staffPerformanceGetDTOList;
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.dj.staff.mapper.StaffProductPerformanceMapper"> <mapper namespace="cn.com.glsx.dj.staff.mapper.StaffProductPerformanceMapper">
<!-- 核心:StaffProductPerformanceDTO 对应的 resultMap -->
<resultMap id="StaffProductPerformanceResultMap" type="cn.com.glsx.dj.staff.model.StaffProductPerformance">
<!-- 主键映射 -->
<id column="id" property="id" jdbcType="BIGINT"/>
<!-- 基础字段映射 -->
<result column="staff_name" property="staffName" jdbcType="VARCHAR"/>
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR"/>
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR"/>
<result column="business_type" property="businessType" jdbcType="TINYINT"/>
<result column="brand_id" property="brandId" jdbcType="INTEGER"/>
<result column="brand_name" property="brandName" jdbcType="VARCHAR"/>
<result column="child_brand_id" property="childBrandId" jdbcType="INTEGER"/>
<result column="child_brand_name" property="childBrandName" jdbcType="VARCHAR"/>
<result column="month" property="month" jdbcType="VARCHAR"/>
<result column="goods_config_type" property="goodsConfigType" jdbcType="TINYINT"/>
<result column="goods_type" property="goodsType" jdbcType="INTEGER"/>
<result column="goods_type_name" property="goodsTypeName" jdbcType="VARCHAR"/>
<result column="secondary_goods_type" property="secondaryGoodsType" jdbcType="INTEGER"/>
<result column="secondary_goods_type_name" property="secondaryGoodsTypeName" jdbcType="VARCHAR"/>
<result column="third_level_goods_type" property="thirdLevelGoodsType" jdbcType="INTEGER"/>
<result column="third_level_goods_type_name" property="thirdLevelGoodsTypeName" jdbcType="VARCHAR"/>
<result column="product_define_id" property="productDefineId" jdbcType="INTEGER"/>
<result column="product_define_name" property="productDefineName" jdbcType="VARCHAR"/>
<result column="gmv_output" property="gmvOutput" jdbcType="DECIMAL"/>
<result column="upgrade_order_num" property="upgradeOrderNum" jdbcType="INTEGER"/>
<result column="personal_penetration_rate" property="personalPenetrationRate" jdbcType="DECIMAL"/>
<result column="performance_amount" property="performanceAmount" jdbcType="DECIMAL"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
</resultMap>
<select id="listStaffPerformance" parameterType="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO" resultType="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO" extends="StaffProductPerformanceResultMap">
</resultMap>
<select id="listStaffPerformance" parameterType="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO" resultMap="DTOResultMap">
SELECT SELECT
* *
FROM FROM
dj_car_life_staff_product_performance dj_car_life_staff_product_performance
WHERE WHERE
deleted_flag = 'N' deleted_flag = 'N'
<if test="dto.staffName != null and dto.staffName != ''"> <if test="staffName != null and staffName != ''">
AND staff_name LIKE CONCAT('%', #{dto.staffName}, AND staff_name LIKE CONCAT('%', #{staffName},
'%') '%')
</if> </if>
<if test="dto.staffPhone != null and dto.staffPhone != ''"> <if test="staffPhone != null and staffPhone != ''">
AND staff_phone = #{dto.staffPhone} AND staff_phone = #{staffPhone}
</if> </if>
<if test="dto.month != null and dto.month != ''"> <if test="month != null and month != ''">
AND month = #{dto.month} AND month = #{month}
</if> </if>
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!