Commit e5df5fa9 by 章家宝

提成方案:提成系统周期配置相关

1 parent 0df4c557
Showing 31 changed files with 553 additions and 94 deletions
package cn.com.glsx.dj.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MerchantBrandDTO {
@ApiModelProperty(notes = "主品牌ID")
private Long first_brand_id;
@ApiModelProperty(notes = "主品牌名称")
private String first_brand_name;
@ApiModelProperty(notes = "二级品牌ID")
private Long sec_brand_id;
@ApiModelProperty(notes = "二级品牌名称")
private String sec_brand_name;
}
package cn.com.glsx.dj.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MerchantBrandModelPageBrandDTO {
@ApiModelProperty(notes = "主品牌id")
private Integer brandId;
@ApiModelProperty(notes = "主品牌名称")
private String brandName;
@ApiModelProperty(notes = "子品牌id")
private Integer childId;
@ApiModelProperty(notes = "子品牌名称")
private String childName;
}
......@@ -22,6 +22,8 @@ public class PerformanceConfigDTO extends PerformanceConfig {
private List<PerformanceParamConfigDTO> performanceParamConfigs;
private List<PerformanceConfigMerchantBrandRefDTO> merchantBrandModelPageBrands;
/**
* 门店ID
*/
......
......@@ -2,10 +2,7 @@ package cn.com.glsx.dj.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.*;
import java.util.List;
......@@ -13,15 +10,17 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MerchantBrandPageDTO {
public class ServiceMerchantPageWithBrandDTO {
// 查询参数,商户号,门店名称
private String queryParam;
@ApiModelProperty(notes = "门店ID")
private String merchantId;
private Integer merchantId;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(name = "merchantBrandList", notes = "品牌列表")
private List<MerchantBrandDTO> merchantBrandList;
private List<MerchantBrandModelPageBrandDTO> merchantBrandList;
}
package cn.com.glsx.dj.staff.dto.performance;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import cn.com.glsx.dj.staff.model.PerformanceApproveConfig;
import lombok.*;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@SuperBuilder
public class PerformanceApproveConfigDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "审批人姓名")
private String approverName;
@ApiModelProperty(notes = "审批人手机号码")
private String approverMobile;
@ApiModelProperty(notes = "审批人类型(1:查阅人;2:审批人)")
private Integer approverType;
public class PerformanceApproveConfigDTO extends PerformanceApproveConfig {
}
\ No newline at end of file
package cn.com.glsx.dj.staff.dto.performance;
import cn.com.glsx.dj.staff.model.PerformanceConfigApproveOperationRecord;
import lombok.*;
import lombok.experimental.SuperBuilder;
@Data
@ToString
@SuperBuilder
@EqualsAndHashCode(callSuper=false)
@NoArgsConstructor
public class PerformanceConfigApproveOperationRecordDTO extends PerformanceConfigApproveOperationRecord {
}
package cn.com.glsx.dj.staff.dto.performance;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.util.Date;
import lombok.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class PerformanceConfigPageByMerchantDTO {
@ApiModelProperty(notes = "主键ID")
private Long id;
// 业务类型
private Byte businessType;
// 状态
private Integer status;
@ApiModelProperty(notes = "门店id")
private Integer merchantId;
@ApiModelProperty(notes = "方案名称")
@ApiModelProperty(notes = "方案名称, 多个以逗号分隔")
private String schemeName;
@ApiModelProperty(notes = "名店名称")
private String merchantName;
@ApiModelProperty(notes = "门店名称")
private String merchantNames;
@ApiModelProperty(notes = "品牌")
@ApiModelProperty(notes = "品牌, 多个以逗号分隔")
private String brandNames;
@ApiModelProperty(notes = "业务类型(0:轻改,1:权益;2:延保)")
private Byte businessType;
@ApiModelProperty(notes = "状态(0.草稿,1.审批中,2.生效,3.未生效)")
private Integer status;
@ApiModelProperty(notes = "生效月份(格式:yyyy-MM)")
private String effectiveMonth;
@ApiModelProperty(notes = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedDate;
@ApiModelProperty(notes = "业务类型(0:轻改,1:权益;2:延保), 多个以逗号分隔")
private String businessTypes;
}
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum PerformanceApproveStatusEnum {
// 已读
READ(1, "已读"),
// 已通过
PASS(2, "已通过"),
// 未通过
NOT_PASS(3, "未通过"),
;
private final Integer code;
private final String desc;
}
package cn.com.glsx.dj.staff.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*
* @time 2026-01-20 10:19
*/
@Getter
@AllArgsConstructor
public enum PerformanceTimeCycleCodeEnum {
/**
* T1:薪资计算触发周期
*/
T1("T1", "1. 确定绩效,产生绩效发放工资;2. 确定门店有客资量(交车数),触发运营相关事项;3. 产生基本考勤数据,产生系统核算薪资"),
/**
* T2:系统核算薪资周期
*/
T2("T2", "4. 系统基于考勤、绩效工资、提成运算产生工资条金额明细"),
/**
* T3:门店考勤申诉周期
*/
T3("T3", "5. 申诉工资异议,包含考勤天数、订单数、日报平账抗议"),
/**
* T4:工资异议处理周期
*/
T4("T4", "6. 接受申诉,处理违章修正考勤、订单数、日报平账抗议"),
/**
* T5:绩效评分申诉周期
*/
T5("T5", "7. 申诉提佣、减免,修订提成部分个人渗透率等评分,涉及重新计算员工提成"),
/**
* T6:薪资最终核算周期
*/
T6("T6", "8. 补充应发和扣减;9. 基于确定的薪资、扣减、补发放提成,系统重新运算最终工资数据"),
/**
* T7:工资锁定周期
*/
T7("T7", "10. 发放最终工资,定稿工资数据"),
;
;
private String code;
private String desc;
}
......@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
......@@ -18,6 +19,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@SuperBuilder
@Table(name = "dj_car_life_performance_approve_config")
public class PerformanceApproveConfig implements Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -35,7 +35,7 @@ public class PerformanceConfigApproveOperationRecord implements Serializable {
@ApiModelProperty(notes = "审批状态(1:审批中;2:已通过;3:已驳回)")
@Column(name = "approve_status")
private Integer approveStatus;
private Integer status;
@ApiModelProperty(notes = "审批操作时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......
......@@ -33,6 +33,10 @@ public class PerformanceTimeCycle implements Serializable {
@Column(name = "cycle_name")
private String cycleName;
@ApiModelProperty(notes = "周期CODE")
@Column(name = "cycle_code")
private String cycleCode;
@ApiModelProperty(notes = "周期基本事项")
@Column(name = "cycle_item")
private String cycleItem;
......
......@@ -7,5 +7,5 @@ import java.util.List;
@ApiService(value = "提成方案审批人配置", owner = "zhangjb", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
public interface PerformanceApproveConfigRemote {
List<PerformanceApproveConfigDTO> selectAll();
List<PerformanceApproveConfigDTO> listAll();
}
\ No newline at end of file
......@@ -2,14 +2,13 @@ package cn.com.glsx.dj.staff.remote.performance;
import cn.com.glsx.dj.staff.dto.PerformanceConfigDTO;
import cn.com.glsx.dj.staff.dto.performance.*;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.annotation.ApiParam.DataTypeEnum;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiService(value = "提成方案", owner = "zhangjb", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
......@@ -35,7 +34,6 @@ public interface PerformanceConfigRemote {
@ApiResponse("招聘需求分页")
RpcResponse<RpcPagination<PerformanceConfigPageByMerchantDTO>> performanceConfigPageByMerchant(RpcPagination<PerformanceConfigPageByMerchantDTO> pagination);
@ApiMethod("通过名称查询提成方案")
@ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("是否成功")
......@@ -45,4 +43,14 @@ public interface PerformanceConfigRemote {
@ApiParam(name = "dto", notes = "提成方案信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("是否成功")
RpcResponse<PerformanceConfigDetailDTO> performanceConfigDetail(PerformanceConfigDTO dto);
@ApiMethod("查询门店有效的提成方案")
@ApiParam(name = "dto", notes = "门店id", dataType = DataTypeEnum.INT, required = true)
@ApiResponse("提成方案")
RpcResponse<List<PerformanceConfigDTO>> effectivePerformanceConfigByMerchant(@NotNull Integer merchantId);
@ApiMethod("查询门店是否有有效的提成方案")
@ApiParam(name = "dto", notes = "门店id", dataType = DataTypeEnum.INT, required = true)
@ApiResponse("提成方案")
RpcResponse<Boolean> isEffectivePerformanceExist(@NotNull Integer merchantId);
}
......@@ -2,6 +2,9 @@ package cn.com.glsx.dj.staff.remote.performance;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.annotation.ApiParam.DataTypeEnum;
import java.util.List;
@ApiService(value = "提成系统周期", owner = "zhangjb", protocol = ApiService.ProtocolEnum.dubbo, version = "1.0.0")
public interface PerformanceTimeCycleRemote {
......@@ -10,4 +13,21 @@ public interface PerformanceTimeCycleRemote {
@ApiParam(name = "dto", notes = "dto", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("当前工资提成系统周期")
PerformanceTimeCycleDTO getCurrPerformanceTimeCycle(PerformanceTimeCycleDTO dto);
@ApiMethod("全部工资提成系统周期管理")
@ApiResponse("工资提成系统周期")
List<PerformanceTimeCycleDTO> getPerformanceTimeCycle();
/**
* 根据Code获取工资提成系统周期管理
*
* @param code {@link cn.com.glsx.dj.staff.enums.PerformanceTimeCycleCodeEnum}
* @return
*/
@ApiMethod("根据Code获取工资提成系统周期管理")
@ApiParam(name = "code", notes = "code", dataType = DataTypeEnum.CHAR, required = true)
@ApiResponse("工资提成系统周期")
PerformanceTimeCycleDTO getPerformanceTimeCycleByCode(String code);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.performance.PerformanceApproveConfigDTO;
import cn.com.glsx.dj.staff.model.PerformanceApproveConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface PerformanceApproveConfigMapper extends OreMapper<PerformanceApproveConfig> {
List<PerformanceApproveConfigDTO> list();
List<PerformanceApproveConfigDTO> listByMoblie(@Param("mobile") String mobile);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO;
import cn.com.glsx.dj.staff.model.PerformanceConfigApproveOperationRecord;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
......@@ -7,4 +8,5 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface PerformanceConfigApproveOperationRecordMapper extends OreMapper<PerformanceConfigApproveOperationRecord> {
void addOp(PerformanceConfigApproveOperationRecordDTO dto);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.PerformanceConfigDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageByMerchantDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO;
import cn.com.glsx.dj.staff.model.PerformanceConfig;
import org.apache.ibatis.annotations.Mapper;
......@@ -19,4 +20,10 @@ public interface PerformanceConfigMapper extends OreMapper<PerformanceConfig> {
List<PerformanceConfigPageDTO> listPerformanceConfig(PerformanceConfigPageDTO dto);
PerformanceConfigDTO selectById(@Param("id") Integer id);
List<PerformanceConfigPageByMerchantDTO> listByMerchant(PerformanceConfigPageByMerchantDTO condition);
List<PerformanceConfigDTO> effectivePerformanceConfigByMerchantId(@Param("merchantId") Integer merchantId);
Boolean isEffectivePerformanceExist(Integer merchantId);
}
\ No newline at end of file
......@@ -3,10 +3,17 @@ package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.performance.PerformanceTimeCycleDTO;
import cn.com.glsx.dj.staff.model.PerformanceTimeCycle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface PerformanceTimeCycleMapper extends OreMapper<PerformanceTimeCycle> {
PerformanceTimeCycleDTO selectCurrCycle();
List<PerformanceTimeCycleDTO> list();
PerformanceTimeCycleDTO selectByCode(@Param("code") String code);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.remote.performance;
import cn.com.glsx.dj.staff.dto.performance.PerformanceApproveConfigDTO;
import cn.com.glsx.dj.staff.service.staffPerformance.PerformanceApproveConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collections;
import java.util.List;
@Slf4j
@DubboService(version = "1.0.0", validation = "true")
public class PerformanceApproveConfigRemoteImpl implements PerformanceApproveConfigRemote {
@Autowired
private PerformanceApproveConfigService performanceApproveConfigService;
@Override
public List<PerformanceApproveConfigDTO> selectAll() {
return Collections.emptyList();
public List<PerformanceApproveConfigDTO> listAll() {
return performanceApproveConfigService.listAll();
}
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ 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 PerformanceConfigRemoteImpl implements PerformanceConfigRemote {
......@@ -35,7 +37,8 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote {
@Override
public RpcResponse<RpcPagination<PerformanceConfigPageByMerchantDTO>> performanceConfigPageByMerchant(RpcPagination<PerformanceConfigPageByMerchantDTO> pagination) {
return null;
pagination = RpcPagination.copyPage(performanceConfigService.pageByMerchant(pagination));
return RpcResponse.success(pagination);
}
@Override
......@@ -48,5 +51,15 @@ public class PerformanceConfigRemoteImpl implements PerformanceConfigRemote {
return RpcResponse.success(performanceConfigService.selectPerformanceConfigDetail(dto));
}
@Override
public RpcResponse<List<PerformanceConfigDTO>> effectivePerformanceConfigByMerchant(Integer merchantId) {
return RpcResponse.success(performanceConfigService.effectivePerformanceConfigByMerchant(merchantId));
}
@Override
public RpcResponse<Boolean> isEffectivePerformanceExist(Integer merchantId) {
return RpcResponse.success(performanceConfigService.isEffectivePerformanceExist(merchantId));
}
}
......@@ -6,6 +6,8 @@ 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 PerformanceTimeCycleRemoteImpl implements PerformanceTimeCycleRemote {
......@@ -15,4 +17,15 @@ public class PerformanceTimeCycleRemoteImpl implements PerformanceTimeCycleRemot
public PerformanceTimeCycleDTO getCurrPerformanceTimeCycle(PerformanceTimeCycleDTO dto) {
return performanceTimeCycleService.selectCurrCycle();
}
@Override
public List<PerformanceTimeCycleDTO> getPerformanceTimeCycle() {
return performanceTimeCycleService.list();
}
@Override
public PerformanceTimeCycleDTO getPerformanceTimeCycleByCode(String code) {
return performanceTimeCycleService.selectByCode(code);
}
}
\ No newline at end of file
package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.performance.PerformanceApproveConfigDTO;
import cn.com.glsx.dj.staff.mapper.PerformanceApproveConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class PerformanceApproveConfigService {
@Autowired
private PerformanceApproveConfigMapper performanceApproveConfigMapper;
public List<PerformanceApproveConfigDTO> listAll() {
return performanceApproveConfigMapper.list();
}
public List<PerformanceApproveConfigDTO> listByMoblie(String mobile) {
return performanceApproveConfigMapper.listByMoblie(mobile);
}
}
package cn.com.glsx.dj.staff.service.staffPerformance;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class PerformanceConfigApproveOperationRecordService {
@Autowired
PerformanceConfigApproveOperationRecordMapper performanceConfigApproveOperationRecordMapper;
public void addOperatorRecord(Integer id, String mobile, PerformanceApproveStatusEnum performanceApproveStatusEnum, String approveName, String opinion) {
PerformanceConfigApproveOperationRecordDTO dto = new PerformanceConfigApproveOperationRecordDTO();
dto.setApproverMobile(mobile);
dto.setStatus(performanceApproveStatusEnum.getCode());
dto.setPerformanceConfigApproveId(id);
dto.setApproveOpinion(opinion);
dto.setApproverName(approveName);
performanceConfigApproveOperationRecordMapper.addOp(dto);
}
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.PerformanceConfigMerchantBrandRefDTO;
import cn.com.glsx.dj.staff.dto.performance.*;
import cn.com.glsx.dj.staff.enums.PerformanceApproveStatusEnum;
import cn.com.glsx.dj.staff.mapper.PerformanceConfigApproveMapper;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
......@@ -22,6 +23,10 @@ public class PerformanceConfigApproveService {
private PerformanceConfigApproveMapper performanceConfigApproveMapper;
@Autowired
private PerformanceConfigMerchantBrandRefService performanceConfigMerchantBrandRefService;
@Autowired
private PerformanceApproveConfigService performanceApproveConfigService;
@Autowired
private PerformanceConfigApproveOperationRecordService performanceConfigApproveOperationRecordService;
public Page<PerformanceConfigApprovePageDTO> pagePerformanceConfigApprove(RpcPagination<PerformanceConfigApprovePageDTO> pagination) {
try{
Page<PerformanceConfigApprovePageDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
......@@ -44,6 +49,22 @@ public class PerformanceConfigApproveService {
}
public PerformanceConfigApprovePermissionDTO getPerformanceConfigApproveDetailAndPermission(PerformanceConfigApproveDTO dto) {
return performanceConfigApproveMapper.getPerformanceConfigApproveDetailAndPermission(dto);
// 1. 获取方案审批详情
PerformanceConfigApprovePermissionDTO performanceConfigApproveDetailAndPermission = performanceConfigApproveMapper.getPerformanceConfigApproveDetailAndPermission(dto);
// 2. 如果手机号码是查询人,则将查询人状态更新为已查看
List<PerformanceApproveConfigDTO> approveConfigs = performanceApproveConfigService.listByMoblie(dto.getMobile());
boolean isQuery = false;
String approveName = "";
for (PerformanceApproveConfigDTO approveConfig : approveConfigs) {
if (approveConfig.getApproverType() == 1) {
isQuery = true;
approveName = approveConfig.getApproverName();
break;
}
}
if (isQuery) {
performanceConfigApproveOperationRecordService.addOperatorRecord(dto.getId(), dto.getMobile(), PerformanceApproveStatusEnum.READ, approveName, "");
}
return performanceConfigApproveDetailAndPermission;
}
}
package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.*;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigDetailDTO;
import cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO;
import cn.com.glsx.dj.staff.dto.performance.*;
import cn.com.glsx.dj.staff.mapper.PerformanceConfigMapper;
import cn.com.glsx.dj.staff.model.PerformanceConfig;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
......@@ -110,4 +109,40 @@ public class PerformanceConfigService {
result.setMerchantBrandRefList(merchantBrandRefs);
return result;
}
public Page<PerformanceConfigPageByMerchantDTO> pageByMerchant(RpcPagination<PerformanceConfigPageByMerchantDTO> pagination) {
try{
Page<PerformanceConfigPageByMerchantDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
performanceConfigMapper.listByMerchant(pagination.getCondition());
return page;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
public List<PerformanceConfigDTO> effectivePerformanceConfigByMerchant(Integer merchantId) {
// 1 查询出有效的方案
List<PerformanceConfigDTO> performanceConfigDTOS = performanceConfigMapper.effectivePerformanceConfigByMerchantId(merchantId);
for (PerformanceConfigDTO dto : performanceConfigDTOS) {
// 2 查询参数配置
List<PerformanceParamConfigDTO> performanceParamConfigs = performanceParamConfigService
.listByConfigId(dto.getId());
dto.setPerformanceParamConfigs(performanceParamConfigs);
// 3 查询配置规则
PerformanceConfigRuleDTO ruleDTO = performanceConfigRuleService
.listByConfigId(dto.getId());
dto.setPerformanceConfigRule(ruleDTO);
// 4 获取商户品牌
List<PerformanceConfigMerchantBrandRefDTO> merchantBrandRefs = performanceConfigMerchantBrandRefService
.listByConfigId(dto.getId());
dto.setMerchantBrandModelPageBrands(merchantBrandRefs);
}
return performanceConfigDTOS;
}
public Boolean isEffectivePerformanceExist(Integer merchantId) {
return performanceConfigMapper.isEffectivePerformanceExist(merchantId);
}
}
......@@ -6,6 +6,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
......@@ -22,4 +24,12 @@ public class PerformanceTimeCycleService {
public PerformanceTimeCycleDTO selectCurrCycle() {
return performanceTimeCycleMapper.selectCurrCycle();
}
public List<PerformanceTimeCycleDTO> list() {
return performanceTimeCycleMapper.list();
}
public PerformanceTimeCycleDTO selectByCode(String code) {
return performanceTimeCycleMapper.selectByCode(code);
}
}
......@@ -17,10 +17,49 @@
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.performance.PerformanceApproveConfigDTO" extends="BaseResultMap">
<!-- 主键ID -->
<id column="id" property="id" jdbcType="INTEGER" />
<!-- 审批人姓名 -->
<result column="approver_name" property="approverName" jdbcType="VARCHAR" />
<!-- 审批人手机号码 -->
<result column="approver_mobile" property="approverMobile" jdbcType="VARCHAR" />
<!-- 审批人类型(1:查阅人;2:审批人) -->
<result column="approver_type" property="approverType" jdbcType="TINYINT" />
<!-- 创建人 -->
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<!-- 创建时间 -->
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<!-- 修改人 -->
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<!-- 修改时间 -->
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<!-- 删除标识(D:已删除;N:未删除) -->
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, approver_name, approver_mobile, approver_type,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="list" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
dj_car_life_performance_approve_config
WHERE
deleted_flag = 'N'
ORDER BY
created_date DESC
</select>
<select id="listByMoblie" parameterType="java.lang.String" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
dj_car_life_performance_approve_config
WHERE
deleted_flag = 'N'
AND approver_mobile = #{mobile}
ORDER BY
created_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -7,7 +7,7 @@
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="performance_config_approve_id" property="performanceConfigApproveId" jdbcType="INTEGER" />
<result column="approve_status" property="approveStatus" jdbcType="TINYINT" />
<result column="approve_status" property="status" jdbcType="TINYINT" />
<result column="approve_time" property="approveTime" jdbcType="TIMESTAMP" />
<result column="approve_opinion" property="approveOpinion" jdbcType="VARCHAR" />
<result column="approver_name" property="approverName" jdbcType="VARCHAR" />
......@@ -26,4 +26,50 @@
id, performance_config_approve_id, approve_status, approve_time, approve_opinion, approver_name,
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>
<!-- 通用值映射:DTO参数 → 字段值 -->
<sql id="value_map">
#{dto.performanceConfigApproveId},
#{dto.status},
#{dto.approveTime},
#{dto.approveOpinion},
#{dto.approverName},
#{dto.approverMobile},
#{dto.createdBy},
<!-- 创建时间:为空则填充当前时间,否则用传入值 -->
IFNULL(#{dto.createdDate}, NOW()),
#{dto.updatedBy},
<!-- 修改时间:每次操作都更新为当前时间 -->
NOW()
</sql>
<!-- 插入/更新审批操作记录:重复则更新最新数据 -->
<insert id="addOp" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigApproveOperationRecordDTO">
INSERT INTO dj_car_life_performance_config_approve_operation_record (
<include refid="column_map"/>
) VALUES (
<include refid="value_map"/>
) ON DUPLICATE KEY UPDATE
-- 重复时更新以下字段(保留创建时间,仅更新最新操作数据)
status = #{dto.status},
approve_time = #{dto.approveTime},
approve_opinion = #{dto.approveOpinion},
approver_name = #{dto.approverName},
updated_by = #{dto.updatedBy},
updated_date = NOW() -- 强制更新修改时间
-- created_date 保留原有值,不更新
</insert>
</mapper>
\ No newline at end of file
......@@ -22,6 +22,15 @@
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" extends="BaseResultMap">
</resultMap>
<resultMap id="MerchantPerformanceResultMap"
type="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageByMerchantDTO">
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR"/>
<result column="scheme_names" property="schemeNames" jdbcType="VARCHAR"/>
<result column="brand_names" property="brandNames" jdbcType="VARCHAR"/>
<result column="business_types" property="businessTypes" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
......@@ -101,4 +110,91 @@
AND c.id = #{id}
LIMIT 1
</select>
<select id="listByMerchant"
parameterType="cn.com.glsx.dj.staff.dto.MerchantPerformanceQueryDTO"
resultMap="MerchantPerformanceResultMap">
SELECT
ref.merchant_id AS merchant_id,
IFNULL(s.merchant_name, '') AS merchant_name,
IFNULL(GROUP_CONCAT(DISTINCT cfg.scheme_name SEPARATOR ','), '') AS scheme_names,
IFNULL(GROUP_CONCAT(DISTINCT ref.brand_name SEPARATOR ','), '') AS brand_names,
IFNULL(GROUP_CONCAT(DISTINCT cfg.business_type SEPARATOR ','), '') AS business_types
FROM
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'
LEFT JOIN
dj_car_life_service_merchant s
ON
ref.merchant_id = s.merchant_id
AND s.deleted_flag = 'N'
WHERE
ref.deleted_flag = 'N'
<if test="merchantId != null">
AND ref.merchant_id = #{merchantId}
</if>
<if test="status != null">
AND cfg.status = #{status}
</if>
<if test="businessType != null">
AND EXISTS (
SELECT 1
FROM dj_car_life_performance_config_merchant_brand_ref ref_sub
INNER JOIN dj_car_life_performance_config cfg_sub
ON ref_sub.performance_config_id = cfg_sub.id
WHERE
ref_sub.merchant_id = ref.merchant_id
AND cfg_sub.business_type = #{businessType}
AND ref_sub.deleted_flag = 'N'
AND cfg_sub.deleted_flag = 'N'
)
</if>
GROUP BY
ref.merchant_id, s.merchant_name
ORDER BY
ref.merchant_id ASC;
</select>
<select id="effectivePerformanceConfigByMerchantId"
parameterType="java.lang.Integer"
resultMap="DTOResultMap">
SELECT
cfg.*
FROM
dj_car_life_performance_config cfg
INNER JOIN
dj_car_life_performance_config_merchant_brand_ref ref
ON
cfg.id = ref.performance_config_id
AND ref.deleted_flag = 'N'
AND ref.merchant_id = #{merchantId}
WHERE
cfg.deleted_flag = 'N'
AND cfg.status = 2
GROUP BY
ref.merchant_id
</select>
<select id="isEffectivePerformanceExist"
parameterType="java.lang.Integer"
resultType="java.lang.Boolean">
SELECT EXISTS (
SELECT 1
FROM dj_car_life_performance_config cfg
INNER JOIN dj_car_life_performance_config_merchant_brand_ref ref
ON cfg.id = ref.performance_config_id
WHERE
cfg.deleted_flag = 'N'
AND cfg.status = 2
AND ref.deleted_flag = 'N'
AND ref.merchant_id = #{merchantId}
) AS exist_flag;
</select>
</mapper>
\ No newline at end of file
......@@ -7,6 +7,7 @@
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="cycle_name" property="cycleName" jdbcType="VARCHAR" />
<result column="cycle_code" property="cycleCode" jdbcType="VARCHAR" />
<result column="cycle_item" property="cycleItem" jdbcType="VARCHAR" />
<result column="start_date" property="startDate" jdbcType="TIMESTAMP" />
<result column="end_date" property="endDate" jdbcType="TIMESTAMP" />
......@@ -25,7 +26,7 @@
<!--
WARNING - @mbg.generated
-->
id, cycle_name, cycle_item, start_date, end_date, enable_flag,
id, cycle_name,cycle_code, cycle_item, start_date, end_date, enable_flag,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
......@@ -40,4 +41,26 @@
AND NOW() BETWEEN start_date AND end_date
LIMIT 1
</select>
<select id="list" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_time_cycle
WHERE
deleted_flag = 'N'
AND enable_flag = 'Y'
</select>
<select id="selectByCode" parameterType="string" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_performance_time_cycle
WHERE
deleted_flag = 'N'
AND enable_flag = 'Y'
AND cycle_code = #{code}
LIMIT 1
</select>
</mapper>
\ 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!