| | |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | private final ProjectTypeRepository projectTypeRepository; |
| | | private final ProjectTypeMapper projectTypeMapper; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectTypeQueryCriteria criteria, Pageable pageable){ |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectTypeDto create(ProjectType resources) { |
| | | // 判断是否拥有同名的项目名称 |
| | | checkAddProject(resources); |
| | | return projectTypeMapper.toDto(projectTypeRepository.save(resources)); |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectType resources) { |
| | | // 判断修改是否拥有同名的项目名称 |
| | | checkUpdateProject(resources); |
| | | ProjectType projectType = projectTypeRepository.findById(resources.getId()).orElseGet(ProjectType::new); |
| | | ValidationUtil.isNull( projectType.getId(),"ProjectType","id",resources.getId()); |
| | |
| | | public void download(List<ProjectTypeDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectTypeDto projectType : all) { |
| | | String unitCurrency = projectType.getStandardUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, projectType.getStandardUnitCurrency()).getLabel() : ""; |
| | | String workloadUnit = projectType.getStandardWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT, projectType.getStandardWorkloadUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称;例:国内二次开发,对日包人月,维保,评估报告,绩效评审", projectType.getName()); |
| | | map.put("标准单价币种;字典:人民币、美元、日元", projectType.getStandardUnitCurrency()); |
| | | map.put("标准单价金额", projectType.getStandardUnitPrice()); |
| | | map.put("标准利润金额", projectType.getStandardProfitPrice()); |
| | | map.put("标准工作量单位;字典:个,本,行", projectType.getStandardWorkloadUnit()); |
| | | map.put("名称", projectType.getName()); |
| | | map.put("标准单价币种", unitCurrency); |
| | | map.put("标准报价单金", projectType.getStandardQuotationPrice()); |
| | | map.put("标准绩效单金", projectType.getStandardPerformancePrice()); |
| | | map.put("标准绩效目标", projectType.getStandardPerformanceObjectives()); |
| | | map.put("标准工作量单位", workloadUnit); |
| | | map.put("备注", projectType.getRemarks()); |
| | | map.put("创建者", projectType.getCreateBy()); |
| | | map.put("创建时间", projectType.getCreateTime()); |
| | |
| | | if(opeDeliveryMethodList.size() == 1){ |
| | | // 根据id判断是否是同一条 |
| | | if(opeDeliveryMethodList.get(0).getId() != resources.getId()){ |
| | | // 存在返回错误 |
| | | throw new BadRequestException("已存在此项目名称"); |
| | | } else { |
| | | |