From b92ca63c89b74404c3684f18c734d83531a9dd3f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 06 三月 2025 16:01:45 +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 |   54 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 22 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 eb84711..c1fd2cb 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
@@ -1,6 +1,7 @@
 package com.doumee.service.business.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
@@ -168,7 +169,7 @@
         String[] params = new String[3];
         params[0] = user.getRealname();
         params[1]=DateUtil.getPlusTime2(date);
-        params[2]=job.getBillCode()+"-銆愬徃鏈猴細"+job.getDriverName()+" "+job.getDrivierPhone()+"銆�-銆愯溅鐗屽彿锛�"+job.getCarCodeFront()+"銆�";
+        params[2]="銆愯繍鍗曞彿锛�"+job.getBillCode()+"銆�-銆愬徃鏈猴細"+job.getDriverName()+" "+job.getDrivierPhone()+"銆�-銆愯溅鐗屽彿锛�"+job.getCarCodeFront()+"銆�";
         //璁板綍鍒犻櫎鏃ュ織
         UserActionServiceImpl.saveUserActionBiz(user,id,Constants.UserActionType.PLATFROM_JOB_DEL,userActionMapper,date,params,JSONObject.toJSONString(job));
     }
@@ -335,14 +336,14 @@
                 .isNull(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ZERO,pageWrap.getModel().getJobType()), PlatformJob::getContractNum)
                 .exists(StringUtils.isNotBlank(pageWrap.getModel().getWmsContractNum()),
                         "select tt.id from platform_wms_detail tt where tt.isdeleted=0 and tt.contract_num='"+pageWrap.getModel().getWmsContractNum()+"' and  tt.job_id=t.id");
-
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+        queryWrapper.orderByDesc(PlatformJob::getCreateDate);
+        /*for(PageWrap.SortData sortData: pageWrap.getSorts()) {
             if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                 queryWrapper.orderByDesc(sortData.getProperty());
             } else {
                 queryWrapper.orderByAsc(sortData.getProperty());
             }
-        }
+        }*/
        IPage<PlatformJob> platformJobIPage = platformJobJoinMapper.selectJoinPage(page,PlatformJob.class,queryWrapper);
         platformJobIPage.getRecords().forEach(i->{
             i.dealTime();
@@ -365,7 +366,8 @@
                 .selectAs(Platform::getName,PlatformJob::getPlatformName)
                 .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
                 .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
-                .select(" case when t.total_num is null  then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id  ) else t.total_num end ioQty ")
+                .select(" (select GROUP_CONCAT(distinct(tt.contract_num ))  from platform_wms_detail tt where tt.isdeleted=0 and tt.contract_num is not null   and  tt.job_id=t.id )as wmsContractNum")
+//                .select(" case when t.total_num is null  then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id  ) else t.total_num end ioQty ")
                 .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                 .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
                 .leftJoin(PlatformBooks.class,PlatformBooks::getJobId,PlatformJob::getId)
@@ -398,11 +400,15 @@
                 )
 //                .like(PlatformJob::getArriveDate,DateUtil.dateTypeToString(new Date(),"yyyy-MM-dd"))
                 .orderByDesc(PlatformJob::getStatus)
+                .orderByAsc(PlatformJob::getSignDate)
         ;
         IPage<PlatformJob> platformJobIPage = platformJobJoinMapper.selectJoinPage(page,PlatformJob.class,queryWrapper);
         platformJobIPage.getRecords().forEach(i->{
             i.dealTime();
-            i.setTotalNum(i.getIoQty());
+            if(Constants.equalsInteger(i.getOrigin(),Constants.ZERO)){
+                i.setWmsContractNum(i.getContractNum());
+            }
+//            i.setTotalNum(i.getIoQty());
 //            this.getWmsJobData(i);
 //            this.queryWaitNum(i);
         });
@@ -583,7 +589,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(confirmTaskDTO.getId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!Constants.equalsInteger(platformJob.getStatus(),Constants.ZERO)){
@@ -619,7 +625,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(signInDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
 
@@ -664,6 +670,7 @@
         }
         //鏌ヨ浠婃棩鏈�澶х殑绛惧埌鏁�
         List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda()
+                .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                 .apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null  "));
         if(CollectionUtils.isEmpty(signList)){
             platformJob.setSignNum(Constants.ONE);
@@ -715,7 +722,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob  = platformJobMapper.selectById(jobDetailDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WART_SIGN_IN.getKey())){
@@ -875,7 +882,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())){
@@ -939,7 +946,6 @@
                             .eq(PlatformJob::getId,platformJob.getId())
                             .last(" limit 1")
             );
-
             WxPlatNotice wxPlatNotice = new WxPlatNotice();
             wxPlatNotice.sendPlatformJobTemplateNotice(systemDictDataBiz,
                     wxNoticeConfigMapper, p,
@@ -1114,7 +1120,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!(Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())
@@ -1132,6 +1138,7 @@
         //鏌ヨ鏈堝彴浠诲姟绛夊緟浣滀笟鏁伴噺
         if(platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda()
                 .eq(PlatformJob::getPlatformId,platform.getId())
+                .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                 .in(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey(),Constants.PlatformJobStatus.WORKING.getKey())
         )>=platform.getWorkingNum()){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瓒呭嚭鏈堝彴鍙悓鏃朵綔涓氭暟閲廩"+platform.getWorkingNum()+"杈哴");
@@ -1261,7 +1268,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if( !( Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())
@@ -1329,7 +1336,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
 
@@ -1382,7 +1389,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())){
@@ -1433,7 +1440,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())){
@@ -1499,7 +1506,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(! (Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())
@@ -1616,6 +1623,7 @@
            if(jobIds.size()>0){
                List<PlatformJob> list = platformJobMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>()
                        .selectAll(PlatformJob.class)
+                       .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                        .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.DONE.getKey())
                        .in(PlatformJob::getId,jobIds)
                );
@@ -1658,7 +1666,7 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId());
-        if(Objects.isNull(platformJob)){
+        if(Objects.isNull(platformJob)||Constants.equalsInteger(platformJob.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){
@@ -1702,6 +1710,7 @@
         PlatformJob platformJob =  platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda()
                 .eq(PlatformJob::getPlatformId,platformDevice.getPlatformId())
                 .eq(PlatformJob::getCarCodeBack,jobOperateDTO.getCarCodeBack())
+                .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                 .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey())
                 .last(" limit 1 ")
         );
@@ -1913,6 +1922,7 @@
                 .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.WORKING.getKey()+" order by pl.CREATE_DATE desc  limit 1  ) as newStartDate  ")
                 .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.CALLED.getKey()+" order by pl.CREATE_DATE desc  limit 1  ) as newCallDate  ")
                 .select(" case when t.total_num is null  then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id  ) else t.total_num end ioQty ")
+                .select(" (select GROUP_CONCAT(distinct(tt.contract_num )) from platform_wms_detail tt where tt.isdeleted=0 and tt.contract_num is not null  and  tt.job_id=t.id )as wmsContractNum")
                 .selectAs(Platform::getName,PlatformJob::getPlatformName)
                 .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
                 .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
@@ -1959,16 +1969,16 @@
         );
         //鏌ヨ浠婃棩瀹屾垚浠诲姟
         platformOrderNumByDateResponse.setDoneNum(
-                platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda()
+                platformJobMapper.selectCount(new MPJLambdaWrapper<PlatformJob>()
                         .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                         .like(PlatformJob::getDoneDate,queryDateStr)
-                        .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.DONE.getKey())
+                        .in(PlatformJob::getStatus,Constants.PlatformJobStatus.DONE.getKey()
+                                ,Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()
+                                ,Constants.PlatformJobStatus.LEAVED.getKey())
                 )
         );
         return platformOrderNumByDateResponse;
     }
-
-
 
     @Override
     public List<PlatformDataListResponse> platformWorkingDataList(PlatformDataListRequest param){

--
Gitblit v1.9.3