Commit e2136abb by 叶立庆

Merge branch 'v5.6.0' of http://192.168.3.233:8090/dj/rpc-staff into v5.6.0

2 parents 1fb819e3 aef7c282
Showing 39 changed files with 717 additions and 313 deletions
......@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 考核因子依赖的基础数据-日报数据
......@@ -44,5 +45,5 @@ public class AssessmentFactorDailyDataDTO implements Serializable {
/**
* 个人应触客数
*/
private Integer personalTargetTouchCount;
private BigDecimal personalTargetTouchCount;
}
......@@ -63,11 +63,6 @@ public class AssessmentFactorOrderDataDTO implements Serializable {
private BigDecimal categoryOrderOutputTotalByBrandAndCategory;
/**
* 提成基数-主订单成交数(门店+业务+品牌+品类)
*/
private Integer commissionBaseMainOrderCountByBrandAndCategory;
/**
* 提成基数-子订单成交数(门店+业务+品牌+品类)
*/
private Integer commissionBaseSubOrderCountByBrandAndCategory;
......
......@@ -14,7 +14,7 @@ import java.util.List;
@SuperBuilder
@ToString(callSuper = true)
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
public class PerformanceConfigDTO extends PerformanceConfig {
private static final long serialVersionUID = -2645954117282535336L;
......@@ -39,4 +39,9 @@ public class PerformanceConfigDTO extends PerformanceConfig {
*/
private Integer childBrandId;
/**
* 商户名称
*/
private String merchantName;
}
......@@ -49,6 +49,11 @@ public class StaffPerformanceCalContextDTO implements Serializable {
private Integer merchantId;
/**
* 商户名称
*/
private String merchantName;
/**
* 业务类型
*/
private Byte businessType;
......
......@@ -39,6 +39,11 @@ public class StaffPerformanceSubOrderDTO implements Serializable {
private String staffPhone;
/**
* 员工姓名
*/
private String staffName;
/**
* 业务类型
*/
private Byte businessType;
......
package cn.com.glsx.dj.staff.dto;
import cn.com.glsx.dj.staff.model.StaffPerformance;
import cn.com.glsx.dj.staff.model.StaffProductPerformance;
import lombok.*;
import lombok.experimental.SuperBuilder;
/**
* 员工绩效计算结果DTO
*/
//@AllArgsConstructor
//@NoArgsConstructor
// @AllArgsConstructor
// @NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
@EqualsAndHashCode(callSuper=false)
public class StaffPerformanceDTO extends StaffPerformance {
@EqualsAndHashCode(callSuper = false)
public class StaffProductPerformanceDTO extends StaffProductPerformance {
private static final long serialVersionUID = -6357597727215841459L;
}
package cn.com.glsx.dj.staff.dto.performance;
import cn.com.glsx.dj.staff.model.StaffPerformance;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class StaffPerformanceDTO extends StaffPerformance {
private static final long serialVersionUID = -1889194971763049271L;
private List<String> staffPhones;
}
package cn.com.glsx.dj.staff.dto.performance;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -10,5 +10,5 @@ import java.util.List;
public class StaffPerformanceGetDTO {
@ApiModelProperty(name = "staffPerformanceList", notes = "工资提成列表获取")
private List<StaffPerformanceDTO> staffPerformanceList;
private List<StaffProductPerformanceDTO> staffPerformanceList;
}
......@@ -4,6 +4,7 @@ package cn.com.glsx.dj.staff.enums;
* 商品配置类型枚举
*/
public enum ProductConfigTypeEnum implements BaseEnum<Integer, String> {
ALL_PRODUCT(-1, "全部商品"),
PRODUCT_CATEGORY(0, "商品分类"),
DESIGNATED_PRODUCT(1, "圈定产品"),
DESIGNATED_PACKAGE(2, "圈定套餐");
......
......@@ -13,7 +13,7 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 员工提成
* 员工提成基础数据
*/
@AllArgsConstructor
@NoArgsConstructor
......@@ -21,7 +21,7 @@ import java.util.Date;
@Data
@Table(name = "dj_car_life_staff_performance")
public class StaffPerformance implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = -1513132045260423746L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
......@@ -68,53 +68,13 @@ public class StaffPerformance implements Serializable {
@Column(name = "month")
private String month;
@ApiModelProperty(notes = "商品配置类型(-1:全部商品,0:商品分类,1:圈定产品,2圈定套餐)")
@Column(name = "goods_config_type")
private Byte goodsConfigType;
@ApiModelProperty(notes = "有效引荐量")
@Column(name = "effective_referral_quantity")
private Integer effectiveReferralQuantity;
@ApiModelProperty(notes = "商品分类(一级)")
@Column(name = "goods_type")
private Integer goodsType;
@ApiModelProperty(notes = "商品分类名(一级)")
@Column(name = "goods_type_name")
private String goodsTypeName;
@ApiModelProperty(notes = "商品分类(二级)")
@Column(name = "secondary_goods_type")
private Integer secondaryGoodsType;
@ApiModelProperty(notes = "商品分类名(二级)")
@Column(name = "secondary_goods_type_name")
private String secondaryGoodsTypeName;
@ApiModelProperty(notes = "商品分类(三级)")
@Column(name = "third_level_goods_type")
private Integer thirdLevelGoodsType;
@ApiModelProperty(notes = "商品分类名(三级)")
@Column(name = "third_level_goods_type_name")
private String thirdLevelGoodsTypeName;
@ApiModelProperty(notes = "关联圈定ID")
@Column(name = "product_define_id")
private Integer productDefineId;
@ApiModelProperty(notes = "关联圈定产品/套餐名称")
@Column(name = "product_define_name")
private String productDefineName;
@ApiModelProperty(notes = "产值")
@Column(name = "gmv_output")
private BigDecimal gmvOutput;
@ApiModelProperty(notes = "升级订单数")
@Column(name = "upgrade_order_num")
private Integer upgradeOrderNum;
@ApiModelProperty(notes = "个人渗透率")
@Column(name = "personal_penetration_rate")
private BigDecimal personalPenetrationRate;
@ApiModelProperty(notes = "实际售前触客数总数")
@Column(name = "touch_number")
private Integer touchNumber;
@ApiModelProperty(notes = "提成金额")
@Column(name = "performance_amount")
......@@ -141,4 +101,19 @@ public class StaffPerformance implements Serializable {
@ApiModelProperty(notes = "删除标识(D:已删除;N:未删除)")
@Column(name = "deleted_flag")
private String deletedFlag;
@ApiModelProperty(notes = "参数json")
@Column(name = "params_json")
/**
* <pre>
* {
* "sumNonCoeff": 100.00, // 非系数部分总额
* "multiplyCoeff": 1.2, // 原始总系数
* "isNewcomerProtection": true, // 是否处于新人保护期
* "finalMultiplyCoeff": 1.2, // 最终使用的系数(考虑新人保护)
* "finalAmount": 120.00 // 最终提成金额(sumNonCoeff * finalMultiplyCoeff)
* }
* </pre>
*/
private String paramsJson;
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ public class StaffPerformanceDetail implements Serializable {
@Column(name = "merchant_id")
private Integer merchantId;
@ApiModelProperty(notes = "商户名")
@ApiModelProperty(notes = "商户名称")
@Column(name = "merchant_name")
private String merchantName;
......@@ -76,7 +76,7 @@ public class StaffPerformanceDetail implements Serializable {
@ApiModelProperty(notes = "考核因子")
@Column(name = "assessment_factor")
private String assessmentFactor;
private Byte assessmentFactor;
@ApiModelProperty(notes = "商品配置类型(-1:全部商品,0:商品分类,1:圈定产品,2圈定套餐)")
@Column(name = "goods_config_type")
......
......@@ -5,21 +5,22 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 员工提成基础数据
* 员工提成
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Table(name = "dj_car_life_staff_performance_base")
public class StaffPerformanceBase implements Serializable {
@SuperBuilder
@Data
@Table(name = "dj_car_life_staff_product_performance")
public class StaffProductPerformance implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......@@ -45,7 +46,7 @@ public class StaffPerformanceBase implements Serializable {
@ApiModelProperty(notes = "业务类型(0:轻改,1:权益;2:延保)")
@Column(name = "business_type")
private Integer businessType;
private Byte businessType;
@ApiModelProperty(notes = "主品牌id")
@Column(name = "brand_id")
......@@ -67,13 +68,57 @@ public class StaffPerformanceBase implements Serializable {
@Column(name = "month")
private String month;
@ApiModelProperty(notes = "有效引荐量")
@Column(name = "effective_referral_quantity")
private Integer effectiveReferralQuantity;
@ApiModelProperty(notes = "商品配置类型(-1:全部商品,0:商品分类,1:圈定产品,2圈定套餐)")
@Column(name = "goods_config_type")
private Byte goodsConfigType;
@ApiModelProperty(notes = "商品分类(一级)")
@Column(name = "goods_type")
private Integer goodsType;
@ApiModelProperty(notes = "商品分类名(一级)")
@Column(name = "goods_type_name")
private String goodsTypeName;
@ApiModelProperty(notes = "商品分类(二级)")
@Column(name = "secondary_goods_type")
private Integer secondaryGoodsType;
@ApiModelProperty(notes = "商品分类名(二级)")
@Column(name = "secondary_goods_type_name")
private String secondaryGoodsTypeName;
@ApiModelProperty(notes = "商品分类(三级)")
@Column(name = "third_level_goods_type")
private Integer thirdLevelGoodsType;
@ApiModelProperty(notes = "商品分类名(三级)")
@Column(name = "third_level_goods_type_name")
private String thirdLevelGoodsTypeName;
@ApiModelProperty(notes = "关联圈定ID")
@Column(name = "product_define_id")
private Integer productDefineId;
@ApiModelProperty(notes = "关联圈定产品/套餐名称")
@Column(name = "product_define_name")
private String productDefineName;
@ApiModelProperty(notes = "产值")
@Column(name = "gmv_output")
private BigDecimal gmvOutput;
@ApiModelProperty(notes = "升级订单数")
@Column(name = "upgrade_order_num")
private Integer upgradeOrderNum;
@ApiModelProperty(notes = "个人渗透率")
@Column(name = "personal_penetration_rate")
private BigDecimal personalPenetrationRate;
@ApiModelProperty(notes = "触客数")
@Column(name = "touch_number")
private Integer touchNumber;
@ApiModelProperty(notes = "提成金额")
@Column(name = "performance_amount")
private BigDecimal performanceAmount;
@ApiModelProperty(notes = "创建人")
@Column(name = "created_by")
......
package cn.com.glsx.dj.staff.config.dubbo;
import cn.com.glsx.dj.staff.config.DubboConfig;
import cn.com.glsx.scrm.proxy.remote.CommonProxyRemote;
import cn.com.glsx.scrm.proxy.remote.merchant.MerchantRemote;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -12,5 +13,10 @@ public class ProxyDubboConfig extends DubboConfig {
public MerchantRemote merchantRemote() {
return factory.builder(MerchantRemote.class).check(check).timeout(timeout).build();
}
@Bean
public CommonProxyRemote commonProxyRemote(){
return factory.builder(CommonProxyRemote.class).check(check).timeout(timeout).build();
}
}
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.model.StaffPerformanceBase;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface StaffPerformanceBaseMapper extends OreMapper<StaffPerformanceBase> {
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDailyReportQueryDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceOrderQueryDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO;
......@@ -13,7 +13,7 @@ import java.util.List;
* 员工绩效计算Mapper
*/
@Mapper
public interface StaffPerformanceCalMapper extends OreMapper<StaffPerformanceDTO> {
public interface StaffPerformanceCalMapper extends OreMapper<StaffProductPerformanceDTO> {
/**
* 查找员工指定时间范围的订单
......
......@@ -4,6 +4,10 @@ import cn.com.glsx.dj.staff.model.StaffPerformanceDetail;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface StaffPerformanceDetailMapper extends OreMapper<StaffPerformanceDetail> {
int removePerformanceDetail(StaffPerformanceDetail query);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.model.StaffPerformance;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
......@@ -9,5 +10,13 @@ import java.util.List;
@Mapper
public interface StaffPerformanceMapper extends OreMapper<StaffPerformance> {
List<StaffPerformanceDTO> listStaffPerformance(StaffPerformanceDTO dto);
List<StaffProductPerformanceDTO> listStaffPerformance(StaffPerformanceDTO dto);
/**
* 逻辑删除
*
* @param staffPerformance
* @return
*/
int removeStaffPerformance(StaffPerformance staffPerformance);
}
\ No newline at end of file
package cn.com.glsx.dj.staff.mapper;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.model.StaffProductPerformance;
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 StaffProductPerformanceMapper extends OreMapper<StaffProductPerformance> {
int removeStaffProductPerformance(@Param("merchantId") Integer merchantId,
@Param("businessType") Byte businessType,
@Param("brandId") Integer brandId,
@Param("childBrandId") Integer childBrandId,
@Param("performanceMonth") String performanceMonth,
@Param("staffPhone") String staffPhone,
@Param("updatedBy") String updatedBy);
List<StaffProductPerformanceDTO> listStaffPerformance(@Param("dto") StaffProductPerformanceDTO dto);
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ public interface EffectiveReferralReviewMapper extends OreMapper<EffectiveReferr
* @param query 查询条件
* @return 记录
*/
EffectiveReferralReviewDTO selectOneByQuery(EffectiveReferralReviewDTO query);
EffectiveReferralReviewDTO selectEffectiveReferralReview(EffectiveReferralReviewDTO query);
/**
* 查询门店列表
......
package cn.com.glsx.dj.staff.service;
import cn.com.glsx.dj.staff.mapper.StaffBeisenBaseInfoMapper;
import cn.com.glsx.dj.staff.model.StaffBeisenBaseInfo;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -9,7 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
......@@ -18,9 +18,16 @@ public class StaffBeisenBaseInfoService {
@Resource
private StaffBeisenBaseInfoMapper staffBeisenBaseInfoMapper;
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public StaffBeisenBaseInfo getByStaffPhone(String staffPhone) {
StaffBeisenBaseInfo query = new StaffBeisenBaseInfo();
query.setStaffPhone(staffPhone);
query.setDeletedFlag("N");
return staffBeisenBaseInfoMapper.selectOne(query);
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void test(String test) {
}
}
\ No newline at end of file
package cn.com.glsx.dj.staff.service.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.mapper.perfSalary.EffectiveReferralReviewMapper;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
......@@ -13,7 +13,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Slf4j
......@@ -59,4 +58,14 @@ public class EffectiveReferralReviewService {
public String effectiveReferralAuditExportData(RpcPagination<EffectiveReferralReviewCommonDTO> pagination) {
return null;
}
/**
* 根据条件查询单条有效引荐数记录
*
* @param query 查询参数
* @return 记录
*/
public EffectiveReferralReviewDTO queryEffectiveReferralReview(EffectiveReferralReviewDTO query) {
return effectiveReferralReviewMapper.selectEffectiveReferralReview(query);
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum;
import cn.com.glsx.dj.smartcarlife.remote.GoodsOrderRemote;
import cn.com.glsx.dj.smartcarlife.util.DateUtils;
import cn.com.glsx.dj.staff.constant.CommonConstants;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDTO;
import cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO;
import cn.com.glsx.dj.staff.dto.salary.SalaryMonthBusinessDataDTO;
import cn.com.glsx.dj.staff.mapper.StaffMonthBusinessDataMapper;
import cn.com.glsx.dj.staff.model.StaffMonthBusinessData;
......@@ -84,13 +84,13 @@ public class StaffMonthBusinessDataService {
return;
}
StaffMonthBusinessData data = list.get(0);
List<StaffPerformanceDTO> performanceDTOList = staffPerformanceCalService.calStaffPerformance(data.getStaffPhone(), data.getSalaryMonth());
List<StaffProductPerformanceDTO> performanceDTOList = staffPerformanceCalService.calStaffPerformance(data.getStaffPhone(), data.getSalaryMonth());
if (performanceDTOList == null || performanceDTOList.isEmpty()) {
return;
}
//performanceDTOList列表按businessType分组,然后累加performanceAmount值,返回map
Map<Byte, BigDecimal> map = performanceDTOList.stream().collect(Collectors.groupingBy(StaffPerformanceDTO::getBusinessType,
Collectors.mapping(StaffPerformanceDTO::getPerformanceAmount, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
Map<Byte, BigDecimal> map = performanceDTOList.stream().collect(Collectors.groupingBy(StaffProductPerformanceDTO::getBusinessType,
Collectors.mapping(StaffProductPerformanceDTO::getPerformanceAmount, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
for (StaffMonthBusinessData staffMonthBusinessData : list) {
if (staffMonthBusinessData.getBusinessType() == null) {
log.warn("StaffMonthBusinessData.businessType is null");
......
......@@ -7,6 +7,8 @@ import cn.com.glsx.dj.staff.model.PerformanceConfig;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
......@@ -34,16 +36,20 @@ public class PerformanceConfigService {
@Autowired
private PerformanceConfigMerchantBrandRefService performanceConfigMerchantBrandRefService;
/**
* 查找门店 业务场景 品牌生效的提成配置
* 查找门店 业务场景 品牌 子品牌 月份生效的提成配置
*
* @param dto 查询条件DTO
* @return 提成配置
*/
public PerformanceConfigDTO selectEffectiveConfig(PerformanceConfigDTO dto) {
log.info("Querying performance config by dto: {}", dto);
log.info("selectEffectiveConfig dto: {}", dto);
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "dto不能为空");
RpcAssert.assertNotNull(dto.getMerchantId(), DefaultErrorEnum.DATA_NULL, "merchantId不能为空");
RpcAssert.assertNotNull(dto.getBusinessType(), DefaultErrorEnum.DATA_NULL, "businessType不能为空");
RpcAssert.assertNotNull(dto.getBrandId(), DefaultErrorEnum.DATA_NULL, "brandId不能为空");
RpcAssert.assertNotNull(dto.getChildBrandId(), DefaultErrorEnum.DATA_NULL, "childBrandId不能为空");
RpcAssert.assertNotNull(dto.getEffectiveMonth(), DefaultErrorEnum.DATA_NULL, "month不能为空");
// 1. 根据入参的dto调用mapper方法查询基础数据的PerformanceConfigDTO result
PerformanceConfigDTO result = performanceConfigMapper.selectEffectiveConfig(dto);
......@@ -53,13 +59,10 @@ public class PerformanceConfigService {
return null;
}
// 2.
// 调用PerformanceParamConfigService的方法,根据performanceConfigId,调用对应的mapper查询List<PerformanceParamConfigDTO>
// List<PerformanceParamConfigDTO> performanceParamConfigs = performanceParamConfigService
// .listByConfigId(result.getId());
//
// // 设置到result
// result.setPerformanceParamConfigs(performanceParamConfigs);
// 2. 查找并设置performanceParamConfigs
List<PerformanceParamConfigDTO> performanceParamConfigs = performanceParamConfigService
.listByConfigId(result.getId());
result.setPerformanceParamConfigs(performanceParamConfigs);
// 3. 返回PerformanceConfigDTO
return result;
......@@ -68,9 +71,11 @@ public class PerformanceConfigService {
public PerformanceConfigDTO selectByName(PerformanceConfigDTO dto) {
return performanceConfigMapper.selectByName(dto);
}
public Page<PerformanceConfigPageDTO> pagePerformanceConfig(RpcPagination<PerformanceConfigPageDTO> pagination) {
try{
Page<PerformanceConfigPageDTO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(),pagination.isNeedCount());
try {
Page<PerformanceConfigPageDTO> page = PageHelper.startPage(pagination.getPageNum(),
pagination.getPageSize(), pagination.isNeedCount());
performanceConfigMapper.listPerformanceConfig(pagination.getCondition());
return page;
} catch (Exception e) {
......
......@@ -2,11 +2,12 @@ package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO;
import cn.com.glsx.dj.staff.mapper.PerformanceParamConfigMapper;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.util.RpcAssert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -26,9 +27,8 @@ public class PerformanceParamConfigService {
* @return List<PerformanceParamConfigDTO>
*/
public List<PerformanceParamConfigDTO> listByConfigId(Integer configId) {
if (configId == null) {
return new ArrayList<>();
}
log.info("根据配置ID查询参数列表: configId={}", configId);
RpcAssert.assertNotNull(configId, DefaultErrorEnum.DATA_NULL, "configId不能为空");
PerformanceParamConfigDTO dto = PerformanceParamConfigDTO.builder().performanceConfigId(configId).build();
return performanceParamConfigMapper.listByConfigId(dto);
}
......
package cn.com.glsx.dj.staff.service.staffPerformance;
import cn.com.glsx.dj.staff.constant.CommonConstants;
import cn.com.glsx.dj.staff.dto.PerformanceConfigDTO;
import cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO;
import cn.com.glsx.dj.staff.mapper.StaffPerformanceDetailMapper;
import cn.com.glsx.dj.staff.model.StaffPerformanceDetail;
import cn.com.glsx.framework.core.beans.BaseModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 员工绩效明细服务
*/
@Slf4j
@Service
public class StaffPerformanceDetailService {
@Autowired
private StaffPerformanceDetailMapper staffPerformanceDetailMapper;
/**
* 保存员工绩效明细
*
* @param config 绩效配置DTO
* @param performanceDetailDTOS 明细列表
*/
@Transactional(rollbackFor = Exception.class)
public void saveStaffPerformanceDetails(PerformanceConfigDTO config,
List<StaffPerformanceDetailDTO> performanceDetailDTOS) {
if (config == null || config.getMerchantId() == null || config.getBusinessType() == null
|| config.getEffectiveMonth() == null) {
log.error("保存员工绩效明细失败:必填参数缺失, config={}", config);
return;
}
log.info("Saving staff performance details. merchantId={}, businessType={}, month={}, count={}",
config.getMerchantId(), config.getBusinessType(), config.getEffectiveMonth(),
performanceDetailDTOS == null ? 0 : performanceDetailDTOS.size());
if (CollectionUtils.isEmpty(performanceDetailDTOS)) {
log.error("员工绩效明细列表为空,无需保存");
return;
}
// 1. 调用mapper,通过update更新相同merchantId businessType brandId childBrandId
// performanceMonth的记录的deletedFlag = 'D'
StaffPerformanceDetail query = StaffPerformanceDetail.builder()
.merchantId(config.getMerchantId())
.businessType(config.getBusinessType())
.brandId(config.getBrandId())
.childBrandId(config.getChildBrandId())
.month(config.getEffectiveMonth())
.updatedBy(CommonConstants.DEFAULT_UPDATE_BY)
.build();
int updatedRecord = staffPerformanceDetailMapper.removePerformanceDetail(query);
log.info("Logically deleted {} old records.", updatedRecord);
// 2. stream处理,设置createdBy、updatedBy='system',createdDate、updatedDate = now (new
// date)
Date now = new Date();
List<StaffPerformanceDetailDTO> insertList = performanceDetailDTOS.stream().map(dto -> {
// Ensure ID is null for insert to avoid conflicts if ID was somehow set
dto.setId(null);
dto.setCreatedBy(CommonConstants.DEFAULT_UPDATE_BY);
dto.setUpdatedBy(CommonConstants.DEFAULT_UPDATE_BY);
dto.setCreatedDate(now);
dto.setUpdatedDate(now);
dto.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
return dto;
}).collect(Collectors.toList());
// 3. 调用mapper.insertList方法将记录入库
// MyBatis batch insert usually has a limit, but assuming list size is
// reasonable for now.
// If list is very large, consider partitioning.
if (CollectionUtils.isNotEmpty(insertList)) {
int insertedCount = staffPerformanceDetailMapper.insertList(insertList);
log.info("Inserted {} new records.", insertedCount);
}
}
}
package cn.com.glsx.dj.staff.service.staffPerformance.util;
import cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO;
import cn.com.glsx.dj.smartcarlife.model.MerchantPerformanceProductDefineItem;
import cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO;
import cn.com.glsx.dj.staff.enums.ProductConfigTypeEnum;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.util.RpcAssert;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 员工绩效订单匹配工具类
* 提供订单与配置的匹配逻辑
*/
public class StaffPerformanceOrderUtil {
/**
* 判断订单列表是否匹配组合套餐
*
* @param o 订单列表(通常指同一主订单下的子订单列表)
* @param packageItemList 套餐包含的商品组列表(每个商品组内必须至少命中一个)
* @return 是否匹配
*/
public static boolean isOrderMatchPackage(List<StaffPerformanceSubOrderDTO> o,
List<List<MerchantPerformanceProductDefineItem>> packageItemList) {
if (CollectionUtils.isEmpty(o) || CollectionUtils.isEmpty(packageItemList)) {
return false;
}
List<Integer> upgradeGoodsIds = o.stream().map(StaffPerformanceSubOrderDTO::getUpgradeGoodsId)
.filter(Objects::nonNull).collect(Collectors.toList());
// 匹配逻辑:packageItemList 定义了多个必选商品组。
// 订单必须包含每一个商品组中的至少一个商品,才被视为匹配该组合套餐。
boolean isMatch = true;
if (packageItemList.stream().anyMatch(packageItem -> {
List<Integer> itemIds = packageItem.stream()
.map(MerchantPerformanceProductDefineItem::getItemId)
.collect(Collectors.toList());
return !CollectionUtils.containsAny(upgradeGoodsIds, itemIds);
})) {
isMatch = false;
}
return isMatch;
}
/**
* 筛选出匹配套餐的子订单
*
* @param o 订单列表
* @param packageItemList 套餐包含的商品组列表
* @return 匹配的子订单列表
*/
public static List<StaffPerformanceSubOrderDTO> matchPackageSubOrders(List<StaffPerformanceSubOrderDTO> o,
List<List<MerchantPerformanceProductDefineItem>> packageItemList) {
if (CollectionUtils.isEmpty(o) || CollectionUtils.isEmpty(packageItemList)) {
return new ArrayList<>();
}
List<Integer> upgradeGoodsIds = packageItemList.stream().flatMap(List::stream)
.map(MerchantPerformanceProductDefineItem::getItemId)
.collect(Collectors.toList());
if (!isOrderMatchPackage(o, packageItemList)) {
return new ArrayList<>();
}
return o.stream().filter(p -> upgradeGoodsIds.contains(p.getUpgradeGoodsId()))
.collect(Collectors.toList());
}
/**
* 统计匹配条件的订单数量
*
* @param orders 订单列表
* @param goodsConfigType 商品配置类型
* @param goodsType 商品类型
* @param secondaryGoodsType 二级商品类型
* @param thirdLevelGoodsType 三级商品类型
* @param productDefine 圈定商品定义(含套餐)
* @return 匹配数量
*/
public static long countMatchingOrders(List<StaffPerformanceSubOrderDTO> orders,
Integer goodsConfigType,
Integer goodsType,
Integer secondaryGoodsType,
Integer thirdLevelGoodsType,
MerchantPerformanceProductDefineDTO productDefine) {
if (CollectionUtils.isEmpty(orders) || goodsConfigType == null) {
return 0;
}
if (goodsConfigType == 2) {
RpcAssert.assertNotNull(productDefine, DefaultErrorEnum.DATA_NULL,
"conditionProductDefine be null");
RpcAssert.assertNotEmpty(productDefine.getPackageItemList(), DefaultErrorEnum.DATA_NULL,
"conditionProductDefine.getPackageItemList() is empty");
Map<String, List<StaffPerformanceSubOrderDTO>> groupedOrders = orders.stream()
.collect(Collectors.groupingBy(StaffPerformanceSubOrderDTO::getOrderCode));
return groupedOrders.values().stream()
.filter(o -> isOrderMatchPackage(o, productDefine.getPackageItemList()))
.count();
} else {
return orders.stream()
.filter(o -> isOrderMatchCategory(o,
goodsConfigType.byteValue(),
goodsType,
secondaryGoodsType,
thirdLevelGoodsType,
productDefine))
.count();
}
}
/**
* 判断单个订单是否匹配各类条件
*
* @param order 订单
* @param goodsConfigType 商品配置类型
* @param goodsType 商品类型
* @param secondaryGoodsType 二级商品类型
* @param thirdLevelGoodsType 三级商品类型
* @param productDefine 圈定商品定义
* @return 是否匹配
*/
public static boolean isOrderMatchCategory(StaffPerformanceSubOrderDTO order,
Byte goodsConfigType,
Integer goodsType,
Integer secondaryGoodsType,
Integer thirdLevelGoodsType,
MerchantPerformanceProductDefineDTO productDefine) {
RpcAssert.assertNotNull(goodsConfigType, DefaultErrorEnum.DATA_NULL, "goodsConfigType不能为空");
// TODO 改用枚举
// -1:全部商品
if (Objects.equals(ProductConfigTypeEnum.ALL_PRODUCT.getCode(), goodsConfigType)) {
return true;
}
// 0:商品分类
if (Objects.equals(ProductConfigTypeEnum.PRODUCT_CATEGORY.getCode(), goodsConfigType)) {
boolean match = true;
if (goodsType != null) {
match = match && Objects.equals(goodsType, order.getGoodsType());
}
if (secondaryGoodsType != null) {
match = match && Objects.equals(secondaryGoodsType, order.getSecondaryGoodsType());
}
if (thirdLevelGoodsType != null) {
match = match && Objects.equals(thirdLevelGoodsType, order.getThirdLevelGoodsType());
}
return match;
}
// 1:圈定产品
if (Objects.equals(ProductConfigTypeEnum.DESIGNATED_PRODUCT.getCode(), goodsConfigType)) {
RpcAssert.assertNotNull(productDefine, DefaultErrorEnum.DATA_NULL,
"productDefine不能为空");
return productDefine.getItemList().stream()
.anyMatch(item -> Objects.equals(item.getItemId(), order.getUpgradeGoodsId()));
}
return false;
}
}
package cn.com.glsx.dj.staff.util;
import cn.com.glsx.dj.staff.constant.CommonConstants;
import java.math.BigDecimal;
public class DataCalUtil {
public static BigDecimal divideToPercent(BigDecimal dividend, BigDecimal divisor) {
if (divisor.compareTo(BigDecimal.ZERO) == 0) {
return null;
}
return dividend.divide(divisor, 4, BigDecimal.ROUND_HALF_UP)
.multiply(CommonConstants.ONEHUNDRED_BIGDECIMAL).setScale(2,
BigDecimal.ROUND_HALF_UP);
}
public static BigDecimal divide(BigDecimal dividend, BigDecimal divisor) {
if (divisor.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
}
return dividend.divide(divisor, 4, BigDecimal.ROUND_HALF_UP);
}
}
......@@ -47,76 +47,81 @@
manager_commit_time, reviewed_by, reviewed_name, reviewed_time,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="selectOneByQuery" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
<select id="selectEffectiveReferralReview" resultMap="DTOResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sal_effective_referral_review
<where>
WHERE
deleted_flag = 'N'
<if test="merchantId != null">
AND merchant_id = #{merchantId}
</if>
<if test="sceneType != null">
AND scene_type = #{sceneType}
</if>
<if test="brandId != null">
AND brand_id = #{brandId}
</if>
<if test="reviewMonth != null">
and review_month = #{reviewMonth}
</if>
</where>
AND merchant_id = #{merchantId}
AND scene_type = #{sceneType}
AND brand_id = #{brandId}
AND review_month = #{reviewMonth}
LIMIT
1
</select>
<select id="selectStoreList" resultMap="CommonDTOResultMap">
SELECT
serr.merchant_id,
MIN(dclsm.merchant_name) AS merchant_name,
serr.review_month,
CASE
WHEN MAX(CASE WHEN serr.status IN (0, 1) THEN 1 ELSE 0 END) = 1
THEN 0
ELSE 1
END AS submit_status
FROM sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N'
and serr.merchant_id in
serr.merchant_id,
MIN(dclsm.merchant_name) AS merchant_name,
serr.review_month,
CASE
WHEN MAX(
CASE
WHEN serr.status IN (0, 1) THEN 1
ELSE 0
END
) = 1 THEN 0
ELSE 1
END AS submit_status
FROM
sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE
serr.deleted_flag = 'N'
AND serr.merchant_id IN
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="merchantName != null and merchantName != ''">
AND dclsm.merchant_name LIKE CONCAT('%', #{merchantName}, '%')
AND dclsm.merchant_name LIKE CONCAT('%', #{merchantName},
'%')
</if>
<if test="createdDate != null and createdDate != ''">
AND DATE_FORMAT(serr.created_date, '%Y-%m') = #{createdDate}
</if>
GROUP BY serr.merchant_id
GROUP BY
serr.merchant_id
<if test="submitStatus != null">
HAVING
CASE
WHEN MAX(CASE WHEN serr.status IN (0, 1) THEN 1 ELSE 0 END) = 1
THEN 0
ELSE 1
END = #{submitStatus}
CASE
WHEN MAX(
CASE
WHEN serr.status IN (0, 1) THEN 1
ELSE 0
END
) = 1 THEN 0
ELSE 1
END = #{submitStatus}
</if>
ORDER BY
CONVERT(MIN(dclsm.merchant_name) USING gbk) DESC
CONVERT(MIN(dclsm.merchant_name) USING gbk) DESC
</select>
<select id="selectStoreEffectiveReferralList" resultMap="CommonDTOResultMap">
SELECT
serr.*,
dclsm.merchant_name
FROM sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE serr.deleted_flag = 'N'
AND serr.merchant_id = #{merchantId}
serr.*,
dclsm.merchant_name
FROM
sal_effective_referral_review serr
LEFT JOIN dj_car_life_service_merchant dclsm ON serr.merchant_id = dclsm.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE
serr.deleted_flag = 'N'
AND serr.merchant_id = #{merchantId}
</select>
</mapper>
\ No newline at end of file
......@@ -20,7 +20,7 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" extends="BaseResultMap">
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="MerchantPerformanceResultMap"
......@@ -40,75 +40,75 @@
</sql>
<select id="selectEffectiveConfig" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" resultMap="DTOResultMap">
SELECT
c.*
FROM
dj_car_life_performance_config c
LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r ON c.id = r.performance_config_id AND r.deleted_flag = 'N'
WHERE
c.deleted_flag = 'N'
SELECT c.*,
dclsm.merchant_name
FROM dj_car_life_performance_config c
LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r ON c.id = r.performance_config_id
LEFT JOIN dj_car_life_service_merchant dclsm ON dclsm.merchant_id = r.merchant_id
AND dclsm.deleted_flag = 'N'
WHERE c.deleted_flag = 'N'
AND c.status = 2
AND C.business_type = #{businessType}
AND c.enable_flag = 'Y'
AND c.effective_month = #{performanceMonth}
AND c.business_type = #{businessType}
AND c.effective_month = #{effectiveMonth}
AND r.merchant_id = #{merchantId}
AND r.brand_id = #{brandId}
AND r.child_id = #{childBrandId}
LIMIT 1
LIMIT 1
</select>
<select id="selectByName" parameterType="cn.com.glsx.dj.staff.dto.PerformanceConfigDTO" resultMap="DTOResultMap">
SELECT
c.*
FROM
dj_car_life_performance_config c
WHERE
c.deleted_flag = 'N'
AND c.status = 2
AND r.scheme_name = #{schemeName}
LIMIT 1
</select>
<select id="listPerformanceConfig" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO" resultType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO">
SELECT
c.id,
c.scheme_name as schemeName,
c.business_type as businessType,
c.status,
c.effective_month as effectiveMonth,
c.updated_date as updatedDate,
IFNULL(COUNT(DISTINCT r.merchant_id), 0) as applicationQuantity
c.*
FROM
dj_car_life_performance_config c
LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r
ON c.id = r.performance_config_id
AND r.deleted_flag = 'N'
WHERE
c.deleted_flag = 'N'
GROUP BY
c.id,
c.scheme_name,
c.business_type,
c.status,
c.effective_month,
c.updated_date
ORDER BY
c.updated_date DESC
AND c.status = 2
AND r.scheme_name = #{schemeName}
LIMIT
1
</select>
<select id="listPerformanceConfig" parameterType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO" resultType="cn.com.glsx.dj.staff.dto.performance.PerformanceConfigPageDTO">
SELECT
c.id,
c.scheme_name AS schemeName,
c.business_type AS businessType,
c.status,
c.effective_month AS effectiveMonth,
c.updated_date AS updatedDate,
IFNULL(COUNT(DISTINCT r.merchant_id), 0) AS applicationQuantity
FROM
dj_car_life_performance_config c
LEFT JOIN dj_car_life_performance_config_merchant_brand_ref r ON c.id = r.performance_config_id
AND r.deleted_flag = 'N'
WHERE
c.deleted_flag = 'N'
GROUP BY
c.id,
c.scheme_name,
c.business_type,
c.status,
c.effective_month,
c.updated_date
ORDER BY
c.updated_date DESC
</select>
<!-- 根据ID查询提成方案配置(未删除) -->
<select id="selectById"
parameterType="java.lang.Integer"
resultMap="DTOResultMap">
SELECT
c.*
FROM
dj_car_life_performance_config c
WHERE
c.deleted_flag = 'N'
AND c.id = #{id}
LIMIT 1
SELECT
c.*
FROM
dj_car_life_performance_config c
WHERE
c.deleted_flag = 'N'
AND c.id = #{id}
LIMIT
1
</select>
<select id="listByMerchant"
......
......@@ -30,16 +30,6 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id = "DTOResultMap" type = "cn.com.glsx.dj.staff.dto.PerformanceParamConfigConditionDTO" extends="BaseResultMap">
<association property="productDefine" javaType="cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO">
<id column="product_define_id" property="id" jdbcType="INTEGER" />
<result column="define_type" property="defineType" jdbcType="TINYINT" />
<result column="define_name" property="defineName" jdbcType="VARCHAR" />
<!-- <collection property="itemList" ofType="cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineItemDTO">-->
<!-- <id column="product_define_item_id" property="id" jdbcType="INTEGER" />-->
<!-- <result column="item_id" property="itemId" jdbcType="INTEGER" />-->
<!-- <result column="item_name" property="itemName" jdbcType="VARCHAR" />-->
<!-- </collection>-->
</association>
</resultMap>
<sql id="Base_Column_List" >
<!--
......
......@@ -30,16 +30,6 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="ListByConfigIdResultMap" type="cn.com.glsx.dj.staff.dto.PerformanceParamConfigDTO" extends="BaseResultMap">
<association property="productDefine" javaType="cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO">
<id column="product_define_id" property="id" jdbcType="INTEGER" />
<result column="define_type" property="defineType" jdbcType="TINYINT" />
<result column="define_name" property="defineName" jdbcType="VARCHAR" />
<collection property="itemList" ofType="cn.com.glsx.dj.smartcarlife.model.MerchantPerformanceProductDefineItem">
<id column="product_define_item_id" property="id" jdbcType="INTEGER" />
<result column="item_id" property="itemId" jdbcType="INTEGER" />
<result column="item_name" property="itemName" jdbcType="VARCHAR" />
</collection>
</association>
<collection property="performanceParamConfigConditions" column="id"
select="cn.com.glsx.dj.staff.mapper.PerformanceParamConfigConditionMapper.listByParamConfigId"/>
</resultMap>
......@@ -86,12 +76,12 @@
AND c.performance_config_id = #{performanceConfigId}
</select>
<update id="deleteByPerformanceParamConfigId" parameterType="java.lang.Integer">
UPDATE dj_car_life_performance_param_config
SET
deleted_flag = 'D',
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND performance_config_id = #{id}
UPDATE dj_car_life_performance_param_config
SET
deleted_flag = 'D',
updated_date = NOW()
WHERE
deleted_flag = 'N'
AND performance_config_id = #{id}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.staff.mapper.StaffPerformanceBaseMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.staff.model.StaffPerformanceBase" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="business_type" property="businessType" jdbcType="TINYINT" />
<result column="brand_id" property="brandId" jdbcType="INTEGER" />
<result column="brand_name" property="brandName" jdbcType="VARCHAR" />
<result column="child_brand_id" property="childBrandId" jdbcType="INTEGER" />
<result column="child_brand_name" property="childBrandName" jdbcType="VARCHAR" />
<result column="month" property="month" jdbcType="VARCHAR" />
<result column="effective_referral_quantity" property="effectiveReferralQuantity" jdbcType="INTEGER" />
<result column="touch_number" property="touchNumber" jdbcType="INTEGER" />
<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" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
brand_name, child_brand_id, child_brand_name, month, effective_referral_quantity,
touch_number, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
</mapper>
\ No newline at end of file
......@@ -3,15 +3,11 @@
<mapper namespace="cn.com.glsx.dj.staff.mapper.StaffPerformanceCalMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO">
<!--
TODO: 用户自行补充 ResultMap 映射
例如:
<result column="order_no" property="orderNo" jdbcType="VARCHAR"/>
-->
<result column="order_code" property="orderCode" jdbcType="VARCHAR"/>
<result column="sub_order_code" property="subOrderCode" jdbcType="VARCHAR"/>
<result column="merchant_id" property="merchantId" jdbcType="INTEGER"/>
<result column="phone_number" property="staffPhone" jdbcType="VARCHAR"/>
<result column="staff_name" property="staffName" jdbcType="VARCHAR"/>
<result column="business_type" property="businessType" jdbcType="TINYINT"/>
<result column="dj_order_type" property="djOrderType" jdbcType="TINYINT"/>
<result column="car_brand_id" property="brandId" jdbcType="INTEGER"/>
......@@ -30,6 +26,7 @@
dclgso.sub_order_code,
dclgo.merchant_id,
dclsi.phone_number,
dclsi.staff_name,
if(dclgo.scene_type = 1, 0, dclgo.business_type) business_type,
dclgo.dj_order_type,
dclgoc.car_brand_id,
......@@ -94,8 +91,10 @@
AND dclsdrh.brand_id = #{childBrandId}
</if>
<if test="month != null and month != ''">
AND dclsdrh.report_date &gt;= concat( #{month}, '-01')
AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month}, '-01'), INTERVAL 1 MONTH)
AND dclsdrh.report_date &gt;= concat( #{month},
'-01')
AND dclsdrh.report_date &lt; DATE_ADD(concat( #{month},
'-01'), INTERVAL 1 MONTH)
</if>
</where>
</select>
......
......@@ -17,7 +17,7 @@
<result column="child_brand_name" property="childBrandName" jdbcType="VARCHAR" />
<result column="month" property="month" jdbcType="VARCHAR" />
<result column="performance_config_id" property="performanceConfigId" jdbcType="INTEGER" />
<result column="assessment_factor" property="assessmentFactor" jdbcType="VARCHAR" />
<result column="assessment_factor" property="assessmentFactor" jdbcType="TINYINT" />
<result column="goods_config_type" property="goodsConfigType" jdbcType="TINYINT" />
<result column="goods_type" property="goodsType" jdbcType="INTEGER" />
<result column="goods_type_name" property="goodsTypeName" jdbcType="VARCHAR" />
......@@ -50,7 +50,7 @@
<!--
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
brand_name, child_brand_id, child_brand_name, month, performance_config_id, assessment_factor,
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,
......@@ -64,4 +64,17 @@
-->
params_json
</sql>
<update id="removePerformanceDetail" parameterType="cn.com.glsx.dj.staff.model.StaffPerformanceDetail">
UPDATE dj_car_life_staff_performance_detail
SET
deleted_flag = 'D',
updated_by = #{updatedBy},
updated_date = now()
WHERE
merchant_id = #{merchantId,jdbcType=INTEGER}
AND business_type = #{businessType,jdbcType=TINYINT}
AND brand_id = #{brandId,jdbcType=INTEGER}
AND child_brand_id = #{childBrandId,jdbcType=INTEGER}
AND month = #{month,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -16,18 +16,8 @@
<result column="child_brand_id" property="childBrandId" jdbcType="INTEGER" />
<result column="child_brand_name" property="childBrandName" jdbcType="VARCHAR" />
<result column="month" property="month" jdbcType="VARCHAR" />
<result column="goods_config_type" property="goodsConfigType" jdbcType="TINYINT" />
<result column="goods_type" property="goodsType" jdbcType="INTEGER" />
<result column="goods_type_name" property="goodsTypeName" jdbcType="VARCHAR" />
<result column="secondary_goods_type" property="secondaryGoodsType" jdbcType="INTEGER" />
<result column="secondary_goods_type_name" property="secondaryGoodsTypeName" jdbcType="VARCHAR" />
<result column="third_level_goods_type" property="thirdLevelGoodsType" jdbcType="INTEGER" />
<result column="third_level_goods_type_name" property="thirdLevelGoodsTypeName" jdbcType="VARCHAR" />
<result column="product_define_id" property="productDefineId" jdbcType="INTEGER" />
<result column="product_define_name" property="productDefineName" jdbcType="VARCHAR" />
<result column="gmv_output" property="gmvOutput" jdbcType="DECIMAL" />
<result column="upgrade_order_num" property="upgradeOrderNum" jdbcType="INTEGER" />
<result column="personal_penetration_rate" property="personalPenetrationRate" jdbcType="DECIMAL" />
<result column="effective_referral_quantity" property="effectiveReferralQuantity" jdbcType="INTEGER" />
<result column="touch_number" property="touchNumber" jdbcType="INTEGER" />
<result column="performance_amount" property="performanceAmount" jdbcType="DECIMAL" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
......@@ -35,33 +25,58 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.StaffPerformanceDTO" extends="BaseResultMap">
<resultMap id="ResultMapWithBLOBs" type="cn.com.glsx.dj.staff.model.StaffPerformanceDetail" extends="BaseResultMap" >
<!--
WARNING - @mbg.generated
-->
<result column="params_json" property="paramsJson" jdbcType="LONGVARCHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO" extends="BaseResultMap">
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, staff_name, staff_phone, merchant_id, merchant_name, business_type, brand_id,
brand_name, child_brand_id, child_brand_name, month, 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, gmv_output,
upgrade_order_num, personal_penetration_rate, performance_amount, created_by, created_date,
updated_by, updated_date, deleted_flag
brand_name, child_brand_id, child_brand_name, month, effective_referral_quantity,
touch_number, performance_amount, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<sql id="Blob_Column_List" >
<!--
WARNING - @mbg.generated
-->
params_json
</sql>
<select id="listStaffPerformance" resultMap="DTOResultMap">
select
<include refid="Base_Column_List" />
from dj_car_life_staff_performance dclsp
SELECT
<include refid="Base_Column_List"/>
FROM
dj_car_life_staff_performance dclsp
<where>
dclsp.deleted_flag = 'N'
<if test="staffPhone != null">
and dclsp.staff_phone = #{staffPhone}
</if>
<if test="month != null">
and dclsp.month = #{month}
</if>
dclsp.deleted_flag = 'N'
<if test="staffPhone != null">
AND dclsp.staff_phone = #{staffPhone}
</if>
<if test="month != null">
AND dclsp.month = #{month}
</if>
</where>
</select>
<update id="removeStaffPerformance" parameterType="cn.com.glsx.dj.staff.model.StaffPerformance">
UPDATE dj_car_life_staff_performance
SET
deleted_flag = 'D',
updated_by = #{updatedBy},
updated_date = now()
WHERE
merchant_id = #{merchantId}
AND business_type = #{businessType}
AND brand_id = #{brandId}
AND child_brand_id = #{childBrandId}
AND month = #{month}
AND deleted_flag = 'N'
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.dj.staff.mapper.StaffProductPerformanceMapper">
<select id="listStaffPerformance" parameterType="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO" resultType="cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO">
SELECT
*
FROM
dj_car_life_staff_product_performance
WHERE
deleted_flag = 'N'
<if test="dto.staffName != null and dto.staffName != ''">
AND staff_name LIKE CONCAT('%', #{dto.staffName},
'%')
</if>
<if test="dto.staffPhone != null and dto.staffPhone != ''">
AND staff_phone = #{dto.staffPhone}
</if>
<if test="dto.month != null and dto.month != ''">
AND month = #{dto.month}
</if>
</select>
<update id="removeStaffProductPerformance">
UPDATE dj_car_life_staff_product_performance
SET
deleted_flag = 'D',
updated_by = #{updatedBy},
updated_date = now()
WHERE
staff_phone = #{staffPhone}
AND merchant_id = #{merchantId}
AND business_type = #{businessType}
AND brand_id = #{brandId}
AND child_brand_id = #{childBrandId}
AND month = #{performanceMonth}
AND deleted_flag = 'N'
</update>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!