| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private DepartmentMapper departmentMapper; |
| | | @Lazy |
| | | @Autowired |
| | | private DepartmentExtService departmentExtService; |
| | | |
| | | @Autowired |
| | | private MaterialMapper materialMapper; |
| | |
| | | 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(),"同一个物料在相同工序不能重复配置哦!"); |
| | | } |
| | |
| | | |
| | | 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() |
| | |
| | | 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); |
| | |
| | | }).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 { |