From b82a5aa7d6167748cce7e94f53b6a3b1fbc201b3 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 26 九月 2024 17:13:52 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java |   51 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
index 771f5c1..cd03e09 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
@@ -174,7 +174,8 @@
                 .selectAs(PlatformGroup::getName,PlatformJob::getPlatformGroupName)
                 .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
                 .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
-                .selectAs(SystemUser::getUsername,PlatformJob::getOutUserName)
+                .selectAs(PlatformWmsJob::getIoCreatedate,PlatformJob::getIoCreatedate)
+                .selectAs(SystemUser::getRealname,PlatformJob::getOutUserName)
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                 .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId)
                 .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
@@ -202,6 +203,7 @@
                 .eq(pageWrap.getModel().getSingType() != null, PlatformJob::getSingType, pageWrap.getModel().getSingType())
                 .eq(pageWrap.getModel().getSignDistance() != null, PlatformJob::getSignDistance, pageWrap.getModel().getSignDistance())
                 .eq(pageWrap.getModel().getPlatformNames() != null, PlatformJob::getPlatformNames, pageWrap.getModel().getPlatformNames())
+                .like(pageWrap.getModel().getPlatformName() != null, Platform::getName, pageWrap.getModel().getPlatformName())
                 .eq(pageWrap.getModel().getPlatforms() != null, PlatformJob::getPlatforms, pageWrap.getModel().getPlatforms())
                 .eq(pageWrap.getModel().getPlatformId() != null, PlatformJob::getPlatformId, pageWrap.getModel().getPlatformId())
                 .ge(pageWrap.getModel().getInwaitDate() != null, PlatformJob::getInwaitDate, Utils.Date.getStart(pageWrap.getModel().getInwaitDate()))
@@ -257,8 +259,8 @@
                 .ge(pageWrap.getModel().getBeginWorkDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(pageWrap.getModel().getBeginWorkDateStart()))
                 .le(pageWrap.getModel().getBeginWorkDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(pageWrap.getModel().getBeginWorkDateEnd()))
 
-                .ge(pageWrap.getModel().getCreateDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(pageWrap.getModel().getCreateDateStart()))
-                .le(pageWrap.getModel().getCreateDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDateEnd()))
+                .ge(pageWrap.getModel().getCreateDateStart() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getStart(pageWrap.getModel().getCreateDateStart()))
+                .le(pageWrap.getModel().getCreateDateEnd() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getEnd(pageWrap.getModel().getCreateDateEnd()))
                 .eq(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ONE,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh)
                 .ne(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ZERO,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh)
         ;
@@ -295,10 +297,6 @@
                 .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
                 .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId())
                 .like(pageWrap.getModel().getCarCodeFront() != null, PlatformJob::getCarCodeFront, pageWrap.getModel().getCarCodeFront())
-//                .eq(Objects.nonNull(pageWrap.getModel().getCallType())
-//                        &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE),
-//                        PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()
-//                )
 
                 .apply(Objects.nonNull(pageWrap.getModel().getCallType())
                                 &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE),
@@ -324,7 +322,7 @@
                                 &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.THREE),
                         i->i.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()).or()
                                 .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.IN_WAIT.getKey()).or()
-                                .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey()).or()
+//                                .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey()).or()
                                 .apply(" ( t.status = "+Constants.PlatformJobStatus.TRANSFERING.getKey()+" and t.PLATFORM_GROUP_ID = "+pageWrap.getModel().getPlatformGroupId()+" ) ")
                 )
 //                .like(PlatformJob::getArriveDate,DateUtil.dateTypeToString(new Date(),"yyyy-MM-dd"))
@@ -549,6 +547,16 @@
         }else{
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"绛惧埌绫诲瀷閿欒");
         }
+        //鏌ヨ鏈堝彴缁勬暟鎹�
+        PlatformGroup platformGroup = platformGroupMapper.selectById(platformJob.getPlatformGroupId());
+        if(Objects.isNull(platformGroup)){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏈堝彴缁勪俊鎭�");
+        }
+        if(System.currentTimeMillis() > DateUtil.getDateByString(DateUtil.getCurrDate() + " " + platformGroup.getEndTime() + ":59" ).getTime()
+        || System.currentTimeMillis() < DateUtil.getDateByString(DateUtil.getCurrDate() + " " + platformGroup.getStartTime() + ":00" ).getTime()){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈湪宸ヤ綔鏃堕棿["+platformGroup.getStartTime() + "-" + platformGroup.getEndTime() +"]锛屾棤娉曡繘琛岀鍒�");
+        }
+
         platformJob.setSignDate(new Date());
         platformJob.setSingType(signInDTO.getSignType());
         platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());
@@ -616,13 +624,16 @@
         ){
             //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺
             this.queryWaitNum(platformJob);
+            Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId());
+            if(Objects.nonNull(platform)){
+                platformJob.setPlatformName(platform.getName());
+            }
         }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){
             //浣滀笟鏈堝彴淇℃伅
             Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId());
             if(Objects.nonNull(platform)){
                 platformJob.setPlatformName(platform.getName());
             }
-
         }
         platformJob.dealTime();
         this.getWorkTime(platformJob);
@@ -677,7 +688,7 @@
                             .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                             .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                             .eq(PlatformJob::getPlatformGroupId,platformGroup.getId())
-                            .ge(Objects.nonNull(platformJob),PlatformJob::getSignDate,DateUtil.dateTypeToString(platformJob.getSignDate(),"yyyy-MM-dd HH:mm:ss"))
+                            .le(Objects.nonNull(platformJob),PlatformJob::getSignDate,DateUtil.dateTypeToString(platformJob.getSignDate(),"yyyy-MM-dd HH:mm:ss"))
                             .in(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey(),
                                     Constants.PlatformJobStatus.IN_WAIT.getKey(),
                                     Constants.PlatformJobStatus.CALLED.getKey())
@@ -916,7 +927,7 @@
         if(platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda()
                 .eq(PlatformJob::getPlatformId,platform.getId())
                 .in(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey(),Constants.PlatformJobStatus.WORKING.getKey())
-        )>platform.getWorkingNum()){
+        )>=platform.getWorkingNum()){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瓒呭嚭鏈堝彴鍙悓鏃朵綔涓氭暟閲廩"+platform.getWorkingNum()+"杈哴");
         };
 
@@ -1115,7 +1126,8 @@
         if(Objects.isNull(platformJob)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){
+        if(! (Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())
+        ||Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.EXCEPTION.getKey()) )){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�");
         }
         PlatformJob oldPlatformJob = new PlatformJob();
@@ -1145,7 +1157,7 @@
      */
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
-    public void powerLevel(JobOperateDTO jobOperateDTO){
+    public PlatformJob powerLevel(JobOperateDTO jobOperateDTO){
         if(Objects.isNull(jobOperateDTO)
                 || Objects.isNull(jobOperateDTO.getJobId())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -1163,11 +1175,16 @@
         platformJob.setOutHkdate(new Date());
         platformJob.setStatus(Constants.PlatformJobStatus.AUTHED_LEAVE.getKey());
         platformJob.setEditDate(new Date());
+        platformJob.setRemark(jobOperateDTO.getRemark());
         platformJobMapper.updateById(platformJob);
         //瀛樺偍鎿嶄綔鏃ュ織
         savePlatformLog(Constants.PlatformJobLogType.AUTHED_LEAVE.getKey(),oldPlatformJob,platformJob ,
                 Constants.PlatformJobLogType.AUTHED_LEAVE.getInfo());
-        //TODO 鎺堟潈杞﹁締绂诲満鏉冮檺
+        return platformJob;
+
+
+
+
     }
 
 
@@ -1272,6 +1289,7 @@
                 platformLog.setParam2(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss"));
                 String v = Long.toString((platformLog.getCreateDate().getTime() - DateUtil.StringToDate(lastBeginPlatform.getParam1(),"yyyy-MM-dd HH:mm:ss").getTime() )/ 1000) ;
                 platformLog.setParam3(v);
+                platformLog.setRemark(platformJobBefor.getPlatformId().toString());
             }else{
                 platformLog.setParam3("0");
             }
@@ -1299,6 +1317,7 @@
                 platformLog.setParam2(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss"));
                 String v = Long.toString((platformJobAfter.getDoneDate().getTime() -  DateUtil.StringToDate(lastBeginPlatform.getParam1(),"yyyy-MM-dd HH:mm:ss").getTime()) / 1000) ;
                 platformLog.setParam3(v);
+                platformLog.setRemark(platformJobBefor.getPlatformId().toString());
             }
         }else if(Constants.equalsInteger(objType,Constants.PlatformJobLogType.WORKING.getKey())){
             platformLog.setParam1(DateUtil.dateTypeToString(platformLog.getCreateDate(),"yyyy-MM-dd HH:mm:ss"));
@@ -1400,7 +1419,9 @@
                 .selectAll(PlatformJob.class)
                 .selectAs(Platform::getName,PlatformJob::getPlatformName)
                 .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
+                .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
+                .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getJobId,PlatformJob::getId)
                 .eq(PlatformJob::getPlatformId,platformId)
                 .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                 .in(PlatformJob::getStatus,
@@ -1420,7 +1441,7 @@
             //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺
             this.queryWaitNum(platformJob);
         }
-        PlatformWorkVO platformWorkVO = PlatformGroupServiceImpl.getPlatformWorkVO(platformId,platformJobList);
+        PlatformWorkVO platformWorkVO = PlatformGroupServiceImpl.getPlatformWorkVO(platformJoinMapper.selectById(platformId),platformJobList);
         return platformWorkVO;
     }
 

--
Gitblit v1.9.3