提交 84aad68a authored 作者: aiqingguo's avatar aiqingguo

车辆信息上报优化

上级 7ef33231
...@@ -31,7 +31,7 @@ public enum IntegralRecordEnum { ...@@ -31,7 +31,7 @@ public enum IntegralRecordEnum {
ORDER_CHILD_PLATFORM_COMPENSATION(25, "平台补偿"), ORDER_CHILD_PLATFORM_COMPENSATION(25, "平台补偿"),
REPORT_TRUCK_INFO(50, "提交基础信息"), // REPORT_TRUCK_INFO(50, "提交基础信息"),
REPORT_REFUEL(51, "油表上报"), REPORT_REFUEL(51, "油表上报"),
REPORT_TRAFFIC(52, "上报交通拥堵"), REPORT_TRAFFIC(52, "上报交通拥堵"),
REPORT_SEND_ADDRESS_WAIT(53, "上报货源地需要排队"), REPORT_SEND_ADDRESS_WAIT(53, "上报货源地需要排队"),
...@@ -41,6 +41,12 @@ public enum IntegralRecordEnum { ...@@ -41,6 +41,12 @@ public enum IntegralRecordEnum {
REPORT_QUALITY(57, "上报煤炭质量问题"), REPORT_QUALITY(57, "上报煤炭质量问题"),
REPORT_ABNORMAL(58, "上报拉运异常问题"), REPORT_ABNORMAL(58, "上报拉运异常问题"),
REPORT_SEND_ADDRESS_INFO(59, "上报货源地情况"), REPORT_SEND_ADDRESS_INFO(59, "上报货源地情况"),
REPORT_TRUCK_INFO_OF_UNLOAD_TYPE(61, "提交基础信息"),
REPORT_TRUCK_INFO_OF_AUTO_LOAN(62, "提交基础信息"),
REPORT_TRUCK_INFO_OF_PARK_ADDRESS(63, "提交基础信息"),
; ;
private Integer value; private Integer value;
...@@ -49,7 +55,6 @@ public enum IntegralRecordEnum { ...@@ -49,7 +55,6 @@ public enum IntegralRecordEnum {
// 取消 // 取消
public static final List<Integer> DRIVER_REPORT_lIST = Arrays.asList( public static final List<Integer> DRIVER_REPORT_lIST = Arrays.asList(
Type.REPORT_TRUCK_INFO.value,
Type.REPORT_REFUEL.value, Type.REPORT_REFUEL.value,
Type.REPORT_TRAFFIC.value, Type.REPORT_TRAFFIC.value,
Type.REPORT_SEND_ADDRESS_WAIT.value, Type.REPORT_SEND_ADDRESS_WAIT.value,
...@@ -60,18 +65,6 @@ public enum IntegralRecordEnum { ...@@ -60,18 +65,6 @@ public enum IntegralRecordEnum {
Type.REPORT_ABNORMAL.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
);
} }
...@@ -23,6 +23,9 @@ public interface IntegralRecordDao extends BaseDao<IntegraRecordMapper, Integral ...@@ -23,6 +23,9 @@ 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 existByTruckNoAndType(@Param("truckNo") String truckNo, @Param("type") Integer type);
Integer sumByStatisticsIdAndTypes(@Param("statisticsId") Integer statisticsId, @Param("list") List<Integer> typeList); Integer sumByStatisticsIdAndTypes(@Param("statisticsId") Integer statisticsId, @Param("list") List<Integer> typeList);
Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId, Integer sumByStatisticsIdAndTypeAndTime(@Param("statisticsId") Integer statisticsId,
......
...@@ -45,6 +45,11 @@ public class IntegralRecordDaoImpl extends BaseDaoImpl<IntegraRecordMapper, Inte ...@@ -45,6 +45,11 @@ public class IntegralRecordDaoImpl extends BaseDaoImpl<IntegraRecordMapper, Inte
); );
} }
@Override
public int existByTruckNoAndType(String truckNo, Integer type) {
return baseMapper.existByTruckNoAndType(truckNo, type);
}
@Override @Override
public Integer sumByStatisticsIdAndTypes(Integer statisticsId, List<Integer> typeList) { public Integer sumByStatisticsIdAndTypes(Integer statisticsId, List<Integer> typeList) {
return baseMapper.sumByStatisticsIdAndTypes(statisticsId, typeList); return baseMapper.sumByStatisticsIdAndTypes(statisticsId, typeList);
......
...@@ -48,4 +48,7 @@ public interface IntegraRecordMapper extends BaseMapper<IntegralRecord> { ...@@ -48,4 +48,7 @@ public interface IntegraRecordMapper extends BaseMapper<IntegralRecord> {
@Param("beginTime")String beginTime, @Param("beginTime")String beginTime,
@Param("endTime")String endTime); @Param("endTime")String endTime);
@Select("SELECT IFNULL((SELECT 1 FROM integral_record WHERE truck_no=#{truckNo} and type=#{type} LIMIT 1),0)")
int existByTruckNoAndType(@Param("truckNo") String truckNo, @Param("type") Integer type);
} }
\ No newline at end of file
...@@ -12,6 +12,8 @@ public interface IntegralRecordService { ...@@ -12,6 +12,8 @@ public interface IntegralRecordService {
void addDriverReportRecord(AppIntegralRuleVO ruleInfo, String truckNo, Integer type, Integer integral, String remark); void addDriverReportRecord(AppIntegralRuleVO ruleInfo, String truckNo, Integer type, Integer integral, String remark);
void addDriverTruckReportRecord(AppIntegralRuleVO ruleInfo, String truckNo, Integer type, Integer integral, String remark);
void addPlatformCompensationRecord(String truckNo); 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);
......
...@@ -104,6 +104,38 @@ public class IntegralRecordServiceImpl implements IntegralRecordService { ...@@ -104,6 +104,38 @@ public class IntegralRecordServiceImpl implements IntegralRecordService {
} }
@Override
public void addDriverTruckReportRecord(AppIntegralRuleVO ruleInfo, String truckNo, Integer type, Integer integral, String remark) {
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 exist = integralRecordDao.existByTruckNoAndType(truckNo, type);
if (exist > 0){
log.info("上报积分重复,本次无效, truckNo:{}, type:{}, integral:{}, remark:{}", truckNo, type, integral, remark);
return;
}
// 更新积分
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 void addPlatformCompensationRecord(String truckNo) { public void addPlatformCompensationRecord(String truckNo) {
......
...@@ -217,7 +217,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService { ...@@ -217,7 +217,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
IntegralRecordEnum.Type.ORDER_CHILD_ARRIVE_SEND_ADDRESS_TIMEOUT_CANCEL.getValue() IntegralRecordEnum.Type.ORDER_CHILD_ARRIVE_SEND_ADDRESS_TIMEOUT_CANCEL.getValue()
); );
List<Integer> reportTypeList = Arrays.asList( List<Integer> reportTypeList = Arrays.asList(
IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getValue(),
IntegralRecordEnum.Type.REPORT_REFUEL.getValue(), IntegralRecordEnum.Type.REPORT_REFUEL.getValue(),
IntegralRecordEnum.Type.REPORT_TRAFFIC.getValue(), IntegralRecordEnum.Type.REPORT_TRAFFIC.getValue(),
IntegralRecordEnum.Type.REPORT_SEND_ADDRESS_WAIT.getValue(), IntegralRecordEnum.Type.REPORT_SEND_ADDRESS_WAIT.getValue(),
...@@ -226,7 +226,11 @@ public class IntegralTruckServiceImpl implements IntegralTruckService { ...@@ -226,7 +226,11 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
IntegralRecordEnum.Type.REPORT_RECEIVE_ADDRESS_NO_WAIT.getValue(), IntegralRecordEnum.Type.REPORT_RECEIVE_ADDRESS_NO_WAIT.getValue(),
IntegralRecordEnum.Type.REPORT_QUALITY.getValue(), IntegralRecordEnum.Type.REPORT_QUALITY.getValue(),
IntegralRecordEnum.Type.REPORT_ABNORMAL.getValue(), IntegralRecordEnum.Type.REPORT_ABNORMAL.getValue(),
IntegralRecordEnum.Type.REPORT_SEND_ADDRESS_INFO.getValue() IntegralRecordEnum.Type.REPORT_SEND_ADDRESS_INFO.getValue(),
IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_UNLOAD_TYPE.getValue(),
IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_AUTO_LOAN.getValue(),
IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_PARK_ADDRESS.getValue()
); );
for (Map.Entry<String, List<IntegralRecord>> entry : map.entrySet()) { for (Map.Entry<String, List<IntegralRecord>> entry : map.entrySet()) {
Integer orderChildCompleteIntegral = 0; Integer orderChildCompleteIntegral = 0;
......
...@@ -66,8 +66,8 @@ public class CollectTruckServiceImpl implements CollectTruckService { ...@@ -66,8 +66,8 @@ public class CollectTruckServiceImpl implements CollectTruckService {
AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo(); AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo();
// 报存积分 // 报存积分
integralRecordService.addDriverReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getValue(), integralRecordService.addDriverTruckReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_UNLOAD_TYPE.getValue(),
ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getMsg()); ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_UNLOAD_TYPE.getMsg());
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -100,8 +100,8 @@ public class CollectTruckServiceImpl implements CollectTruckService { ...@@ -100,8 +100,8 @@ public class CollectTruckServiceImpl implements CollectTruckService {
AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo(); AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo();
// 报存积分 // 报存积分
integralRecordService.addDriverReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getValue(), integralRecordService.addDriverTruckReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_AUTO_LOAN.getValue(),
ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getMsg()); ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_AUTO_LOAN.getMsg());
} }
...@@ -134,8 +134,8 @@ public class CollectTruckServiceImpl implements CollectTruckService { ...@@ -134,8 +134,8 @@ public class CollectTruckServiceImpl implements CollectTruckService {
AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo(); AppIntegralRuleVO ruleInfo = integralRuleService.getRuleInfo();
// 报存积分 // 报存积分
integralRecordService.addDriverReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getValue(), integralRecordService.addDriverTruckReportRecord(ruleInfo, truck.getTruckNo(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_PARK_ADDRESS.getValue(),
ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO.getMsg()); ruleInfo.getDriverReportRule().getIntegralTruck(), IntegralRecordEnum.Type.REPORT_TRUCK_INFO_OF_PARK_ADDRESS.getMsg());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论