From a1647a5152e3d368ec2fb738ca7cc858e220d06c Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 24 九月 2024 09:15:08 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java |   84 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 75 insertions(+), 9 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 a4b0ac7..af60a31 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
@@ -17,6 +17,7 @@
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.openapi.request.*;
 import com.doumee.dao.openapi.response.*;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.dao.web.reqeust.*;
 import com.doumee.dao.web.response.DriverHomeVO;
 import com.doumee.dao.web.response.LineUpVO;
@@ -94,6 +95,15 @@
         platformJobMapper.deleteById(id);
     }
 
+
+    @Override
+    public void delete(Integer id) {
+        platformJobMapper.update(null,new UpdateWrapper<PlatformJob>().lambda()
+                        .set(PlatformJob::getIsdeleted,Constants.ONE)
+                        .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CANCEL.getKey())
+                .eq(PlatformJob::getId,id));
+    }
+
     @Override
     public void delete(PlatformJob platformJob) {
         UpdateWrapper<PlatformJob> deleteWrapper = new UpdateWrapper<>(platformJob);
@@ -150,8 +160,10 @@
                 .selectAs(Platform::getName,PlatformJob::getPlatformName)
                 .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
                 .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
+                .selectAs(SystemUser::getUsername,PlatformJob::getOutUserName)
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                 .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
+                .leftJoin(SystemUser.class,SystemUser::getId,PlatformJob::getOutUserId)
                 .eq(pageWrap.getModel().getId() != null, PlatformJob::getId, pageWrap.getModel().getId())
                 .eq(pageWrap.getModel().getCreator() != null, PlatformJob::getCreator, pageWrap.getModel().getCreator())
                 .ge(pageWrap.getModel().getCreateDate() != null, PlatformJob::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()))
@@ -225,6 +237,12 @@
                 .eq(pageWrap.getModel().getInType() != null, PlatformJob::getInType, pageWrap.getModel().getInType())
                 .eq(pageWrap.getModel().getTotalNum() != null, PlatformJob::getTotalNum, pageWrap.getModel().getTotalNum())
                 .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId())
+
+                .apply(pageWrap.getModel().getQueryStatus() != null, " find_in_set(t.`STATUS`,'"+pageWrap.getModel().getQueryStatus()+"')")
+                .ge(pageWrap.getModel().getBeginWorkDateStart() != null, PlatformJob::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getBeginWorkDateStart()))
+                .le(pageWrap.getModel().getBeginWorkDateEnd() != null, PlatformJob::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getBeginWorkDateEnd()))
+                .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)
         ;
 
         for(PageWrap.SortData sortData: pageWrap.getSorts()) {
@@ -275,7 +293,7 @@
                                 .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"))
+//                .like(PlatformJob::getArriveDate,DateUtil.dateTypeToString(new Date(),"yyyy-MM-dd"))
                 .orderByDesc(PlatformJob::getStatus)
         ;
         IPage<PlatformJob> platformJobIPage = platformJobJoinMapper.selectJoinPage(page,PlatformJob.class,queryWrapper);
@@ -355,7 +373,8 @@
             }else{
                 platformJob.setWaitTime("绛夊緟鍙彿");
             }
-        }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){
+        }else if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())
+        || Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){
             //鏌ヨ鏈�鍚庡紑濮嬩换鍔$殑鏈堝彴璁板綍  鏃ュ織琛�  鍥犱负瀛樺湪寮傚父鎸傝捣 杞Щ 绛夐棶棰�
             PlatformLog platformLog = platformLogMapper.selectOne(new QueryWrapper<PlatformLog>().lambda()
                     .eq(PlatformLog::getJobId,platformJob.getId())
@@ -398,7 +417,7 @@
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                 .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                 .eq(PlatformJob::getDrivierPhone,loginUserInfo.getMobile())
-                .like(PlatformJob::getArriveDate,DateUtil.getCurrDate())
+//                .like(PlatformJob::getArriveDate,DateUtil.getCurrDate())
                 .orderByDesc(PlatformJob::getId)
         );
         for (PlatformJob platformJob:platformJobList) {
@@ -444,8 +463,9 @@
 
         PlatformJob oldPlatformJob = new PlatformJob();
         BeanUtils.copyProperties(platformJob,oldPlatformJob);
-
+        platformJob.setConfirmTaskDate(new Date());
         platformJob.setArriveDate(confirmTaskDTO.getArriveDate());
+        platformJob.setCarCodeBack(confirmTaskDTO.getCarCodeBack());
         platformJob.setStatus(Constants.PlatformJobStatus.WART_SIGN_IN.getKey());
         platformJob.setEditDate(new Date());
         platformJobMapper.updateById(platformJob);
@@ -470,19 +490,31 @@
         if(Objects.isNull(platformJob)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅");
-        }
+
         PlatformJob oldPlatformJob = new PlatformJob();
         BeanUtils.copyProperties(platformJob,oldPlatformJob);
 
         if(Constants.equalsInteger(signInDTO.getSignType(),Constants.ZERO)){
+            if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅");
+            }
             this.distanceSignIn(signInDTO,platformJob);
         }else if(Constants.equalsInteger(signInDTO.getSignType(),Constants.ONE)){
+            if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅");
+            }
             this.sceneSignIn(signInDTO);
+        }else if(Constants.equalsInteger(signInDTO.getSignType(),Constants.TWO)){
+            if(!(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CONFIRM.getKey())||
+                    Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey()))
+            ){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆锛岃鍒锋柊鏌ョ湅");
+            }
+        }else{
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"绛惧埌绫诲瀷閿欒");
         }
         platformJob.setSignDate(new Date());
-        platformJob.setSingType(Constants.ZERO);
+        platformJob.setSingType(signInDTO.getSignType());
         platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());
         platformJobMapper.updateById(platformJob);
         //瀛樺偍鎿嶄綔鏃ュ織
@@ -490,12 +522,12 @@
                 Constants.PlatformJobLogType.SIGN.getInfo());
     }
 
-
     public void distanceSignIn(SignInDTO signInDTO , PlatformJob platformJob){
         if(Objects.isNull(signInDTO.getLat())
                 || Objects.isNull(signInDTO.getLnt())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"缁忕含搴︿俊鎭紓甯�");
         }
+
         //鑾峰彇绛惧埌鐐圭殑缁忕含搴�
         Double lat = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LAT).getCode());
         Double lnt = Double.parseDouble(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_PLACE_LNT).getCode());
@@ -511,6 +543,7 @@
     }
 
     public void sceneSignIn(SignInDTO signInDTO){
+
         if( StringUtils.isNotBlank(signInDTO.getQrCodeKey())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -697,6 +730,7 @@
         || Constants.equalsInteger(platformJob.getType(),Constants.THREE)
         || Constants.equalsInteger(platformJob.getType(),Constants.FOUR)){
             //TODO 涓嬪彂鍏ュ洯鏉冮檺
+
 
         }
         //瀛樺偍鎿嶄綔鏃ュ織
@@ -946,6 +980,38 @@
 
 
     /**
+     * 鎺堟潈绂诲洯
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void powerLevel(JobOperateDTO jobOperateDTO){
+        if(Objects.isNull(jobOperateDTO)
+                || Objects.isNull(jobOperateDTO.getJobId())){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
+        if(Objects.isNull(platformJob)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�");
+        }
+        PlatformJob oldPlatformJob = new PlatformJob();
+        BeanUtils.copyProperties(platformJob,oldPlatformJob);
+        platformJob.setOutUserId(jobOperateDTO.getLoginUserInfo().getId());
+        platformJob.setOutHkdate(new Date());
+        platformJob.setStatus(Constants.PlatformJobStatus.AUTHED_LEAVE.getKey());
+        platformJob.setEditDate(new Date());
+        platformJobMapper.updateById(platformJob);
+        //瀛樺偍鎿嶄綔鏃ュ織
+        savePlatformLog(Constants.PlatformJobLogType.AUTHED_LEAVE.getKey(),oldPlatformJob,platformJob ,
+                Constants.PlatformJobLogType.AUTHED_LEAVE.getInfo());
+
+        //TODO 鎺堟潈杞﹁締绂诲満鏉冮檺
+    }
+
+
+    /**
      * 鏈堝彴鐩告満鎺ㄩ�� 寮�濮嬩綔涓�
      * @param jobOperateDTO
      */

--
Gitblit v1.9.3