| | |
| | | public Response add(ProjectManage pm) { |
| | | Response response = new Response<>(); |
| | | pm.setProNameCode(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())); |
| | | pm.setProProgress(1);//立项 |
| | | pm.setProState(1);//项目状态 进行中 |
| | | pm.setProProgress(1);//项目进度 立项 |
| | | Integer num = projectManageMapper.checkUniqueId(pm); |
| | | if (num > 0) { |
| | | return response.setMsg(0, "添加失败,pro_name_code重复"); |
| | |
| | | for (int i = 0; i < pams.size(); i++) { |
| | | ProjectArchiveManage pam = pams.get(i); |
| | | HashMap<Object, Object> mapDoc = new HashMap<>(); |
| | | mapDoc.put("fileName", pam.getProDocumentName()); |
| | | mapDoc.put("name", pam.getProDocumentName()); |
| | | mapDoc.put("url", pam.getProFilePath()); |
| | | list.add(mapDoc); |
| | | } |
| | |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | try { |
| | | bl = projectManageMapper.updateManageState(pm) > 0; |
| | | String path = pm.getNote().trim(); |
| | | if (path.length() > 10) { |
| | | ArrayList<String> fileList = pm.getFileList(); |
| | | if (bl&&null != fileList) { |
| | | for (int i = 0; i < fileList.size(); i++) { |
| | | String filePath = fileList.get(i); |
| | | Boolean fileExist = projectArchiveManageMapper.checkFileExist(filePath)>0; |
| | | if (!fileExist) { |
| | | ProjectArchiveManage pam = new ProjectArchiveManage(); |
| | | pam.setProNum(pm.getProNum()); |
| | | pam.setProName(pm.getProName()); |
| | | pam.setProNameCode(pm.getProNameCode());//唯一 |
| | | pam.setProSort(pm.getProSort()); |
| | | pam.setProFilePath(path); |
| | | String[] split = path.split("-"); |
| | | pam.setProFilePath(filePath); |
| | | String[] split = filePath.split("_"); |
| | | int rexIdex = split[1].lastIndexOf("."); |
| | | pam.setProDocumentName(split[1].substring(0, rexIdex)); |
| | | pam.setProDocumentFormat(split[1].substring(rexIdex + 1)); |
| | | projectArchiveManageMapper.insert(pam); |
| | | } |
| | | response.setMsg(1, "更新成功"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return response.setMsg(0, "更新失败"); |
| | | } |
| | | if (bl) { |
| | | response.setMsg(1, "更新成功"); |
| | | dataSourceTransactionManager.commit(transactionStatus); |
| | | } else { |
| | | |
| | | response.setMsg(0, "更新失败"); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | } |
| | | return response; |