Commit c8433977 by 章家宝

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

2 parents f59990af 458090c4
Showing 17 changed files with 120 additions and 49 deletions
......@@ -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,
......
......@@ -311,7 +311,7 @@ public class AttendanceDataCleansingService {
// 2. 处理每条考勤记录
// 判断该打卡日期是否在离职直接之后,如果在离职日期之后则不计算
if (StrUtil.isNotBlank(employee.getLastWorkDate())) {
if(DateUtil.compare(DateUtil.parse(clockInfo.getClockInDate(), "yyyy-MM-dd"), DateUtil.parse(employee.getLastWorkDate(), "yyyy-MM-dd")) > 0){
if (DateUtil.compare(DateUtil.parse(clockInfo.getClockInDate(), "yyyy-MM-dd"), DateUtil.parse(employee.getLastWorkDate(), "yyyy-MM-dd")) > 0) {
log.info("{} 打卡日期:{},离职日期:{} 打卡日期在离职日期之后,不处理", employee.getStaffName(), clockInfo.getClockInDate(), employee.getLastWorkDate());
continue;
}
......@@ -416,24 +416,23 @@ public class AttendanceDataCleansingService {
// 处理每个批次
for (List<AttendanceSummary> batch : batches) {
try {
// 1. 开启事务
TransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = transactionManager.getTransaction(def);
try {
// 2. 执行批量插入
attendanceSummaryMapper.insertOrUpdateBatch(batch);
transactionManager.commit(status);
log.info("成功插入 {} 条考勤数据", batch.size());
} catch (Exception e) {
// 3. 批量插入失败,回滚事务
transactionManager.rollback(status);
throw e;
for (AttendanceSummary summary : batch) {
try {
// 尝试单条插入
insertAttendanceData(summary);
} catch (Exception ex) {
// 记录详细失败信息
recordFailure(summary.getMobilePhone(), summary.getAttendanceMonth(),
"单条插入失败: " + ex.getMessage());
// 记录关键日志
log.error("单条插入失败 [phone: {}, month: {}] - {}",
summary.getMobilePhone(),
summary.getAttendanceMonth(),
ex.getMessage()
);
}
}
} catch (Exception e) {
// 4. 批量插入失败,重试单条插入
log.error("批量插入失败,开始单条重试 [batchSize: {}]", batch.size());
processSingleInsertBatch(batch);
} finally {
// 5. 释放内存
batch.clear();
......@@ -773,7 +772,6 @@ public class AttendanceDataCleansingService {
}
private ClockInResult processWithMerchant(StaffQwClockClean clockInfo, MerchantAttendanceList merchant, StaffBeisenBaseInfo employee) {
log.info("策略一:处理打卡时间:{}-{},经纬度:{},{}", clockInfo.getClockInTimeStart(), clockInfo.getClockOutTimeEnd(),
merchant.getAddressLng(), merchant.getAddressLat());
......
......@@ -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);
}
}
......@@ -101,6 +101,31 @@
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'
<if test="isReviewed != null and isReviewed == 0">
AND serr.is_reviewed = #{isReviewed}
AND now() BETWEEN
STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-'),
(SELECT start_day_of_month FROM dj_car_life_performance_time_cycle ORDER BY id LIMIT 1)),
'%Y-%m-%d %H:%i:%s')
AND
STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-'),
(SELECT end_day_of_month FROM dj_car_life_performance_time_cycle ORDER BY id LIMIT 1)),
'%Y-%m-%d %H:%i:%s')
</if>
<if test="isReviewed != null and isReviewed == 1">
AND serr.is_reviewed = #{isReviewed}
</if>
<if test="isReviewed != null and isReviewed == 2">
AND serr.is_reviewed = #{isReviewed}
AND now() NOT BETWEEN
STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-'),
(SELECT start_day_of_month FROM dj_car_life_performance_time_cycle ORDER BY id LIMIT 1)),
'%Y-%m-%d %H:%i:%s')
AND
STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-'),
(SELECT end_day_of_month FROM dj_car_life_performance_time_cycle ORDER BY id LIMIT 1)),
'%Y-%m-%d %H:%i:%s')
</if>
<if test="merchantId != null">
AND serr.merchant_id = #{merchantId}
</if>
......@@ -116,9 +141,6 @@
<if test="isNeedReviewed != null and isNeedReviewed != '' ">
AND serr.is_need_reviewed = #{isNeedReviewed}
</if>
<if test="isReviewed != null ">
AND serr.is_reviewed = #{isReviewed}
</if>
<if test="brandName != null and brandName != '' ">
AND serr.brand_name = #{brandName}
</if>
......
......@@ -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>
<sql id="Base_Column_List" >
<!--
......@@ -32,7 +35,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!