Commit 2c7ba0c2 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents c707d5a6 c3611a0f
Showing with 246 additions and 114 deletions
...@@ -19,6 +19,7 @@ package com.dituhui.pea.dispatch; ...@@ -19,6 +19,7 @@ package com.dituhui.pea.dispatch;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
/** /**
...@@ -27,6 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -27,6 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@EnableFeignClients(basePackages = {"com.dituhui.pea.user"}) @EnableFeignClients(basePackages = {"com.dituhui.pea.user"})
@Import(cn.hutool.extra.spring.SpringUtil.class)
public class DispatchServiceApplication { public class DispatchServiceApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package com.dituhui.pea.dispatch.common; package com.dituhui.pea.dispatch.common.redis;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration @Configuration
...@@ -16,10 +21,27 @@ public class RedisConfig { ...@@ -16,10 +21,27 @@ public class RedisConfig {
// objectMapper.activateDefaultTyping(objectMapper.getPolymorphicTypeValidator(), // objectMapper.activateDefaultTyping(objectMapper.getPolymorphicTypeValidator(),
// ObjectMapper.DefaultTyping.EVERYTHING, JsonTypeInfo.As.PROPERTY); // ObjectMapper.DefaultTyping.EVERYTHING, JsonTypeInfo.As.PROPERTY);
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
Jackson2JsonRedisSerializer jacksonSerial = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper objectMapper = new ObjectMapper();
// 指定要序列化的域,field, get和set,以及修饰符范围,ANY是都有包括private和public
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会抛出异常
objectMapper.activateDefaultTyping(objectMapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
// jsonToBean时,json中有的字段,bean中没有 无法匹配时,忽略此字段,不抛出异常(默认是抛出异常的)
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
jacksonSerial.setObjectMapper(objectMapper);
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>(); RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(connectionFactory); redisTemplate.setConnectionFactory(connectionFactory);
redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new StringRedisSerializer()); redisTemplate.setValueSerializer(jacksonSerial);
// 设置hash key 和 value 序列化模式
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(jacksonSerial);
return redisTemplate; return redisTemplate;
} }
......
package com.dituhui.pea.dispatch.common; package com.dituhui.pea.dispatch.common.redis;
import org.redisson.Redisson; import org.redisson.Redisson;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
......
package com.dituhui.pea.dispatch.common; package com.dituhui.pea.dispatch.common.redis;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
...@@ -67,8 +67,12 @@ public class DispatchConstraintProvider implements ConstraintProvider { ...@@ -67,8 +67,12 @@ public class DispatchConstraintProvider implements ConstraintProvider {
Integer arrivalTime = customer.getArrivalTime(); Integer arrivalTime = customer.getArrivalTime();
if (arrivalTime != null && arrivalTime > 0) { if (arrivalTime != null && arrivalTime > 0) {
boolean in = false; boolean in = false;
Integer departureTime = customer.getDepartureTime();
for (int[] window : timeWindows) { for (int[] window : timeWindows) {
if (window[0] <= arrivalTime && window[1] >= arrivalTime) { if (window[0] <= arrivalTime
&& window[1] >= arrivalTime
&& window[0] <= departureTime
&& window[1] >= departureTime) {
in = true; in = true;
break; break;
} }
......
package com.dituhui.pea.dispatch.constraint;
public class RedisKeyConstant {
public static final String LOCATION_DISTANCE_KEY = "location:%s:distance:%s";
public static final String LOCATION_DISTANCE_TIME_KEY = "location:%s:distanceTime:%s";
}
package com.dituhui.pea.dispatch.quartz.dispatch; package com.dituhui.pea.dispatch.quartz.dispatch;
import com.dituhui.pea.dispatch.common.RedissonUtil;
import com.dituhui.pea.dispatch.service.SchedulerService; import com.dituhui.pea.dispatch.service.SchedulerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution; import org.quartz.DisallowConcurrentExecution;
......
...@@ -40,9 +40,9 @@ public class BatchScheduler { ...@@ -40,9 +40,9 @@ public class BatchScheduler {
@Autowired @Autowired
ExtractService extractService; ExtractService extractService;
@Autowired @Autowired
OrgTeamDao orgTeamDao; OrgTeamDao orgTeamDao;
private DefaultSolverFactory<DispatchSolution> solverFactory; private DefaultSolverFactory<DispatchSolution> solverFactory;
private Solver<DispatchSolution> solver; private Solver<DispatchSolution> solver;
...@@ -52,22 +52,22 @@ public class BatchScheduler { ...@@ -52,22 +52,22 @@ public class BatchScheduler {
solver = solverFactory.buildSolver(); solver = solverFactory.buildSolver();
} }
/* /*
* 异步执行任务开始 * 异步执行任务开始
*/ */
//@Scheduled(cron = "${dispatch.cron.expr}") //@Scheduled(cron = "${dispatch.cron.expr}")
public void dispatchRun2() { public void dispatchRun2() {
String groupId = "gsuzhou"; String groupId = "gsuzhou";
log.info("dispatchRun group:{}", groupId); log.info("dispatchRun group:{}", groupId);
// TODO 分布式任务,循环大区/分部/分站/小队 // TODO 分布式任务,循环大区/分部/分站/小队
// 循环分站/网点下面的小队 // 循环分站/网点下面的小队
List<OrgTeamEntity> teams = orgTeamDao.findByGroupId(groupId); List<OrgTeamEntity> teams = orgTeamDao.findByGroupId(groupId);
for (OrgTeamEntity team : teams) { for (OrgTeamEntity team : teams) {
String teamId = team.getTeamId(); String teamId = team.getTeamId();
for (int i = 1; i <= nextDaysLimit; i++) { for (int i = 1; i <= nextDaysLimit; i++) {
String currDay = LocalDate.now().plusDays(i).format(DateTimeFormatter.ISO_LOCAL_DATE); String currDay = LocalDate.now().plusDays(i).format(DateTimeFormatter.ISO_LOCAL_DATE);
log.info("dispatchRun begin----- teamId:{}, day:{}", teamId, currDay); log.info("dispatchRun begin----- teamId:{}, day:{}", teamId, currDay);
String batchNo = batchService.buildBatchData2(teamId, currDay, false); String batchNo = batchService.buildBatchData2(teamId, currDay, false);
UUID problemId = solveService.generateProblemId(teamId, batchNo); UUID problemId = solveService.generateProblemId(teamId, batchNo);
...@@ -88,19 +88,19 @@ public class BatchScheduler { ...@@ -88,19 +88,19 @@ public class BatchScheduler {
log.info("dispatchRun done ------ teamId:{}, day:{}", teamId, currDay); log.info("dispatchRun done ------ teamId:{}, day:{}", teamId, currDay);
JacksonSolutionFileIO<DispatchSolution> exporter = new JacksonSolutionFileIO<DispatchSolution>(DispatchSolution.class); JacksonSolutionFileIO<DispatchSolution> exporter = new JacksonSolutionFileIO<DispatchSolution>(DispatchSolution.class);
exporter.write(solution, new File(String.format("dispatchSolution_%s_%s.json",teamId, currDay))); exporter.write(solution, new File(String.format("dispatchSolution_%s_%s.json", teamId, currDay)));
} }
} }
log.info("dispatchRun group:{} done", groupId);
}
log.info("dispatchRun group:{} done", groupId);
}
/* /*
* 异步执行任务开始 * 异步执行任务开始
* */ * */
//@Scheduled(cron = "${dispatch.cron.expr}") //@Scheduled(cron = "${dispatch.cron.expr}")
public void dispatchRun() { public void dispatchRun() {
String groupId = "gsuzhou"; String groupId = "gsuzhou";
log.info("dispatchRun group:{}", groupId); log.info("dispatchRun group:{}", groupId);
try { try {
for (int i = 0; i <= nextDaysLimit; i++) { for (int i = 0; i <= nextDaysLimit; i++) {
...@@ -155,7 +155,7 @@ public class BatchScheduler { ...@@ -155,7 +155,7 @@ public class BatchScheduler {
// Set the output file. // Set the output file.
exporter.write(solution, new File(String.format("dispatchSolution_%s_%s.json",groupId, currDay))); exporter.write(solution, new File(String.format("dispatchSolution_%s_%s.json", groupId, currDay)));
Thread.sleep(1000 * 5); Thread.sleep(1000 * 5);
......
...@@ -3,9 +3,12 @@ package com.dituhui.pea.dispatch.service.impl; ...@@ -3,9 +3,12 @@ package com.dituhui.pea.dispatch.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.dituhui.pea.dispatch.dao.*; import com.dituhui.pea.dispatch.dao.*;
import com.dituhui.pea.dispatch.entity.*; import com.dituhui.pea.dispatch.entity.*;
import com.dituhui.pea.dispatch.pojo.Customer;
import com.dituhui.pea.dispatch.pojo.DispatchSolution;
import com.dituhui.pea.dispatch.service.ExtractService; import com.dituhui.pea.dispatch.service.ExtractService;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
...@@ -295,7 +298,13 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -295,7 +298,13 @@ public class ExtractServiceImpl implements ExtractService {
orderInfo.setArriveElapsed(0); orderInfo.setArriveElapsed(0);
orderInfo.setArriveDistance(0); orderInfo.setArriveDistance(0);
orderInfo.setAppointmentStatus("INIT"); orderInfo.setAppointmentStatus("INIT");
orderInfo.setDispatcher("AUTO_BATCH"); if (cutOff) {
orderInfo.setAppointmentMethod("MANUAL");
orderInfo.setDispatcher("MANUAL");
log.info("算法结果更新到工单为人工, teamId:{}, batchNo:{}, orderId:{}", teamId, batchNo, orderId);
} else {
orderInfo.setDispatcher("AUTO_BATCH");
}
orderInfo.setUpdateTime(LocalDateTime.now()); orderInfo.setUpdateTime(LocalDateTime.now());
orderInfoRepo.save(orderInfo); orderInfoRepo.save(orderInfo);
......
...@@ -3,7 +3,6 @@ package com.dituhui.pea.dispatch.service.impl; ...@@ -3,7 +3,6 @@ package com.dituhui.pea.dispatch.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.dituhui.pea.dispatch.common.RedissonUtil;
import com.dituhui.pea.dispatch.dao.DispatchBatchRepository; import com.dituhui.pea.dispatch.dao.DispatchBatchRepository;
import com.dituhui.pea.dispatch.dao.OrgGroupRepository; import com.dituhui.pea.dispatch.dao.OrgGroupRepository;
import com.dituhui.pea.dispatch.dao.OrgTeamDao; import com.dituhui.pea.dispatch.dao.OrgTeamDao;
...@@ -11,7 +10,6 @@ import com.dituhui.pea.dispatch.entity.DispatchBatch; ...@@ -11,7 +10,6 @@ import com.dituhui.pea.dispatch.entity.DispatchBatch;
import com.dituhui.pea.dispatch.entity.OrgGroup; import com.dituhui.pea.dispatch.entity.OrgGroup;
import com.dituhui.pea.dispatch.entity.OrgTeamEntity; import com.dituhui.pea.dispatch.entity.OrgTeamEntity;
import com.dituhui.pea.dispatch.pojo.DispatchSolution; import com.dituhui.pea.dispatch.pojo.DispatchSolution;
import com.dituhui.pea.dispatch.quartz.dispatch.AutoDispatchJob;
import com.dituhui.pea.dispatch.service.BatchService; import com.dituhui.pea.dispatch.service.BatchService;
import com.dituhui.pea.dispatch.service.ExtractService; import com.dituhui.pea.dispatch.service.ExtractService;
import com.dituhui.pea.dispatch.service.SchedulerService; import com.dituhui.pea.dispatch.service.SchedulerService;
......
...@@ -3,7 +3,7 @@ server: ...@@ -3,7 +3,7 @@ server:
dispatch: dispatch:
cron: cron:
expr: 0 9 8-23 * * ? expr: 0 20 8-23 * * ?
next-day-limit: 2 next-day-limit: 2
scheduler: scheduler:
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<property name="FILE_LOG_PATTERN" <property name="FILE_LOG_PATTERN"
value="%d{yyyy-MM-dd HH:mm:ss} %-5level ${spring.application.name:-} %thread %logger %msg%n"/> value="%d{yyyy-MM-dd HH:mm:ss} %-5level ${spring.application.name:-} %thread %logger %msg%n"/>
<!-- 控制台输出 --> <!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level> <level>DEBUG</level>
</filter> </filter>
...@@ -29,23 +29,44 @@ ...@@ -29,23 +29,44 @@
</encoder> </encoder>
</appender> </appender>
<!-- 按照每天生成常规日志文件 --> <appender name="FILE_DEBUG"
<appender name="FileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}/info/${spring.application.name:-}.info.log</file> <File>${LOG_FILE}/debug/${spring.application.name:-}.debug.log</File>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<FileNamePattern>${LOG_FILE}/debug/${spring.application.name:-}.debug-%d{yyyy-MM-dd}-%i.zip
</FileNamePattern>
<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
<maxHistory>${LOG_FILEMAXDAY}</maxHistory>
<totalSizeCap>500MB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
<!-- 基于时间的分包策略 --> <filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印错误日志 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <level>DEBUG</level>
<fileNamePattern>${LOG_FILE}/info/${spring.application.name:-}.info.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <onMatch>ACCEPT</onMatch>
<!--保留时间,单位:天--> <onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="FILE_INFO"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_FILE}/info/${spring.application.name:-}.info.log</File>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<FileNamePattern>${LOG_FILE}/debug/${spring.application.name:-}.info-%d{yyyy-MM-dd}-%i.zip
</FileNamePattern>
<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
<maxHistory>${LOG_FILEMAXDAY}</maxHistory> <maxHistory>${LOG_FILEMAXDAY}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <totalSizeCap>500MB</totalSizeCap>
<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy> </rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印错误日志 -->
<level>INFO</level> <level>INFO</level>
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
...@@ -98,26 +119,6 @@ ...@@ -98,26 +119,6 @@
</filter> </filter>
</appender> </appender>
<appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}/debug/${spring.application.name:-}.debug.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 基于时间的分包策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}/debug/${spring.application.name:-}.debug.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--保留时间,单位:天-->
<maxHistory>${LOG_FILEMAXDAY}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
</filter>
</appender>
<!-- 异步输出 --> <!-- 异步输出 -->
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<!-- 0-不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> <!-- 0-不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
...@@ -125,7 +126,7 @@ ...@@ -125,7 +126,7 @@
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>256</queueSize> <queueSize>256</queueSize>
<!-- 添加附加的appender,最多只能添加一个 --> <!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="FileAppender"/> <appender-ref ref="FILE_INFO"/>
</appender> </appender>
<logger name="org.optaplanner" level="info"/> <logger name="org.optaplanner" level="info"/>
...@@ -133,8 +134,8 @@ ...@@ -133,8 +134,8 @@
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="CONSOLE"/>
<appender-ref ref="FileAppender"/> <appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/> <appender-ref ref="FILE_ERROR"/>
<appender-ref ref="FILE_WARN"/> <appender-ref ref="FILE_WARN"/>
</root> </root>
......
...@@ -91,9 +91,6 @@ public class MsgController { ...@@ -91,9 +91,6 @@ public class MsgController {
@PostMapping("/msg/add") @PostMapping("/msg/add")
public Result<Boolean> add(@RequestBody @Valid MsgDTO dto) { public Result<Boolean> add(@RequestBody @Valid MsgDTO dto) {
CommonUtil.setNullValue(dto); CommonUtil.setNullValue(dto);
AssertUtil.checkArgument(StrUtil.isNotEmpty(dto.getClusterId())
|| StrUtil.isNotEmpty(dto.getBranchId())
|| StrUtil.isNotEmpty(dto.getGroupId()), "大区Id、分部Id、分组Id不能同时为空");
msgService.add(dto); msgService.add(dto);
return Result.success(true); return Result.success(true);
} }
......
...@@ -86,4 +86,20 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -86,4 +86,20 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.is_read=0 and r.user_id=?1" " from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.is_read=0 and r.user_id=?1"
, nativeQuery = true) , nativeQuery = true)
Integer getUnReadNum(String userId); Integer getUnReadNum(String userId);
@Query(value = "SELECT count(t.id)" +
" from zzz_msg t" +
" where IF(:groupId is not null, t.group_id =:groupId, t.group_id is null)" +
" and IF(:branchId is not null, t.branch_id =:branchId, t.branch_id is null)" +
" and IF(:clusterId is not null, t.cluster_id =:clusterId, t.cluster_id is null)" +
" and t.capacity_layer_id = :capacityLayerId" +
" and t.capacity_date = :capacityDate" +
" and date_format(t.create_time,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')"
, nativeQuery = true
)
Integer getCapacityMsgCount(@Param("clusterId") String clusterId,
@Param("branchId") String branchId,
@Param("groupId") String groupId,
@Param("capacityLayerId") String capacityLayerId,
@Param("capacityDate") String capacityDate);
} }
...@@ -50,6 +50,16 @@ public class MsgDTO { ...@@ -50,6 +50,16 @@ public class MsgDTO {
@Max(value = 1, message = "标签类型格式不对") @Max(value = 1, message = "标签类型格式不对")
private Integer tag; private Integer tag;
/**
* 容量所属图层 ID
*/
private String capacityLayerId;
/**
* 容量所属日期
*/
private String capacityDate;
@Data @Data
public static class IdDTO { public static class IdDTO {
......
...@@ -26,7 +26,7 @@ public class ScheduleEngineerOverviewResp { ...@@ -26,7 +26,7 @@ public class ScheduleEngineerOverviewResp {
/** /**
* 在途公里数 * 在途公里数
*/ */
private Integer distance; private String distance;
/** /**
* 上门时间 * 上门时间
*/ */
......
...@@ -73,5 +73,17 @@ public class MsgEntity { ...@@ -73,5 +73,17 @@ public class MsgEntity {
@Column(name = "update_time", nullable = false, columnDefinition = "datetime default current_timestamp") @Column(name = "update_time", nullable = false, columnDefinition = "datetime default current_timestamp")
private Date updateTime; private Date updateTime;
/**
* 容量类所属图层ID
*/
@Column(name = "capacity_layer_id")
private String capacityLayerId;
/**
* 容量类所属日期:2022-10-20
*/
@Column(name = "capacity_date")
private String capacityDate;
} }
...@@ -169,7 +169,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService { ...@@ -169,7 +169,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
} }
String layerId = UUID.randomUUID().toString().replace("-", ""); String layerId = UUID.randomUUID().toString().replace("-", "");
// 同步创建saas图层,返回layerId // 同步创建saas图层,返回layerId
String saasLayerName = branchId + "_" + layerId; String saasLayerName = branchId + "_" + layerId;
String result = saasRemoteService.addLayer(ak, saasLayerName, 1, 1); String result = saasRemoteService.addLayer(ak, saasLayerName, 1, 1);
...@@ -304,16 +304,16 @@ public class BusinessLayerServiceImpl implements BusinessLayerService { ...@@ -304,16 +304,16 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
List<String> items = new ArrayList<>(); List<String> items = new ArrayList<>();
List<SkillInfoEntity> skills = skillInfoDao.findAll(); List<SkillInfoEntity> skills = skillInfoDao.findAll();
Map<String, String> skillMap = skills.stream().collect(Collectors.toMap( Map<String, SkillInfoEntity> skillMap = skills.stream().collect(Collectors.toMap(
SkillInfoEntity::getSkillCode, SkillInfoEntity::getSkill)); SkillInfoEntity::getSkillCode, e -> e));
List<MapLayerCustomizeSkillEntity> laySkills = mapLayerCustomizeSkillDao.findByLayerId(layerId); List<MapLayerCustomizeSkillEntity> laySkills = mapLayerCustomizeSkillDao.findByLayerId(layerId);
for (MapLayerCustomizeSkillEntity s : laySkills) { for (MapLayerCustomizeSkillEntity s : laySkills) {
if (s.getStatus() == 0) { if (s.getStatus() == 0) {
continue; continue;
} }
String skill = skillMap.getOrDefault(s.getSkillCode(), ""); SkillInfoEntity skill = skillMap.getOrDefault(s.getSkillCode(), null);
items.add(skill); items.add(skill.getType() + "-" + skill.getSkill());
} }
return items; return items;
} }
......
...@@ -373,8 +373,9 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -373,8 +373,9 @@ public class DispatchServiceImpl implements DispatchService {
if (CollectionUtils.isNotEmpty(errorList)) { if (CollectionUtils.isNotEmpty(errorList)) {
String msg = errorList.size() > 3 ? String.join(",", errorList.subList(0, 3)) + "..." : String.join(",", errorList); String msg = errorList.size() > 3 ? String.join(",", errorList.subList(0, 3)) + "..." : String.join(",", errorList);
resultList.add(String.format(StatusCodeEnum.ENGINEER_IS_LEAVE_TIME.getDesc(), msg, engineer.getName())); resultList.add(String.format(StatusCodeEnum.ENGINEER_IS_LEAVE_TIME.getDesc(), msg, engineer.getName()));
return Result.failed(CollectionUtils.isNotEmpty(resultList) ? String.join(",", resultList) : null);
} }
return Result.success(CollectionUtils.isNotEmpty(resultList) ? String.join(",", resultList) : null); return Result.success();
} }
@Override @Override
......
...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.service.impl; ...@@ -2,6 +2,7 @@ package com.dituhui.pea.order.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dituhui.pea.common.PageResult; import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.order.dao.*; import com.dituhui.pea.order.dao.*;
...@@ -16,6 +17,7 @@ import com.dituhui.pea.order.entity.OrgGroupEntity; ...@@ -16,6 +17,7 @@ import com.dituhui.pea.order.entity.OrgGroupEntity;
import com.dituhui.pea.order.enums.MsgTagEnum; import com.dituhui.pea.order.enums.MsgTagEnum;
import com.dituhui.pea.order.enums.MsgTypeEnum; import com.dituhui.pea.order.enums.MsgTypeEnum;
import com.dituhui.pea.order.service.MsgService; import com.dituhui.pea.order.service.MsgService;
import com.dituhui.pea.order.utils.AssertUtil;
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.data.domain.*; import org.springframework.data.domain.*;
...@@ -121,6 +123,10 @@ public class MsgServiceImpl implements MsgService { ...@@ -121,6 +123,10 @@ public class MsgServiceImpl implements MsgService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(MsgDTO dto) { public void add(MsgDTO dto) {
AssertUtil.checkArgument(StrUtil.isNotEmpty(dto.getClusterId())
|| StrUtil.isNotEmpty(dto.getBranchId())
|| StrUtil.isNotEmpty(dto.getGroupId()), "大区Id、分部Id、分组Id不能同时为空");
if (Objects.nonNull(dto.getGroupId())) { if (Objects.nonNull(dto.getGroupId())) {
OrgGroupEntity group = groupDao.getByGroupId(dto.getGroupId()); OrgGroupEntity group = groupDao.getByGroupId(dto.getGroupId());
dto.setBranchId(group.getBranchId()); dto.setBranchId(group.getBranchId());
...@@ -133,6 +139,19 @@ public class MsgServiceImpl implements MsgService { ...@@ -133,6 +139,19 @@ public class MsgServiceImpl implements MsgService {
dto.setClusterId(branch.getClusterId()); dto.setClusterId(branch.getClusterId());
} }
if (ObjectUtil.equals(MsgTypeEnum.CAPACITY.getCode(), dto.getType())) {
AssertUtil.checkArgument(ObjectUtil.isNotEmpty(dto.getCapacityLayerId())
&& ObjectUtil.isNotEmpty(dto.getCapacityDate()), "容量类消息图层ID、所属日期不能为空");
int count = msgDao.getCapacityMsgCount(dto.getClusterId(),
dto.getBranchId(),
dto.getGroupId(),
dto.getCapacityLayerId(),
dto.getCapacityDate());
if (count > 0) {
return;
}
}
List<String> userList = msgDao.getDispatchUserList(dto.getClusterId(), dto.getBranchId(), dto.getGroupId()); List<String> userList = msgDao.getDispatchUserList(dto.getClusterId(), dto.getBranchId(), dto.getGroupId());
MsgEntity msgEntity = new MsgEntity(); MsgEntity msgEntity = new MsgEntity();
......
...@@ -308,7 +308,7 @@ public class OrderAssignImpl implements OrderAssign { ...@@ -308,7 +308,7 @@ public class OrderAssignImpl implements OrderAssign {
private OrderInfoEntity handleMultipleOrders(OrderInfoEntity order) { private OrderInfoEntity handleMultipleOrders(OrderInfoEntity order) {
//处理一家多单逻辑 //处理一家多单逻辑
Result<String> deleteMultipleOrders = orderInfoService.deleteMultipleOrders(order.getMultipleOrders(), order.getAddressId()); Result<String> deleteMultipleOrders = orderInfoService.deleteMultipleOrders(order.getMultipleOrders(), order.getOrderId());
if (!deleteMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) { if (!deleteMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) {
throw new BusinessException("改约日期失败"); throw new BusinessException("改约日期失败");
} }
......
...@@ -802,7 +802,7 @@ public class OrderInfoServiceImpl implements OrderInfoService { ...@@ -802,7 +802,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
private OrderInfoEntity handleMultipleOrders(OrderInfoEntity order) { private OrderInfoEntity handleMultipleOrders(OrderInfoEntity order) {
//处理一家多单逻辑 //处理一家多单逻辑
Result<String> deleteMultipleOrders = this.deleteMultipleOrders(order.getMultipleOrders(), order.getAddressId()); Result<String> deleteMultipleOrders = this.deleteMultipleOrders(order.getMultipleOrders(), order.getOrderId());
if (!deleteMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) { if (!deleteMultipleOrders.getCode().equals(ResultEnum.SUCCESS.getCode())) {
throw new BusinessException("改约日期失败"); throw new BusinessException("改约日期失败");
} }
......
...@@ -16,6 +16,7 @@ import com.dituhui.pea.order.entity.*; ...@@ -16,6 +16,7 @@ import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.enums.OrderFlowEnum; import com.dituhui.pea.order.enums.OrderFlowEnum;
import com.dituhui.pea.order.enums.VehicleEnum; import com.dituhui.pea.order.enums.VehicleEnum;
import com.dituhui.pea.order.service.ScheduleService; import com.dituhui.pea.order.service.ScheduleService;
import com.dituhui.pea.order.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -128,10 +129,10 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -128,10 +129,10 @@ public class ScheduleServiceImpl implements ScheduleService {
List<ScheduleOverviewResp.Item> children = new ArrayList<>(); List<ScheduleOverviewResp.Item> children = new ArrayList<>();
Integer teamDistance = 0; Integer teamDistance = 0;
Integer minOrderSum=0; Integer minOrderSum = 0;
Integer maxOrderSum=0; Integer maxOrderSum = 0;
Integer minDistance=0; Integer minDistance = 0;
Integer maxDistance=0; Integer maxDistance = 0;
for (Map.Entry<String, List<EngineerInfoEntity>> entry : engineers.entrySet()) { for (Map.Entry<String, List<EngineerInfoEntity>> entry : engineers.entrySet()) {
ScheduleOverviewResp.Item child = new ScheduleOverviewResp.Item(); ScheduleOverviewResp.Item child = new ScheduleOverviewResp.Item();
...@@ -149,31 +150,31 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -149,31 +150,31 @@ public class ScheduleServiceImpl implements ScheduleService {
child.setOrderDesc(Integer.toString(orders2.size())); child.setOrderDesc(Integer.toString(orders2.size()));
Integer distanceSum = orders2.stream().map(order -> Objects.nonNull(order.getArriveDistance()) ? order.getArriveDistance() : 0).reduce(Integer::sum).orElse(0); Integer distanceSum = orders2.stream().map(order -> Objects.nonNull(order.getArriveDistance()) ? order.getArriveDistance() : 0).reduce(Integer::sum).orElse(0);
teamDistance += distanceSum; teamDistance += distanceSum;
child.setDistanceDesc(distanceSum + ""); child.setDistanceDesc(CommonUtil.converMToKm(distanceSum));
children.add(child); children.add(child);
if(null==minOrderSum||null==maxOrderSum){ if (null == minOrderSum || null == maxOrderSum) {
minOrderSum=child.getOrder().getTotal(); minOrderSum = child.getOrder().getTotal();
maxOrderSum=child.getOrder().getTotal(); maxOrderSum = child.getOrder().getTotal();
}else { } else {
if(child.getOrder().getTotal()<minOrderSum){ if (child.getOrder().getTotal() < minOrderSum) {
minOrderSum=child.getOrder().getTotal(); minOrderSum = child.getOrder().getTotal();
} }
if(child.getOrder().getTotal()>maxOrderSum){ if (child.getOrder().getTotal() > maxOrderSum) {
maxOrderSum=child.getOrder().getTotal(); maxOrderSum = child.getOrder().getTotal();
} }
} }
if(null==minDistance||null==maxDistance){ if (null == minDistance || null == maxDistance) {
minDistance=distanceSum; minDistance = distanceSum;
maxDistance=distanceSum; maxDistance = distanceSum;
}else { } else {
if(distanceSum<minDistance){ if (distanceSum < minDistance) {
minDistance=distanceSum; minDistance = distanceSum;
} }
if(distanceSum>maxDistance){ if (distanceSum > maxDistance) {
maxDistance=distanceSum; maxDistance = distanceSum;
} }
} }
} }
...@@ -189,8 +190,8 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -189,8 +190,8 @@ public class ScheduleServiceImpl implements ScheduleService {
teamEngineers.size() > 0 ? new BigDecimal(teamDistance) teamEngineers.size() > 0 ? new BigDecimal(teamDistance)
.divide(new BigDecimal(teamEngineers.size()), 2, RoundingMode.HALF_UP) .divide(new BigDecimal(teamEngineers.size()), 2, RoundingMode.HALF_UP)
.stripTrailingZeros() : 0, .stripTrailingZeros() : 0,
minDistance, CommonUtil.converMToKm(minDistance),
maxDistance)); CommonUtil.converMToKm(maxDistance)));
teams.add(team); teams.add(team);
} }
...@@ -267,7 +268,7 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -267,7 +268,7 @@ public class ScheduleServiceImpl implements ScheduleService {
.divide(new BigDecimal(60), 2, RoundingMode.HALF_UP) .divide(new BigDecimal(60), 2, RoundingMode.HALF_UP)
.stripTrailingZeros() .stripTrailingZeros()
+ "时"); + "时");
dynamics.setRoadTotalDistance(sumDistance + "公里"); dynamics.setRoadTotalDistance(CommonUtil.converMToKm(sumDistance) + "公里");
if (Objects.nonNull(engineerBusinessEntity)) { if (Objects.nonNull(engineerBusinessEntity)) {
dynamics.setWorkTime(engineerBusinessEntity.getWorkOn() + "-" + engineerBusinessEntity.getWorkOff()); dynamics.setWorkTime(engineerBusinessEntity.getWorkOn() + "-" + engineerBusinessEntity.getWorkOff());
} else { } else {
...@@ -289,7 +290,7 @@ public class ScheduleServiceImpl implements ScheduleService { ...@@ -289,7 +290,7 @@ public class ScheduleServiceImpl implements ScheduleService {
item.setSkill(o.getSkill()); item.setSkill(o.getSkill());
item.setOrderStatus(o.getAppointmentStatus()); item.setOrderStatus(o.getAppointmentStatus());
item.setOrderStatusName(""); item.setOrderStatusName("");
item.setDistance(o.getArriveDistance()); item.setDistance(CommonUtil.converMToKm(o.getArriveDistance()));
item.setTimeType("auto"); item.setTimeType("auto");
if (Objects.nonNull(o.getArriveElapsed())) { if (Objects.nonNull(o.getArriveElapsed())) {
......
...@@ -11,6 +11,7 @@ import com.dituhui.pea.order.dto.OrderChangeListDTO; ...@@ -11,6 +11,7 @@ import com.dituhui.pea.order.dto.OrderChangeListDTO;
import com.dituhui.pea.order.dto.WorkbenchSummaryResp; import com.dituhui.pea.order.dto.WorkbenchSummaryResp;
import com.dituhui.pea.order.entity.OrderEventEntity; import com.dituhui.pea.order.entity.OrderEventEntity;
import com.dituhui.pea.order.entity.OrderInfoEntity; import com.dituhui.pea.order.entity.OrderInfoEntity;
import com.dituhui.pea.order.enums.AppointmentMethodEnum;
import com.dituhui.pea.order.enums.OrderFlowEnum; import com.dituhui.pea.order.enums.OrderFlowEnum;
import com.dituhui.pea.order.service.WorkbenchService; import com.dituhui.pea.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -79,16 +80,26 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -79,16 +80,26 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return Result.success(rs); return Result.success(rs);
} }
/**
* 工作台工单状态统计
*
* @param levelType
* @param levelValue
* @param dt
* @return
*/
@Override @Override
public Result<?> getWorkbenchSummary(String levelType, String levelValue, LocalDate dt) { public Result<?> getWorkbenchSummary(String levelType, String levelValue, LocalDate dt) {
List<WorkbenchSummaryResp.ItemDTO> items = new ArrayList<>(); List<WorkbenchSummaryResp.ItemDTO> items = new ArrayList<>();
//处理工单分配状态 待人工处理 待自动处理 全部订单
HashMap<String, Long> methodSummary = this.transAppointmentMethod(this.queryCountByAppointmentMethod(levelType, levelValue, dt)); HashMap<String, Long> methodSummary = this.transAppointmentMethod(this.queryCountByAppointmentMethod(levelType, levelValue, dt));
WorkbenchSummaryResp.ItemDTO methodItem = new WorkbenchSummaryResp.ItemDTO(); WorkbenchSummaryResp.ItemDTO methodItem = new WorkbenchSummaryResp.ItemDTO();
methodItem.setType("order"); methodItem.setType("order");
methodItem.setRows(this.packValueAppointmentMethod(methodSummary)); methodItem.setRows(this.packValueAppointmentMethod(methodSummary));
items.add(methodItem); items.add(methodItem);
// 处理改约。取消。超时等状态
HashMap<String, Long> statusSummary = this.transOrderStatus(this.queryCountByOrderStatus(levelType, levelValue, dt)); HashMap<String, Long> statusSummary = this.transOrderStatus(this.queryCountByOrderStatus(levelType, levelValue, dt));
WorkbenchSummaryResp.ItemDTO statusItem = new WorkbenchSummaryResp.ItemDTO(); WorkbenchSummaryResp.ItemDTO statusItem = new WorkbenchSummaryResp.ItemDTO();
statusItem.setType("order"); statusItem.setType("order");
...@@ -99,7 +110,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -99,7 +110,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
// - 已延误:已到开始时间,TARO没有反馈开始的工单. // - 已延误:已到开始时间,TARO没有反馈开始的工单.
valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已延误", queryDelayNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>())); valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已延误", queryDelayNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>()));
statusItem.setRows(valueDTOS); statusItem.setRows(valueDTOS);
// - 已超时:已到开始时间,TARO没有反馈开始的工单. // - 已超时:已过预计结束时间,TARO没有反馈开始的工单.
valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已超时", queryOvertimeNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>())); valueDTOS.add(new WorkbenchSummaryResp.ValueDTO("已超时", queryOvertimeNum(levelType, levelValue, dt), null, "#FF3D44", "", new HashMap<>()));
statusItem.setRows(valueDTOS); statusItem.setRows(valueDTOS);
items.add(statusItem); items.add(statusItem);
...@@ -186,6 +197,14 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -186,6 +197,14 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return rescheduledNum; return rescheduledNum;
} }
/**
* 分组统计订单分配状态
*
* @param levelType
* @param levelValue
* @param dt
* @return
*/
private List<Map<String, Object>> queryCountByAppointmentMethod(String levelType, String levelValue, LocalDate dt) { private List<Map<String, Object>> queryCountByAppointmentMethod(String levelType, String levelValue, LocalDate dt) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Object[]> criteriaQuery = criteriaBuilder.createQuery(Object[].class); CriteriaQuery<Object[]> criteriaQuery = criteriaBuilder.createQuery(Object[].class);
...@@ -278,6 +297,12 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -278,6 +297,12 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return mappedResults; return mappedResults;
} }
/**
* 组装分组数据
*
* @param results
* @return
*/
private HashMap<String, Long> transAppointmentMethod(List<Map<String, Object>> results) { private HashMap<String, Long> transAppointmentMethod(List<Map<String, Object>> results) {
HashMap<String, Long> map = new HashMap<>(); HashMap<String, Long> map = new HashMap<>();
...@@ -291,15 +316,15 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -291,15 +316,15 @@ public class WorkbenchServiceImpl implements WorkbenchService {
total += count; total += count;
if (method.equals("MANUAL")) { if (method.equals(AppointmentMethodEnum.MANUAL.name())) {
manualTotal += count; manualTotal += count;
} else if (method.startsWith("AUTO_")) { } else if (method.startsWith("AUTO_")) {
autoTotal += count; autoTotal += count;
} }
if (method.equals("MANUAL") && status.equals("INIT")) { if (method.equals(AppointmentMethodEnum.MANUAL.name()) && status.equals(OrderFlowEnum.INIT.name())) {
map.put("manualDealing", count); map.put("manualDealing", count);
} else if (method.equals("AUTO_") && status.equals("INIT")) { } else if (method.startsWith("AUTO_") && status.equals(OrderFlowEnum.INIT.name())) {
map.put("autoDealing", count); map.put("autoDealing", count);
} }
} }
......
...@@ -5,6 +5,7 @@ import com.dituhui.pea.util.DateUtil; ...@@ -5,6 +5,7 @@ import com.dituhui.pea.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
...@@ -112,6 +113,13 @@ public class CommonUtil { ...@@ -112,6 +113,13 @@ public class CommonUtil {
} }
} }
public static String converMToKm(Integer m) {
if (Objects.isNull(m)) {
return null;
}
return BigDecimal.valueOf(m / 1000.0).stripTrailingZeros().toString();
}
public static void main(String[] args) { public static void main(String[] args) {
isCutoff(LocalDateTime.now(), "18:00"); isCutoff(LocalDateTime.now(), "18:00");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!