| | |
| | | import com.ycl.mapper.*; |
| | | import com.ycl.service.FileService; |
| | | import com.ycl.service.ProjectInfoService; |
| | | import com.ycl.service.ProjectInfoWinUnitService; |
| | | import com.ycl.system.mapper.SysDeptMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.codec.Charsets; |
| | |
| | | public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements ProjectInfoService { |
| | | |
| | | private final ProjectInfoMapper projectInfoMapper; |
| | | private final ProjectInfoWinUnitService projectInfoWinUnitService; |
| | | private final ProjectInvestmentFundingMapper investmentFundingMapper; |
| | | private final ProjectInvestmentInfoMapper investmentInfoMapper; |
| | | private final ProjectInvestmentPolicyComplianceMapper policyMapper; |
| | |
| | | ProjectInfo entity = ProjectInfoForm.getEntityByForm(form, null); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long deptId = SecurityUtils.getDeptId(); |
| | | List<ProjectInfoWinUnitForm> projectInfoWinUnitForm = form.getWinUnitList(); |
| | | entity.setProjectOwnerUnit(deptId); |
| | | entity.setCreateBy(userId); |
| | | entity.setUpdateBy(userId); |
| | |
| | | item.setType(FileTypeEnum.PROJECT_INFO); |
| | | }); |
| | | fileService.saveBatch(fileList); |
| | | |
| | | //添加项目中标单位 |
| | | saveUnit(projectInfoWinUnitForm); |
| | | return Result.ok("添加成功").data(entity.getId()); |
| | | } |
| | | |
| | |
| | | fileMapper.delete(fileQueryWrapper); |
| | | //替换成现有 |
| | | fileService.saveBatch(fileList); |
| | | |
| | | //修改项目中标单位 |
| | | //删除原数据 |
| | | List<ProjectInfoWinUnitForm> projectInfoWinUnitForm = form.getWinUnitList(); |
| | | QueryWrapper<ProjectInfoWinUnit> unitWrapper = new QueryWrapper<>(); |
| | | unitWrapper.eq("project_info_id",form.getId()); |
| | | projectInfoWinUnitService.remove(unitWrapper); |
| | | //添加项目中标单位 |
| | | saveUnit(projectInfoWinUnitForm); |
| | | |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | private void saveUnit(List<ProjectInfoWinUnitForm> projectInfoWinUnitForm) { |
| | | List<ProjectInfoWinUnit> projectInfoWinUnits = new ArrayList<>(); |
| | | for (ProjectInfoWinUnitForm winUnitForm : projectInfoWinUnitForm) { |
| | | ProjectInfoWinUnit projectInfoWinUnit = ProjectInfoWinUnitForm.getEntityByForm(winUnitForm, null); |
| | | projectInfoWinUnits.add(projectInfoWinUnit); |
| | | } |
| | | if (!CollectionUtils.isEmpty(projectInfoWinUnits)) { |
| | | projectInfoWinUnitService.saveBatch(projectInfoWinUnits); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | investmentInfoMapper.delete(new QueryWrapper<ProjectInvestmentInfo>().eq("project_id", id)); |
| | | policyMapper.delete(new QueryWrapper<ProjectInvestmentPolicyCompliance>().eq("project_id", id)); |
| | | unitRegistrationInfoMapper.delete(new QueryWrapper<ProjectUnitRegistrationInfo>().eq("project_id", id)); |
| | | projectInfoWinUnitService.remove(new QueryWrapper<ProjectInfoWinUnit>().eq("project_info_id",id)); |
| | | |
| | | List<String> types = new ArrayList<>(); |
| | | types.add(FileTypeEnum.PROJECT_INFO.getType()); |
| | |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type", FileTypeEnum.PROJECT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id", vo.getId()); |
| | | |
| | | List<File> files = fileMapper.selectList(fileQueryWrapper); |
| | | vo.setFileList(files); |
| | | List<ProjectInfoWinUnitVO> unitVOS = new ArrayList<>(); |
| | | List<ProjectInfoWinUnit> unitList = projectInfoWinUnitService.list(new QueryWrapper<ProjectInfoWinUnit>().eq("project_info_id", id)); |
| | | for (ProjectInfoWinUnit projectInfoWinUnit : unitList) { |
| | | ProjectInfoWinUnitVO unitVO = ProjectInfoWinUnitVO.getVoByEntity(projectInfoWinUnit,null); |
| | | unitVOS.add(unitVO); |
| | | } |
| | | vo.setWinUnitVOList(unitVOS); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |