浏览代码

补充内部调用更新工作票进度

Frankensteinly 11 月之前
父节点
当前提交
fafe7c89be

+ 2 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/IIsJobTicketLockService.java

@@ -59,4 +59,6 @@ public interface IIsJobTicketLockService extends IService<IsJobTicketLock>
      * @return 结果
      */
     int deleteIsJobTicketLockByRecordId(Long recordId);
+
+    List<IsJobTicketLock> selectByTicketId(Long ticketId);
 }

+ 34 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareApiServiceImpl.java

@@ -2,6 +2,7 @@ package com.ktg.iscs.service.impl;
 
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ktg.common.utils.SecurityUtils;
 import com.ktg.common.utils.bean.BeanUtils;
 import com.ktg.iscs.domain.*;
 import com.ktg.iscs.domain.dto.hardwareApi.*;
@@ -10,6 +11,7 @@ import com.ktg.iscs.domain.enums.LockStatusEnum;
 import com.ktg.iscs.domain.enums.LocksetStatusEnum;
 import com.ktg.iscs.domain.enums.PointStatusEnum;
 import com.ktg.iscs.domain.vo.hardwareApi.*;
+import com.ktg.iscs.domain.vo.ticket.JobTicketUpdateProgressReqVO;
 import com.ktg.iscs.service.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +19,7 @@ import org.springframework.stereotype.Service;
 
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 硬件Service业务层处理
@@ -92,6 +95,12 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                     .set(IsJobTicketKey::getCollectTime, date)
                     .set(IsJobTicketKey::getKeyStatus, KeyStatusEnum.TAKED.status));
         }
+
+        JobTicketUpdateProgressReqVO reqVO = new JobTicketUpdateProgressReqVO();
+        reqVO.userId = SecurityUtils.getUserId();
+        reqVO.ticketId = dto.getTicketId();
+        reqVO.equipStatus = 3;
+        isJobTicketService.updateTicketProgress(reqVO);
         return true;
     }
 
@@ -137,6 +146,11 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                     .set(IsJobTicketKey::getGiveBackTime, date)
                     .set(IsJobTicketKey::getKeyStatus, KeyStatusEnum.RETURNED.status));
         }
+        JobTicketUpdateProgressReqVO reqVO = new JobTicketUpdateProgressReqVO();
+        reqVO.userId = SecurityUtils.getUserId();
+        reqVO.ticketId = dto.getTicketId();
+        isJobTicketService.updateTicketProgress(reqVO);
+
         return true;
     }
 
@@ -175,6 +189,17 @@ public class HardwareApiServiceImpl implements HardwareApiService {
             iIsJobTicketLockService.updateById(isJobTicketLock);
         }
 
+        List<IsJobTicketLock> lockList = iIsJobTicketLockService.selectByTicketId(list.get(0).getTicketId());
+        // 已取锁数量
+        int takeCount = lockList.stream().filter(data -> data.getLockId() != null).collect(Collectors.toList()).size();
+        int status = takeCount == lockList.size() ? 2 : 1;
+
+        JobTicketUpdateProgressReqVO reqVO = new JobTicketUpdateProgressReqVO();
+        reqVO.ticketId = list.get(0).getTicketId();
+        reqVO.userId = SecurityUtils.getUserId();
+        reqVO.equipStatus = status;
+        isJobTicketService.updateTicketProgress(reqVO);
+
 
         /*int size = list.size();
         List<String> nfcList = list.stream().map(TakeTicketLockDTO::getLockNfc).collect(Collectors.toList());
@@ -246,6 +271,10 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                 log.error("当前挂锁找到多条关联的作业票, nfc: {}, name : {}", dto.getLockNfc(), lock.getLockName());
             }
         }
+        JobTicketUpdateProgressReqVO reqVO = new JobTicketUpdateProgressReqVO();
+        reqVO.userId = SecurityUtils.getUserId();
+        reqVO.ticketId = dto.getTicketId();
+        isJobTicketService.updateTicketProgress(reqVO);
         return true;
     }
 
@@ -342,6 +371,11 @@ public class HardwareApiServiceImpl implements HardwareApiService {
                         .set(IsJobTicketLock::getLockStatus, LockStatusEnum.REMOVED_LOCK.status));
             }
         }
+        JobTicketUpdateProgressReqVO reqVO = new JobTicketUpdateProgressReqVO();
+        reqVO.userId = SecurityUtils.getUserId();
+        reqVO.ticketId = list.get(0).getTicketId();
+        isJobTicketService.updateTicketProgress(reqVO);
+
         return true;
     }
 

+ 5 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsJobTicketLockServiceImpl.java

@@ -98,4 +98,9 @@ public class IsJobTicketLockServiceImpl extends ServiceImpl<IsJobTicketLockMappe
     {
         return isJobTicketLockMapper.deleteIsJobTicketLockByRecordId(recordId);
     }
+
+    @Override
+    public List<IsJobTicketLock> selectByTicketId(Long ticketId) {
+        return isJobTicketLockMapper.selectList(IsJobTicketLock::getTicketId, ticketId);
+    }
 }