提成计算相关-问题修复

1 parent 3b6502e9
......@@ -44,4 +44,8 @@ public class PerformanceConfigDTO extends PerformanceConfig {
*/
private String merchantName;
private String brandName;
private String childBrandName;
}
......@@ -6,12 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
@EqualsAndHashCode(callSuper=false)
@AllArgsConstructor
@NoArgsConstructor
public class PerformanceParamConfigConditionDTO extends PerformanceParamConfigCondition {
private MerchantPerformanceProductDefineDTO productDefine;
@ApiModelProperty(notes = "提成方案置ID")
......
......@@ -64,11 +64,21 @@ public class StaffPerformanceCalContextDTO implements Serializable {
private Integer brandId;
/**
* 品牌名称
*/
private String brandName;
/**
* 子品牌ID
*/
private Integer childBrandId;
/**
* 子品牌名称
*/
private String childBrandName;
/**
* 当前计算的门店提成方案
*/
private PerformanceConfigDTO performanceConfig;
......
......@@ -2,9 +2,9 @@ package cn.com.glsx.dj.staff.dto;
import cn.com.glsx.dj.staff.model.StaffPerformanceDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
......@@ -12,13 +12,16 @@ import java.math.BigDecimal;
/**
* 提成结果明细DTO
*/
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
@EqualsAndHashCode(callSuper=false)
public class StaffPerformanceDetailDTO extends StaffPerformanceDetail {
private static final long serialVersionUID = 833236627080089143L;
@ApiModelProperty(notes = "额外提成金额")
private BigDecimal extraPerformanceAmount;
@ApiModelProperty(notes = "个人渗透率")
private BigDecimal personalPenetrationRate;
}
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.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* 有效引荐数表
*/
//@AllArgsConstructor
//@NoArgsConstructor
// @AllArgsConstructor
// @NoArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
@EqualsAndHashCode(callSuper=false)
public class EffectiveReferralReviewDTO extends EffectiveReferralReview {
private static final long serialVersionUID = 1L;
private List<Integer> ids;
}
\ No newline at end of file
package cn.com.glsx.dj.staff.enums;
import java.util.Objects;
/**
* 绩效参数配置条件类型枚举
*/
......@@ -17,12 +19,12 @@ public enum PerformanceConditionTypeEnum implements BaseEnum<Byte, String> {
this.desc = desc;
}
public static PerformanceConditionTypeEnum getByCode(Number code) {
public static PerformanceConditionTypeEnum getByCode(Byte code) {
if (code == null) {
return null;
}
for (PerformanceConditionTypeEnum type : PerformanceConditionTypeEnum.values()) {
if (type.getCode().equals(code.intValue())) {
if (Objects.equals(type.getCode(), code)) {
return type;
}
}
......
......@@ -134,10 +134,6 @@ public class StaffPerformanceDetail implements Serializable {
@Column(name = "upgrade_order_num")
private Integer upgradeOrderNum;
@ApiModelProperty(notes = "个人渗透率")
@Column(name = "personal_penetration_rate")
private BigDecimal personalPenetrationRate;
@ApiModelProperty(notes = "提成方式(比例-BL,系数-XS,固定金额-DDJE)")
@Column(name = "commission_type")
private String commissionType;
......@@ -151,6 +147,26 @@ public class StaffPerformanceDetail implements Serializable {
/**
* <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": [
* {
* "conditionType": 1,
......
......@@ -41,8 +41,10 @@ public class StaffPerformanceDetailService {
return;
}
log.info("Saving staff performance details. merchantId={}, businessType={}, month={}, count={}",
config.getMerchantId(), config.getBusinessType(), config.getEffectiveMonth(),
log.info(
"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());
if (CollectionUtils.isEmpty(performanceDetailDTOS)) {
......
......@@ -61,16 +61,22 @@ public class StaffPerformanceService {
merchantId, businessType, brandId, childBrandId, performanceMonth, staffPhone);
return;
}
log.info(
"保存员工绩效数据: merchantId={}, businessType={}, brandId={}, childBrandId={}, performanceMonth={}, staffPhone={}",
merchantId, businessType, brandId, childBrandId, performanceMonth, staffPhone);
// 2. 检查是否处于新人保护期
boolean isNewcomerProtection = checkNewcomerProtection(context.getStaffPhone(), context.getPerformanceMonth());
log.info("是否处于新人保护期: isNewcomerProtection={}", isNewcomerProtection);
// 3. 构建 StaffPerformance
StaffPerformance staffPerformance = buildStaffPerformance(performanceDetailDTOS, context, isNewcomerProtection);
// 4. 逻辑删除旧数据
log.debug("逻辑删除旧数据: staffPerformance={}", staffPerformance);
staffPerformanceMapper.removeStaffPerformance(staffPerformance);
// 5. 插入新数据
log.debug("插入新数据: staffPerformance={}", staffPerformance);
staffPerformanceMapper.insertSelective(staffPerformance);
}
......
......@@ -24,7 +24,7 @@ public class DataCalUtil {
if (divisor.compareTo(BigDecimal.ZERO) == 0) {
return null;
}
return dividend.divide(divisor, 4, BigDecimal.ROUND_HALF_UP);
return dividend.divide(divisor, 2, BigDecimal.ROUND_HALF_UP);
}
}
......@@ -20,7 +20,10 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<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="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="child_name" property="childBrandName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="MerchantPerformanceResultMap"
......@@ -41,7 +44,10 @@
<select id="selectEffectiveConfig" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" resultMap="DTOResultMap">
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
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
......
......@@ -54,7 +54,7 @@
<if test="month != null and month != ''">
AND dclpo.success_date &gt;= concat( #{month},
'-01 00:00:00')
AND dclpo.success_date &lt; DATE_ADD(concat( #{month},
AND dclpo.success_date &lt; DATE_ADD(concat( #{month},
'-01 00:00:00'), INTERVAL 1 MONTH)
</if>
<if test="statusList != null and statusList.size > 0">
......@@ -91,10 +91,8 @@
AND dclsdrh.brand_id = #{childBrandId}
</if>
<if test="month != null and month != ''">
AND dclsdrh.report_date &gt;= concat( #{month},
'-01')
AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month},
'-01'), INTERVAL 1 MONTH)
AND dclsdrh.report_date &gt;= concat( #{month}, '-01')
AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month}, '-01'), INTERVAL 1 MONTH)
</if>
</where>
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!