Commit 3a4a7f2a by 张富康

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

2 parents 986b1b11 f5961ece
Showing 24 changed files with 283 additions and 82 deletions
......@@ -57,4 +57,12 @@ public class EffectiveReferralReviewCommonDTO extends EffectiveReferralReview {
@ApiModelProperty(notes = "是否可编辑:0-不可编辑,1-可编辑")
private Integer updateFlag;
@ApiModelProperty(notes = "周期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date cycleStartDate;
@ApiModelProperty(notes = "周期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date cycleEndDate;
}
\ No newline at end of file
......@@ -4,7 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PerformanceConfigApproveHandleDTO {
public class PerformanceConfigApproveHandleDTO implements java.io.Serializable{
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "performanceConfigApproveId")
private Integer performanceConfigApproveId;
......
package cn.com.glsx.dj.staff.dto.performance;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
......@@ -31,6 +33,10 @@ public class PerformanceConfigApprovePermissionDTO implements Serializable {
@ApiModelProperty(notes = "提交人用户名")
private String submitUsername;
@ApiModelProperty(notes = "提交时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date submitDate;
@ApiModelProperty(notes = "审批状态(1:审批中;2:已通过;3:已驳回)")
private Integer approveStatus;
......
package cn.com.glsx.dj.staff.dto.salaryappealapply;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 日报补填校验DTO
*/
@Data
public class DailyReportFillCheckDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("补填的日期 yyyy-MM-dd")
private String fillDate;
@ApiModelProperty("员工手机号")
private String staffPhone;
@ApiModelProperty("是否超级管理员")
private Boolean isSuper;
@ApiModelProperty("登录角色")
private Integer loginRole;
}
......@@ -24,6 +24,12 @@ public class StaffSalaryAppealSummaryDTO implements Serializable {
@ApiModelProperty("实际出勤天数")
private BigDecimal actualAttendanceDays;
@ApiModelProperty("是否超级管理员")
private Boolean isSuper;
@ApiModelProperty("登录角色")
private Integer loginRole;
@ApiModelProperty("日报完成天数")
private Integer dailyReportDays;
......
......@@ -34,7 +34,7 @@ public class PerformanceConfigApproveOperationRecord implements Serializable {
private Integer performanceConfigApproveId;
@ApiModelProperty(notes = "审批状态(0:初始化状态 1:已查看;2:已通过;3:已驳回)")
@Column(name = "approve_status")
@Column(name = "status")
private Integer status;
@ApiModelProperty(notes = "审批人类型(1:查阅人;2:审批人)")
......
......@@ -68,6 +68,10 @@ public class StaffPerformance implements Serializable {
@Column(name = "month")
private String month;
@ApiModelProperty(notes = "提成方案配置ID(dj_car_life_performance_config.id)")
@Column(name = "performance_config_id")
private Integer performanceConfigId;
@ApiModelProperty(notes = "有效引荐量")
@Column(name = "effective_referral_quantity")
private Integer effectiveReferralQuantity;
......
......@@ -70,9 +70,9 @@ public class StaffPerformanceDetail implements Serializable {
@Column(name = "month")
private String month;
@ApiModelProperty(notes = "提成方案配置ID(dj_car_life_performance_config.id)")
@Column(name = "performance_config_id")
private Integer performanceConfigId;
@ApiModelProperty(notes = "门店工资绩效参数配置ID(dj_car_life_performance_param_config.id)")
@Column(name = "performance_param_config_id")
private Integer performanceParamConfigId;
@ApiModelProperty(notes = "考核因子")
@Column(name = "assessment_factor")
......
package cn.com.glsx.dj.staff.remote.salaryappealapply;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.framework.core.annotation.ApiService;
......@@ -56,4 +57,9 @@ public interface StaffSalaryAppealApplyRecordRemote {
* 查询员工工资申诉订单统计
*/
RpcResponse<StaffSalaryAppealOrderStatDTO> orderStatistics(StaffSalaryAppealOrderStatDTO dto);
/**
* 判断选中日期是否可补填日报
*/
RpcResponse<Boolean> isDailyReportFillAllowed(DailyReportFillCheckDTO dto);
}
package cn.com.glsx.dj.staff.remote.salaryappealapply;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.dj.staff.service.StaffSalaryAppealApplyRecordService;
......@@ -131,4 +132,16 @@ public class StaffSalaryAppealApplyRecordRemoteImpl implements StaffSalaryAppeal
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<Boolean> isDailyReportFillAllowed(DailyReportFillCheckDTO dto) {
try {
log.info("isDailyReportFillAllowed start, dto:{}", dto);
Boolean result = staffSalaryAppealApplyRecordService.isDailyReportFillAllowed(dto);
return RpcResponse.success(result);
} catch (Exception e) {
log.error(e.getMessage(),e);
return RpcResponse.error(e);
}
}
}
......@@ -9,6 +9,7 @@ import cn.com.glsx.dj.staff.dto.MerchantInfo;
import cn.com.glsx.dj.staff.dto.SalaryAppealApplyAttachmentDTO;
import cn.com.glsx.dj.staff.dto.StaffSalaryAppealApplyRecordDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.DailyReportFillCheckDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealOrderStatDTO;
import cn.com.glsx.dj.staff.dto.salaryappealapply.StaffSalaryAppealSummaryDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
......@@ -496,34 +497,44 @@ public class StaffSalaryAppealApplyRecordService {
}
// 5. 判断可申诉(T3申诉,只允许申诉上个月的)、补日报日期(T1-T5可补,也只能补上个月的)
setAppealAvailability(dto, result, appealMonth);
log.info("summary end, result:{}", result);
return result;
}
private void setAppealAvailability(StaffSalaryAppealSummaryDTO dto, StaffSalaryAppealSummaryDTO result, String appealMonth) {
// 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date());
// 判断appealMonth是否等于上个月
boolean isLastMonth = Objects.equals(appealMonth, lastMonth);
// 判断是否为驻店人员(loginRole=5)
boolean isStoreStaff = Objects.equals(dto.getLoginRole(), 5);
// 获取T3时间配置(考勤申诉周期)
PerformanceTimeCycleDTO t3Cycle =
performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T3.getCode());
performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T3.getCode());
boolean inT3Period = false;
if (t3Cycle != null && t3Cycle.getStartDate() != null && t3Cycle.getEndDate() != null) {
Date now = new Date();
inT3Period = !now.before(t3Cycle.getStartDate()) && !now.after(t3Cycle.getEndDate());
}
// 考勤申诉:只允许在T3周期内申诉上个月的
result.setAttendanceAppealable(isLastMonth && inT3Period);
// 平板申诉:只允许在T3周期内申诉上个月的
result.setPadAppealable(isLastMonth && inT3Period);
// 考勤申诉:只允许驻店人员在T3周期内申诉上个月的
result.setAttendanceAppealable(isStoreStaff && isLastMonth && inT3Period);
// 平板申诉:只允许驻店人员在T3周期内申诉上个月的
result.setPadAppealable(isStoreStaff && isLastMonth && inT3Period);
// 获取T1-T5时间配置(补日报周期)
boolean inT1ToT5Period = false;
if (isLastMonth) {
// 检查是否在T1到T5的任意一个周期内
String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
};
Date now = new Date();
Map<String, PerformanceTimeCycleDTO> cycleMap = performanceTimeCycleService.list().stream()
......@@ -545,8 +556,6 @@ public class StaffSalaryAppealApplyRecordService {
result.setAppealStartTime(sdf.format(t3Cycle.getStartDate()));
result.setAppealEndTime(sdf.format(t3Cycle.getEndDate()));
}
log.info("summary end, result:{}", result);
return result;
}
private StaffMonthBdmCount getStaffMonthBdmCount(String staffPhone, String appealMonth) {
......@@ -653,4 +662,67 @@ public class StaffSalaryAppealApplyRecordService {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "申请月份格式错误");
}
}
/**
* 判断选中日期是否可补填日报
* @param dto 包含补填日期、员工信息等
* @return true-可以补填,false-不可以补填
*/
public Boolean isDailyReportFillAllowed(DailyReportFillCheckDTO dto) {
log.info("isDailyReportFillAllowed start, dto:{}", dto);
// 1. 校验参数
if (dto == null || dto.getFillDate() == null) {
log.error("参数不能为空");
return false;
}
try {
// 2. 解析补填日期,获取所属月份 yyyy-MM
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date fillDate = sdf.parse(dto.getFillDate());
SimpleDateFormat monthFormat = new SimpleDateFormat("yyyy-MM");
String fillMonth = monthFormat.format(fillDate);
// 3. 获取上个月月份字符串
String lastMonth = DateUtils.getLastMonthString(new Date());
// 4. 判断fillMonth是否等于上个月
boolean isLastMonth = Objects.equals(fillMonth, lastMonth);
if (!isLastMonth) {
log.info("补填日期{}不是上个月,不允许补填", dto.getFillDate());
return false;
}
// 5. 检查是否在T1到T5的任意一个周期内
String[] tCodes = {
PerformanceTimeCycleCodeEnum.T1.getCode(),
PerformanceTimeCycleCodeEnum.T2.getCode(),
PerformanceTimeCycleCodeEnum.T3.getCode(),
PerformanceTimeCycleCodeEnum.T4.getCode(),
PerformanceTimeCycleCodeEnum.T5.getCode()
};
Date now = new Date();
Map<String, PerformanceTimeCycleDTO> cycleMap = performanceTimeCycleService.list().stream()
.collect(Collectors.toMap(PerformanceTimeCycleDTO::getCycleCode, Function.identity()));
for (String tCode : tCodes) {
PerformanceTimeCycleDTO cycle = cycleMap.get(tCode);
if (cycle != null && cycle.getStartDate() != null && cycle.getEndDate() != null) {
if (!now.before(cycle.getStartDate()) && !now.after(cycle.getEndDate())) {
log.info("当前时间在{}周期内,允许补填日报", tCode);
return true;
}
}
}
log.info("当前时间不在T1-T5周期内,不允许补填日报");
return false;
} catch (ParseException e) {
log.error("日期格式解析异常,fillDate:{}", dto.getFillDate(), e);
return false;
}
}
}
\ No newline at end of file
......@@ -65,7 +65,11 @@ public class EffectiveReferralReviewMiniProgramService {
//特殊逻辑:根据商户门店id去重,根据门店首字母倒序。要根据门店的不同业务场景的数据判断是否已提交和未提交。
//不同业务场景`scene_type` '业务场景:1-精品升级(轻改);2-会员权益(广联权益);3-单延保 状态`status` '状态:0-未提交,1-草稿,2-已提交',全部为已提交时,总的提交状态submitStatus才是已提交。
//注意:要跟服务商户表dj_car_life_service_merchant根据`merchant_id`关联,用于筛选项门店搜索,sal_effective_referral_review作为主表
request.getMerchantIds().addAll(Lists.newArrayList(44211832,44209298,44209902,44209880));
// request.getMerchantIds().addAll(Lists.newArrayList(44211832,44209298,44209902,44209880));
if (CollectionUtils.isEmpty(request.getMerchantIds())) {
log.info("门店有效引荐数列表MerchantIds为空");
return Collections.emptyList();
}
log.info("门店有效引荐数列表MerchantIds:{}", JSON.toJSONString(request.getMerchantIds()));
List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreList(request);
if (CollectionUtils.isEmpty(list)) {
......
......@@ -100,16 +100,23 @@ public class EffectiveReferralReviewService {
* @return 门店列表
*/
public RpcPagination<EffectiveReferralReviewCommonDTO> effectiveReferralAuditPage(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
//1、查询需要复核的有效引荐数列表
//1、查询T1时间配置
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
//2、查询需要复核的有效引荐数列表
Page<EffectiveReferralReviewCommonDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null) {
pagination.getCondition().setCycleStartDate(performanceTimeCycleDTO.getStartDate());
pagination.getCondition().setCycleEndDate(performanceTimeCycleDTO.getEndDate());
}
List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(pagination.getCondition());
if(CollectionUtils.isEmpty(list)) {
return new RpcPagination<>();
}
//2、查询T1时间配置
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
//3、当前时间年月是否比核查时间晚并超过1个月, 则不可编辑
long monthDiff = getMonthDiff(list.get(0).getReviewMonth());
......
package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO;
import cn.com.glsx.dj.smartcarlife.remote.MerchantPerformanceProductDefineRemote;
import cn.com.glsx.dj.staff.enums.GoodsConfigTypeEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class MerchantPerformanceProductDefineService {
@Autowired
private MerchantPerformanceProductDefineRemote merchantPerformanceProductDefineRemote;
public MerchantPerformanceProductDefineDTO fetchProductDefine(Byte goodsConfigType, Integer productDefineId) {
if (goodsConfigType == null || productDefineId == null) {
return null;
}
GoodsConfigTypeEnum configTypeEnum = GoodsConfigTypeEnum.getByCode(goodsConfigType);
if (configTypeEnum == GoodsConfigTypeEnum.DESIGNATED_PRODUCT
|| configTypeEnum == GoodsConfigTypeEnum.DESIGNATED_PACKAGE) {
return merchantPerformanceProductDefineRemote
.getByIdWithRadicalUpgradeGoodsItem(productDefineId).getResult();
}
return null;
}
}
......@@ -21,6 +21,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
......@@ -28,6 +30,7 @@ import java.util.stream.Collectors;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class PerformanceConfigApproveService {
@Autowired
private PerformanceConfigApproveMapper performanceConfigApproveMapper;
......@@ -91,7 +94,8 @@ public class PerformanceConfigApproveService {
if (record.getApproverType().equals(PerformanceApproverTypeEnum.READER.getCode())) {
approvePermission = 1;
}
if (record.getApproverType().equals(PerformanceApproverTypeEnum.APPROVER.getCode()) && record.getStatus().equals(PerformanceApproveOperatorStatusEnum.INIT.getCode())) {
if (record.getApproverType().equals(PerformanceApproverTypeEnum.APPROVER.getCode())
&& (record.getStatus().equals(PerformanceApproveOperatorStatusEnum.INIT.getCode()) || record.getStatus().equals(PerformanceApproveOperatorStatusEnum.READ.getCode()))) {
approvePermission = 2;
}
if (record.getStatus().equals(PerformanceApproveOperatorStatusEnum.PASS.getCode())) {
......@@ -112,6 +116,7 @@ public class PerformanceConfigApproveService {
return performanceConfigApproveDetailAndPermission;
}
public boolean submit(PerformanceConfigApproveDTO dto) {
List<PerformanceConfigApproveDTO> performanceConfigApproveList = performanceConfigApproveMapper.selectByPerformanceConfigId(dto.getPerformanceConfigId());
boolean isUpdate = !performanceConfigApproveList.isEmpty();
......@@ -140,6 +145,12 @@ public class PerformanceConfigApproveService {
dto.setMerchantNames(merchantNames);
dto.setBrandsNames(brandsNames);
dto.setApproveStatus(PerformanceConfigApproveStatusEnum.APPROVEING.getCode());
dto.setApproveStatus(PerformanceConfigApproveStatusEnum.APPROVEING.getCode());
dto.setDeletedFlag("N");
dto.setCreatedBy(dto.getSubmitUsername());
dto.setUpdatedBy(dto.getSubmitUsername());
dto.setCreatedDate(new Date());
dto.setUpdatedDate(new Date());
performanceConfigApproveMapper.insertOne(dto);
Integer id = dto.getId();
......@@ -158,11 +169,18 @@ public class PerformanceConfigApproveService {
PerformanceConfigApproveOperationRecordDTO record = PerformanceConfigApproveOperationRecordDTO
.builder()
.performanceConfigApproveId(id)
.status(PerformanceApproveOperatorStatusEnum.INIT.getCode())
.approverType(performanceApproveConfigDTO.getApproverType())
.pushStatus(sendResult ? PerformanceApprovePushStatusEnum.SUCCESS.getCode() : PerformanceApprovePushStatusEnum.FAILED.getCode())
.approveTime(new Date())
.approveOpinion("")
.approverName(performanceApproveConfigDTO.getApproverName())
.approverMobile(performanceApproveConfigDTO.getApproverMobile())
.status(PerformanceApproveOperatorStatusEnum.INIT.getCode())
.pushStatus(sendResult ? PerformanceApprovePushStatusEnum.SUCCESS.getCode() : PerformanceApprovePushStatusEnum.FAILED.getCode())
.createdBy(dto.getSubmitUsername())
.createdDate(new Date())
.updatedBy(dto.getSubmitUsername())
.updatedDate(new Date())
.deletedFlag("N")
.build();
recordDTOList.add(record);
}
......@@ -225,7 +243,7 @@ public class PerformanceConfigApproveService {
if (approveDTO == null) {
return false;
}
PerformanceConfigDTO config = performanceConfigService.selectById(approveDTO.getId());
PerformanceConfigDTO config = performanceConfigService.selectById(approveDTO.getPerformanceConfigId());
if (config == null) {
return false;
}
......@@ -242,7 +260,7 @@ public class PerformanceConfigApproveService {
if (record.getApproverMobile().equals(dto.getMobile())){
currRecord = record;
}
if (record.getApproverMobile().equals(dto.getMobile()) && !record.getStatus().equals(PerformanceApproveOperatorStatusEnum.INIT.getCode())){
if (record.getApproverMobile().equals(dto.getMobile()) && (!record.getStatus().equals(PerformanceApproveOperatorStatusEnum.INIT.getCode()) && !record.getStatus().equals(PerformanceApproveOperatorStatusEnum.READ.getCode()))){
log.info("当前审批id{}审批人{}已处理过,请勿重复处理", record.getPerformanceConfigApproveId(), record.getApproverMobile());
return false;
}
......@@ -251,7 +269,7 @@ public class PerformanceConfigApproveService {
if (currRecord == null) {
return false;
}
if (!config.getStatus().equals(PerformanceConfigStatusEnum.APPROVING.getCode()) || !config.getStatus().equals(PerformanceConfigStatusEnum.NOT_EFFECTIVE.getCode())) {
if (!config.getStatus().equals(PerformanceConfigStatusEnum.APPROVING.getCode()) && !config.getStatus().equals(PerformanceConfigStatusEnum.NOT_EFFECTIVE.getCode())) {
return false;
}
currRecord.setApproveOpinion(dto.getApproveOpinion());
......
......@@ -63,6 +63,8 @@ public class StaffPerformanceCalService {
@Autowired
private StaffPerformanceDetailService staffPerformanceDetailService;
@Autowired
private MerchantPerformanceProductDefineService merchantPerformanceProductDefineService;
/**
* 计算员工提成
*
......@@ -487,7 +489,7 @@ public class StaffPerformanceCalService {
.brandName(context.getBrandName())
.childBrandId(context.getChildBrandId())
.childBrandName(context.getChildBrandName())
.performanceConfigId(paramConfig.getId())
.performanceParamConfigId(paramConfig.getId())
.assessmentFactor(paramConfig.getAssessmentFactor())
.goodsConfigType(paramConfig.getGoodsConfigType())
.goodsType(paramConfig.getGoodsType())
......@@ -575,7 +577,7 @@ public class StaffPerformanceCalService {
// 是否跳过渗透率限制条件类型的继续判断
boolean skipPenetrationRateCondition = false;
log.info("= 开始计算条件: configId={}", paramConfig.getId());
log.info("= 开始计算条件: paramConfigId={}", paramConfig.getId());
for (PerformanceParamConfigConditionDTO condition : paramConfig.getPerformanceParamConfigConditions()) {
log.info("==处理条件: conditionId={}, conditionType={}", condition.getId(),
......@@ -615,16 +617,11 @@ public class StaffPerformanceCalService {
throw new RpcServiceException("未处理的条件类型: " + conditionTypeEnum);
}
} catch (RpcServiceException e) {
// 业务异常主要针对渗透率限制的校验,需要抛出
log.warn("业务规则校验失败: {}", e.getMessage());
throw e;
} catch (Exception e) {
log.error("条件计算异常: conditionType={}, conditionId={}", condition.getConditionType(),
condition.getId(),
e);
resultLog.put("error", e.getMessage());
condition.getId(),
e);
throw e;
}
executionLog.put("result", resultLog);
conditionExecutions.add(executionLog);
}
......@@ -778,7 +775,7 @@ public class StaffPerformanceCalService {
boolean deduct = personalPenetrationRate.compareTo(conditionEndValue) < 0;
log.info("订单数不足扣减检查: realRate={}, targetRate={}, needDeduct={}", personalPenetrationRate,
conditionEndValue, deduct);
resultLog.put("needDeduct", deduct);
if (deduct) {
BigDecimal personalTargetTouchCount = context.getAssessmentFactorDependencyData()
.getDailyData().getPersonalTargetTouchCount();
......@@ -847,17 +844,24 @@ public class StaffPerformanceCalService {
StaffPerformanceCalContextDTO context, PerformanceParamConfigConditionDTO condition,
JSONObject resultLog) {
log.info("执行订单数剔除条件: conditionId={}", condition.getId());
MerchantPerformanceProductDefineDTO productDefine = null;
if (condition.getConditionProductDefineId() != null) {
productDefine = merchantPerformanceProductDefineService
.fetchProductDefine(condition.getConditionGoodsConfigType(),
condition.getConditionProductDefineId());
}
// 4.订单数剔除
String groupKey = generateGroupOrderMapKey(context.getMerchantId(),
context.getBusinessType(), context.getBrandId(),
context.getChildBrandId());
List<StaffPerformanceSubOrderDTO> orders = context.getGroupedOrdersMap().get(groupKey);
Integer excludedOrderCount = StaffPerformanceOrderUtil.countMatchingOrders(orders,
condition.getConditionGoodsConfigType(),
condition.getConditionGoodsType(),
condition.getConditionSecondaryGoodsType(),
condition.getConditionThirdLevelGoodsType(),
condition.getProductDefine());
productDefine);
log.info("订单剔除检查: excludedCount={}", excludedOrderCount);
......@@ -883,6 +887,12 @@ public class StaffPerformanceCalService {
*/
public BigDecimal calculateConditionProductPenetrationRate(PerformanceParamConfigConditionDTO condition,
StaffPerformanceCalContextDTO context) {
MerchantPerformanceProductDefineDTO productDefine = null;
if (condition.getConditionProductDefineId() != null) {
productDefine = merchantPerformanceProductDefineService
.fetchProductDefine(condition.getConditionGoodsConfigType(),
condition.getConditionProductDefineId());
}
// 计算条件定义的商品生成的子订单数
String groupKey = generateGroupOrderMapKey(context.getMerchantId(), context.getBusinessType(),
context.getBrandId(), context.getChildBrandId());
......@@ -896,7 +906,7 @@ public class StaffPerformanceCalService {
condition.getConditionGoodsType(),
condition.getConditionSecondaryGoodsType(),
condition.getConditionThirdLevelGoodsType(),
condition.getProductDefine());
productDefine);
BigDecimal targetTouchCount = context.getAssessmentFactorDependencyData().getDailyData()
.getPersonalTargetTouchCount();
......@@ -1140,7 +1150,7 @@ public class StaffPerformanceCalService {
thirdLevelGoodsType,
productDefineId);
log.debug("goodsConfigType:{}, goodsType:{},secondaryGoodsType:{},thirdLevelGoodsType:{},productDefineId:{},考核因子: {},实际值: {}",
log.info("goodsConfigType:{}, goodsType:{},secondaryGoodsType:{},thirdLevelGoodsType:{},productDefineId:{},assessmentFactor: {},实际值: {}",
goodsConfigType, goodsType,
secondaryGoodsType, thirdLevelGoodsType,
productDefineId, assessmentFactor, actualValue);
......
......@@ -140,6 +140,7 @@ public class StaffPerformanceService {
staffPerformance.setChildBrandId(first.getChildBrandId());
staffPerformance.setChildBrandName(first.getChildBrandName());
staffPerformance.setMonth(first.getMonth());
staffPerformance.setPerformanceConfigId(context.getPerformanceConfig().getId());
Date now = new Date();
staffPerformance.setCreatedBy(CommonConstants.DEFAULT_UPDATE_BY);
......
......@@ -2,8 +2,10 @@ package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO;
import cn.com.glsx.dj.smartcarlife.remote.MerchantPerformanceProductDefineRemote;
import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.StaffPerformanceCalContextDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceGetDTO;
import cn.com.glsx.dj.staff.enums.CommissionTypeEnum;
......@@ -44,7 +46,7 @@ public class StaffProductPerformanceService {
@Autowired
private StaffProductPerformanceMapper staffProductPerformanceMapper;
@Autowired
private MerchantPerformanceProductDefineRemote merchantPerformanceProductDefineRemote;
private MerchantPerformanceProductDefineService merchantPerformanceProductDefineService;
@Autowired
private StaffPerformanceService staffPerformanceService;
......@@ -183,7 +185,7 @@ public class StaffProductPerformanceService {
Integer productDefineId = detailDTO.getProductDefineId();
// 1. 获取产品定义配置
MerchantPerformanceProductDefineDTO productDefine = fetchProductDefine(goodsConfigType, productDefineId);
MerchantPerformanceProductDefineDTO productDefine = merchantPerformanceProductDefineService.fetchProductDefine(goodsConfigType, productDefineId);
// 2. 获取当前层级关联的所有原始订单
List<StaffPerformanceSubOrderDTO> orders = getRelevantOrders(context);
......@@ -204,18 +206,7 @@ public class StaffProductPerformanceService {
productPerformance.setPersonalPenetrationRate(penetrationRate);
}
private MerchantPerformanceProductDefineDTO fetchProductDefine(Byte goodsConfigType, Integer productDefineId) {
if (goodsConfigType == null || productDefineId == null) {
return null;
}
GoodsConfigTypeEnum configTypeEnum = GoodsConfigTypeEnum.getByCode(goodsConfigType);
if (configTypeEnum == GoodsConfigTypeEnum.DESIGNATED_PRODUCT
|| configTypeEnum == GoodsConfigTypeEnum.DESIGNATED_PACKAGE) {
return merchantPerformanceProductDefineRemote
.getByIdWithRadicalUpgradeGoodsItem(productDefineId).getResult();
}
return null;
}
private List<StaffPerformanceSubOrderDTO> getRelevantOrders(StaffPerformanceCalContextDTO context) {
String groupKey = StaffPerformanceCalService.generateGroupOrderMapKey(context.getMerchantId(),
......
......@@ -103,28 +103,18 @@
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 test="cycleStartDate != null and cycleEndDate != null">
AND now() &gt;= #{cycleStartDate} AND now() &lt;= #{cycleEndDate}
</if>
</if>
<if test="isReviewed != null and isReviewed == 1">
AND serr.is_reviewed = #{isReviewed}
</if>
<if test="isReviewed != null and isReviewed == 2">
<if test="isReviewed != null and isReviewed == 2 and cycleStartDate != null and cycleEndDate != null">
AND serr.is_reviewed = 0 AND (now() &lt; #{cycleStartDate} OR now() &gt; #{cycleEndDate})
</if>
<if test="isReviewed != null and isReviewed == 2 and cycleStartDate == null and cycleEndDate == null">
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}
......
......@@ -99,7 +99,8 @@
a.submit_username AS submitUsername,
a.approve_status AS approveStatus,
a.merchant_names AS merchantNames,
a.brands_names AS brandsNames
a.brands_names AS brandsNames,
a.created_date AS submitDate
FROM
dj_car_life_performance_config_approve a
WHERE
......@@ -184,6 +185,7 @@
<if test="updatedBy != null and updatedBy != ''">
updated_by = #{updatedBy},
</if>
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND id = #{id}
......
......@@ -69,6 +69,7 @@
WHERE
deleted_flag = 'N'
AND approver_mobile = #{mobile}
AND status = 0
AND approver_type = 2
</update>
</mapper>
\ No newline at end of file
......@@ -61,7 +61,7 @@
AND cfg.business_type = #{businessType}
SET
ref.deleted_flag = 'D',
ref.updated_date = NOW(),
ref.updated_date = NOW()
WHERE
ref.deleted_flag = 'N'
AND ref.merchant_id = #{merchantId}
......
......@@ -16,7 +16,7 @@
<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="performance_config_id" property="performanceConfigId" jdbcType="INTEGER" />
<result column="performance_param_config_id" property="performanceParamConfigId" jdbcType="INTEGER" />
<result column="assessment_factor" property="assessmentFactor" jdbcType="TINYINT" />
<result column="goods_config_type" property="goodsConfigType" jdbcType="TINYINT" />
<result column="goods_type" property="goodsType" jdbcType="INTEGER" />
......@@ -51,7 +51,7 @@
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
brand_name, child_brand_id, child_brand_name, month, performance_config_id, assessment_factor,
brand_name, child_brand_id, child_brand_name, month, performance_param_config_id, assessment_factor,
goods_config_type, goods_type, goods_type_name, secondary_goods_type, secondary_goods_type_name,
third_level_goods_type, third_level_goods_type_name, product_define_id, product_define_name,
performance_amount, assessment_factor_value, commission_base, gmv_output, upgrade_order_num,
......
......@@ -16,6 +16,7 @@
<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="performance_config_id" property="performanceConfigId" jdbcType="INTEGER" />
<result column="effective_referral_quantity" property="effectiveReferralQuantity" jdbcType="INTEGER" />
<result column="touch_number" property="touchNumber" jdbcType="INTEGER" />
<result column="performance_amount" property="performanceAmount" jdbcType="DECIMAL" />
......@@ -39,7 +40,7 @@
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
brand_name, child_brand_id, child_brand_name, month, effective_referral_quantity,
brand_name, child_brand_id, child_brand_name, month, performance_config_id, effective_referral_quantity,
touch_number, performance_amount, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<sql id="Blob_Column_List" >
......@@ -73,6 +74,7 @@
updated_date = now()
WHERE
merchant_id = #{merchantId}
AND staff_phone = #{staffPhone}
AND business_type = #{businessType}
AND brand_id = #{brandId}
AND child_brand_id = #{childBrandId}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!