| | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectReimburse; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.system.domain.Dict; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | |
| | | * @param resources / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateApprove(ProjectReimburse resources) { |
| | | ProjectReimburse projectReimburse = projectReimburseRepository.findById(resources.getId()).orElseGet(ProjectReimburse::new); |
| | | ValidationUtil.isNull( projectReimburse.getId(),"ProjectReimburse","id",resources.getId()); |
| | | projectReimburse.copy(resources); |
| | | projectReimburseRepository.save(projectReimburse); |
| | | } |
| | | |
| | | /** |
| | | * 批量审核报销 |
| | | * |
| | | * @param type / |
| | | * @param ids / |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void batchUpdateApprove(String type, List<Long> ids, String reason) { |
| | | if (type.equals(Constant.REIMBURSE_APPROVE_STATUS_AGREE) || type.equals(Constant.REIMBURSE_APPROVE_STATUS_REFUSE)) { |
| | | for (Long id : ids) { |
| | | ProjectReimburse projectReimburse = projectReimburseRepository.findById(id).orElseGet(ProjectReimburse::new); |
| | | ValidationUtil.isNull(projectReimburse.getId(), "ProjectReimburse", "id", id); |
| | | projectReimburse.setApprovalStatus(type); |
| | | if (type.equals(Constant.REIMBURSE_APPROVE_STATUS_REFUSE) && StringUtils.isNotBlank(reason)) { |
| | | projectReimburse.setApprovalDescription(Optional.ofNullable(projectReimburse.getApprovalDescription()).orElse("").concat(" ").concat(reason).trim()); |
| | | } |
| | | projectReimburseRepository.save(projectReimburse); |
| | | } |
| | | } |
| | | } |
| | | } |