From ca133ed72b297141f906810f81413e15d3d66333 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 03 七月 2024 18:24:37 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java |  223 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 153 insertions(+), 70 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
index 62379b0..384cdcc 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ApproveServiceImpl.java
@@ -1,7 +1,6 @@
 package com.doumee.service.business.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.api.R;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
@@ -18,6 +17,7 @@
 import com.doumee.dao.business.join.VisitsJoinMapper;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.ApproveDataVO;
+import com.doumee.dao.system.dto.NoticesDTO;
 import com.doumee.dao.system.join.NoticesJoinMapper;
 import com.doumee.dao.system.model.Notices;
 import com.doumee.dao.system.model.SystemUser;
@@ -36,6 +36,7 @@
 import org.apache.xpath.operations.Bool;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -240,7 +241,7 @@
      * @return
      */
     @Override
-    public InternalHomeVO getHomeData(Integer memberId,Integer isDetail){
+    public InternalHomeVO getHomeDataH5(Integer memberId,Integer isDetail){
         InternalHomeVO internalHomeVO = new InternalHomeVO();
         internalHomeVO.setHomeImg(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.HOME_IMAGE).getCode());
         //浠诲姟鏁版嵁
@@ -257,17 +258,19 @@
                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
                         ).count()
                 );
+                //宸插鐞嗘暟鎹�
                 internalHomeVO.setNoticeDealNum(
                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId)
+                                &&StringUtils.equals(i.getParam4(),i.getUserId().toString())
                                 &&Constants.equalsInteger(i.getStatus(),Constants.ONE)
                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
                         ).count()
                 );
-
+                //鎴戝彂璧风殑鏁版嵁
                 internalHomeVO.setNoticeCreateNum(
                         noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,memberId))
                 );
-
+                //鎶勯�佹垜鐨勬暟鎹�
                 internalHomeVO.setNoticeCopyNum(
                         noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),memberId)
                                 &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE)
@@ -279,6 +282,49 @@
         return internalHomeVO;
     }
 
+
+    @Override
+    public InternalHomeVO getHomeDataPC(NoticesDTO noticesDTO){
+        InternalHomeVO internalHomeVO = new InternalHomeVO();
+        internalHomeVO.setHomeImg(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.HOME_IMAGE).getCode());
+        //浠诲姟鏁版嵁
+        List<Notices> noticesList = noticesJoinMapper.
+                selectList(new QueryWrapper<Notices>().lambda()
+                        .ge(noticesDTO.getStartDate() != null, Notices::getCreateDate, Utils.Date.getStart(noticesDTO.getStartDate() ))
+                        .le(noticesDTO.getEndDate() != null,  Notices::getCreateDate, Utils.Date.getEnd(noticesDTO.getEndDate() ))
+                        .eq(noticesDTO.getType() != null,  Notices::getType, noticesDTO.getType())
+                        .eq(Notices::getUserId,noticesDTO.getMemberId())
+                        .orderByDesc(Notices::getCreateDate)
+                );
+        internalHomeVO.setTaskNum(noticesList.size());
+        if(CollectionUtils.isNotEmpty(noticesList)){
+            //寰呮垜澶勭悊鐨勬暟鎹�
+            internalHomeVO.setNoticeWaitNum(
+                    noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId())
+                            &&Constants.equalsInteger(i.getStatus(),Constants.ZERO)
+                            &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
+                    ).count()
+            );
+            internalHomeVO.setNoticeDealNum(
+                    noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId())
+                            &&Constants.equalsInteger(i.getStatus(),Constants.ONE)
+                            &&Constants.equalsInteger(i.getSendacopy(),Constants.ZERO)
+                    ).count()
+            );
+
+            internalHomeVO.setNoticeCreateNum(
+                    noticesJoinMapper.selectCount(new QueryWrapper<Notices>().lambda().eq(Notices::getParam3,noticesDTO.getMemberId()))
+            );
+
+            internalHomeVO.setNoticeCopyNum(
+                    noticesList.stream().filter(i->Constants.equalsInteger(i.getUserId(),noticesDTO.getMemberId())
+                            &&Constants.equalsInteger(i.getSendacopy(),Constants.ONE)
+                    ).count()
+            );
+        }
+
+        return internalHomeVO;
+    }
 
     /**
      * 鍒涘缓瀹℃壒娴佺▼
@@ -331,7 +377,8 @@
         if(CollectionUtils.isNotEmpty(approveCopyList)){
             this.organizeApproveCopyData(approveTempl,approveParamList,businessId,approveList);
         }
-        approveMapper.insertBatchSomeColumn(approveList);
+        approveJoinMapper.insert(approveList);
+//        approveJoinMapper.insert(approveList);
 
     }
 
@@ -353,6 +400,7 @@
         createUserApprove.setIsdeleted(Constants.ZERO);
         createUserApprove.setTemplatId(approveTempl.getId());
         createUserApprove.setChekorId(createMember.getId());
+        createUserApprove.setCheckDate(createUserApprove.getCreateDate());
         createUserApprove.setStatus(Constants.approveStatus.pass);
         createUserApprove.setTitle("鍙戣捣鐢宠");
         createUserApprove.setStatusInfo("");
@@ -424,6 +472,7 @@
                 approve.setChekorId(memberId);
                 approve.setStatus(i==0?Constants.ONE:Constants.ZERO);
                 approve.setStatusInfo(i==0?"瀹℃壒涓�":"寰呭鎵�");
+                approve.setTitle("瀹℃壒浜�");
                 approve.setIsEndCheck((i+1) == approveParamList.size()?Constants.ONE:Constants.ZERO);
                 approve.setObjId(businessId);
                 approve.setLevel(i+1);
@@ -506,18 +555,18 @@
             if(CollectionUtils.isNotEmpty(memberList)){
                 userIds.addAll(memberList.stream().map(m->m.getId()).collect(Collectors.toList()));
             }
-            //鍏姟鐢ㄨ溅 榛樿鍔犲叆 鍙告満鎶勯��
-            if(approveTempl.getType()==Constants.THREE||approveTempl.getType()==Constants.FOUR){
-                CarUseBook carUseBook = carUseBookMapper.selectById(businessId);
-                if(Objects.isNull(carUseBook)){
-                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"涓烘煡璇㈠埌鐢ㄨ溅鐢宠淇℃伅");
-                }
-                CarDriver carDriver = carDriverMapper.selectById(carUseBook.getDriverId());
-                if(Objects.isNull(carDriver)){
-                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"涓烘煡璇㈠埌鍙告満淇℃伅");
-                }
-                userIds.add(carDriver.getMemberId());
-            }
+            //鍏姟鐢ㄨ溅 榛樿鍔犲叆 鍙告満鎶勯��  2024骞�6鏈�28鏃�16:49:08 鍙告満鎶勯�佷慨鏀瑰埌 瀹℃壒涓氬姟鏃惰繘琛屽彂閫�
+//            if(approveTempl.getType()==Constants.THREE||approveTempl.getType()==Constants.FOUR){
+//                CarUseBook carUseBook = carUseBookMapper.selectById(businessId);
+//                if(Objects.isNull(carUseBook)){
+//                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"涓烘煡璇㈠埌鐢ㄨ溅鐢宠淇℃伅");
+//                }
+//                CarDriver carDriver = carDriverMapper.selectById(carUseBook.getDriverId());
+//                if(Objects.isNull(carDriver)){
+//                    throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"涓烘煡璇㈠埌鍙告満淇℃伅");
+//                }
+//                userIds.add(carDriver.getMemberId());
+//            }
 
             if(CollectionUtils.isNotEmpty(userIds)){
                 for (Integer memberId:userIds) {
@@ -637,13 +686,10 @@
         List<Approve> levelList = getLevelListFromResult(approveGroupList,approveDateVO,memberId);
         List<Approve> copyList = getAllCopyList(approveGroupList);
         //閬嶅巻level鏌ヨ姣忎竴绾у埆涓氬姟鏁版嵁
-        for(Approve level:levelList){
-            List<Approve> tlist = getLevelInfoFromList(level,approveGroupList);
-            approveDateVO.getApproveList().addAll(tlist);
-            if(tlist.size() ==0
-                    ||Constants.equalsInteger(Constants.approveStatus.unPass,  tlist.get(0).getStatus())
-                    ||Constants.equalsInteger(Constants.approveStatus.cancel,  tlist.get(0).getStatus())){
-                break;
+        if(levelList!=null){
+            for(Approve level:levelList){
+                List<Approve> tlist = getLevelInfoFromList(level,approveGroupList);
+                approveDateVO.getApproveList().addAll(tlist);
             }
         }
 
@@ -657,6 +703,7 @@
             waitModel.setApproveList(copyList);
             approveDateVO.getApproveList().add(waitModel);
         }
+        System.out.println(JSONObject.toJSONString(approveDateVO));
         return approveDateVO;
     }
 
@@ -703,6 +750,9 @@
                         ||Constants.equalsInteger(level.getStatus(),Constants.approveStatus.pass)){
                     waitModel.setMemberName(waitList.size() +"浜轰細绛�");
                 }
+                if(CollectionUtils.isNotEmpty(waitList)){
+                    waitModel.setCreateDate(waitList.get(Constants.ZERO).getCreateDate());
+                }
                 waitModel.setApproveList(waitList);
                 list.add(waitModel);
             }else if(waitList.size()>0){
@@ -730,19 +780,17 @@
                 if(passList.size()>0){
                     approveList.addAll(otherPassList);
                 }
-                waitModel.setMemberName("宸叉妱閫�"+ approveList.size() +"浜�");
+                if(CollectionUtils.isNotEmpty(approveList)){
+                    waitModel.setCreateDate(approveList.get(Constants.ZERO).getCreateDate());
+                }
+                if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.pass)){
+                    waitModel.setMemberName("宸叉妱閫�"+ approveList.size() +"浜�");
+                }else if(Constants.equalsInteger(waitModel.getStatus(),Constants.approveStatus.wait)){
+                    waitModel.setMemberName("澶勭悊涓�");
+                }
                 waitModel.setApproveList(approveList);
                 list.add(waitModel);
             }
-            //濡傛灉鏄垨绛�
-//            if(otherPassList.size()>0){
-//                Approve waitModel = new Approve();
-//                waitModel.setApproveType(Constants.ONE);
-//                waitModel.setStatusInfo(StringUtils.defaultString(level.getTitle(),"瀹℃壒浜�")+"锛堟妱閫佹垨绛惧鎵逛汉锛�");
-//                waitModel.setStatus(Constants.ONE);
-//                waitModel.setApproveList(otherPassList);
-//                list.add(waitModel);
-//            }
         }
 
 
@@ -765,7 +813,7 @@
             }else if(Constants.equalsInteger(Constants.approveStatus.auditIng,approve.getStatus())||Constants.equalsInteger(Constants.approveStatus.wait,approve.getStatus())){
                 waitList.add(approve);
             }else if(Constants.equalsInteger(Constants.approveStatus.unPass,approve.getStatus())){
-                refuseModel = approve;
+                BeanUtils.copyProperties(approve,refuseModel);
             }
         }
     }
@@ -799,7 +847,7 @@
             }
         }
         if(CollectionUtils.isEmpty(approveList)){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀹℃壒淇℃伅锛氱骇鍒暟鎹紓甯�");
+         //   throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀹℃壒淇℃伅锛氱骇鍒暟鎹紓甯�");
         }
         return  approveList;
     }
@@ -958,6 +1006,7 @@
                 .eq(Notices::getUserId,approve.getChekorId())
                 .eq(Notices::getSendacopy,Constants.ZERO)
                 .eq(Notices::getIsdeleted,Constants.ZERO)
+                .last(" limit 1 ")
         );
         if(Objects.isNull(notices)){
             log.info("鏈煡璇㈠埌閫氱煡璁板綍");
@@ -969,7 +1018,7 @@
         approve.setCheorId(approveDTO.getLoginUserInfo().getMemberId().toString());
         approve.setCheckorName(approveDTO.getLoginUserInfo().getRealname());
         approve.setCheckDate(new Date());
-        approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"宸插悓鎰�":approveDTO.getCheckInfo());
+        approve.setStatusInfo(approveDTO.getStatus()==Constants.TWO?"宸插悓鎰�":"宸查┏鍥�");
         //鏈骇鎵�鏈� 寰呭鎵硅褰�
         List<Approve> approveList = approveJoinMapper.selectJoinList(Approve.class,
                 new MPJLambdaWrapper<Approve>()
@@ -997,10 +1046,12 @@
         Boolean dealBusinessBean = false;
         //瀹℃壒椹冲洖鎯呭喌
         if(approveDTO.getStatus().equals(Constants.THREE)){
+            dealBusinessBean = true;
             //淇敼鍏朵粬鎵�鏈夊緟瀹℃壒鍜屽鎵逛腑璁板綍鏁版嵁
             approveJoinMapper.update(null,new UpdateWrapper<Approve>()
                     .lambda()
                     .set(Approve::getStatus,Constants.approveStatus.otherUnPass)
+                    .set(Approve::getCheckDate,new Date())
                     .in(Approve::getStatus,Constants.approveStatus.auditIng,Constants.approveStatus.wait)
                     .eq(Approve::getObjId,approve.getObjId())
                     .eq(Approve::getObjType,approve.getObjType())
@@ -1010,8 +1061,10 @@
                 //淇敼鑷繁鐨勯�氱煡璁板綍
                 noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
                         .set(Notices::getEditDate,new Date())
+                        .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId())
                         .set(Notices::getReaded,Constants.ONE)
-                        .set(Notices::getParam2,approve.getStatus())
+                        .set(Notices::getParam2,Constants.TWO)
+                        .set(Notices::getStatus,Constants.ONE)
                         .eq(Notices::getId,notices.getId())
                 );
                 //淇敼 鏈鐞嗙殑 閫氱煡鏁版嵁 涓烘妱閫�
@@ -1019,7 +1072,8 @@
                     noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
                             .set(Notices::getEditDate,new Date())
                             .set(Notices::getSendacopy,Constants.ONE)
-                            .set(Notices::getParam2,approve.getStatus())
+                            .set(Notices::getStatus,Constants.ONE)
+                            .set(Notices::getParam2,Constants.TWO)
                             .eq(Notices::getObjId,notices.getObjId())
                             .eq(Notices::getObjType,notices.getObjType())
                             .eq(Notices::getReaded,Constants.ZERO)
@@ -1027,34 +1081,45 @@
                     );
                 }
             }
-            return;
         }else{
             //澶勭悊鍏朵粬涓氬姟鏁版嵁
             if((Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)
                     || Constants.equalsInteger( approve.getApproveType(),Constants.TWO)) && Constants.equalsInteger(approve.getIsEndCheck(),Constants.ONE)){
                 //鎴栫 / 鍗曚汉瀹� 涓� 缁堝
-                approveJoinMapper.update(null,new UpdateWrapper<Approve>()
-                        .lambda()
-                        .set(Approve::getStatus,Constants.approveStatus.otherDeal)
-                        .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList())));
+                if(CollectionUtils.isNotEmpty(approveList)){
+                    approveJoinMapper.update(null,new UpdateWrapper<Approve>()
+                            .lambda()
+                            .set(Approve::getStatus,Constants.approveStatus.otherDeal)
+                            .set(Approve::getCheckDate,new Date())
+                            .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList())));
+                }
                 dealBusinessBean = true;
             }else if((approve.getApproveType().equals(Constants.ZERO)
                     || approve.getApproveType().equals(Constants.TWO)) &&approve.getIsEndCheck()!=Constants.ONE){
                 //鎴栫 / 鍗曚汉瀹� 闈炵粓瀹� 鍒欏紑鍚笅涓�姝ヤ笟鍔℃祦绋�
                 /**澶勭悊鏈骇鏁版嵁**/
-                approveJoinMapper.update(null,new UpdateWrapper<Approve>()
-                        .lambda()
-                        .set(Approve::getStatus,Constants.approveStatus.otherDeal)
-                        .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList())));
+                if(CollectionUtils.isNotEmpty(approveList)){
+                    approveJoinMapper.update(null,new UpdateWrapper<Approve>()
+                            .lambda()
+                            .set(Approve::getStatus,Constants.approveStatus.otherDeal)
+                            .set(Approve::getCheckDate,new Date())
+                            .in(Approve::getId,approveList.stream().map(m->m.getId()).collect(Collectors.toList())));
+                }
                 /**寮�鍚笅涓�绾у埆鐨勬暟鎹负寰呭鏍�**/
                 approveJoinMapper.update(null,new UpdateWrapper<Approve>()
                         .lambda()
                         .set(Approve::getStatus,Constants.approveStatus.auditIng)
+                        .set(Approve::getTitle,"瀹℃壒浜�")
+                        .set(Approve::getCheckDate,new Date())
                         .eq(Approve::getStatus,Constants.approveStatus.wait)
                         .eq(Approve::getObjId,approve.getObjId())
                         .eq(Approve::getObjType,approve.getObjType())
                         .eq(Approve::getLevel,(approve.getLevel()+1))
                 );
+                if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals(
+                        Constants.approveObjectType.unCityUseCar)){
+                    this.updDriver(approveDTO,approve,false);
+                }
             }else if(approve.getApproveType().equals(Constants.ONE)){
                 //浼氱 涓旂粓瀹�
                 //鏃犱粬浜哄鎵圭殑鎯呭喌 鍒欎慨鏀规暟鎹姸鎬�
@@ -1062,7 +1127,7 @@
                     dealBusinessBean = true;
                 }
             }
-            this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList);
+            this.passNextNotices(dealBusinessBean,notices,approve,approveList,approveCopyList,approveDTO);
         }
         //澶勭悊涓氬姟鏁版嵁
         if(dealBusinessBean){
@@ -1076,12 +1141,14 @@
      * @param approve  瀹℃壒璁板綍
      * @param approveList  鍚岀骇寰呭鎵规暟鎹�
      */
-    public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList){
+    public void passNextNotices(Boolean dealBusinessBean,Notices notices,Approve approve,List<Approve> approveList,List<Approve> copyList,ApproveDTO approveDTO){
         //1銆佷慨鏀硅嚜宸辩殑鏁版嵁璁板綍
         noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
                 .set(Notices::getEditDate,new Date())
                 .set(Notices::getReaded,Constants.ONE)
-                .set(dealBusinessBean,Notices::getParam2,approve.getStatus())
+                .set(Notices::getStatus,Constants.ONE)
+                .set(dealBusinessBean,Notices::getParam2,Constants.ONE)
+                .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId())
                 .eq(Notices::getId,notices.getId())
         );
         if(Constants.equalsInteger(approve.getApproveType(),Constants.ZERO)){
@@ -1091,7 +1158,9 @@
                     .set(Notices::getEditDate,new Date())
                     .set(Notices::getReaded,Constants.ONE)
                     .set(Notices::getSendacopy,Constants.ONE)
-                    .set(dealBusinessBean,Notices::getParam2,approve.getStatus())
+                    .set(Notices::getStatus,Constants.ONE)
+                    .set(Notices::getParam4,approveDTO.getLoginUserInfo().getMemberId())
+                    .set(dealBusinessBean,Notices::getParam2,Constants.ONE)
                     .eq(Notices::getObjId,notices.getObjId())
                     .eq(Notices::getObjType,notices.getObjType())
                     .ne(Notices::getId,notices.getId())
@@ -1153,7 +1222,7 @@
                 .eq(Approve::getType,Constants.ZERO)
                 .eq(Approve::getLevel,(approve.getLevel() + Constants.ONE))
         );
-        if(CollectionUtils.isNotEmpty(nextApproveList)){
+        if(CollectionUtils.isEmpty(nextApproveList)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀹℃壒娴佹暟鎹紓甯�");
         }
         Notices newNotices = new Notices();
@@ -1193,23 +1262,7 @@
             visitsMapper.updateById(visits);
         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.cityUseCar)||approveDTO.getObjType().equals(
                 Constants.approveObjectType.unCityUseCar)){
-            // 甯傚唴澶栫敤杞︾敵璇�
-            CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId());
-            if(Objects.isNull(carUseBook)){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鐢ㄨ溅璁板綍");
-            }
-            carUseBook.setStatus(approveDTO.getStatus());
-            carUseBook.setEditDate(new Date());
-            carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId());
-            //濡傛灉閰嶇疆淇敼鍙告満 涓� 鍏ュ弬浜嗘洿鎹㈠悗鍙告満淇℃伅
-            if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){
-                CarDriver carDriver = carDriverMapper.selectById(approveDTO.getDriverId());
-                if(Objects.isNull(carDriver)){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鍙告満淇℃伅");
-                }
-                carUseBook.setDriverId(carDriver.getId());
-            }
-            carUseBookMapper.updateById(carUseBook);
+            this.updDriver(approveDTO,approve,true);
         }else if(approveDTO.getObjType().equals(Constants.approveObjectType.logisticsCarUse)){
             //TODO  鐗╂祦杞﹂绾�
 
@@ -1219,4 +1272,34 @@
     }
 
 
+    public void updDriver(ApproveDTO approveDTO,Approve approve,Boolean dealBusinessBean){
+        // 甯傚唴澶栫敤杞︾敵璇�
+        CarUseBook carUseBook = carUseBookMapper.selectById(approveDTO.getObjId());
+        if(Objects.isNull(carUseBook)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鐢ㄨ溅璁板綍");
+        }
+        if(dealBusinessBean){
+            carUseBook.setStatus(approveDTO.getStatus());
+        }else{
+            if(Constants.equalsInteger(approveDTO.getStatus(),Constants.TWO)){
+                carUseBook.setStatus(Constants.ONE);
+            }
+        }
+        carUseBook.setEditDate(new Date());
+        carUseBook.setEditor(approveDTO.getLoginUserInfo().getMemberId());
+        //濡傛灉閰嶇疆淇敼鍙告満 涓� 鍏ュ弬浜嗘洿鎹㈠悗鍙告満淇℃伅
+        if(approveDTO.getStatus()==Constants.TWO&&Constants.equalsInteger(approve.getDriverParam(),Constants.ONE)){
+            CarDriver carDriver = carDriverMapper.selectOne(new QueryWrapper<CarDriver>().lambda()
+                    .eq(CarDriver::getIsdeleted,Constants.ZERO)
+                    .eq(CarDriver::getStatus,Constants.ZERO)
+                    .eq(CarDriver::getMemberId,approveDTO.getDriverId()));
+            if(Objects.isNull(carDriver)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鍙告満淇℃伅");
+            }
+             carUseBook.setDriverId(carDriver.getMemberId());
+        }
+        carUseBookMapper.updateById(carUseBook);
+    }
+
+
 }

--
Gitblit v1.9.3