From 7cd0d2d9c0aa9d17ff91ff613b47bb07253a8e28 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 18 八月 2023 21:57:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java |   49 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
index 7347a46..355ca24 100644
--- a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
@@ -14,14 +14,18 @@
 import doumeemes.dao.ext.MaterialExtMapper;
 import doumeemes.dao.ext.dto.SalaryParamDTO;
 import doumeemes.dao.ext.dto.SalaryParamImportDTO;
+import doumeemes.dao.ext.vo.DepartmentExtListVO;
 import doumeemes.service.business.DepartmentService;
 import doumeemes.service.business.SalaryParamService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import doumeemes.service.ext.DepartmentExtService;
 import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -43,6 +47,9 @@
 
     @Autowired
     private DepartmentMapper departmentMapper;
+    @Lazy
+    @Autowired
+    private DepartmentExtService departmentExtService;
 
     @Autowired
     private MaterialMapper materialMapper;
@@ -200,17 +207,24 @@
 
         for (int i = 0; i < plansList.size(); i++) {
             SalaryParamImportDTO salaryParamImportDTO = plansList.get(i);
-
-            QueryWrapper<Department> wrapper = new QueryWrapper<>();
-            wrapper.lambda()
-                    .eq(Department::getName,salaryParamImportDTO.getDepartName())
-                    .eq(Department::getType,Constants.DEPART_TYPE.factory)
-                    .eq(Department::getDeleted,Constants.ZERO)
-                    .last("limit 1");
-            Department department = departmentMapper.selectOne(wrapper);
-            if (Objects.isNull(department)){
+//
+//            QueryWrapper<Department> wrapper = new QueryWrapper<>();
+//            wrapper.lambda()
+//                    .eq(Department::getName,salaryParamImportDTO.getDepartName())
+//                    .eq(Department::getType,Constants.DEPART_TYPE.factory)
+//                    .eq(Department::getDeleted,Constants.ZERO)
+//                    .last("limit 1");
+            Department dparam = new Department();
+            dparam.setName(salaryParamImportDTO.getDepartName());
+            dparam.setDeleted(Constants.ZERO);
+            dparam.setType(Constants.DEPART_TYPE.factory);
+            dparam = departmentExtService.findOne(dparam);
+            if (Objects.isNull(dparam)){
                 throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愬叕鍙稿悕绉般�戞湁璇紒");
             }
+            DepartmentExtListVO department = new DepartmentExtListVO();
+            BeanUtils.copyProperties(dparam, department);
+            Integer comDepartId = departmentExtService.getComDepartId(department);
 
             QueryWrapper<Material> materialWrapper = new QueryWrapper<>();
             materialWrapper.lambda()
@@ -223,6 +237,22 @@
             if (Objects.isNull(material)){
                 throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愪骇鍝佺紪鐮併�戞湁璇紒");
             }
+<<<<<<< HEAD
+            if (Objects.nonNull(material) && !Objects.equals(material.getName(),salaryParamImportDTO.getMaterialName())){
+                throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愪骇鍝佸悕绉般�戞湁璇紒");
+            }
+            QueryWrapper<MaterialDistribute> materialDistributeQueryWrapper = new QueryWrapper<>();
+            materialDistributeQueryWrapper.lambda()
+                    .eq(MaterialDistribute::getMaterialId,material.getId())
+                    .eq(MaterialDistribute::getRootDepartId,department.getRootId())
+                    .eq(MaterialDistribute::getDepartId, comDepartId)
+                    .eq(MaterialDistribute::getDeleted,Constants.ZERO)
+                    .last("limit 1");
+            MaterialDistribute materialDistribute = materialDistributeMapper.selectOne(materialDistributeQueryWrapper);
+            if (Objects.isNull(materialDistribute)){
+                throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愪骇鍝佺紪鐮併�戞湁璇紒");
+            }
+=======
             QueryWrapper<MaterialDistribute>  materialDistribute = new QueryWrapper<>();
             materialDistribute.lambda()
                                 .eq(MaterialDistribute::getDeleted,Constants.ZERO)
@@ -233,6 +263,7 @@
 //            if (Objects.nonNull(material) && !Objects.equals(material.getName(),salaryParamImportDTO.getMaterialName())){
 //                throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愪骇鍝佸悕绉般�戞湁璇紒");
 //            }
+>>>>>>> 4d94726acad17e5cdcf828e21cab762e8b39921c
             QueryWrapper<Procedures> proceduresWrapper = new QueryWrapper<>();
             proceduresWrapper.lambda()
                     .eq(Procedures::getName,salaryParamImportDTO.getProcedureName())

--
Gitblit v1.9.3