Commit 89b72b4f by 林冲

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

2 parents c7157ca4 324b1442
Showing 59 changed files with 1229 additions and 153 deletions
package cn.com.glsx.dj.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PerformanceCommissionStaffDTO implements java.io.Serializable{
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "员工姓名")
private String staffPhone;
@ApiModelProperty(notes = "员工姓名")
private String staffName;
}
package cn.com.glsx.dj.staff.dto; package cn.com.glsx.dj.staff.dto;
import cn.com.glsx.dj.staff.model.PerformanceConfigMerchantBrandRef; import cn.com.glsx.dj.staff.model.PerformanceConfigMerchantBrandRef;
import lombok.Data; import lombok.*;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
public class PerformanceConfigMerchantBrandRefDTO extends PerformanceConfigMerchantBrandRef { public class PerformanceConfigMerchantBrandRefDTO extends PerformanceConfigMerchantBrandRef {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Byte businessType;
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.dto; package cn.com.glsx.dj.staff.dto;
import cn.com.glsx.dj.staff.model.PerformanceConfigRule; import cn.com.glsx.dj.staff.model.PerformanceConfigRule;
import lombok.Data; import lombok.*;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@NoArgsConstructor
public class PerformanceConfigRuleDTO extends PerformanceConfigRule { public class PerformanceConfigRuleDTO extends PerformanceConfigRule {
private static final long serialVersionUID = -448678837056991912L; private static final long serialVersionUID = -448678837056991912L;
} }
...@@ -10,6 +10,8 @@ import lombok.experimental.SuperBuilder; ...@@ -10,6 +10,8 @@ import lombok.experimental.SuperBuilder;
@ToString(callSuper = true) @ToString(callSuper = true)
@Data @Data
@EqualsAndHashCode(callSuper=false) @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")
......
package cn.com.glsx.dj.staff.dto.perfSalary;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable;
/**
* 商户品牌统计报表实体类
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MerchantBrandReportDTO implements Serializable {
private static final long serialVersionUID = 1L;
/** 商户ID */
private Integer merchantId;
/** 年月(格式:YYYY-MM) */
private String reportYearMonth;
/** 轻改享界数量 */
private Integer qgXiangjCount;
/** 轻改尊界数量 */
private Integer qgZunjCount;
/** 轻改尚界数量 */
private Integer qgShangjCount;
/** 轻改智界数量 */
private Integer qgZhijCount;
/** 轻改问界数量 */
private Integer qgWenjCount;
/** 轻改其他品牌数量 */
private Integer qgOtherCount;
/** 单延保享界数量 */
private Integer ybXiangjCount;
/** 单延保尊界数量 */
private Integer ybZunjCount;
/** 单延保尚界数量 */
private Integer ybShangjCount;
/** 单延保智界数量 */
private Integer ybZhijCount;
/** 单延保问界数量 */
private Integer ybWenjCount;
/** 单延保其他品牌数量 */
private Integer ybOtherCount;
/** 广联权益享界数量 */
private Integer qyXiangjCount;
/** 广联权益尊界数量 */
private Integer qyZunjCount;
/** 广联权益尚界数量 */
private Integer qyShangjCount;
/** 广联权益智界数量 */
private Integer qyZhijCount;
/** 广联权益问界数量 */
private Integer qyWenjCount;
/** 广联权益其他品牌数量 */
private Integer qyOtherCount;
}
\ No newline at end of file \ No newline at end of file
...@@ -23,4 +23,7 @@ public class SceneTypeEffectiveReferralDTO implements Serializable { ...@@ -23,4 +23,7 @@ public class SceneTypeEffectiveReferralDTO implements Serializable {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(notes = "状态:0-未提交,1-草稿,2-已提交")
private Byte status;
} }
...@@ -4,13 +4,15 @@ import cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO; ...@@ -4,13 +4,15 @@ import cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
public class PerformanceConfigApproveDetailDTO { public class PerformanceConfigApproveDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "主键ID") @ApiModelProperty(notes = "主键ID")
private Integer id; private Integer id;
......
package cn.com.glsx.dj.staff.dto.performance;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PerformanceConfigApproveHandleDTO {
@ApiModelProperty(notes = "performanceConfigApproveId")
private Integer performanceConfigApproveId;
@ApiModelProperty(notes = "审批状态 2:已通过;3:已驳回")
private Integer status;
@ApiModelProperty(notes = "手机号码")
private String mobile;
@ApiModelProperty(notes = "审批意见")
private String approveOpinion;
}
...@@ -4,10 +4,12 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -4,10 +4,12 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
public class PerformanceConfigApprovePageDTO { public class PerformanceConfigApprovePageDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "主键ID") @ApiModelProperty(notes = "主键ID")
private Integer id; private Integer id;
......
...@@ -3,8 +3,11 @@ package cn.com.glsx.dj.staff.dto.performance; ...@@ -3,8 +3,11 @@ package cn.com.glsx.dj.staff.dto.performance;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
@Data @Data
public class PerformanceConfigApprovePermissionDTO { public class PerformanceConfigApprovePermissionDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "主键ID") @ApiModelProperty(notes = "主键ID")
private Integer id; private Integer id;
......
package cn.com.glsx.dj.staff.dto.performance; package cn.com.glsx.dj.staff.dto.performance;
import cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO; import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.PerformanceConfigRuleDTO;
import cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
...@@ -19,6 +17,9 @@ public class PerformanceConfigDetailDTO implements Serializable { ...@@ -19,6 +17,9 @@ public class PerformanceConfigDetailDTO implements Serializable {
@ApiModelProperty(notes = "主键ID") @ApiModelProperty(notes = "主键ID")
private Integer id; private Integer id;
@ApiModelProperty(notes = "源提成方案配置ID(dj_car_life_performance_config.id)")
private Integer originPerformanceConfigId;
@ApiModelProperty(notes = "方案名称") @ApiModelProperty(notes = "方案名称")
private String schemeName; private String schemeName;
......
...@@ -3,11 +3,14 @@ package cn.com.glsx.dj.staff.dto.performance; ...@@ -3,11 +3,14 @@ package cn.com.glsx.dj.staff.dto.performance;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import java.io.Serializable;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString @ToString
public class PerformanceConfigPageByMerchantDTO { public class PerformanceConfigPageByMerchantDTO implements Serializable {
private static final long serialVersionUID = 1L;
// 业务类型 // 业务类型
private Byte businessType; private Byte businessType;
// 状态 // 状态
......
...@@ -2,10 +2,7 @@ package cn.com.glsx.dj.staff.dto.performance; ...@@ -2,10 +2,7 @@ package cn.com.glsx.dj.staff.dto.performance;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -16,6 +13,7 @@ import java.util.Date; ...@@ -16,6 +13,7 @@ import java.util.Date;
@ToString @ToString
public class PerformanceConfigPageDTO implements Serializable { public class PerformanceConfigPageDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer schemeType;
@ApiModelProperty(notes = "主键ID") @ApiModelProperty(notes = "主键ID")
private Long id; private Long id;
......
package cn.com.glsx.dj.staff.dto.performance; package cn.com.glsx.dj.staff.dto.performance;
import cn.com.glsx.dj.staff.model.PerformanceTimeCycle; import cn.com.glsx.dj.staff.model.PerformanceTimeCycle;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.util.Date;
@Data @Data
@ToString @ToString
@SuperBuilder @SuperBuilder
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
public class PerformanceTimeCycleDTO extends PerformanceTimeCycle { public class PerformanceTimeCycleDTO extends PerformanceTimeCycle {
@ApiModelProperty(notes = "周期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startDate;
@ApiModelProperty(notes = "周期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endDate;
} }
\ No newline at end of file \ No newline at end of file
...@@ -4,11 +4,35 @@ import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO; ...@@ -4,11 +4,35 @@ import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Data @Data
public class StaffPerformanceGetDTO { public class StaffPerformanceGetDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "staffPerformanceList", notes = "工资提成列表获取") private String month;
private String staffPhone;
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "门店ID")
private Integer merchantId;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(notes = "有效引荐量")
private Integer effectiveReferralQuantity;
@ApiModelProperty(notes = "实际售前触客数总数")
private Integer touchNumber;
@ApiModelProperty(notes = "总提成金额")
private BigDecimal totalPerformanceAmount;
@ApiModelProperty(name = "staffPerformanceList", notes = "工资提成列表")
private List<StaffProductPerformanceDTO> staffPerformanceList; private List<StaffProductPerformanceDTO> staffPerformanceList;
} }
...@@ -6,7 +6,8 @@ import lombok.Getter; ...@@ -6,7 +6,8 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum PerformanceApproveStatusEnum { public enum PerformanceApproveOperatorStatusEnum {
INIT(0, "初始化"),
// 已读 // 已读
READ(1, "已读"), READ(1, "已读"),
// 已通过 // 已通过
......
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum PerformanceApprovePushStatusEnum {
FAILED(0, "失败"),
SUCCESS(1, "成功"),
;
private Integer code;
private String desc;
}
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum PerformanceApproverTypeEnum {
READER(1, "查阅人"),
APPROVER(2, "审批人"),
;
private final Integer code;
private final String desc;
}
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum PerformanceConfigApproveStatusEnum {
APPROVEING(1, "审批中"),
APPROVE_SUCCESS(2, "已通过"),
APPROVE_FAIL(3, "已驳回"),
;
private final Integer code;
private final String desc;
}
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum PerformanceConfigStatusEnum {
DRAFT(0, "草稿"),
APPROVING(1, "审批中"),
EFFECTIVE(2, "生效"),
NOT_EFFECTIVE(3, "失效"),
;
private final Integer code;
private final String desc;
public static PerformanceConfigStatusEnum getByCode(Integer code) {
for (PerformanceConfigStatusEnum value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
}
...@@ -33,10 +33,18 @@ public class PerformanceConfigApproveOperationRecord implements Serializable { ...@@ -33,10 +33,18 @@ public class PerformanceConfigApproveOperationRecord implements Serializable {
@Column(name = "performance_config_approve_id") @Column(name = "performance_config_approve_id")
private Integer performanceConfigApproveId; private Integer performanceConfigApproveId;
@ApiModelProperty(notes = "审批状态(1:审批中;2:已通过;3:已驳回)") @ApiModelProperty(notes = "审批状态(0:初始化状态 1:已查看;2:已通过;3:已驳回)")
@Column(name = "approve_status") @Column(name = "approve_status")
private Integer status; private Integer status;
@ApiModelProperty(notes = "审批人类型(1:查阅人;2:审批人)")
@Column(name = "approver_type")
private Integer approverType;
@ApiModelProperty(notes = "推送状态 0推送失败 1推送成功")
@Column(name = "push_status")
private Integer pushStatus;
@ApiModelProperty(notes = "审批操作时间") @ApiModelProperty(notes = "审批操作时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "approve_time") @Column(name = "approve_time")
......
...@@ -42,18 +42,13 @@ public class PerformanceTimeCycle implements Serializable { ...@@ -42,18 +42,13 @@ public class PerformanceTimeCycle implements Serializable {
private String cycleItem; private String cycleItem;
@ApiModelProperty(notes = "周期开始时间") @ApiModelProperty(notes = "周期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Column(name = "start_day_of_month")
@Column(name = "start_date") private String stratDayOfMonth;
private Date startDate;
@ApiModelProperty(notes = "周期结束时间") @ApiModelProperty(notes = "周期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "end_date") @Column(name = "end_day_of_month")
private Date endDate; private String endDayOfMonth;
@ApiModelProperty(notes = "是否启用(N:否,Y:是)")
@Column(name = "enable_flag")
private String enableFlag;
@ApiModelProperty(notes = "创建人") @ApiModelProperty(notes = "创建人")
@Column(name = "created_by") @Column(name = "created_by")
......
...@@ -60,6 +60,7 @@ public class EffectiveReferralReview implements Serializable { ...@@ -60,6 +60,7 @@ public class EffectiveReferralReview implements Serializable {
* 复核时间-月份 * 复核时间-月份
*/ */
@ApiModelProperty(notes = "复核时间-月份") @ApiModelProperty(notes = "复核时间-月份")
@Column(name = "review_month")
private String reviewMonth; private String reviewMonth;
/** /**
......
package cn.com.glsx.dj.staff.remote;
import cn.com.glsx.dj.staff.dto.PerformanceCommissionStaffDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceGetDTO;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
@ApiService(value = "员工提成", owner = "zhangjb", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
public interface StaffProductPerformanceRemote {
@ApiMethod("查询员工提成构成")
@ApiParam(name = "dto", notes = "提成构成信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提成构成列表")
RpcResponse<List<StaffPerformanceGetDTO>> getPerformanceCommissionCompositionForStaff(StaffPerformanceGetDTO dto);
@ApiMethod("查询有绩效提成的人员")
@ApiResponse("有绩效提成的人员列表(员工名称、手机号码)")
RpcResponse<List<PerformanceCommissionStaffDTO>> listStaffWithPerformanceCommission();
}
...@@ -22,4 +22,14 @@ public interface PerformanceConfigApproveRemote { ...@@ -22,4 +22,14 @@ public interface PerformanceConfigApproveRemote {
@ApiParam(name = "dto", notes = "查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "查询信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提成方案审批详情") @ApiResponse("提成方案审批详情")
RpcResponse<PerformanceConfigApprovePermissionDTO> performanceConfigApproveDetailAndPermission(PerformanceConfigApproveDTO dto); RpcResponse<PerformanceConfigApprovePermissionDTO> performanceConfigApproveDetailAndPermission(PerformanceConfigApproveDTO dto);
@ApiMethod("提交提成方案审批")
@ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提交提成方案审批")
RpcResponse<Boolean> approveSubmit(PerformanceConfigApproveDTO dto);
@ApiMethod("提成方案审批")
@ApiParam(name = "dto", notes = "提成方案审批信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("提成方案审批")
RpcResponse<Boolean> approveHandle(PerformanceConfigApproveHandleDTO request);
} }
\ No newline at end of file \ No newline at end of file
...@@ -17,7 +17,7 @@ public interface PerformanceConfigRemote { ...@@ -17,7 +17,7 @@ public interface PerformanceConfigRemote {
@ApiMethod("提成方案新增") @ApiMethod("提成方案新增")
@ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("是否成功") @ApiResponse("是否成功")
RpcResponse<Boolean> performanceConfigAdd(@NotNull PerformanceConfigDTO dto); RpcResponse<Integer> performanceConfigSave(@NotNull PerformanceConfigDTO dto);
@ApiMethod("提成方案修改") @ApiMethod("提成方案修改")
@ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
...@@ -52,5 +52,10 @@ public interface PerformanceConfigRemote { ...@@ -52,5 +52,10 @@ public interface PerformanceConfigRemote {
@ApiMethod("查询门店是否有有效的提成方案") @ApiMethod("查询门店是否有有效的提成方案")
@ApiParam(name = "dto", notes = "门店id", dataType = DataTypeEnum.INT, required = true) @ApiParam(name = "dto", notes = "门店id", dataType = DataTypeEnum.INT, required = true)
@ApiResponse("提成方案") @ApiResponse("提成方案")
RpcResponse<Boolean> isEffectivePerformanceExist(@NotNull Integer merchantId); RpcResponse<Boolean> hasEffectivePerformanceConfigForMerchant(@NotNull Integer merchantId);
@ApiMethod("查询门店是否有有效的提成方案")
@ApiParam(name = "dto", notes = "门店id", dataType = DataTypeEnum.INT, required = true)
@ApiResponse("提成方案")
RpcResponse<List<PerformanceConfigDetailDTO>> performanceConfigDetailWithMerchant(PerformanceConfigDTO dto);
} }
package cn.com.glsx.dj.staff.job;
import cn.com.glsx.dj.staff.service.staffPerformance.PerformanceConfigService;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@ElasticJobConf(name = "PerformanceConfigEnableJob", cron = "0 0 0 1 * ?", description = "提成方案启用定时任务", overwrite = false)
public class PerformanceConfigEnableJob implements SimpleJob {
@Autowired
private PerformanceConfigService performanceConfigService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("----------------提成方案启用定时任务-----------------");
long beginTime = System.currentTimeMillis();
try {
performanceConfigService.enblePerformanceConfig();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
} finally {
log.info("----------------提成方案启用定时任务,耗时:{}-----------------", System.currentTimeMillis() - beginTime);
}
}
}
...@@ -15,4 +15,12 @@ public interface PerformanceConfigApproveMapper extends OreMapper<PerformanceCon ...@@ -15,4 +15,12 @@ public interface PerformanceConfigApproveMapper extends OreMapper<PerformanceCon
PerformanceConfigApproveDetailDTO getPerformanceConfigApproveDetail(PerformanceConfigApproveDTO dto); PerformanceConfigApproveDetailDTO getPerformanceConfigApproveDetail(PerformanceConfigApproveDTO dto);
PerformanceConfigApprovePermissionDTO getPerformanceConfigApproveDetailAndPermission(PerformanceConfigApproveDTO dto); PerformanceConfigApprovePermissionDTO getPerformanceConfigApproveDetailAndPermission(PerformanceConfigApproveDTO dto);
Integer insertOne(PerformanceConfigApproveDTO dto);
PerformanceConfigApproveDTO selectById(Integer id);
void updateById(PerformanceConfigApproveDTO approveDTO);
List<PerformanceConfigApproveDTO> selectByPerformanceConfigId(Integer performanceConfigId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,8 +5,14 @@ import cn.com.glsx.dj.staff.model.PerformanceConfigApproveOperationRecord; ...@@ -5,8 +5,14 @@ import cn.com.glsx.dj.staff.model.PerformanceConfigApproveOperationRecord;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper @Mapper
public interface PerformanceConfigApproveOperationRecordMapper extends OreMapper<PerformanceConfigApproveOperationRecord> { public interface PerformanceConfigApproveOperationRecordMapper extends OreMapper<PerformanceConfigApproveOperationRecord> {
void addOp(PerformanceConfigApproveOperationRecordDTO dto); List<PerformanceConfigApproveOperationRecordDTO> listByPerformanceConfigApproveId(Integer performanceConfigApproveId);
void updateApproveOpinionAndStatusById(PerformanceConfigApproveOperationRecordDTO dto);
void updateReadStatusByMobile(String mobile);
} }
\ No newline at end of file \ No newline at end of file
...@@ -25,5 +25,11 @@ public interface PerformanceConfigMapper extends OreMapper<PerformanceConfig> { ...@@ -25,5 +25,11 @@ public interface PerformanceConfigMapper extends OreMapper<PerformanceConfig> {
List<PerformanceConfigDTO> effectivePerformanceConfigByMerchantId(@Param("merchantId") Integer merchantId); List<PerformanceConfigDTO> effectivePerformanceConfigByMerchantId(@Param("merchantId") Integer merchantId);
Boolean isEffectivePerformanceExist(Integer merchantId); Boolean hasEffectivePerformanceConfigForMerchant(Integer merchantId);
int insertOne(PerformanceConfigDTO dto);
void updateById(PerformanceConfigDTO dto);
void enblePerformanceConfig();
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.mapper; package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO;
import cn.com.glsx.dj.staff.model.PerformanceConfigMerchantBrandRef; import cn.com.glsx.dj.staff.model.PerformanceConfigMerchantBrandRef;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper @Mapper
public interface PerformanceConfigMerchantBrandRefMapper extends OreMapper<PerformanceConfigMerchantBrandRef> { public interface PerformanceConfigMerchantBrandRefMapper extends OreMapper<PerformanceConfigMerchantBrandRef> {
void deleteByConfigId(Integer performanceConfigId);
void insertLists(List<PerformanceConfigMerchantBrandRefDTO> merchantBrandModelPageBrands);
List<PerformanceConfigMerchantBrandRefDTO> listByConfigId(Integer id);
void invalidByBusinessTypeAndMerchantBrand(PerformanceConfigMerchantBrandRefDTO merchantBrandRef);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.mapper; package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.PerformanceConfigRuleDTO;
import cn.com.glsx.dj.staff.model.PerformanceConfigRule; import cn.com.glsx.dj.staff.model.PerformanceConfigRule;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper @Mapper
public interface PerformanceConfigRuleMapper extends OreMapper<PerformanceConfigRule> { public interface PerformanceConfigRuleMapper extends OreMapper<PerformanceConfigRule> {
PerformanceConfigRuleDTO listByConfigId(Integer id);
void insertOne(PerformanceConfigRuleDTO performanceConfigRule);
void deleteByConfigId(Integer performanceConfigId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -13,4 +13,6 @@ public interface PerformanceParamConfigConditionMapper extends OreMapper<Perform ...@@ -13,4 +13,6 @@ public interface PerformanceParamConfigConditionMapper extends OreMapper<Perform
List<PerformanceParamConfigConditionDTO> listByParamConfigId( List<PerformanceParamConfigConditionDTO> listByParamConfigId(
PerformanceParamConfigConditionDTO dto); PerformanceParamConfigConditionDTO dto);
void deleteByPerformanceConfigId(@Param("performanceConfigId") Integer performanceConfigId); void deleteByPerformanceConfigId(@Param("performanceConfigId") Integer performanceConfigId);
void insertLists(List<PerformanceParamConfigConditionDTO> performanceParamConfigConditionDTOList);
} }
\ No newline at end of file \ No newline at end of file
...@@ -12,4 +12,6 @@ public interface PerformanceParamConfigMapper extends OreMapper<PerformanceParam ...@@ -12,4 +12,6 @@ public interface PerformanceParamConfigMapper extends OreMapper<PerformanceParam
List<PerformanceParamConfigDTO> listByConfigId(PerformanceParamConfigDTO dto); List<PerformanceParamConfigDTO> listByConfigId(PerformanceParamConfigDTO dto);
void deleteByPerformanceParamConfigId(Integer id); void deleteByPerformanceParamConfigId(Integer id);
int insertOne(PerformanceParamConfigDTO performanceParamConfig);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.mapper; package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO; import cn.com.glsx.dj.staff.dto.PerformanceCommissionStaffDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO; import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.model.StaffPerformance; import cn.com.glsx.dj.staff.model.StaffPerformance;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -19,4 +19,9 @@ public interface StaffPerformanceMapper extends OreMapper<StaffPerformance> { ...@@ -19,4 +19,9 @@ public interface StaffPerformanceMapper extends OreMapper<StaffPerformance> {
* @return * @return
*/ */
int removeStaffPerformance(StaffPerformance staffPerformance); int removeStaffPerformance(StaffPerformance staffPerformance);
/**
* 查询有生成过绩效工资的员工信息
*/
List<PerformanceCommissionStaffDTO> listStaffWithPerformanceCommission();
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.staff.mapper.perfSalary; ...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.staff.mapper.perfSalary;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.MerchantBrandReportDTO;
import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview; import cn.com.glsx.dj.staff.model.perfSalary.EffectiveReferralReview;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -42,4 +43,8 @@ public interface EffectiveReferralReviewMapper extends OreMapper<EffectiveReferr ...@@ -42,4 +43,8 @@ public interface EffectiveReferralReviewMapper extends OreMapper<EffectiveReferr
List<String> queryOnlineNoHandlerQwSendMobilePhone(@Param("date") String date, @Param("merchantId") Integer merchantId, @Param("sceneType") Byte sceneType); List<String> queryOnlineNoHandlerQwSendMobilePhone(@Param("date") String date, @Param("merchantId") Integer merchantId, @Param("sceneType") Byte sceneType);
List<Integer> getAll4sRefMerchantId();
List<MerchantBrandReportDTO> getDeliveryCount(@Param("date") String date);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.staff.remote;
import cn.com.glsx.dj.staff.dto.PerformanceCommissionStaffDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceGetDTO;
import cn.com.glsx.dj.staff.service.staffPerformance.StaffPerformanceService;
import cn.com.glsx.dj.staff.service.staffPerformance.StaffProductPerformanceService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(version = "1.0.0", validation = "true")
public class StaffProductPerformanceRemoteImpl implements StaffProductPerformanceRemote{
@Autowired
private StaffProductPerformanceService staffProductPerformanceService;
@Autowired
private StaffPerformanceService staffPerformanceService;
@Override
public RpcResponse<List<StaffPerformanceGetDTO>> getPerformanceCommissionCompositionForStaff(StaffPerformanceGetDTO dto) {
return RpcResponse.success(staffProductPerformanceService.getPerformanceCommissionCompositionForStaff(dto));
}
@Override
public RpcResponse<List<PerformanceCommissionStaffDTO>> listStaffWithPerformanceCommission() {
return RpcResponse.success(staffPerformanceService.listStaffWithPerformanceCommission());
}
}
...@@ -30,4 +30,13 @@ public class PerformanceConfigApproveRemoteImpl implements PerformanceConfigAppr ...@@ -30,4 +30,13 @@ public class PerformanceConfigApproveRemoteImpl implements PerformanceConfigAppr
return RpcResponse.success(performanceConfigApproveService.getPerformanceConfigApproveDetailAndPermission(dto)); return RpcResponse.success(performanceConfigApproveService.getPerformanceConfigApproveDetailAndPermission(dto));
} }
@Override
public RpcResponse<Boolean> approveSubmit(PerformanceConfigApproveDTO dto) {
return RpcResponse.success(performanceConfigApproveService.submit(dto));
}
@Override
public RpcResponse<Boolean> approveHandle(PerformanceConfigApproveHandleDTO dto) {
return RpcResponse.success(performanceConfigApproveService.approveHandle(dto));
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -19,8 +19,8 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote { ...@@ -19,8 +19,8 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote {
@Override @Override
public RpcResponse<Boolean> performanceConfigAdd(PerformanceConfigDTO dto) { public RpcResponse<Integer> performanceConfigSave(PerformanceConfigDTO dto) {
return null; return performanceConfigService.savePerformanceConfig(dto);
} }
@Override @Override
...@@ -57,8 +57,13 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote { ...@@ -57,8 +57,13 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote {
} }
@Override @Override
public RpcResponse<Boolean> isEffectivePerformanceExist(Integer merchantId) { public RpcResponse<Boolean> hasEffectivePerformanceConfigForMerchant(Integer merchantId) {
return RpcResponse.success(performanceConfigService.isEffectivePerformanceExist(merchantId)); return RpcResponse.success(performanceConfigService.hasEffectivePerformanceConfigForMerchant(merchantId));
}
@Override
public RpcResponse<List<PerformanceConfigDetailDTO>> performanceConfigDetailWithMerchant(PerformanceConfigDTO dto) {
return RpcResponse.success(performanceConfigService.performanceConfigDetailWithMerchant(dto));
} }
......
...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.staff.service.perfSalary; ...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.staff.service.perfSalary;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants; import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewCommonDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO; import cn.com.glsx.dj.staff.dto.perfSalary.EffectiveReferralReviewDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.MerchantBrandReportDTO;
import cn.com.glsx.dj.staff.dto.perfSalary.MerchantCarBrandDTO; import cn.com.glsx.dj.staff.dto.perfSalary.MerchantCarBrandDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO; import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum; import cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum;
...@@ -17,6 +18,9 @@ import cn.com.glsx.framework.core.exception.RpcServiceException; ...@@ -17,6 +18,9 @@ import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.proxy.model.MerchantCarInfoResponse; import cn.com.glsx.scrm.proxy.model.MerchantCarInfoResponse;
import cn.com.glsx.scrm.proxy.model.merchant.MerchantRopResponse; import cn.com.glsx.scrm.proxy.model.merchant.MerchantRopResponse;
import cn.com.glsx.scrm.proxy.remote.merchant.MerchantRemote; import cn.com.glsx.scrm.proxy.remote.merchant.MerchantRemote;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -32,10 +36,9 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -32,10 +36,9 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.*;
import java.util.List; import java.util.concurrent.CompletableFuture;
import java.util.Objects; import java.util.concurrent.ConcurrentHashMap;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -87,10 +90,10 @@ public class EffectiveReferralReviewService { ...@@ -87,10 +90,10 @@ public class EffectiveReferralReviewService {
List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(pagination.getCondition()); List<EffectiveReferralReviewCommonDTO> list = effectiveReferralReviewMapper.selectStoreEffectiveReferralList(pagination.getCondition());
//2、查询T1时间配置 //2、查询T1时间配置
PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode()); // PerformanceTimeCycleDTO performanceTimeCycleDTO = performanceTimeCycleService.selectByCode(PerformanceTimeCycleCodeEnum.T1.getCode());
//3、填充复核状态,待复核状态下的数据,如果当前时间大于T1时间配置内的结束时间,置为已失效 //3、填充复核状态,待复核状态下的数据,如果当前时间大于T1时间配置内的结束时间,置为已失效
for (EffectiveReferralReviewCommonDTO item : list) { /*for (EffectiveReferralReviewCommonDTO item : list) {
if (Objects.nonNull(performanceTimeCycleDTO) if (Objects.nonNull(performanceTimeCycleDTO)
&& performanceTimeCycleDTO.getStartDate() != null && performanceTimeCycleDTO.getStartDate() != null
&& performanceTimeCycleDTO.getEndDate() != null && performanceTimeCycleDTO.getEndDate() != null
...@@ -99,7 +102,7 @@ public class EffectiveReferralReviewService { ...@@ -99,7 +102,7 @@ public class EffectiveReferralReviewService {
item.setIsReviewed(2); item.setIsReviewed(2);
} }
} }
} }*/
//4、返回结果 //4、返回结果
pagination = RpcPagination.copyPage(page); pagination = RpcPagination.copyPage(page);
...@@ -174,7 +177,65 @@ public class EffectiveReferralReviewService { ...@@ -174,7 +177,65 @@ public class EffectiveReferralReviewService {
* 有效引荐数(交车数)统计 * 有效引荐数(交车数)统计
*/ */
public void stats() { public void stats() {
// 获取所有4s店商户id
List<Integer> merchantIds = effectiveReferralReviewMapper.getAll4sRefMerchantId();
// 查询这些4s店对应的品牌信息
// 多线程调用getCarBrand接口
ConcurrentHashMap<Integer, List<MerchantCarBrandDTO>> merchantCarBrandMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (Integer merchantId : merchantIds) {
CompletableFuture<Void> future = CompletableFuture.supplyAsync(
() -> fetchCarBrand(merchantId), // 封装业务逻辑
taskExecutor).thenAccept(carBrands -> {
if (carBrands != null) {
merchantCarBrandMap.put(merchantId, carBrands);
}}).exceptionally(ex -> {
log.error("获取车辆品牌失败-merchantId={}", merchantId, ex);
// 6. 添加默认空值
merchantCarBrandMap.put(merchantId, new ArrayList<>());
return null;
});
futures.add(future);
}
// 5. 等待所有任务完成
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
// 获取交车数
// 上个月
DateTime lastMonthDate = DateUtil.offsetMonth(new Date(), -1);
String lastMonth = DateUtil.format(lastMonthDate, DatePattern.NORM_MONTH_PATTERN);
List<MerchantBrandReportDTO> deliveryCount = effectiveReferralReviewMapper.getDeliveryCount(lastMonth);
Map<Integer, MerchantBrandReportDTO> deliveryCountMap = deliveryCount.stream().collect(Collectors.toMap(MerchantBrandReportDTO::getMerchantId, item -> item));
List<EffectiveReferralReview> insertList = new ArrayList<>();
for (Integer merchantId : merchantIds) {
List<MerchantCarBrandDTO> merchantCarBrandDTOS = merchantCarBrandMap.get(merchantId);
MerchantBrandReportDTO merchantBrandReportDTO = deliveryCountMap.get(merchantId);
// 判断品牌和设置品牌对应的交车数
}
}
// 封装业务逻辑 + 重试机制
private List<MerchantCarBrandDTO> fetchCarBrand(Integer merchantId) {
// 3次指数退避重试
int maxRetries = 3;
for (int i = 0; i < maxRetries; i++) {
try {
return getCarBrand(merchantId);
} catch (Exception e) {
if (i == maxRetries - 1) throw e;
try {
Thread.sleep((long) Math.pow(2, i) * 100); // 指数退避
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new RuntimeException(ex);
}
}
}
return null;
} }
......
package cn.com.glsx.dj.staff.service.staffPerformance; package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO; import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO;
import cn.com.glsx.dj.staff.enums.PerformanceApproveStatusEnum;
import cn.com.glsx.dj.staff.mapper.PerformanceConfigApproveOperationRecordMapper; import cn.com.glsx.dj.staff.mapper.PerformanceConfigApproveOperationRecordMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j @Slf4j
@Service @Service
public class PerformanceConfigApproveOperationRecordService { public class PerformanceConfigApproveOperationRecordService {
@Autowired @Autowired
PerformanceConfigApproveOperationRecordMapper performanceConfigApproveOperationRecordMapper; PerformanceConfigApproveOperationRecordMapper performanceConfigApproveOperationRecordMapper;
public void addOperatorRecord(Integer id, String mobile, PerformanceApproveStatusEnum performanceApproveStatusEnum, String approveName, String opinion) { public List<PerformanceConfigApproveOperationRecordDTO> listByPerformanceConfigApproveId(Integer performanceConfigApproveId) {
PerformanceConfigApproveOperationRecordDTO dto = new PerformanceConfigApproveOperationRecordDTO(); return performanceConfigApproveOperationRecordMapper.listByPerformanceConfigApproveId(performanceConfigApproveId);
dto.setApproverMobile(mobile); }
dto.setStatus(performanceApproveStatusEnum.getCode());
dto.setPerformanceConfigApproveId(id); public void updateApproveOpinionAndStatusById(PerformanceConfigApproveOperationRecordDTO dto) {
dto.setApproveOpinion(opinion); performanceConfigApproveOperationRecordMapper.updateApproveOpinionAndStatusById(dto);
dto.setApproverName(approveName); }
performanceConfigApproveOperationRecordMapper.addOp(dto);
public void insertList(List<PerformanceConfigApproveOperationRecordDTO> recordDTOList) {
performanceConfigApproveOperationRecordMapper.insertList(recordDTOList);
}
public void updateReadStatusByMobile(String mobile) {
performanceConfigApproveOperationRecordMapper.updateReadStatusByMobile(mobile);
} }
} }
...@@ -21,6 +21,19 @@ public class PerformanceConfigMerchantBrandRefService { ...@@ -21,6 +21,19 @@ public class PerformanceConfigMerchantBrandRefService {
public List<PerformanceConfigMerchantBrandRefDTO> listByConfigId(Integer id) { public List<PerformanceConfigMerchantBrandRefDTO> listByConfigId(Integer id) {
return null; return performanceConfigMerchantBrandRefMapper.listByConfigId(id);
}
public void addRef(List<PerformanceConfigMerchantBrandRefDTO> merchantBrandModelPageBrands, Integer performanceConfigId) {
for (PerformanceConfigMerchantBrandRefDTO merchantBrandModelPageBrand : merchantBrandModelPageBrands) {
merchantBrandModelPageBrand.setPerformanceConfigId(performanceConfigId);
}
performanceConfigMerchantBrandRefMapper.deleteByConfigId(performanceConfigId);
performanceConfigMerchantBrandRefMapper.insertLists(merchantBrandModelPageBrands);
}
public void invalidByBusinessTypeAndMerchantBrand(Byte businessType, PerformanceConfigMerchantBrandRefDTO merchantBrandRef) {
merchantBrandRef.setBusinessType(businessType);
performanceConfigMerchantBrandRefMapper.invalidByBusinessTypeAndMerchantBrand(merchantBrandRef);
} }
} }
...@@ -17,6 +17,12 @@ public class PerformanceConfigRuleService { ...@@ -17,6 +17,12 @@ public class PerformanceConfigRuleService {
@Autowired @Autowired
private PerformanceConfigRuleMapper performanceConfigRuleMapper; private PerformanceConfigRuleMapper performanceConfigRuleMapper;
public PerformanceConfigRuleDTO listByConfigId(Integer id) { public PerformanceConfigRuleDTO listByConfigId(Integer id) {
return null; return performanceConfigRuleMapper.listByConfigId(id);
}
public void addRule(PerformanceConfigRuleDTO performanceConfigRule, Integer performanceConfigId) {
performanceConfigRuleMapper.deleteByConfigId(performanceConfigId);
performanceConfigRule.setPerformanceConfigId(performanceConfigId);
performanceConfigRuleMapper.insertOne(performanceConfigRule);
} }
} }
...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.staff.dto.performance.*; ...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.staff.dto.performance.*;
import cn.com.glsx.dj.staff.mapper.PerformanceConfigMapper; import cn.com.glsx.dj.staff.mapper.PerformanceConfigMapper;
import cn.com.glsx.dj.staff.model.PerformanceConfig; import cn.com.glsx.dj.staff.model.PerformanceConfig;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
...@@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -147,7 +149,70 @@ public class PerformanceConfigService { ...@@ -147,7 +149,70 @@ public class PerformanceConfigService {
return performanceConfigDTOS; return performanceConfigDTOS;
} }
public Boolean isEffectivePerformanceExist(Integer merchantId) { public Boolean hasEffectivePerformanceConfigForMerchant(Integer merchantId) {
return performanceConfigMapper.isEffectivePerformanceExist(merchantId); return performanceConfigMapper.hasEffectivePerformanceConfigForMerchant(merchantId);
}
/**
* 保存一个方案
*/
public RpcResponse<Integer> savePerformanceConfig(PerformanceConfigDTO dto) {
Integer id = dto.getId();
if (id == null) {
performanceConfigMapper.insertOne(dto);
id = dto.getId();
} else {
performanceConfigMapper.updateById(dto);
}
performanceParamConfigService.addParamConfig(dto.getPerformanceParamConfigs(), id);
performanceConfigRuleService.addRule(dto.getPerformanceConfigRule(), id);
performanceConfigMerchantBrandRefService.addRef(dto.getMerchantBrandModelPageBrands(), id);
return RpcResponse.success(id);
}
public PerformanceConfigDTO selectById(Integer id) {
return performanceConfigMapper.selectById(id);
}
public void updateById(PerformanceConfigDTO config) {
performanceConfigMapper.updateById(config);
}
public List<PerformanceConfigDetailDTO> performanceConfigDetailWithMerchant(PerformanceConfigDTO dto) {
log.info("selectEffectiveConfig dto: {}", dto);
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "dto不能为空");
RpcAssert.assertNotNull(dto.getMerchantId(), DefaultErrorEnum.DATA_NULL, "merchantId不能为空");
// 1 查询生效中的方案
List<PerformanceConfigDTO> performanceConfigDTOS = performanceConfigMapper.effectivePerformanceConfigByMerchantId(dto.getMerchantId());
List<PerformanceConfigDetailDTO> result = new ArrayList<>();
for (PerformanceConfigDTO performanceConfigDTO : performanceConfigDTOS) {
PerformanceConfigDetailDTO detailDTO = PerformanceConfigDetailDTO.builder()
.id(null)
.originPerformanceConfigId(performanceConfigDTO.getId())
.schemeName(performanceConfigDTO.getSchemeName())
.schemeType(2)
.businessType(performanceConfigDTO.getBusinessType())
.effectiveMonth(performanceConfigDTO.getEffectiveMonth())
.build();
// 查询rule
PerformanceConfigRuleDTO ruleDTO = performanceConfigRuleService
.listByConfigId(performanceConfigDTO.getId());
detailDTO.setPerformanceConfigRule(ruleDTO);
// 查询参数配置
List<PerformanceParamConfigDTO> performanceParamConfigs = performanceParamConfigService
.listByConfigId(performanceConfigDTO.getId());
detailDTO.setParamConfigList(performanceParamConfigs);
// 查询商户品牌
List<PerformanceConfigMerchantBrandRefDTO> merchantBrandRefs = performanceConfigMerchantBrandRefService
.listByConfigId(performanceConfigDTO.getId());
merchantBrandRefs.removeIf(merchantBrandRef -> !merchantBrandRef.getMerchantId().equals(dto.getMerchantId()));
detailDTO.setMerchantBrandRefList(merchantBrandRefs);
result.add(detailDTO);
}
return result;
}
public void enblePerformanceConfig() {
performanceConfigMapper.enblePerformanceConfig();
} }
} }
...@@ -13,10 +13,10 @@ import java.util.List; ...@@ -13,10 +13,10 @@ import java.util.List;
public class PerformanceParamConfigConditionService { public class PerformanceParamConfigConditionService {
@Autowired @Autowired
private PerformanceParamConfigConditionMapper performanceParamConfigConditionMapper; private PerformanceParamConfigConditionMapper performanceParamConfigConditionMapper;
public void deleteByPerformanceConfigId(Integer performanceConfigId) {
performanceParamConfigConditionMapper.deleteByPerformanceConfigId(performanceConfigId);
}
public void insertList(List<PerformanceParamConfigConditionDTO> performanceParamConfigConditionDTOList) { public void insertList(List<PerformanceParamConfigConditionDTO> performanceParamConfigConditionDTOList) {
// 1 把物理删除久的condition performanceParamConfigConditionMapper.insertLists(performanceParamConfigConditionDTOList);
performanceParamConfigConditionMapper.deleteByPerformanceConfigId(performanceParamConfigConditionDTOList.get(0).getPerformanceConfigId());
// 2 插入新的condition
performanceParamConfigConditionMapper.insertList(performanceParamConfigConditionDTOList);
} }
} }
package cn.com.glsx.dj.staff.service.staffPerformance; package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.PerformanceParamConfigConditionDTO;
import cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO; import cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO;
import cn.com.glsx.dj.staff.mapper.PerformanceParamConfigMapper; import cn.com.glsx.dj.staff.mapper.PerformanceParamConfigMapper;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
...@@ -20,6 +21,9 @@ public class PerformanceParamConfigService { ...@@ -20,6 +21,9 @@ public class PerformanceParamConfigService {
@Autowired @Autowired
private PerformanceParamConfigMapper performanceParamConfigMapper; private PerformanceParamConfigMapper performanceParamConfigMapper;
@Autowired
private PerformanceParamConfigConditionService performanceParamConfigConditionService;
/** /**
* 根据配置ID查询参数列表 * 根据配置ID查询参数列表
* *
...@@ -32,4 +36,24 @@ public class PerformanceParamConfigService { ...@@ -32,4 +36,24 @@ public class PerformanceParamConfigService {
PerformanceParamConfigDTO dto = PerformanceParamConfigDTO.builder().performanceConfigId(configId).build(); PerformanceParamConfigDTO dto = PerformanceParamConfigDTO.builder().performanceConfigId(configId).build();
return performanceParamConfigMapper.listByConfigId(dto); return performanceParamConfigMapper.listByConfigId(dto);
} }
public void addParamConfig(List<PerformanceParamConfigDTO> performanceParamConfigs, Integer performanceConfigId) {
// 1. 先删掉原来的配置
performanceParamConfigMapper.deleteByPerformanceParamConfigId(performanceConfigId);
// 2. 删除掉原有的条件
performanceParamConfigConditionService.deleteByPerformanceConfigId(performanceConfigId);
for (PerformanceParamConfigDTO performanceParamConfig : performanceParamConfigs) {
performanceParamConfig.setPerformanceConfigId(performanceConfigId);
// 3. 执行插入,拿到id
int id = performanceParamConfigMapper.insertOne(performanceParamConfig);
// 4. 插入条件
List<PerformanceParamConfigConditionDTO> performanceParamConfigConditions = performanceParamConfig.getPerformanceParamConfigConditions();
if (performanceParamConfigConditions != null && !performanceParamConfigConditions.isEmpty()) {
for (PerformanceParamConfigConditionDTO performanceParamConfigCondition : performanceParamConfigConditions) {
performanceParamConfigCondition.setPerformanceConfigId(id);
}
performanceParamConfigConditionService.insertList(performanceParamConfigConditions);
}
}
}
} }
package cn.com.glsx.dj.staff.service.staffPerformance; package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.constant.CommonConstants; import cn.com.glsx.dj.staff.constant.CommonConstants;
import cn.com.glsx.dj.staff.dto.StaffPerformanceCalContextDTO; import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO; import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.enums.CommissionTypeEnum; import cn.com.glsx.dj.staff.enums.CommissionTypeEnum;
import cn.com.glsx.dj.staff.mapper.StaffPerformanceMapper; import cn.com.glsx.dj.staff.mapper.StaffPerformanceMapper;
...@@ -220,4 +219,14 @@ public class StaffPerformanceService { ...@@ -220,4 +219,14 @@ public class StaffPerformanceService {
cn.com.glsx.framework.core.enums.DefaultErrorEnum.DATABASE_ERROR); cn.com.glsx.framework.core.enums.DefaultErrorEnum.DATABASE_ERROR);
} }
} }
public List<PerformanceCommissionStaffDTO> listStaffWithPerformanceCommission() {
try {
return staffPerformanceMapper.listStaffWithPerformanceCommission();
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new cn.com.glsx.framework.core.exception.RpcServiceException(
cn.com.glsx.framework.core.enums.DefaultErrorEnum.DATABASE_ERROR);
}
}
} }
...@@ -3,10 +3,9 @@ package cn.com.glsx.dj.staff.service.staffPerformance; ...@@ -3,10 +3,9 @@ package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.smartcarlife.constant.CommonConstants; import cn.com.glsx.dj.smartcarlife.constant.CommonConstants;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO; import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO;
import cn.com.glsx.dj.smartcarlife.remote.MerchantPerformanceProductDefineRemote; import cn.com.glsx.dj.smartcarlife.remote.MerchantPerformanceProductDefineRemote;
import cn.com.glsx.dj.staff.dto.StaffPerformanceCalContextDTO; import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO; import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO; import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceGetDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.enums.CommissionTypeEnum; import cn.com.glsx.dj.staff.enums.CommissionTypeEnum;
import cn.com.glsx.dj.staff.enums.GoodsConfigTypeEnum; import cn.com.glsx.dj.staff.enums.GoodsConfigTypeEnum;
import cn.com.glsx.dj.staff.mapper.StaffProductPerformanceMapper; import cn.com.glsx.dj.staff.mapper.StaffProductPerformanceMapper;
...@@ -28,8 +27,6 @@ import org.springframework.stereotype.Service; ...@@ -28,8 +27,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.ctc.wstx.util.StringUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -48,6 +45,8 @@ public class StaffProductPerformanceService { ...@@ -48,6 +45,8 @@ public class StaffProductPerformanceService {
private StaffProductPerformanceMapper staffProductPerformanceMapper; private StaffProductPerformanceMapper staffProductPerformanceMapper;
@Autowired @Autowired
private MerchantPerformanceProductDefineRemote merchantPerformanceProductDefineRemote; private MerchantPerformanceProductDefineRemote merchantPerformanceProductDefineRemote;
@Autowired
private StaffPerformanceService staffPerformanceService;
StaffProductPerformanceService(AutoPerformRuleService autoPerformRuleService) { StaffProductPerformanceService(AutoPerformRuleService autoPerformRuleService) {
this.autoPerformRuleService = autoPerformRuleService; this.autoPerformRuleService = autoPerformRuleService;
...@@ -299,6 +298,42 @@ public class StaffProductPerformanceService { ...@@ -299,6 +298,42 @@ public class StaffProductPerformanceService {
return DataCalUtil.divideToPercent(new BigDecimal(upgradeOrderNum), personalTargetTouchCount); return DataCalUtil.divideToPercent(new BigDecimal(upgradeOrderNum), personalTargetTouchCount);
} }
public List<StaffPerformanceGetDTO> getPerformanceCommissionCompositionForStaff(StaffPerformanceGetDTO dto) {
StaffProductPerformanceDTO query = StaffProductPerformanceDTO.builder().staffPhone(dto.getStaffPhone()).month(dto.getMonth()).build();
List<StaffProductPerformanceDTO> staffProductPerformanceDTOList = staffProductPerformanceMapper.listStaffPerformance(query);
if (staffProductPerformanceDTOList.isEmpty()) {
return new ArrayList<>();
}
StaffPerformanceDTO staffPerformanceDTO = StaffPerformanceDTO.builder().staffPhone(dto.getStaffPhone()).month(dto.getMonth()).build();
List<StaffPerformanceDTO> staffPerformanceDTOList = staffPerformanceService.listStaffPerformance(staffPerformanceDTO);
Map<Integer, List<StaffProductPerformanceDTO>> map = staffProductPerformanceDTOList.stream().collect(Collectors.groupingBy(StaffProductPerformanceDTO::getMerchantId));
List<StaffPerformanceGetDTO> staffPerformanceGetDTOList = new ArrayList<>();
for (List<StaffProductPerformanceDTO> value : map.values()) {
StaffProductPerformanceDTO staffProductPerformanceDTO = value.get(0);
StaffPerformanceGetDTO staffPerformanceGetDTO = new StaffPerformanceGetDTO();
staffPerformanceGetDTOList.add(staffPerformanceGetDTO);
staffPerformanceGetDTO.setStaffName(staffProductPerformanceDTO.getStaffName());
staffPerformanceGetDTO.setMerchantId(staffProductPerformanceDTO.getMerchantId());
int effectiveReferralQuantity = 0;
int touchNumber = 0;
BigDecimal totalPerformanceAmount = BigDecimal.ZERO;
for (StaffPerformanceDTO performanceDTO : staffPerformanceDTOList) {
if (performanceDTO.getMerchantId().equals(staffProductPerformanceDTO.getMerchantId())) {
effectiveReferralQuantity += performanceDTO.getEffectiveReferralQuantity();
touchNumber += performanceDTO.getTouchNumber();
}
}
for (StaffProductPerformanceDTO productPerformanceDTO : value) {
totalPerformanceAmount = totalPerformanceAmount.add(productPerformanceDTO.getPerformanceAmount());
}
staffPerformanceGetDTO.setEffectiveReferralQuantity(effectiveReferralQuantity);
staffPerformanceGetDTO.setTouchNumber(touchNumber);
staffPerformanceGetDTO.setStaffPerformanceList(value);
}
return staffPerformanceGetDTOList;
}
private static class MetricsResult { private static class MetricsResult {
private final int upgradeOrderNum; private final int upgradeOrderNum;
private final BigDecimal gmvOutput; private final BigDecimal gmvOutput;
......
...@@ -90,12 +90,7 @@ ...@@ -90,12 +90,7 @@
<if test="submitStatus != null"> <if test="submitStatus != null">
HAVING IF(MIN(serr.status) &lt;= 1, 0, 1) = #{submitStatus} HAVING IF(MIN(serr.status) &lt;= 1, 0, 1) = #{submitStatus}
</if> </if>
ORDER BY ORDER BY submit_status ASC
CASE
WHEN merchant_name REGEXP '^[0-9]' THEN 1
ELSE 0
END,
CONVERT(UPPER(LEFT(merchant_name, 1)) USING gbk) ASC,
</select> </select>
<select id="selectStoreEffectiveReferralList" resultMap="CommonDTOResultMap"> <select id="selectStoreEffectiveReferralList" resultMap="CommonDTOResultMap">
...@@ -106,7 +101,7 @@ ...@@ -106,7 +101,7 @@
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N' AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N' WHERE serr.deleted_flag = 'N'
<if test="merchantId != null'"> <if test="merchantId != null">
AND serr.merchant_id = #{merchantId} AND serr.merchant_id = #{merchantId}
</if> </if>
<if test="merchantName != null and merchantName != ''"> <if test="merchantName != null and merchantName != ''">
...@@ -133,9 +128,9 @@ ...@@ -133,9 +128,9 @@
<if test="managerCommitEndTime != null "> <if test="managerCommitEndTime != null ">
AND serr.manager_commit_time &lt;= #{managerCommitEndTime} AND serr.manager_commit_time &lt;= #{managerCommitEndTime}
</if> </if>
<if test="merchantIdList != null and merchantIdList.size() > 0"> <if test="merchantIds != null and merchantIds.size() > 0">
AND serr.merchant_id IN AND serr.merchant_id IN
<foreach collection="merchantIdList" item="item" open="(" separator="," close=")"> <foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
...@@ -190,4 +185,56 @@ ...@@ -190,4 +185,56 @@
AND dc.director_phone IS NOT NULL; AND dc.director_phone IS NOT NULL;
</select> </select>
<select id="getAll4sRefMerchantId" resultType="java.lang.Integer">
select distinct main_merchant_id
from dj_car_life_scene_merchant_ref a
where a.main_merchant_type = 2
and a.sub_merchant_type in (6, 8)
and a.deleted_flag = 'N'
and a.scene in (0, 1)
</select>
<select id="getDeliveryCount" resultType="cn.com.glsx.dj.staff.dto.perfSalary.MerchantBrandReportDTO">
SELECT
m.merchant_id AS `merchantId`,
DATE_FORMAT(m.report_date, '%Y-%m') AS `reportYearMonth`,
SUM(IF(m.brand_name = '享界' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgXiangjCount`,
SUM(IF(m.brand_name = '尊界' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgZunjCount`,
SUM(IF(m.brand_name = '尚界' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgShangjCount`,
SUM(IF(m.brand_name = '智界' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgZhijCount`,
SUM(IF(m.brand_name = '问界' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgWenjCount`,
SUM(IF(m.brand_name = '其他' AND (s.template_type IN (0) OR s.template_type IS NULL), m.delivery_count, null)) AS `qgOtherCount`,
SUM(IF(m.brand_name = '享界' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybXiangjCount`,
SUM(IF(m.brand_name = '尊界' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybZunjCount`,
SUM(IF(m.brand_name = '尚界' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybShangjCount`,
SUM(IF(m.brand_name = '智界' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybZhijCount`,
SUM(IF(m.brand_name = '问界' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybWenjCount`,
SUM(IF(m.brand_name = '其他' AND (s.template_type IN (1, 2) OR s.template_type IS NULL), m.delivery_count, null)) AS `ybOtherCount`,
SUM(IF(m.brand_name = '享界' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyXiangjCount`,
SUM(IF(m.brand_name = '尊界' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyZunjCount`,
SUM(IF(m.brand_name = '尚界' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyShangjCount`,
SUM(IF(m.brand_name = '智界' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyZhijCount`,
SUM(IF(m.brand_name = '问界' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyWenjCount`,
SUM(IF(m.brand_name = '其他' AND (s.template_type IN (2, 3) OR s.template_type IS NULL), m.delivery_count, null)) AS `qyOtherCount`
FROM dj_car_life_merchant_daily_report_huawei m
left join (SELECT merchant_id, report_date, scene_type, template_type
FROM dj_car_life_staff_daily_report
WHERE deleted_flag = 'N'
AND DATE_FORMAT(report_date, '%Y-%m') = #{date}
AND template_type IN (0, 1, 2, 3)
GROUP BY merchant_id, report_date, template_type) s
ON m.merchant_id = s.merchant_id
AND m.report_date = s.report_date
AND m.scene_type = s.scene_type
WHERE m.deleted_flag = 'N'
AND m.brand_name IN ('享界', '尊界', '尚界', '智界', '问界', '其他')
AND s.merchant_id IS NOT NULL
AND template_type IN (0, 1, 2, 3)
AND DATE_FORMAT(m.report_date, '%Y-%m') = #{date}
GROUP BY m.merchant_id, DATE_FORMAT(m.report_date, '%Y-%m');
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -19,15 +19,6 @@ ...@@ -19,15 +19,6 @@
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveDTO" extends="BaseResultMap">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="performance_config_id" property="performanceConfigId" jdbcType="INTEGER" />
<result column="approve_remark" property="approveRemark" jdbcType="VARCHAR" />
<result column="approve_attachments" property="approveAttachments" jdbcType="VARCHAR" />
<result column="attachment_imgs" property="attachmentImgs" jdbcType="VARCHAR" />
<result column="submit_username" property="submitUsername" jdbcType="VARCHAR" />
<result column="approve_status" property="approveStatus" jdbcType="TINYINT" />
<result column="merchant_names" property="merchantNames" jdbcType="VARCHAR" />
<result column="brands_names" property="brandsNames" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<!-- 分页DTO结果映射:联表后完整匹配所有字段 --> <!-- 分页DTO结果映射:联表后完整匹配所有字段 -->
...@@ -74,7 +65,7 @@ ...@@ -74,7 +65,7 @@
SELECT SELECT
a.id AS a_id, a.id AS a_id,
c.scheme_name AS c_scheme_name, c.scheme_name AS c_scheme_name,
c.business_typeG AS c_business_type, c.business_type AS c_business_type,
c.effective_month AS c_effective_month, c.effective_month AS c_effective_month,
c.status AS c_status, c.status AS c_status,
a.merchant_names AS a_merchant_names, a.merchant_names AS a_merchant_names,
...@@ -138,4 +129,94 @@ ...@@ -138,4 +129,94 @@
AND a.id = #{id} AND a.id = #{id}
LIMIT 1 LIMIT 1
</select> </select>
<insert id="insertOne"
parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveDTO"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id">
INSERT INTO dj_car_life_performance_config_approve (
performance_config_id,
approve_remark,
approve_attachments,
attachment_imgs,
submit_username,
approve_status,
merchant_names,
brands_names,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag
) VALUES (
#{performanceConfigId},
#{approveRemark},
#{approveAttachments},
#{attachmentImgs},
#{submitUsername},
#{approveStatus},
#{merchantNames},
#{brandsNames},
#{createdBy},
NOW(),
#{updatedBy},
NOW(),
'N'
)
</insert>
<select id="selectById" parameterType="java.lang.Integer" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_config_approve
WHERE
deleted_flag = 'N'
AND id = #{id}
LIMIT 1
</select>
<update id="updateById" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveDTO">
UPDATE dj_car_life_performance_config_approve
SET
<if test="performanceConfigId != null">
performance_config_id = #{performanceConfigId},
</if>
<if test="approveRemark != null and approveRemark != ''">
approve_remark = #{approveRemark},
</if>
<if test="approveAttachments != null and approveAttachments != ''">
approve_attachments = #{approveAttachments},
</if>
<if test="attachmentImgs != null and attachmentImgs != ''">
attachment_imgs = #{attachmentImgs},
</if>
<if test="submitUsername != null and submitUsername != ''">
submit_username = #{submitUsername},
</if>
<if test="approveStatus != null">
approve_status = #{approveStatus},
</if>
<if test="merchantNames != null and merchantNames != ''">
merchant_names = #{merchantNames},
</if>
<if test="brandsNames != null and brandsNames != ''">
brands_names = #{brandsNames},
</if>
<if test="updatedBy != null and updatedBy != ''">
updated_by = #{updatedBy},
</if>
WHERE
deleted_flag = 'N'
AND id = #{id}
</update>
<select id="selectByPerformanceConfigId" parameterType="java.lang.Integer" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_config_approve
WHERE
deleted_flag = 'N'
AND performance_config_id = #{performanceConfigId}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
--> -->
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="performance_config_approve_id" property="performanceConfigApproveId" jdbcType="INTEGER" /> <result column="performance_config_approve_id" property="performanceConfigApproveId" jdbcType="INTEGER" />
<result column="approve_status" property="status" jdbcType="TINYINT" /> <result column="status" property="status" jdbcType="TINYINT" />
<result column="approver_type" property="approverType" jdbcType="TINYINT" />
<result column="push_status" property="pushStatus" jdbcType="TINYINT" />
<result column="approve_time" property="approveTime" jdbcType="TIMESTAMP" /> <result column="approve_time" property="approveTime" jdbcType="TIMESTAMP" />
<result column="approve_opinion" property="approveOpinion" jdbcType="VARCHAR" /> <result column="approve_opinion" property="approveOpinion" jdbcType="VARCHAR" />
<result column="approver_name" property="approverName" jdbcType="VARCHAR" /> <result column="approver_name" property="approverName" jdbcType="VARCHAR" />
...@@ -19,57 +21,54 @@ ...@@ -19,57 +21,54 @@
<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.performance.PerformanceConfigApproveOperationRecordDTO" extends="BaseResultMap">--> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO" extends="BaseResultMap">
<!-- </resultMap>--> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, performance_config_approve_id, approve_status, approve_time, approve_opinion, approver_name, id, performance_config_approve_id, approve_status, approver_type, push_status, approve_time, approve_opinion, approver_name,
approver_mobile, created_by, created_date, updated_by, updated_date, deleted_flag approver_mobile, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<!-- 通用字段映射:DTO → 数据库字段 -->
<sql id="column_map">
performance_config_approve_id,
status,
approve_time,
approve_opinion,
approver_name,
approver_mobile,
created_by,
created_date,
updated_by,
updated_date
</sql> </sql>
<!-- 通用值映射:DTO参数 → 字段值 --> <select id="listByPerformanceConfigApproveId" parameterType="java.lang.Integer" resultMap="DTOResultMap">
<sql id="value_map"> SELECT
#{dto.performanceConfigApproveId}, <include refid="Base_Column_List"/>
#{dto.status}, FROM
#{dto.approveTime}, dj_car_life_performance_config_approve_operation_record
#{dto.approveOpinion}, WHERE
#{dto.approverName}, deleted_flag = 'N'
#{dto.approverMobile}, AND performance_config_approve_id = #{performanceConfigApproveId}
#{dto.createdBy}, ORDER BY
<!-- 创建时间:为空则填充当前时间,否则用传入值 --> approve_time DESC
IFNULL(#{dto.createdDate}, NOW()), </select>
#{dto.updatedBy}, <update id="updateApproveOpinionAndStatusById" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO">
<!-- 修改时间:每次操作都更新为当前时间 --> UPDATE dj_car_life_performance_config_approve_operation_record
NOW() SET
</sql> <if test="status != null">
approve_status = #{status},
</if>
<if test="approveOpinion != null and approveOpinion != ''">
approve_opinion = #{approveOpinion},
</if>
<if test="approveTime != null">
approve_time = #{approveTime},
</if>
<if test="updatedBy != null and updatedBy != ''">
updated_by = #{updatedBy},
</if>
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND id = #{id}
</update>
<!-- 插入/更新审批操作记录:重复则更新最新数据 --> <update id="updateReadStatusByMobile" parameterType="string">
<insert id="addOp" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO"> UPDATE dj_car_life_performance_config_approve_operation_record
INSERT INTO dj_car_life_performance_config_approve_operation_record ( SET
<include refid="column_map"/> approve_status = 1
) VALUES ( WHERE
<include refid="value_map"/> deleted_flag = 'N'
) ON DUPLICATE KEY UPDATE AND approver_mobile = #{mobile}
-- 重复时更新以下字段(保留创建时间,仅更新最新操作数据) AND approver_type = 2
status = #{dto.status}, </update>
approve_time = #{dto.approveTime},
approve_opinion = #{dto.approveOpinion},
approver_name = #{dto.approverName},
updated_by = #{dto.updatedBy},
updated_date = NOW() -- 强制更新修改时间
-- created_date 保留原有值,不更新
</insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<select id="listPerformanceConfig" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO" resultType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO"> <select id="listPerformanceConfig" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO" resultType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO">
SELECT SELECT
c.id, c.id,
c.scheme_type,
c.scheme_name AS schemeName, c.scheme_name AS schemeName,
c.business_type AS businessType, c.business_type AS businessType,
c.status, c.status,
...@@ -85,6 +86,9 @@ ...@@ -85,6 +86,9 @@
AND r.deleted_flag = 'N' AND r.deleted_flag = 'N'
WHERE WHERE
c.deleted_flag = 'N' c.deleted_flag = 'N'
<if test="scheme_type != null">
AND c.scheme_type = #{schemeType}
</if>
GROUP BY GROUP BY
c.id, c.id,
c.scheme_name, c.scheme_name,
...@@ -156,7 +160,7 @@ ...@@ -156,7 +160,7 @@
GROUP BY GROUP BY
ref.merchant_id, s.merchant_name ref.merchant_id, s.merchant_name
ORDER BY ORDER BY
ref.merchant_id ASC; ref.merchant_id DESC
</select> </select>
...@@ -176,12 +180,13 @@ ...@@ -176,12 +180,13 @@
WHERE WHERE
cfg.deleted_flag = 'N' cfg.deleted_flag = 'N'
AND cfg.status = 2 AND cfg.status = 2
AND cfg.enable_flag = 'Y'
GROUP BY GROUP BY
ref.merchant_id ref.merchant_id
</select> </select>
<select id="isEffectivePerformanceExist" <select id="hasEffectivePerformanceConfigForMerchant"
parameterType="java.lang.Integer" parameterType="java.lang.Integer"
resultType="java.lang.Boolean"> resultType="java.lang.Boolean">
SELECT EXISTS ( SELECT EXISTS (
...@@ -197,4 +202,55 @@ ...@@ -197,4 +202,55 @@
) AS exist_flag; ) AS exist_flag;
</select> </select>
<insert id="insertOne" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
INSERT INTO dj_car_life_performance_config (scheme_name,
scheme_type,
origin_performance_config_id,
business_type,
effective_month,
status)
VALUES (#{schemeName},
#{schemeType},
#{originPerformanceConfigId},
#{businessType},
#{effectiveMonth},
#{status})
</insert>
<update id="updateById" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO">
UPDATE dj_car_life_performance_config
SET
<if test="schemeName != null and schemeName != ''">
scheme_name = #{schemeName},
</if>
<if test="schemeType != null">
scheme_type = #{schemeType},
</if>
<if test="originPerformanceConfigId != null">
origin_performance_config_id = #{originPerformanceConfigId},
</if>
<if test="businessType != null">
business_type = #{businessType},
</if>
<if test="effectiveMonth != null and effectiveMonth != ''">
effective_month = #{effectiveMonth},
</if>
<if test="status != null">
status = #{status}
</if>
WHERE id = #{id}
</update>
<update id="enblePerformanceConfig">
UPDATE dj_car_life_performance_config
SET
enable_flag = 'Y',
updated_by = 'system'
WHERE
deleted_flag = 'N'
AND effective_month &lt;= DATE_FORMAT(NOW(), '%Y-%m')
AND status = 2
AND enable_flag = 'N';
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<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.PerformanceConfigMerchantBrandRefDTO" extends="BaseResultMap">
</resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -26,4 +29,88 @@ ...@@ -26,4 +29,88 @@
id, performance_config_id, merchant_id, merchant_name, brand_id, brand_name, child_id, id, performance_config_id, merchant_id, merchant_name, brand_id, brand_name, child_id,
child_name, created_by, created_date, updated_by, updated_date, deleted_flag child_name, created_by, created_date, updated_by, updated_date, deleted_flag
</sql> </sql>
<!-- 新增:根据配置ID逻辑删除商户品牌关联数据 -->
<update id="deleteByConfigId" parameterType="java.lang.Integer">
UPDATE dj_car_life_performance_config_merchant_brand_ref
SET
deleted_flag = 'D',
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND performance_config_id = #{performanceConfigId}
</update>
<!-- 新增:批量插入商户品牌关联数据 -->
<insert id="insertLists"
parameterType="java.util.List"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id">
INSERT INTO dj_car_life_performance_config_merchant_brand_ref (
performance_config_id,
merchant_id,
merchant_name,
brand_id,
brand_name,
child_id,
child_name,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.performanceConfigId},
#{item.merchantId},
#{item.merchantName},
#{item.brandId},
#{item.brandName},
#{item.childId},
#{item.childName},
#{item.createdBy},
NOW(),
#{item.updatedBy},
NOW(),
'N'
)
</foreach>
</insert>
<!-- 新增:根据配置ID查询商户品牌关联列表 -->
<select id="listByConfigId" parameterType="java.lang.Integer" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_config_merchant_brand_ref
WHERE
deleted_flag = 'N'
AND performance_config_id = #{id}
ORDER BY
id DESC
</select>
<update id="invalidByBusinessTypeAndMerchantBrand" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO">
UPDATE dj_car_life_performance_config_merchant_brand_ref ref
INNER JOIN dj_car_life_performance_config cfg
ON ref.performance_config_id = cfg.id
AND cfg.deleted_flag = 'N'
AND cfg.status = 2
AND cfg.business_type = #{businessType}
SET
ref.deleted_flag = 'D',
ref.updated_date = NOW(),
WHERE
ref.deleted_flag = 'N'
AND ref.merchant_id = #{merchantId}
AND ref.brand_id = #{brandId}
<!-- 兼容child_id为NULL的场景 -->
<if test="childId != null">
AND ref.child_id = #{childId}
</if>
<if test="childId == null">
AND ref.child_id IS NULL
</if>
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<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.PerformanceConfigRuleDTO" extends="BaseResultMap">
</resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -24,4 +27,57 @@ ...@@ -24,4 +27,57 @@
id, performance_config_id, assessment_factors, commission_bases, commission_types, id, performance_config_id, assessment_factors, commission_bases, commission_types,
goods_config_types, created_by, created_date, updated_by, updated_date, deleted_flag goods_config_types, created_by, created_date, updated_by, updated_date, deleted_flag
</sql> </sql>
<!-- 新增:根据配置ID查询单条规则 -->
<select id="listByConfigId" parameterType="java.lang.Integer" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_config_rule
WHERE
deleted_flag = 'N'
AND performance_config_id = #{id}
LIMIT 1
</select>
<!-- 新增:单条插入规则数据 -->
<insert id="insertOne"
parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigRuleDTO"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id">
INSERT INTO dj_car_life_performance_config_rule (
performance_config_id,
assessment_factors,
commission_bases,
commission_types,
goods_config_types,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag
) VALUES (
#{performanceConfigId},
#{assessmentFactors},
#{commissionBases},
#{commissionTypes},
#{goodsConfigTypes},
#{createdBy},
NOW(),
#{updatedBy},
NOW(),
'N'
)
</insert>
<!-- 新增:根据配置ID逻辑删除规则 -->
<update id="deleteByConfigId" parameterType="java.lang.Integer">
UPDATE dj_car_life_performance_config_rule
SET
deleted_flag = 'D',
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND performance_config_id = #{performanceConfigId}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -88,4 +88,61 @@ ...@@ -88,4 +88,61 @@
ORDER BY ORDER BY
dcpcc.id DESC dcpcc.id DESC
</select> </select>
<!-- 新增的批量插入语句 -->
<insert id="insertLists"
parameterType="java.util.List"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id">
INSERT INTO dj_car_life_performance_param_config_condition (
performance_param_config_id,
condition_type,
condition_goods_config_type,
condition_goods_type,
condition_goods_type_name,
condition_secondary_goods_type,
condition_secondary_goods_type_name,
condition_third_level_goods_type,
condition_third_level_goods_type_name,
condition_product_define_id,
condition_product_define_name,
condition_assessment_factors,
condition_start_value,
condition_end_value,
condition_commission_base,
condition_commission_type,
condition_commission_type_value,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.performanceParamConfigId},
#{item.conditionType},
#{item.conditionGoodsConfigType},
#{item.conditionGoodsType},
#{item.conditionGoodsTypeName},
#{item.conditionSecondaryGoodsType},
#{item.conditionSecondaryGoodsTypeName},
#{item.conditionThirdLevelGoodsType},
#{item.conditionThirdLevelGoodsTypeName},
#{item.conditionProductDefineId},
#{item.conditionProductDefineName},
#{item.conditionAssessmentFactors},
#{item.conditionStartValue},
#{item.conditionEndValue},
#{item.conditionCommissionBase},
#{item.conditionCommissionType},
#{item.conditionCommissionTypeValue},
#{item.createdBy},
NOW(),
#{item.updatedBy},
NOW(),
'N'
)
</foreach>
</insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -84,4 +84,54 @@ ...@@ -84,4 +84,54 @@
deleted_flag = 'N' deleted_flag = 'N'
AND performance_config_id = #{id} AND performance_config_id = #{id}
</update> </update>
<insert id="insertOne"
parameterType="cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id">
INSERT INTO dj_car_life_performance_param_config (performance_config_id,
template_type,
assessment_factor,
start_value,
end_value,
commission_base,
commission_type,
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,
commission_type_value,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag)
VALUES (#{performanceConfigId},
#{templateType},
#{assessmentFactor},
#{startValue},
#{endValue},
#{commissionBase},
#{commissionType},
#{goodsConfigType},
#{goodsType},
#{goodsTypeName},
#{secondaryGoodsType},
#{secondaryGoodsTypeName},
#{thirdLevelGoodsType},
#{thirdLevelGoodsTypeName},
#{productDefineId},
#{productDefineName},
#{commissionTypeValue},
#{createdBy},
NOW(),
#{updatedBy},
NOW(),
'N')
</insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
<result column="cycle_name" property="cycleName" jdbcType="VARCHAR" /> <result column="cycle_name" property="cycleName" jdbcType="VARCHAR" />
<result column="cycle_code" property="cycleCode" jdbcType="VARCHAR" /> <result column="cycle_code" property="cycleCode" jdbcType="VARCHAR" />
<result column="cycle_item" property="cycleItem" jdbcType="VARCHAR" /> <result column="cycle_item" property="cycleItem" jdbcType="VARCHAR" />
<result column="start_date" property="startDate" jdbcType="TIMESTAMP" /> <result column="start_day_of_month" property="stratDayOfMonth" jdbcType="VARCHAR" />
<result column="end_date" property="endDate" jdbcType="TIMESTAMP" /> <result column="end_day_of_month" property="endDayOfMonth" jdbcType="VARCHAR" />
<result column="enable_flag" property="enableFlag" jdbcType="CHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" /> <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
...@@ -20,46 +19,50 @@ ...@@ -20,46 +19,50 @@
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO" extends="BaseResultMap">
<result column="start_date" property="startDate" jdbcType="TIMESTAMP" />
<result column="end_date" property="endDate" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, cycle_name,cycle_code, cycle_item, start_date, end_date, enable_flag, id, cycle_name,cycle_code, cycle_item, start_day_of_month, end_day_of_month,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, deleted_flag
</sql> </sql>
<sql id="DTO_Column_List" >
<include refid="Base_Column_List"/>,
STR_TO_DATE(CONCAT(DATE_FORMAT(NOW(), '%Y-%m-'), start_day_of_month), '%Y-%m-%d %H:%i:%s') AS start_date,
STR_TO_DATE(CONCAT(DATE_FORMAT(NOW(), '%Y-%m-'), end_day_of_month), '%Y-%m-%d %H:%i:%s') AS end_date
</sql>
<select id="selectCurrCycle" resultMap="DTOResultMap"> <select id="selectCurrCycle" resultMap="DTOResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="DTO_Column_List"/>
FROM FROM
dj_car_life_performance_time_cycle dj_car_life_performance_time_cycle
WHERE WHERE
deleted_flag = 'N' deleted_flag = 'N'
AND enable_flag = 'Y' AND NOW() BETWEEN STR_TO_DATE(CONCAT(DATE_FORMAT(NOW(), '%Y-%m-'), start_day_of_month), '%Y-%m-%d %H:%i:%s') AND STR_TO_DATE(CONCAT(DATE_FORMAT(NOW(), '%Y-%m-'), end_day_of_month), '%Y-%m-%d %H:%i:%s')
AND NOW() BETWEEN start_date AND end_date
LIMIT 1 LIMIT 1
</select> </select>
<select id="list" resultMap="DTOResultMap"> <select id="list" resultMap="DTOResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="DTO_Column_List"/>
FROM FROM
dj_car_life_performance_time_cycle dj_car_life_performance_time_cycle
WHERE WHERE
deleted_flag = 'N' deleted_flag = 'N'
AND enable_flag = 'Y'
</select> </select>
<select id="selectByCode" parameterType="string" resultMap="DTOResultMap"> <select id="selectByCode" parameterType="string" resultMap="DTOResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="DTO_Column_List"/>
FROM FROM
dj_car_life_performance_time_cycle dj_car_life_performance_time_cycle
WHERE WHERE
deleted_flag = 'N' deleted_flag = 'N'
AND enable_flag = 'Y'
AND cycle_code = #{code} AND cycle_code = #{code}
LIMIT 1 LIMIT 1
</select> </select>
......
...@@ -79,4 +79,15 @@ ...@@ -79,4 +79,15 @@
AND month = #{month} AND month = #{month}
AND deleted_flag = 'N' AND deleted_flag = 'N'
</update> </update>
<select id="listStaffWithPerformanceCommission" resultType="cn.com.glsx.dj.staff.dto.PerformanceCommissionStaffDTO">
SELECT
staff_name as staffName,
staff_phone as staffPhone
FROM
dj_car_life_staff_performance dclsp
WHERE
dclsp.deleted_flag = 'N'
group by dclsp.staff_phone
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!