From f63e0073e96abe1e52d74749f408e3f542600a09 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期三, 03 四月 2024 13:27:12 +0800
Subject: [PATCH] 提交一把

---
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |   64 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index 7ad77ab..2b7c1ed 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -27,10 +28,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * 淇濋櫓鏂规淇℃伅琛⊿ervice瀹炵幇
@@ -40,6 +38,10 @@
 @Service
 public class SolutionsServiceImpl implements SolutionsService {
 
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+    @Autowired
+    private MultifileMapper multifileMapper;
     @Autowired
     private SolutionsMapper solutionsMapper;
     @Autowired
@@ -87,6 +89,22 @@
         solutionsMapper.insert(newModel);
 
         dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true);
+        if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){
+           if  (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){
+             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇蜂笂浼犳柟妗堢‘璁や功锛�");
+            }
+
+            Multifile file = solutions.getFanganFile();
+            file.setIsdeleted(Constants.ZERO);
+            file.setCreateDate(new Date());
+            file.setCreator(user.getId());
+            file.setObjId(solutions.getId());
+            file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
+            file.setType(Constants.formatIntegerNum(file.getType()));
+            multifileMapper.insert(file);
+           file.setObjId(newModel.getId());
+            multifileMapper.insert(file);
+        }
         return solutions.getId();
     }
 
@@ -216,7 +234,27 @@
                 .lambda()
                 .eq(SolutionWorktype::getSolutionId,solutions.getId())
         );
-
+        if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){
+            if  (solutions.getFanganFile()!=null && StringUtils.isNotBlank(solutions.getFanganFile().getFileurl())){
+                multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda()
+                                .set(Multifile::getIsdeleted,Constants.ONE)
+                                .set(Multifile::getEditDate,solutions.getEditDate())
+                                .set(Multifile::getEditor,solutions.getEditor())
+                                .eq(Multifile::getObjId,solutions.getId())
+                                .eq(Multifile::getIsdeleted,Constants.ZERO)
+                                .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()));
+                Multifile file = solutions.getFanganFile();
+                file.setIsdeleted(Constants.ZERO);
+                file.setCreateDate(solutions.getEditDate());
+                file.setCreator(solutions.getEditor());
+                file.setObjId(solutions.getId());
+                file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
+                file.setType(Constants.formatIntegerNum(file.getType()));
+                multifileMapper.insert(file);
+                file.setObjId(newModel.getId());
+                multifileMapper.insert(file);
+            }
+        }
 
         solutionsMapper.update(null,new UpdateWrapper<Solutions>()
                 .lambda()
@@ -303,6 +341,16 @@
         wrapper.orderByAsc(SolutionWorktype::getSortnum);
         List<SolutionWorktype> worktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class,wrapper);
         model.setWorktypeList(worktypeList);
+        Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,model.getId())
+                .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey())
+                .eq(Multifile::getIsdeleted,Constants.ZERO)
+                .last("limit 1"));
+        if(f!=null && StringUtils.isNotBlank(f.getFileurl())){
+            String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl();
+            f.setFileurlFull(url);
+            model.setFanganFile(f);//鏂规纭涔�
+        }
         return model;
     }
 
@@ -314,12 +362,18 @@
 
     @Override
     public List<Solutions> findList(Solutions solutions) {
+        LoginUserInfo user = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
         solutions.setIsdeleted(Constants.ZERO);
         solutions.setStatus(Constants.ZERO);
         if(solutions.getDataType() == null){
             solutions.setDataType(Constants.TWO);
         }
+        if(Constants.equalsObject(user.getType(),Constants.TWO)){
+            //濡傛灉鏄垹闄�
+            solutions.setShopId(user.getCompanyId());
+        }
         QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
+
         return solutionsMapper.selectList(wrapper);
     }
   

--
Gitblit v1.9.3