| | |
| | | @Autowired |
| | | private ProductSoftwareApprovingService psaService; |
| | | |
| | | @Autowired |
| | | private ProductSoftwareService productSoftwareService; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMain main, DocUser user) { |
| | | main.setType(1); |
| | |
| | | Response response = new Response(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | ProductSoftwareApproving approving = mainDTO.getApproving(); |
| | | //首先校验文件名是否已存在 |
| | | String filename = file.getOriginalFilename(); |
| | | List<ProductSoftwareApproving> softwareApprovingList = psaService.getAll(); |
| | | List<ProductSoftware> softwareList = productSoftwareService.getAll(); |
| | | List<String> existApprovingList = softwareApprovingList.stream().map(ProductSoftwareApproving::getSoftwareName).collect(Collectors.toList()); |
| | | List<String> existList = softwareList.stream().map(ProductSoftware::getSoftwareName).collect(Collectors.toList()); |
| | | |
| | | for (String existFilename:existList){ |
| | | if(filename.equals(existFilename)){ |
| | | return response.set(1,false,"软件文件名已存在"); |
| | | } |
| | | } |
| | | for (String existFilename:existApprovingList){ |
| | | if(filename.equals(existFilename)){ |
| | | return response.set(1,false,"软件文件名在审批列表中已存在"); |
| | | } |
| | | } |
| | | |
| | | main.setType(1); |
| | | //提交主表 |