From c29ce426a6ce314bc26a23cd92d226cc01825783 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 26 八月 2024 18:18:27 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java |   62 +++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 15 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..68318b2 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
@@ -186,7 +186,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 +225,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);
@@ -252,9 +244,45 @@
         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())
+                || Objects.isNull(platformBooksApplyDTO.getReasonId())
+                || StringUtils.isBlank(platformBooksApplyDTO.getInReason())
+        ){
+            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());
+        platformBooksMapper.insert(platformBooks);
+        return platformBooks.getId();
+    }
+
 
 
     @Override
@@ -263,8 +291,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();

--
Gitblit v1.9.3