提成计算相关-问题修复

1 parent 3b6502e9
...@@ -44,4 +44,8 @@ public class PerformanceConfigDTO extends PerformanceConfig { ...@@ -44,4 +44,8 @@ public class PerformanceConfigDTO extends PerformanceConfig {
*/ */
private String merchantName; private String merchantName;
private String brandName;
private String childBrandName;
} }
...@@ -6,12 +6,11 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,12 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder @SuperBuilder
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
@EqualsAndHashCode(callSuper=false)
@AllArgsConstructor
@NoArgsConstructor
public class PerformanceParamConfigConditionDTO extends PerformanceParamConfigCondition { public class PerformanceParamConfigConditionDTO extends PerformanceParamConfigCondition {
private MerchantPerformanceProductDefineDTO productDefine; private MerchantPerformanceProductDefineDTO productDefine;
@ApiModelProperty(notes = "提成方案置ID") @ApiModelProperty(notes = "提成方案置ID")
......
...@@ -64,11 +64,21 @@ public class StaffPerformanceCalContextDTO implements Serializable { ...@@ -64,11 +64,21 @@ public class StaffPerformanceCalContextDTO implements Serializable {
private Integer brandId; private Integer brandId;
/** /**
* 品牌名称
*/
private String brandName;
/**
* 子品牌ID * 子品牌ID
*/ */
private Integer childBrandId; private Integer childBrandId;
/** /**
* 子品牌名称
*/
private String childBrandName;
/**
* 当前计算的门店提成方案 * 当前计算的门店提成方案
*/ */
private PerformanceConfigDTO performanceConfig; private PerformanceConfigDTO performanceConfig;
......
...@@ -2,9 +2,9 @@ package cn.com.glsx.dj.staff.dto; ...@@ -2,9 +2,9 @@ package cn.com.glsx.dj.staff.dto;
import cn.com.glsx.dj.staff.model.StaffPerformanceDetail; import cn.com.glsx.dj.staff.model.StaffPerformanceDetail;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -12,13 +12,16 @@ import java.math.BigDecimal; ...@@ -12,13 +12,16 @@ import java.math.BigDecimal;
/** /**
* 提成结果明细DTO * 提成结果明细DTO
*/ */
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder @SuperBuilder
@ToString(callSuper = true)
@Data @Data
@EqualsAndHashCode(callSuper=false)
public class StaffPerformanceDetailDTO extends StaffPerformanceDetail { public class StaffPerformanceDetailDTO extends StaffPerformanceDetail {
private static final long serialVersionUID = 833236627080089143L; private static final long serialVersionUID = 833236627080089143L;
@ApiModelProperty(notes = "额外提成金额") @ApiModelProperty(notes = "额外提成金额")
private BigDecimal extraPerformanceAmount; private BigDecimal extraPerformanceAmount;
@ApiModelProperty(notes = "个人渗透率")
private BigDecimal personalPenetrationRate;
} }
package cn.com.glsx.dj.staff.dto.perfSalary; package cn.com.glsx.dj.staff.dto.perfSalary;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview; import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor;
import lombok.*; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.util.List;
/** /**
* 有效引荐数表 * 有效引荐数表
*/ */
//@AllArgsConstructor // @AllArgsConstructor
//@NoArgsConstructor // @NoArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder @SuperBuilder
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
@EqualsAndHashCode(callSuper=false)
public class EffectiveReferralReviewDTO extends EffectiveReferralReview { public class EffectiveReferralReviewDTO extends EffectiveReferralReview {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<Integer> ids;
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.enums; package cn.com.glsx.dj.staff.enums;
import java.util.Objects;
/** /**
* 绩效参数配置条件类型枚举 * 绩效参数配置条件类型枚举
*/ */
...@@ -17,12 +19,12 @@ public enum PerformanceConditionTypeEnum implements BaseEnum<Byte, String> { ...@@ -17,12 +19,12 @@ public enum PerformanceConditionTypeEnum implements BaseEnum<Byte, String> {
this.desc = desc; this.desc = desc;
} }
public static PerformanceConditionTypeEnum getByCode(Number code) { public static PerformanceConditionTypeEnum getByCode(Byte code) {
if (code == null) { if (code == null) {
return null; return null;
} }
for (PerformanceConditionTypeEnum type : PerformanceConditionTypeEnum.values()) { for (PerformanceConditionTypeEnum type : PerformanceConditionTypeEnum.values()) {
if (type.getCode().equals(code.intValue())) { if (Objects.equals(type.getCode(), code)) {
return type; return type;
} }
} }
......
...@@ -134,10 +134,6 @@ public class StaffPerformanceDetail implements Serializable { ...@@ -134,10 +134,6 @@ public class StaffPerformanceDetail implements Serializable {
@Column(name = "upgrade_order_num") @Column(name = "upgrade_order_num")
private Integer upgradeOrderNum; private Integer upgradeOrderNum;
@ApiModelProperty(notes = "个人渗透率")
@Column(name = "personal_penetration_rate")
private BigDecimal personalPenetrationRate;
@ApiModelProperty(notes = "提成方式(比例-BL,系数-XS,固定金额-DDJE)") @ApiModelProperty(notes = "提成方式(比例-BL,系数-XS,固定金额-DDJE)")
@Column(name = "commission_type") @Column(name = "commission_type")
private String commissionType; private String commissionType;
...@@ -151,6 +147,26 @@ public class StaffPerformanceDetail implements Serializable { ...@@ -151,6 +147,26 @@ public class StaffPerformanceDetail implements Serializable {
/** /**
* <pre> * <pre>
* { * {
* "assessmentFactorDependencyData": {
* "orderData": { // 订单依赖数据
* "personalMonthlyTotalOutput": 1000.00, // 个人月度总产值(业务)
* "personalMonthlyStoreOutput": 800.00, // 个人月度单店产值(门店+业务)
* "mainOrderCountByBrand": 5, // 主订单成交数(门店+业务+品牌)
* "mainOrderCountByBrandAndCategory": 3, // 主订单成交数(门店+业务+品牌+品类)
* "subOrderCountByBrandAndCategory": 10, // 子订单成交数(门店+业务+品牌+品类)
* "categoryOrderOutputTotalByBrandAndCategory": 500.00, // 品类订单产值合计(门店+业务+品牌+品类)
* "commissionBaseSubOrderCountByBrandAndCategory": 8, // 提成基数-子订单成交数(门店+业务+品牌+品类)
* "commissionBaseCategoryOrderOutputTotalByBrandAndCategory": 400.00 // 提成基数-品类订单产值合计(门店+业务+品牌+品类)
* },
* "dailyData": { // 日报/触客依赖数据
* "personalTotalPreSalesTouchCount": 100, // 该个人在所有门店的实际售前触客数总和
* "storePersonalPreSalesTouchCount": 50, // 该门店的该个人实际售前触客数
* "storeTotalTouchCount": 500, // 门店总触客数(该门店的所有个人实际售前触客数之和)
* "storeDeliveryCount": 40, // 门店交车数
* "storeValidRecommendationCount": 45, // 门店有效引荐数
* "personalTargetTouchCount": 10.50 // 个人应触客数
* }
* },
* "conditionExecutions": [ * "conditionExecutions": [
* { * {
* "conditionType": 1, * "conditionType": 1,
......
...@@ -41,8 +41,10 @@ public class StaffPerformanceDetailService { ...@@ -41,8 +41,10 @@ public class StaffPerformanceDetailService {
return; return;
} }
log.info("Saving staff performance details. merchantId={}, businessType={}, month={}, count={}", log.info(
config.getMerchantId(), config.getBusinessType(), config.getEffectiveMonth(), "Saving staff performance details. merchantId={}, businessType={}, brandId={}, childBrandId={}, month={}, count={}",
config.getMerchantId(), config.getBusinessType(), config.getBrandId(), config.getChildBrandId(),
config.getEffectiveMonth(),
performanceDetailDTOS == null ? 0 : performanceDetailDTOS.size()); performanceDetailDTOS == null ? 0 : performanceDetailDTOS.size());
if (CollectionUtils.isEmpty(performanceDetailDTOS)) { if (CollectionUtils.isEmpty(performanceDetailDTOS)) {
......
...@@ -61,16 +61,22 @@ public class StaffPerformanceService { ...@@ -61,16 +61,22 @@ public class StaffPerformanceService {
merchantId, businessType, brandId, childBrandId, performanceMonth, staffPhone); merchantId, businessType, brandId, childBrandId, performanceMonth, staffPhone);
return; return;
} }
log.info(
"保存员工绩效数据: merchantId={}, businessType={}, brandId={}, childBrandId={}, performanceMonth={}, staffPhone={}",
merchantId, businessType, brandId, childBrandId, performanceMonth, staffPhone);
// 2. 检查是否处于新人保护期 // 2. 检查是否处于新人保护期
boolean isNewcomerProtection = checkNewcomerProtection(context.getStaffPhone(), context.getPerformanceMonth()); boolean isNewcomerProtection = checkNewcomerProtection(context.getStaffPhone(), context.getPerformanceMonth());
log.info("是否处于新人保护期: isNewcomerProtection={}", isNewcomerProtection);
// 3. 构建 StaffPerformance // 3. 构建 StaffPerformance
StaffPerformance staffPerformance = buildStaffPerformance(performanceDetailDTOS, context, isNewcomerProtection); StaffPerformance staffPerformance = buildStaffPerformance(performanceDetailDTOS, context, isNewcomerProtection);
// 4. 逻辑删除旧数据 // 4. 逻辑删除旧数据
log.debug("逻辑删除旧数据: staffPerformance={}", staffPerformance);
staffPerformanceMapper.removeStaffPerformance(staffPerformance); staffPerformanceMapper.removeStaffPerformance(staffPerformance);
// 5. 插入新数据 // 5. 插入新数据
log.debug("插入新数据: staffPerformance={}", staffPerformance);
staffPerformanceMapper.insertSelective(staffPerformance); staffPerformanceMapper.insertSelective(staffPerformance);
} }
......
...@@ -24,7 +24,7 @@ public class DataCalUtil { ...@@ -24,7 +24,7 @@ public class DataCalUtil {
if (divisor.compareTo(BigDecimal.ZERO) == 0) { if (divisor.compareTo(BigDecimal.ZERO) == 0) {
return null; return null;
} }
return dividend.divide(divisor, 4, BigDecimal.ROUND_HALF_UP); return dividend.divide(divisor, 2, BigDecimal.ROUND_HALF_UP);
} }
} }
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" extends="BaseResultMap">
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" /> <result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="child_name" property="childBrandName" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="MerchantPerformanceResultMap" <resultMap id="MerchantPerformanceResultMap"
...@@ -41,7 +44,10 @@ ...@@ -41,7 +44,10 @@
<select id="selectEffectiveConfig" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" resultMap="DTOResultMap"> <select id="selectEffectiveConfig" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" resultMap="DTOResultMap">
SELECT c.*, SELECT c.*,
dclsm.merchant_name r.merchant_id,
r.brand_name,
r.child_name,
ifnull(dclsm.merchant_name, r.merchant_name) merchant_name
FROM dj_car_life_performance_config c FROM dj_car_life_performance_config c
LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r ON c.id = r.performance_config_id LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r ON c.id = r.performance_config_id
LEFT JOIN dj_car_life_service_merchant dclsm ON dclsm.merchant_id = r.merchant_id LEFT JOIN dj_car_life_service_merchant dclsm ON dclsm.merchant_id = r.merchant_id
......
...@@ -91,10 +91,8 @@ ...@@ -91,10 +91,8 @@
AND dclsdrh.brand_id = #{childBrandId} AND dclsdrh.brand_id = #{childBrandId}
</if> </if>
<if test="month != null and month != ''"> <if test="month != null and month != ''">
AND dclsdrh.report_date &gt;= concat( #{month}, AND dclsdrh.report_date &gt;= concat( #{month}, '-01')
'-01') AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month}, '-01'), INTERVAL 1 MONTH)
AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month},
'-01'), INTERVAL 1 MONTH)
</if> </if>
</where> </where>
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!