From d3ee2de7d4b60b573842b1c7f31e755c854df0d4 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 11 九月 2023 09:28:05 +0800
Subject: [PATCH] 小程序菜单
---
server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java | 76 +++++++++++++++++++++++++++-----------
1 files changed, 54 insertions(+), 22 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 b97cf17..368d0ae 100644
--- a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
@@ -8,22 +8,24 @@
import doumeemes.core.utils.Constants;
import doumeemes.core.utils.Utils;
import doumeemes.core.utils.excel.EasyExcelUtil;
-import doumeemes.dao.business.DepartmentMapper;
-import doumeemes.dao.business.MaterialMapper;
-import doumeemes.dao.business.ProceduresMapper;
-import doumeemes.dao.business.SalaryParamMapper;
+import doumeemes.dao.business.*;
import doumeemes.dao.business.model.*;
import doumeemes.dao.business.vo.SalaryParamVO;
+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;
@@ -45,9 +47,14 @@
@Autowired
private DepartmentMapper departmentMapper;
+ @Lazy
+ @Autowired
+ private DepartmentExtService departmentExtService;
@Autowired
private MaterialMapper materialMapper;
+ @Autowired
+ private MaterialDistributeMapper materialDistributeMapper;
@Autowired
private ProceduresMapper proceduresMapper;
@@ -55,15 +62,17 @@
@Override
public Integer create(SalaryParam salaryParam) {
-
LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-
+ DepartmentExtListVO department =departmentExtService.getModelById(principal.getCompany().getId(),salaryParam.getDepartId());
+ Integer comDepartId = departmentExtService.getComDepartId(department);
SalaryParam insert = new SalaryParam();
insert.setRootDepartId(principal.getRootDepartment().getId());
insert.setDepartId(salaryParam.getDepartId());
+// insert.setDepartId(comDepartId);
insert.setProcedureId(salaryParam.getProcedureId());
insert.setMaterialId(salaryParam.getMaterialId());
insert.setDeleted((byte) Constants.ZERO);
+ insert.setType(salaryParam.getType());
if(findOne(insert) != null){
throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"鍚屼竴涓墿鏂欏湪鐩稿悓宸ュ簭涓嶈兘閲嶅閰嶇疆鍝︼紒");
}
@@ -158,7 +167,7 @@
LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
SalaryParamDTO model = pageWrap.getModel();
model.setRootDepartId(principal.getRootDepartment().getId());
-// model.setDepartId(principal.getComDepartment().getId());
+// model.setDepartId(principal.getCurComDepartment().getId());
IPage<SalaryParamVO> salaryParamVOIPage = salaryParamMapper.selectPage(page, model);
if (!CollectionUtils.isEmpty(salaryParamVOIPage.getRecords())){
salaryParamVOIPage.getRecords().forEach(s->s.setSalary(s.getSalary().divide(new BigDecimal(100))));
@@ -199,29 +208,52 @@
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)
- .last("limit 1");
- Department department = departmentMapper.selectOne(wrapper);
- if (Objects.isNull(department)){
- throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愬叕鍙稿悕绉般�戞湁璇紒");
+//
+// 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();
+ department.setId(dparam.getId());
+ department.setType(dparam.getType());
+ department.setParentId(dparam.getParentId());
+ department.setRootId(dparam.getRootId());
+ department.setCompanyId(dparam.getCompanyId());
+ Integer comDepartId = departmentExtService.getComDepartId(department);
QueryWrapper<Material> materialWrapper = new QueryWrapper<>();
materialWrapper.lambda()
.eq(Material::getCode,salaryParamImportDTO.getMaterialCode())
- .eq(Material::getRootDepartId,department.getRootId())
+ .eq(Material::getRootDepartId,dparam.getRootId())
+ .eq(Material::getDeleted,Constants.ZERO)
.last("limit 1");
Material material = materialMapper.selectOne(materialWrapper);
if (Objects.isNull(material)){
throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭銆愪骇鍝佺紪鐮併�戞湁璇紒");
}
- if (Objects.nonNull(material) && Objects.equals(material.getName(),salaryParamImportDTO.getMaterialName())){
+ 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<Procedures> proceduresWrapper = new QueryWrapper<>();
proceduresWrapper.lambda()
@@ -235,9 +267,9 @@
}
SalaryParam salaryParam = new SalaryParam();
salaryParam.setRootDepartId(department.getRootId());
- salaryParam.setDepartId(department.getId());
+ salaryParam.setDepartId(dparam.getId());
salaryParam.setProcedureId(procedures.getId());
- salaryParam.setMaterialId(material.getId());
+ salaryParam.setMaterialId(materialDistribute.getId());
salaryParam.setSalary(salaryParamImportDTO.getSalary());
salaryParam.setNum(new BigDecimal(salaryParamImportDTO.getNum()));
salaryParam.setTimes(getIntegerTimes(salaryParamImportDTO.getTimesName()));
@@ -250,7 +282,7 @@
}).orElse(0);
salaryParam.setUnqualified(unqualified);
- Integer type = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> {
+ Integer type = Optional.ofNullable(salaryParamImportDTO.getType()).map(s -> {
if ("璁′欢".equals(s)) {
return 0;
} else {
--
Gitblit v1.9.3