提交 7d04692b authored 作者: huyufan's avatar huyufan

Merge remote-tracking branch 'origin/v5.7_break_contract_reverse_20231020' into…

Merge remote-tracking branch 'origin/v5.7_break_contract_reverse_20231020' into v5.7_break_contract_reverse_20231020
package com.clx.performance.enums.integral;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
public enum IntegralRecordEnum {
;
@Getter
@AllArgsConstructor
public enum Type{
SYSTEM(1, "系统"),
PROTECTION(2, "保护分"),
PROTECTION_CANCEL(3, "保护分取消"),
SETTLEMENT(4, "结算分"),
BASE(5, "基础分"),
ORDER_CHILD_COMPLETE(11, "运单完成"),
ORDER_CHILD_COMPLETE_NUM(12, "运单完成数量"),
ORDER_CHILD_COMPLETE_WATER(13, "流水单"),
ORDER_CHILD_COMPLETE_SUPPORT(14, "支援单"),
ORDER_CHILD_COMPLETE_TIMEOUT(15, "运单完成超时"),
ORDER_CHILD_CANCEL(21, "运单取消"),
ORDER_CHILD_CANCEL_TIMEOUT(22, "运单取消超时"),
ORDER_CHILD_PLATFORM_CANCEL(23, "平台取消"),
ORDER_CHILD_PLATFORM_COMPENSATION(25, "平台补偿"),
REPORT_TRUCK_INFO(50, "提交基础信息"),
REPORT_REFUEL(51, "油表上报"),
REPORT_TRAFFIC(52, "上报交通拥堵"),
REPORT_SEND_ADDRESS_WAIT(53, "上报货源地需要排队"),
REPORT_SEND_ADDRESS_NO_WAIT(54, "上报货源地无需排队"),
REPORT_RECEIVE_ADDRESS_WAIT(55, "上报目的地需要排队"),
REPORT_RECEIVE_ADDRESS_NO_WAIT(56, "上报目的地无需排队"),
REPORT_QUALITY(57, "上报煤炭质量问题"),
REPORT_ABNORMAL(58, "上报拉运异常问题"),
;
private Integer value;
private String msg;
}
// 取消
public static final List<Integer> DRIVER_REPORT_lIST = Arrays.asList(
Type.REPORT_TRUCK_INFO.value,
Type.REPORT_REFUEL.value,
Type.REPORT_TRAFFIC.value,
Type.REPORT_SEND_ADDRESS_WAIT.value,
Type.REPORT_SEND_ADDRESS_NO_WAIT.value,
Type.REPORT_RECEIVE_ADDRESS_WAIT.value,
Type.REPORT_RECEIVE_ADDRESS_NO_WAIT.value,
Type.REPORT_QUALITY.value,
Type.REPORT_ABNORMAL.value
);
// 取消
public static final List<Integer> PLATFORM_CANCEL_lIST = Arrays.asList(
Type.REPORT_TRUCK_INFO.value,
Type.REPORT_REFUEL.value,
Type.REPORT_TRAFFIC.value,
Type.REPORT_SEND_ADDRESS_WAIT.value,
Type.REPORT_SEND_ADDRESS_NO_WAIT.value,
Type.REPORT_RECEIVE_ADDRESS_WAIT.value,
Type.REPORT_RECEIVE_ADDRESS_NO_WAIT.value,
Type.REPORT_QUALITY.value,
Type.REPORT_ABNORMAL.value
);
}
package com.clx.performance.param.pc.integral;
import com.clx.performance.vo.pc.integral.AppIntegralRuleVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.validation.Valid;
/**
* @Author: aiqingguo
* @Description: 新增积分
* @Date: 2023-10-11 17:30:57
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public class IntegralRuleUpdateParam {
@Valid
@ApiModelProperty(value = "运单完成积分规则")
private AppIntegralRuleVO.OrderChildCompleteRule orderChildCompleteRule;
@Valid
@ApiModelProperty(value = "货单奖励积分规则")
private AppIntegralRuleVO.OrderAwardRule orderAwardRule;
@Valid
@ApiModelProperty(value = "货单扣减积分规则")
private AppIntegralRuleVO.OrderChildCancelRule orderDiscountRule;
@Valid
@ApiModelProperty(value = "运单超时扣减规则")
private AppIntegralRuleVO.OrderChildTimeoutRule orderChildTimeoutRule;
@Valid
@ApiModelProperty(value = "平台补偿积分规则")
private AppIntegralRuleVO.PlatformCompensationRule platformCompensationRule;
@Valid
@ApiModelProperty(value = "司机上报积分规则")
private AppIntegralRuleVO.DriverReportRule driverReportRule;
}
package com.clx.performance.vo.pc.integral;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Author: aiqinguo
* @Description: 车辆积分规则
* @Date: 2023/11/06 14:12:53
* @Version: 1.0
*/
@ApiModel(description = "积分规则")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class AppIntegralRuleVO {
@ApiModelProperty(value = "运单完成积分规则")
private OrderChildCompleteRule orderChildCompleteRule;
@ApiModelProperty(value = "货单奖励积分规则")
private OrderAwardRule orderAwardRule;
@ApiModelProperty(value = "货单扣减积分规则")
private OrderChildCancelRule orderChildCancelRule;
@ApiModelProperty(value = "运单超时扣减规则")
private OrderChildTimeoutRule orderChildTimeoutRule;
@ApiModelProperty(value = "平台补偿积分规则")
private PlatformCompensationRule platformCompensationRule;
@ApiModelProperty(value = "司机上报积分规则")
private DriverReportRule driverReportRule;
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class OrderChildCompleteRule{
@ApiModelProperty(value = "当日完成第1笔运单积分x")
@NotNull(message = "参数不能为空")
private Integer integer1;
@ApiModelProperty(value = "当日完成第2笔运单积分x")
@NotNull(message = "参数不能为空")
private Integer integer2;
@ApiModelProperty(value = "当日完成第3笔运单积分x")
@NotNull(message = "参数不能为空")
private Integer integer3;
@ApiModelProperty(value = "当日完成第4笔运单积分x")
@NotNull(message = "参数不能为空")
private Integer integer4;
}
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class OrderAwardRule{
@ApiModelProperty(value = "完成流水单每单附加积分x")
private Integer integerWater;
@ApiModelProperty(value = "当日流水单奖励次数上限x")
private Integer countWaterLimit;
@ApiModelProperty(value = "完成支援单每单附加积分x")
private Integer integerSupport;
@ApiModelProperty(value = "当日支援单奖励次数上限x")
private Integer countSupportLimit;
}
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class OrderChildCancelRule {
@ApiModelProperty(value = "自行取消运单每单扣减积分x")
@NotNull(message = "参数不能为空")
private Integer integralCancel;
@ApiModelProperty(value = "自行取消流水单每单另扣积分x")
private Integer integralWaterCancel;
@ApiModelProperty(value = "自行取消支援单每单另扣积分x")
private Integer integralSupportCancel;
}
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class OrderChildTimeoutRule{
@ApiModelProperty(value = "超时未到达货源地扣积分x")
@NotNull(message = "参数不能为空")
private Integer integralSendAddressTimeout;
@ApiModelProperty(value = "超时未到达目的地扣积分x")
@NotNull(message = "参数不能为空")
private Integer integralReceiveAddressTimeout;
@ApiModelProperty(value = "接单超时扣积分x")
private Integer integralTakeOrderTimeout;
}
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class PlatformCompensationRule{
@ApiModelProperty(value = "平台取消运单补偿积分x")
private Integer integralCancel;
@ApiModelProperty(value = "当日平台补偿积分上限x")
private Integer integralCancelLimit;
@ApiModelProperty(value = "规定时间不能装车补偿x")
private Integer integralLoad;
@ApiModelProperty(value = "规定时间不能卸车补偿x")
private Integer integralUnload;
}
@Getter
@Setter
@ToString
@NoArgsConstructor
public static class DriverReportRule{
@ApiModelProperty(value = "提交基础信息每项积分x")
private Integer integralTruck;
@ApiModelProperty(value = "油表上报积分x")
private Integer integralRefuel;
@ApiModelProperty(value = "上报交通拥堵积分x")
private Integer integralTraffic;
@ApiModelProperty(value = "上报货源地需要排队积分x")
private Integer integralSendAddressWait;
@ApiModelProperty(value = "上报货源地无需排队积分x")
private Integer integralSendAddressNoWait;
@ApiModelProperty(value = "上报目的地需要排队积分x")
private Integer integralReceiveAddressWait;
@ApiModelProperty(value = "上报目的地无需排队积分x")
private Integer integralReceiveAddressNoWait;
@ApiModelProperty(value = "上报煤炭质量问题积分x")
private Integer integralQuality;
@ApiModelProperty(value = "上报拉运异常问题积分x")
private Integer integralAbnormal;
@ApiModelProperty(value = "限制频繁上报奖励间隔x(小时)")
private BigDecimal reportLimit;
@ApiModelProperty(value = "当日上报奖励积分上限x")
private Integer integralLimit;
}
@ApiModelProperty(value = "运单完成积分规则", example = "", hidden = true)
private OrderChildCompleteRule orderChildCompleteRuleJson;
@ApiModelProperty(value = "货单奖励积分规则", example = "", hidden = true)
private OrderAwardRule orderAwardRuleJson;
@ApiModelProperty(value = "货单扣减积分规则", example = "", hidden = true)
private OrderChildCancelRule orderDiscountRuleJson;
@ApiModelProperty(value = "运单超时扣减规则", example = "", hidden = true)
private OrderChildTimeoutRule orderChildTimeoutRuleJson;
@ApiModelProperty(value = "平台补偿积分规则", example = "", hidden = true)
private PlatformCompensationRule platformCompensationRuleJson;
}
\ No newline at end of file
...@@ -8,6 +8,8 @@ import com.clx.performance.vo.pc.IntegralRecordVO; ...@@ -8,6 +8,8 @@ import com.clx.performance.vo.pc.IntegralRecordVO;
import com.msl.common.dao.BaseDao; import com.msl.common.dao.BaseDao;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Author: aiqinguo * @Author: aiqinguo
* @Description: 积分记录 * @Description: 积分记录
...@@ -21,6 +23,7 @@ public interface IntegralRecordDao extends BaseDao<IntegraRecordMapper, Integral ...@@ -21,6 +23,7 @@ public interface IntegralRecordDao extends BaseDao<IntegraRecordMapper, Integral
Integer sumIntegral(@Param("statisticsId") Integer statisticsId); Integer sumIntegral(@Param("statisticsId") Integer statisticsId);
IntegralRecord selectByStatisticsIdAndType(@Param("statisticsId") Integer statisticsId, @Param("type") Integer type); IntegralRecord selectByStatisticsIdAndType(@Param("statisticsId") Integer statisticsId, @Param("type") Integer type);
int sumByStatisticsIdAndTypes(@Param("statisticsId") Integer statisticsId, @Param("list") List<Integer> typeList);
Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId, Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId,
@Param("type") Integer type, @Param("type") Integer type,
......
...@@ -11,6 +11,8 @@ import com.msl.common.base.Optional; ...@@ -11,6 +11,8 @@ import com.msl.common.base.Optional;
import com.msl.common.dao.impl.BaseDaoImpl; import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @Author: aiqinguo * @Author: aiqinguo
...@@ -40,6 +42,11 @@ public class IntegralRecordDaoImpl extends BaseDaoImpl<IntegraRecordMapper, Inte ...@@ -40,6 +42,11 @@ public class IntegralRecordDaoImpl extends BaseDaoImpl<IntegraRecordMapper, Inte
.eq(IntegralRecord::getType, type)); .eq(IntegralRecord::getType, type));
} }
@Override
public int sumByStatisticsIdAndTypes(Integer statisticsId, List<Integer> typeList) {
return baseMapper.sumByStatisticsIdAndTypes(statisticsId, typeList);
}
@Override @Override
public Integer sumByStatisticsIdAndTypeAndTime(Integer statisticsId, Integer type, String beginTime, String endTime) { public Integer sumByStatisticsIdAndTypeAndTime(Integer statisticsId, Integer type, String beginTime, String endTime) {
return baseMapper.sumByStatisticsIdAndTypeAndTime(statisticsId, type, beginTime, endTime); return baseMapper.sumByStatisticsIdAndTypeAndTime(statisticsId, type, beginTime, endTime);
......
package com.clx.performance.dao.impl.integral;
import com.clx.performance.dao.integral.IntegralRuleDao;
import com.clx.performance.mapper.integral.IntegralRuleMapper;
import com.clx.performance.model.integral.IntegralRule;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @Author: aiqinguo
* @Description: 积分规则
* @Date: 2023-10-9 12:00:54
* @Version: 1.0
*/
@Repository
public class IntegralRuleDaoImpl extends BaseDaoImpl<IntegralRuleMapper, IntegralRule, Integer> implements IntegralRuleDao {
@Override
public boolean update(IntegralRule item) {
return update(lUdWrapper()
.eq(IntegralRule::getId, item.getId())
.set(IntegralRule::getOrderChildCompleteRuleJson, item.getOrderChildCompleteRuleJson())
.set(IntegralRule::getOrderAwardRuleJson, item.getOrderAwardRuleJson())
.set(IntegralRule::getOrderDiscountRuleJson, item.getOrderDiscountRuleJson())
.set(IntegralRule::getOrderChildTimeoutRuleJson, item.getOrderChildTimeoutRuleJson())
.set(IntegralRule::getPlatformCompensationRuleJson, item.getPlatformCompensationRuleJson())
.set(IntegralRule::getDriverReportRuleJson, item.getDriverReportRuleJson())
);
}
}
package com.clx.performance.dao.integral;
import com.clx.performance.mapper.integral.IntegralRuleMapper;
import com.clx.performance.model.integral.IntegralRule;
import com.msl.common.dao.BaseDao;
/**
* @Author: aiqinguo
* @Description: 积分规则
* @Date: 2023-10-9 11:55:36
* @Version: 1.0
*/
public interface IntegralRuleDao extends BaseDao<IntegralRuleMapper, IntegralRule, Integer> {
boolean update(IntegralRule item);
}
...@@ -6,13 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,13 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.model.IntegralRecord; import com.clx.performance.model.IntegralRecord;
import com.clx.performance.param.pc.pageIntegralStatisticsDetailParam; import com.clx.performance.param.pc.pageIntegralStatisticsDetailParam;
import com.clx.performance.sqlProvider.IntegralRecordSqlProvider; import com.clx.performance.sqlProvider.IntegralRecordSqlProvider;
import com.clx.performance.sqlProvider.IntegralTruckSqlProvider;
import com.clx.performance.vo.pc.IntegralRecordVO; import com.clx.performance.vo.pc.IntegralRecordVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
/** /**
* @Author: aiqinguo * @Author: aiqinguo
* @Description: 积分记录 * @Description: 积分记录
...@@ -29,6 +30,12 @@ public interface IntegraRecordMapper extends BaseMapper<IntegralRecord> { ...@@ -29,6 +30,12 @@ public interface IntegraRecordMapper extends BaseMapper<IntegralRecord> {
@SelectProvider(type = IntegralRecordSqlProvider.class, method = "pageByParam") @SelectProvider(type = IntegralRecordSqlProvider.class, method = "pageByParam")
IPage<IntegralRecordVO> pageByParam(@Param("page") Page<IntegralRecordVO> page, @Param("param") pageIntegralStatisticsDetailParam param); IPage<IntegralRecordVO> pageByParam(@Param("page") Page<IntegralRecordVO> page, @Param("param") pageIntegralStatisticsDetailParam param);
@Select("<script>select sum(integral) from integral_record where " +
" type in <foreach collection='list' item='item' open='(' separator=',' close=')'>#{item}</foreach> " +
" and statistics_id = #{statisticsId}" +
"</script>")
int sumByStatisticsIdAndTypes(@Param("statisticsId") Integer statisticsId, @Param("list") List<Integer> typeList);
@Select("select sum(integral) from integral_record where statistics_id = #{statisticsId} and type = #{type} and create_time >= #{beginTime} and create_time < #{endTime}") @Select("select sum(integral) from integral_record where statistics_id = #{statisticsId} and type = #{type} and create_time >= #{beginTime} and create_time < #{endTime}")
Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId, Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId,
@Param("type") Integer type, @Param("type") Integer type,
......
package com.clx.performance.mapper.integral;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.clx.performance.model.integral.IntegralRule;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author: aiqinguo
* @Description: 积分规则
* @Date: 2023-10-9 11:52:22
* @Version: 1.0
*/
@Mapper
public interface IntegralRuleMapper extends BaseMapper<IntegralRule> {
}
\ No newline at end of file
package com.clx.performance.model.integral;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
/**
* @Author: aiqinguo
* @Description: 积分规则
* @Date: 2023/11/06 16:14:44
* @Version: 1.0
*/
@Getter
@Setter
@NoArgsConstructor
@TableName(autoResultMap = true)
public class IntegralRule implements HasKey<Integer> {
@TableId(value = "id", type = IdType.AUTO)
private Integer id; //id
private String orderChildCompleteRuleJson; //运单完成积分规则
private String orderAwardRuleJson; //货单奖励积分规则
private String orderDiscountRuleJson; //货单扣减积分规则
private String orderChildTimeoutRuleJson; //运单超时扣减规则
private String platformCompensationRuleJson; //平台补偿积分规则
private String driverReportRuleJson; //司机上报积分规则
private LocalDateTime createTime; //创建时间
private LocalDateTime modifiedTime; //修改时间
@KeyColumn("id")
@Override
public Integer gainKey() {
return id;
}
}
\ No newline at end of file
...@@ -9,6 +9,8 @@ public interface IntegralRecordService { ...@@ -9,6 +9,8 @@ public interface IntegralRecordService {
void addRecord(IntegralRecordAddParam param); void addRecord(IntegralRecordAddParam param);
void addPlatformCompensationRecord(String truckNo);
IntegralRecord save(Integer statisticsId, LocalDateTime statisticsDate, String truckNo, Integer type, Integer integral, String remark); IntegralRecord save(Integer statisticsId, LocalDateTime statisticsDate, String truckNo, Integer type, Integer integral, String remark);
} }
...@@ -4,18 +4,22 @@ import com.clx.performance.dao.IntegralRecordDao; ...@@ -4,18 +4,22 @@ import com.clx.performance.dao.IntegralRecordDao;
import com.clx.performance.dao.IntegralStatisticsDao; import com.clx.performance.dao.IntegralStatisticsDao;
import com.clx.performance.dao.IntegralTruckDao; import com.clx.performance.dao.IntegralTruckDao;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.integral.IntegralRecordEnum;
import com.clx.performance.model.IntegralRecord; import com.clx.performance.model.IntegralRecord;
import com.clx.performance.model.IntegralStatistics; import com.clx.performance.model.IntegralStatistics;
import com.clx.performance.model.IntegralTruck; import com.clx.performance.model.IntegralTruck;
import com.clx.performance.param.pc.IntegralRecordAddParam; import com.clx.performance.param.pc.IntegralRecordAddParam;
import com.clx.performance.service.IntegralMqService; import com.clx.performance.service.IntegralMqService;
import com.clx.performance.service.IntegralRecordService; import com.clx.performance.service.IntegralRecordService;
import com.clx.performance.service.integral.IntegralRuleService;
import com.clx.performance.utils.LocalDateTimeUtils; import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.vo.pc.integral.AppIntegralRuleVO;
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.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays;
@Slf4j @Slf4j
@Service @Service
...@@ -32,6 +36,8 @@ public class IntegralRecordServiceImpl implements IntegralRecordService { ...@@ -32,6 +36,8 @@ public class IntegralRecordServiceImpl implements IntegralRecordService {
@Autowired @Autowired
private IntegralMqService integralMqService; private IntegralMqService integralMqService;
@Autowired
private IntegralRuleService integralRuleService;
@Override @Override
public void addRecord(IntegralRecordAddParam param) { public void addRecord(IntegralRecordAddParam param) {
...@@ -57,6 +63,52 @@ public class IntegralRecordServiceImpl implements IntegralRecordService { ...@@ -57,6 +63,52 @@ public class IntegralRecordServiceImpl implements IntegralRecordService {
} }
@Override
public void addPlatformCompensationRecord(String truckNo) {
// 查找规则
AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo();
Integer type = IntegralRecordEnum.Type.ORDER_CHILD_PLATFORM_COMPENSATION.getValue();
Integer integral = ruleInfo.getPlatformCompensationRule().getIntegralCancel();
String remark = IntegralRecordEnum.Type.ORDER_CHILD_PLATFORM_COMPENSATION.getMsg();
String statisticsDate = LocalDateTimeUtils.getWeekStart();
IntegralTruck truck = integralTruckDao.getByTruckNo(truckNo).orNull();
if (truck == null) {return;}
// 查找最新统计
IntegralStatistics statistics = integralStatisticsDao.selectByTruckNoAndStatisticsDate(truckNo, statisticsDate).orNull();
if (statistics == null) {return;}
int sum = integralRecordDao.sumByStatisticsIdAndTypes(statistics.getId(), Arrays.asList(IntegralRecordEnum.Type.ORDER_CHILD_PLATFORM_COMPENSATION.getValue()));
if (sum > ruleInfo.getPlatformCompensationRule().getIntegralCancelLimit()){
log.info("平台补偿超上限,本次无效, truckNo:{}, type:{}, integral:{}, remark:{}", truckNo, type, integral, remark);
return;
}
else if (sum+integral > ruleInfo.getPlatformCompensationRule().getIntegralCancelLimit()){
integral = ruleInfo.getPlatformCompensationRule().getIntegralCancelLimit()-sum;
}
else {
}
// 更新积分
statistics.setIntegral(statistics.getIntegral()+integral);
integralStatisticsDao.updateIntegral(statistics);
truck.setIntegral(statistics.getIntegral());
integralTruckDao.updateIntegral(truck);
// 新增积分记录
IntegralRecord record = save(statistics.getId(), statistics.getStatisticsDate(), statistics.getTruckNo(), type, integral, remark);
// 发送mq (新增积分记录)
integralMqService.integralRecordAdd(record.getStatisticsId(), record.getTruckNo(), record.getType(), record.getIntegral(), record.getRemark());
}
@Override @Override
public IntegralRecord save(Integer statisticsId, LocalDateTime statisticsDate, String truckNo, Integer type, Integer integral, String remark){ public IntegralRecord save(Integer statisticsId, LocalDateTime statisticsDate, String truckNo, Integer type, Integer integral, String remark){
IntegralRecord record = new IntegralRecord(); IntegralRecord record = new IntegralRecord();
......
...@@ -15,6 +15,7 @@ import com.clx.performance.model.breakcontract.BreakContractDriverRule; ...@@ -15,6 +15,7 @@ import com.clx.performance.model.breakcontract.BreakContractDriverRule;
import com.clx.performance.param.app.breakcontract.DriverPageBreakContractDriverRecordParam; import com.clx.performance.param.app.breakcontract.DriverPageBreakContractDriverRecordParam;
import com.clx.performance.param.pc.breakcontract.carrier.BreakContractDriverRecordAddParam; import com.clx.performance.param.pc.breakcontract.carrier.BreakContractDriverRecordAddParam;
import com.clx.performance.param.pc.breakcontract.carrier.PageBreakContractDriverRecordParam; import com.clx.performance.param.pc.breakcontract.carrier.PageBreakContractDriverRecordParam;
import com.clx.performance.service.IntegralRecordService;
import com.clx.performance.service.breakcontract.BreakContractDriverRecordService; import com.clx.performance.service.breakcontract.BreakContractDriverRecordService;
import com.clx.performance.service.breakcontract.BreakContractMqService; import com.clx.performance.service.breakcontract.BreakContractMqService;
import com.clx.performance.service.impl.UniqueOrderNumService; import com.clx.performance.service.impl.UniqueOrderNumService;
...@@ -57,6 +58,8 @@ public class BreakContractDriverRecordServiceImpl implements BreakContractDrive ...@@ -57,6 +58,8 @@ public class BreakContractDriverRecordServiceImpl implements BreakContractDrive
private BreakContractMqService breakContractMqService; private BreakContractMqService breakContractMqService;
@Autowired @Autowired
private UniqueOrderNumService uniqueOrderNumService; private UniqueOrderNumService uniqueOrderNumService;
@Autowired
private IntegralRecordService integralRecordService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -101,6 +104,11 @@ public class BreakContractDriverRecordServiceImpl implements BreakContractDrive ...@@ -101,6 +104,11 @@ public class BreakContractDriverRecordServiceImpl implements BreakContractDrive
// 发送mq (违约记录新增) // 发送mq (违约记录新增)
breakContractMqService.driverRecordAdd(record.getId()); breakContractMqService.driverRecordAdd(record.getId());
// 保存平台补偿积分
if (Objects.equals(param.getBreakContractPartyType(), BreakContractRecordEnum.BreakContractPartyType.PLATFORM.getCode())) {
integralRecordService.addPlatformCompensationRecord(record.getTruckNo());
}
} }
@Override @Override
......
package com.clx.performance.service.impl.integral;
import com.alibaba.fastjson.JSON;
import com.clx.performance.dao.integral.IntegralRuleDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.integral.IntegralRule;
import com.clx.performance.param.pc.integral.IntegralRuleUpdateParam;
import com.clx.performance.service.integral.IntegralRuleService;
import com.clx.performance.vo.pc.integral.AppIntegralRuleVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class IntegralRuleServiceImpl implements IntegralRuleService {
@Autowired
private IntegralRuleDao integralRuleDao;
@Override
public void updateRule(IntegralRuleUpdateParam param) {
IntegralRule rule = integralRuleDao.getEntityByKey(1).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
rule.setOrderChildCompleteRuleJson(JSON.toJSONString(param.getOrderChildCompleteRule()));
rule.setOrderAwardRuleJson(JSON.toJSONString(param.getOrderAwardRule()));
rule.setOrderDiscountRuleJson(JSON.toJSONString(param.getOrderDiscountRule()));
rule.setOrderChildTimeoutRuleJson(JSON.toJSONString(param.getOrderChildTimeoutRule()));
rule.setPlatformCompensationRuleJson(JSON.toJSONString(param.getPlatformCompensationRule()));
rule.setDriverReportRuleJson(JSON.toJSONString(param.getDriverReportRule()));
integralRuleDao.update(rule);
}
@Override
public AppIntegralRuleVO getRuleInfo() {
IntegralRule rule = integralRuleDao.getEntityByKey(1).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
AppIntegralRuleVO vo = new AppIntegralRuleVO();
vo.setOrderChildCompleteRule(JSON.parseObject(rule.getOrderChildCompleteRuleJson(), AppIntegralRuleVO.OrderChildCompleteRule.class));
vo.setOrderAwardRule(JSON.parseObject(rule.getOrderAwardRuleJson(), AppIntegralRuleVO.OrderAwardRule.class));
vo.setOrderChildCancelRule(JSON.parseObject(rule.getOrderDiscountRuleJson(), AppIntegralRuleVO.OrderChildCancelRule.class));
vo.setOrderChildTimeoutRule(JSON.parseObject(rule.getOrderChildTimeoutRuleJson(), AppIntegralRuleVO.OrderChildTimeoutRule.class));
vo.setPlatformCompensationRule(JSON.parseObject(rule.getPlatformCompensationRuleJson(), AppIntegralRuleVO.PlatformCompensationRule.class));
vo.setDriverReportRule(JSON.parseObject(rule.getDriverReportRuleJson(), AppIntegralRuleVO.DriverReportRule.class));
return vo;
}
}
package com.clx.performance.service.integral;
import com.clx.performance.param.pc.integral.IntegralRuleUpdateParam;
import com.clx.performance.vo.pc.integral.AppIntegralRuleVO;
public interface IntegralRuleService {
void updateRule(IntegralRuleUpdateParam param);
AppIntegralRuleVO getRuleInfo();
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论