龚焕茏
2024-08-22 58c5c6e49c8b4d67cd9d1637beea4706f9b5ae83
ycl-server/src/main/java/com/ycl/platform/service/impl/WorkOrderServiceImpl.java
@@ -59,6 +59,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -79,7 +80,7 @@
    private final WorkOrderYwConditionRecordMapper workOrderYwConditionRecordMapper;
    private final NotifyService notifyService;
    private final WorkOrderDistributeRecordMapper workOrderDistributeRecordMapper;
    private final TMonitorMapper monitorMapper;
    private final WorkOrderErrorTypeMapper workOrderErrorTypeMapper;
    private final SysConfigMapper configMapper;
    private final ServerConfig serverConfig;
    private final ReportMapper reportMapper;
@@ -214,6 +215,9 @@
        Date now = new Date();
        entity.setCreateTime(now);
        entity.setUpdateTime(now);
        entity.setErrorType(form.getErrorType().stream().map(ErrorTypeEnum::getValue).collect(Collectors.joining(",")));
        List<WorkOrderErrorType> workOrderErrorTypes = form.getErrorType().stream().map(errorType -> new WorkOrderErrorType(entity.getWorkOrderNo(), errorType.getValue())).toList();
        workOrderErrorTypeMapper.insertWorkOrderErrorTypeList(workOrderErrorTypes);
        if(baseMapper.insert(entity) > 0) {
            return Result.ok("添加成功");
        }
@@ -500,7 +504,7 @@
     */
    public synchronized Boolean getDistributeLock() {
        if (Objects.isNull(redisCache.getCacheObject(DISTRIBUTE_LOCK_KEY))) {
            redisCache.setCacheObject(DISTRIBUTE_LOCK_KEY, "1");
            redisCache.setCacheObject(DISTRIBUTE_LOCK_KEY, "1", 30, TimeUnit.SECONDS);
            return true;
        } else {
            return false;