From 6ef869b1adcf3a5bb8e4c3117dc507d173f13fd8 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期三, 18 九月 2024 15:19:55 +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/PlatformBooksServiceImpl.java |   89 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 67 insertions(+), 22 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
index a155825..e9b3d38 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
@@ -18,6 +18,8 @@
 import com.doumee.dao.business.join.ApproveJoinMapper;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.ApproveDataVO;
+import com.doumee.dao.system.join.NoticesJoinMapper;
+import com.doumee.dao.web.reqeust.ConfirmTaskDTO;
 import com.doumee.dao.web.reqeust.PlatformBooksApplyDTO;
 import com.doumee.dao.web.reqeust.PlatformBooksCheckNumDTO;
 import com.doumee.dao.web.reqeust.RevokeDTO;
@@ -50,6 +52,9 @@
 
     @Autowired
     private PlatformBooksMapper platformBooksMapper;
+
+    @Autowired
+    private NoticesJoinMapper noticesJoinMapper;
 
     @Autowired
     private ApproveTemplMapper approveTemplMapper;
@@ -158,16 +163,24 @@
                 .eq(pageWrap.getModel().getPlateNum() != null, PlatformBooks::getPlateNum, pageWrap.getModel().getPlateNum())
                 .eq(pageWrap.getModel().getDriverPhone() != null, PlatformBooks::getDriverPhone, pageWrap.getModel().getDriverPhone())
                 .ge(pageWrap.getModel().getQueryDate() != null, PlatformBooks::getCreateDate, pageWrap.getModel().getQueryDate())
+                .ge(pageWrap.getModel().getArriveDateStart() != null, PlatformBooks::getArriveDate, Utils.Date.getStart(pageWrap.getModel().getArriveDateStart()))
+                .le(pageWrap.getModel().getArriveDateEnd() != null, PlatformBooks::getArriveDate, Utils.Date.getEnd(pageWrap.getModel().getArriveDateEnd()))
+                .orderByDesc(PlatformBooks::getCreateDate)
         ;
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
+        PageData<PlatformBooks> pageData = PageData.from(platformBooksMapper.selectPage(page, queryWrapper));
+        for (PlatformBooks platformBooks:pageData.getRecords()) {
+            if(Constants.equalsInteger(platformBooks.getStatus(),Constants.ONE)){
+                String auditName = approveService.getApproveUserName(platformBooks.getId(),Constants.approveObjectType.reason);
+                platformBooks.setAuditName(auditName);
             }
         }
-        return PageData.from(platformBooksMapper.selectPage(page, queryWrapper));
+
+        return pageData;
     }
+
+
+
+
 
     @Override
     public long count(PlatformBooks platformBooks) {
@@ -186,7 +199,7 @@
         }
         //鏌ヨ姣忔棩閰嶇疆鐨勬�婚绾﹂噺
         PlatformReason platformReason = platformReasonMapper.selectById(platformBooksCheckNumDTO.getReasonId());
-        if(Objects.isNull(platformReason)|| Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){
+        if(Objects.isNull(platformReason)|| !Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍏ュ洯鍘熷洜淇℃伅寮傚父,璇峰埛鏂伴噸璇�");
         }
         List<PlatformBooks> platformBooksList = platformBooksMapper.selectList(new QueryWrapper<PlatformBooks>().lambda()
@@ -225,23 +238,15 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         PlatformReason platformReason = platformReasonMapper.selectById(platformBooksApplyDTO.getReasonId());
-        if(Objects.isNull(platformReason)|| Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){
+        if(Objects.isNull(platformReason)|| !Constants.equalsInteger(platformReason.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍏ュ洯鍘熷洜淇℃伅寮傚父,璇峰埛鏂伴噸璇�");
         }
-        ApproveTempl approveTempl = approveTemplMapper.selectOne(new QueryWrapper<ApproveTempl>().lambda()
-                .eq(ApproveTempl::getIsdeleted,Constants.ZERO)
-                .eq(ApproveTempl::getObjId,platformReason.getId())
-                .last(" limit 1")
-        );
+        ApproveTempl approveTempl = approveTemplMapper.selectById(platformReason.getId());
         if(Objects.isNull(approveTempl)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈厤缃鎵规祦,璇疯仈绯荤鐞嗗憳");
         }
-
-        if(Constants.equalsInteger(platformBooksApplyDTO.getUserId(),platformBooksApplyDTO.getDriverId())){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浜哄憳淇℃伅鍖归厤閿欒");
-        }
-        if(Objects.nonNull(platformReason.getLimitNum())&&platformReason.getLimitNum().compareTo(platformBooksApplyDTO.getTotalNum())>0){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瓒呭嚭鍏ュ洯鐢宠绾胯川閲�");
+        if(!Constants.equalsInteger(approveTempl.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀹℃壒娴佸凡鍋滅敤,璇疯仈绯荤鐞嗗憳");
         }
         PlatformBooks platformBooks = new PlatformBooks();
         BeanUtils.copyProperties(platformBooksApplyDTO,platformBooks);
@@ -249,12 +254,49 @@
         platformBooks.setIsdeleted(Constants.ZERO);
         platformBooks.setStatus(Constants.ZERO);
         platformBooks.setDriverId(platformBooksApplyDTO.getUserId());
+        platformBooks.setEditDate(new Date());
         platformBooksMapper.insert(platformBooks);
 
         //鍒涘缓瀹℃壒娴佷俊鎭�
-        approveService.createApproveFlow(5,platformBooks.getId(),platformBooks.getDriverId());
+        approveService.createApproveForPlatfrom(platformReason.getApproveTemplId(),platformBooks.getId(),platformBooks.getDriverId());
         return platformBooks.getId();
     }
+
+
+
+    @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+    public Integer edit(PlatformBooksApplyDTO platformBooksApplyDTO){
+        if(Objects.isNull(platformBooksApplyDTO)
+                || Objects.isNull(platformBooksApplyDTO.getId())
+                || StringUtils.isBlank(platformBooksApplyDTO.getContractNum())
+                || Objects.isNull(platformBooksApplyDTO.getArriveDate())
+                || Objects.isNull(platformBooksApplyDTO.getInType())
+                || Objects.isNull(platformBooksApplyDTO.getTotalNum())
+                || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeFront())
+                || StringUtils.isBlank(platformBooksApplyDTO.getCarCodeBack())
+                || Objects.isNull(platformBooksApplyDTO.getDriverId())
+                || StringUtils.isBlank(platformBooksApplyDTO.getDriverPhone())
+                || StringUtils.isBlank(platformBooksApplyDTO.getDriverName())
+                || StringUtils.isBlank(platformBooksApplyDTO.getTransportImg())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        PlatformBooks platformBooks = platformBooksMapper.selectById(platformBooksApplyDTO.getId());
+        if(Objects.isNull(platformBooks)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(platformBooks.getStatus(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"涓氬姟鐘舵�佸凡娴佽浆");
+        }
+        BeanUtils.copyProperties(platformBooksApplyDTO,platformBooks);
+        platformBooks.setEditDate(new Date());
+        platformBooks.setReasonId(null);
+        platformBooks.setInReason(null);
+        platformBooksMapper.updateById(platformBooks);
+        return platformBooks.getId();
+    }
+
 
 
     @Override
@@ -263,8 +305,12 @@
         if(Objects.isNull(model)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌棰勭害璁板綍");
         }
+        String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() +
+                systemDictDataBiz.queryByCode(Constants.FTP,Constants.PLATFORM).getCode();
+        model.setPrefixUrl(prefixUrl);
+
         ApproveDataVO approveDataVO = approveService.arrangeApprovedData(id,
-               5,
+               6,
                 memberId);
         model.setApproveDateVO(approveDataVO);
         List<Approve> approveList = approveDataVO.getApproveList();
@@ -326,7 +372,6 @@
                 .eq(Approve::getObjId,revokeDTO.getId())
         );
     }
-
 
 
 }

--
Gitblit v1.9.3