jiangping
2023-08-18 ba8b66cc8f5a3f1f7774063152f70b4a82e8327c
修复bug
已修改3个文件
44 ■■■■ 文件已修改
server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/service/ext/impl/DepartmentExtServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
@@ -13,14 +13,18 @@
import doumeemes.dao.business.vo.SalaryParamVO;
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;
@@ -42,6 +46,9 @@
    @Autowired
    private DepartmentMapper departmentMapper;
    @Lazy
    @Autowired
    private DepartmentExtService departmentExtService;
    @Autowired
    private MaterialMapper materialMapper;
@@ -198,17 +205,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()
@@ -228,6 +242,7 @@
            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);
server/src/main/java/doumeemes/service/ext/impl/DepartmentExtServiceImpl.java
@@ -254,8 +254,8 @@
    @Override
    public Department findOne(Department Department) {
        Wrapper<Department> wrapper = new QueryWrapper<>(Department);
        return departmentExtMapper.selectOne(wrapper);
        QueryWrapper<Department> wrapper = new QueryWrapper<>(Department);
        return departmentExtMapper.selectOne(wrapper.last("limit 1"));
    }
    @Override
server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
@@ -1527,11 +1527,14 @@
        workorderRecord = new WorkorderRecord();
        workorderRecord.setDeleted(Constants.ZERO);
        if(!Objects.isNull(userId)){
            CompanyUser companyUser = companyUserExtMapper.selectById(userId);
            CompanyUser companyUser = new CompanyUser();
            companyUser.setUserId(userId);
            companyUser.setRootDepartId(loginUserInfo.getRootDepartment().getId());
            companyUser =     companyUserExtMapper.selectOne(new QueryWrapper<>(companyUser).last("limit 1"));
            if(Objects.isNull(companyUser)){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,未查询到生产人员对应企业用户信息!");
            }
            workorderRecord.setCreateUser(companyUser.getUserId());
            workorderRecord.setCreateUser(userId);
            workorderRecord.setRootDepartId(loginUserInfo.getRootDepartment().getId());
            workorderRecord.setDepartId(loginUserInfo.getCurComDepartment().getId());
        }else{