TPssrOverhaulExchangerController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. package com.ruoyi.project.pssr.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.ruoyi.common.utils.DateUtils;
  4. import com.ruoyi.common.utils.StringUtils;
  5. import com.ruoyi.common.utils.file.ExcelUtils;
  6. import com.ruoyi.common.utils.poi.ExcelUtil;
  7. import com.ruoyi.framework.aspectj.lang.annotation.Log;
  8. import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
  9. import com.ruoyi.framework.web.controller.BaseController;
  10. import com.ruoyi.framework.web.domain.AjaxResult;
  11. import com.ruoyi.framework.web.page.TableDataInfo;
  12. import com.ruoyi.project.listener.pssr.ConfirmTaskCreateListener;
  13. import com.ruoyi.project.pssr.domain.TPssrApprove;
  14. import com.ruoyi.project.pssr.domain.TPssrOverhaulExchanger;
  15. import com.ruoyi.project.pssr.domain.TPssrSubcontent;
  16. import com.ruoyi.project.pssr.domain.TPssrTurndown;
  17. import com.ruoyi.project.pssr.mapper.TPssrOverhaulExchangerMapper;
  18. import com.ruoyi.project.pssr.service.*;
  19. import com.ruoyi.project.system.domain.SysDept;
  20. import com.ruoyi.project.system.domain.SysUser;
  21. import com.ruoyi.project.system.service.ISysDeptService;
  22. import com.ruoyi.project.system.service.ISysUserService;
  23. import org.activiti.engine.*;
  24. import org.activiti.engine.impl.identity.Authentication;
  25. import org.activiti.engine.runtime.ProcessInstance;
  26. import org.activiti.engine.task.Task;
  27. import org.apache.commons.collections4.CollectionUtils;
  28. import org.apache.poi.ss.usermodel.*;
  29. import org.apache.poi.xssf.usermodel.XSSFSheet;
  30. import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  31. import org.springframework.beans.factory.annotation.Autowired;
  32. import org.springframework.security.access.prepost.PreAuthorize;
  33. import org.springframework.web.bind.annotation.*;
  34. import org.springframework.web.multipart.MultipartFile;
  35. import javax.annotation.Resource;
  36. import java.io.FileOutputStream;
  37. import java.io.IOException;
  38. import java.io.InputStream;
  39. import java.io.OutputStream;
  40. import java.text.SimpleDateFormat;
  41. import java.util.*;
  42. /**
  43. * 检修项目-换热器Controller
  44. *
  45. * @author ssy
  46. * @date 2024-09-18
  47. */
  48. @RestController
  49. @RequestMapping("/pssr/overhaulExchanger")
  50. public class TPssrOverhaulExchangerController extends BaseController {
  51. @Resource
  52. private TPssrOverhaulExchangerMapper tPssrOverhaulExchangerMapper;
  53. @Autowired
  54. private ITPssrFileService tPssrFileService;
  55. @Autowired
  56. private ITPssrTurndownService tPssrTurndownService;
  57. @Autowired
  58. private ITPssrOverhaulExchangerService tPssrOverhaulExchangerService;
  59. @Autowired
  60. private ITPssrApproveService tPssrApproveService;
  61. @Autowired
  62. private RuntimeService runtimeService;
  63. @Autowired
  64. private HistoryService historyService;
  65. @Autowired
  66. private ITPssrSubcontentService tPssrSubcontentService;
  67. @Autowired
  68. private ISysUserService sysUserService;
  69. private String forShort = "jxxm-hrq";
  70. @Autowired
  71. private ISysDeptService iSysDeptService;
  72. @Autowired
  73. private ISysUserService userService;
  74. /**
  75. * 查询检修项目-换热器列表
  76. */
  77. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:list')")
  78. @GetMapping("/list")
  79. public TableDataInfo list(TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  80. try {
  81. TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrOverhaulExchanger.getSubId());
  82. if (approve != null) {
  83. ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  84. TaskService taskService = processEngine.getTaskService();
  85. Task task = processEngine.getTaskService()//获取任务service
  86. .createTaskQuery()//创建查询对象
  87. .taskAssignee(getUserId().toString())
  88. .processInstanceId(approve.getProcessId()).singleResult();
  89. if (task != null) {
  90. if (task.getName().equals("确认人")){
  91. tPssrOverhaulExchanger.setConfirmedPerson(getUserId().toString());
  92. }
  93. }
  94. }
  95. } catch (Exception e) {
  96. e.printStackTrace();
  97. logger.error("待办确认人查询报错:{}",e.getMessage());
  98. }
  99. if ("1".equals(tPssrOverhaulExchanger.getConfirmedPerson())) {
  100. tPssrOverhaulExchanger.setConfirmedPerson(getUserId().toString());
  101. }
  102. startPage();
  103. List<TPssrOverhaulExchanger> list = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerList(tPssrOverhaulExchanger);
  104. list.forEach(item -> {
  105. item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "jxxm-hrq"));
  106. if (item.getApproveStatus() != 2)
  107. item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "jxxm-hrq"));
  108. });
  109. return getDataTable(list);
  110. }
  111. /**
  112. * 导出检修项目-换热器列表
  113. */
  114. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:export')")
  115. @Log(title = "检修项目-换热器", businessType = BusinessType.EXPORT)
  116. @GetMapping("/export")
  117. public AjaxResult export(TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  118. List<TPssrOverhaulExchanger> list = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerList(tPssrOverhaulExchanger);
  119. if (list.size() != 0) {
  120. return AjaxResult.success(exportTmpl(list, tPssrOverhaulExchanger.getDevType()));
  121. } else {
  122. return AjaxResult.error("暂无可导出数据");
  123. }
  124. }
  125. public String exportTmpl(List<TPssrOverhaulExchanger> list, Long devType) {
  126. OutputStream out = null;
  127. String filename = null;
  128. try {
  129. String tempUrl = "static/word/pssr/jxxmhrq.xlsx"; // 模板文件
  130. InputStream is = null;
  131. is = Thread.currentThread().getContextClassLoader().getResourceAsStream(tempUrl);
  132. XSSFWorkbook wb = null;
  133. wb = new XSSFWorkbook(is);
  134. XSSFSheet sheet = wb.getSheetAt(0);
  135. switch (devType.toString()) {
  136. case "1":
  137. filename = "PSSR_01_检修项目_换热器" + ".xlsx";
  138. sheet.getRow(0).getCell(0).setCellValue("蒸汽裂解装置换热器检修清单");
  139. break;
  140. case "2":
  141. filename = "PSSR_01_检修项目_电仪" + ".xlsx";
  142. sheet.getRow(0).getCell(0).setCellValue("蒸汽裂解装置电仪检修清单");
  143. break;
  144. case "3":
  145. filename = "PSSR_01_检修项目_反应器" + ".xlsx";
  146. sheet.getRow(0).getCell(0).setCellValue("蒸汽裂解装置反应器检修清单");
  147. break;
  148. case "4":
  149. filename = "PSSR_01_检修项目_裂解炉" + ".xlsx";
  150. sheet.getRow(0).getCell(0).setCellValue("蒸汽裂解装置裂解炉检修清单");
  151. break;
  152. case "5":
  153. filename = "PSSR_01_检修项目_其他" + ".xlsx";
  154. sheet.getRow(0).getCell(0).setCellValue("蒸汽裂解装置其他检修清单");
  155. break;
  156. }
  157. //填充数据
  158. int rowIndex = 3;
  159. int num = 1;
  160. Row originalRow = sheet.getRow(3);
  161. Cell originalcell = originalRow.getCell(0);
  162. // 获取单元格样式
  163. CellStyle originalStyle = originalcell.getCellStyle();
  164. for (TPssrOverhaulExchanger t : list) {
  165. Row row = sheet.createRow(rowIndex);
  166. row.setHeight((short) 800);
  167. row.createCell(0).setCellValue(num);
  168. row.createCell(1).setCellValue(t.getTagNo());
  169. row.createCell(2).setCellValue(t.getEquipmentName());
  170. row.createCell(3).setCellValue(t.getPidNo());
  171. row.createCell(4).setCellValue(t.getWorkDes());
  172. row.createCell(5).setCellValue(t.getCompletionStatus());
  173. row.createCell(6);
  174. try {
  175. SysUser sysUser = sysUserService.selectUserById(Long.valueOf(t.getConfirmedPerson()));
  176. String confirm1 = sysUser.getSignUrl();
  177. ExcelUtils.insertPicture(wb, sheet, confirm1, row.getRowNum(), 6, 1, 1);
  178. } catch (Exception e) {
  179. }
  180. row.createCell(7).setCellValue(DateUtils.dateTime(t.getCompletionDate()));
  181. row.createCell(8).setCellValue(t.getRemarks());
  182. //渲染样式
  183. for (int i = 0; i < 9; i++) {
  184. row.getCell(i).setCellStyle(originalStyle);
  185. }
  186. num++;
  187. rowIndex++;
  188. }
  189. out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
  190. wb.write(out);
  191. wb.close();
  192. } catch (IOException e) {
  193. e.printStackTrace();
  194. }
  195. return filename;
  196. }
  197. /**
  198. * 获取检修项目-换热器详细信息
  199. */
  200. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:query')")
  201. @GetMapping(value = "/{id}")
  202. public AjaxResult getInfo(@PathVariable("id") Long id) {
  203. TPssrOverhaulExchanger item = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerById(id);
  204. item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "jxxm-hrq"));
  205. if (item.getApproveStatus() != 2)
  206. item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "jxxm-hrq"));
  207. return AjaxResult.success(item);
  208. }
  209. /**
  210. * 新增检修项目-换热器
  211. */
  212. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:add')")
  213. @Log(title = "检修项目-换热器", businessType = BusinessType.INSERT)
  214. @PostMapping
  215. public AjaxResult add(@RequestBody TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  216. tPssrOverhaulExchanger.setApproveStatus(0L);
  217. return toAjax(tPssrOverhaulExchangerService.insertTPssrOverhaulExchanger(tPssrOverhaulExchanger));
  218. }
  219. //导入时判断更新或新增
  220. private int insertOrUpdate(TPssrOverhaulExchanger item) {
  221. TPssrOverhaulExchanger entity = new TPssrOverhaulExchanger();
  222. entity.setSubId(item.getSubId());
  223. entity.setTagNo(item.getTagNo());
  224. List<TPssrOverhaulExchanger> list = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerList(entity);
  225. if (CollectionUtils.isNotEmpty(list)) {
  226. item.setId(list.get(0).getId());
  227. return tPssrOverhaulExchangerService.updateTPssrOverhaulExchanger(item);
  228. }else{
  229. return tPssrOverhaulExchangerService.insertTPssrOverhaulExchanger(item);
  230. }
  231. }
  232. /**
  233. * 修改检修项目-换热器
  234. */
  235. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:edit')")
  236. @Log(title = "检修项目-换热器", businessType = BusinessType.UPDATE)
  237. @PutMapping
  238. public AjaxResult edit(@RequestBody TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  239. TPssrOverhaulExchanger entity = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerById(tPssrOverhaulExchanger.getId());
  240. if (entity.getApproveStatus() != 1 && entity.getApproveStatus() != 0) {
  241. return AjaxResult.error("当前状态不可修改!");
  242. }
  243. tPssrFileService.updateFileRelevance(tPssrOverhaulExchanger.getFileIds(), "jxxm-hrq", tPssrOverhaulExchanger.getId(), tPssrOverhaulExchanger.getSubId());
  244. return toAjax(tPssrOverhaulExchangerService.updateTPssrOverhaulExchanger(tPssrOverhaulExchanger));
  245. }
  246. /**
  247. * 修改检修项目-换热器
  248. */
  249. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:edit')")
  250. @Log(title = "检修项目-换热器", businessType = BusinessType.UPDATE)
  251. @PutMapping("/editBatch")
  252. public AjaxResult editb(@RequestBody TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  253. return toAjax(tPssrOverhaulExchangerMapper.updateTPssrOverhaulExchangerByIds(tPssrOverhaulExchanger));
  254. }
  255. /**
  256. * 删除检修项目-换热器
  257. */
  258. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:remove')")
  259. @Log(title = "检修项目-换热器", businessType = BusinessType.DELETE)
  260. @DeleteMapping("/{ids}")
  261. public AjaxResult remove(@PathVariable Long[] ids) {
  262. return toAjax(tPssrOverhaulExchangerService.deleteTPssrOverhaulExchangerByIds(ids));
  263. }
  264. /**
  265. * 确认检修项目-换热器
  266. */
  267. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:edit')")
  268. @Log(title = "检修项目-换热器", businessType = BusinessType.UPDATE)
  269. @PutMapping("/confirmExchanger")
  270. public AjaxResult confirmExchanger(@RequestBody TPssrOverhaulExchanger tPssrOverhaulExchanger) {
  271. if (tPssrOverhaulExchanger.getIds() != null && tPssrOverhaulExchanger.getIds().length > 0) {
  272. for (Long id : tPssrOverhaulExchanger.getIds()) {
  273. TPssrOverhaulExchanger exchanger = tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerById(id);
  274. exchanger.setCompletionDate(new Date());
  275. exchanger.setApproveStatus(2L);
  276. exchanger.setUpdatedate(new Date());
  277. exchanger.setUpdaterCode(String.valueOf(getUserId()));
  278. tPssrOverhaulExchangerService.updateTPssrOverhaulExchanger(exchanger);
  279. }
  280. } else {
  281. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
  282. exchanger.setSubId(tPssrOverhaulExchanger.getSubId());
  283. exchanger.setConfirmedPerson(getUserId().toString());
  284. exchanger.setApproveStatus(1L);
  285. for (TPssrOverhaulExchanger overhaulExchanger : tPssrOverhaulExchangerService.selectTPssrOverhaulExchangerList(exchanger)) {
  286. overhaulExchanger.setCompletionDate(new Date());
  287. overhaulExchanger.setApproveStatus(2L);
  288. overhaulExchanger.setUpdatedate(new Date());
  289. overhaulExchanger.setUpdaterCode(String.valueOf(getUserId()));
  290. tPssrOverhaulExchangerService.updateTPssrOverhaulExchanger(overhaulExchanger);
  291. }
  292. }
  293. //查询当前待审批的确认人
  294. TPssrOverhaulExchanger entity = new TPssrOverhaulExchanger();
  295. entity.setSubId(tPssrOverhaulExchanger.getSubId());
  296. entity.setApproveStatus(1L);
  297. TPssrOverhaulExchanger exchanger = tPssrOverhaulExchangerService.selectAllConfirmedPersonBySubId(entity);
  298. if (exchanger != null) {
  299. String confirmedPerson = exchanger.getConfirmedPerson();
  300. logger.info("===========confirmedPerson:{}", confirmedPerson);
  301. //如果当前用户还有待审批任务
  302. if (confirmedPerson.contains(getUserId().toString())) {
  303. return AjaxResult.success();
  304. }
  305. }
  306. //无待审批任务结束当前用户流程
  307. // 因为流程关系所以approve一定会有且只有一条数据
  308. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(tPssrOverhaulExchanger.getSubId());
  309. TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
  310. return AjaxResult.success();
  311. }
  312. @PutMapping("/turnDownExchanger")
  313. public AjaxResult turnDownExchanger(@RequestBody List<TPssrOverhaulExchanger> tPssrOverhaulExchanger) {
  314. if (CollectionUtils.isNotEmpty(tPssrOverhaulExchanger)) {
  315. String userId = getUserId().toString();
  316. Long subId = tPssrOverhaulExchanger.get(0).getSubId();
  317. // 修改已选择数据的状态
  318. for (TPssrOverhaulExchanger item : tPssrOverhaulExchanger) {
  319. TPssrOverhaulExchanger blind = new TPssrOverhaulExchanger();
  320. blind.setId(item.getId());
  321. blind.setApproveStatus(1L);
  322. blind.setUpdatedate(new Date());
  323. blind.setUpdaterCode(getUserId().toString());
  324. tPssrOverhaulExchangerService.updateTPssrOverhaulExchanger(blind);
  325. // 新增驳回原因数据
  326. TPssrTurndown turndown = new TPssrTurndown();
  327. turndown.setForShort(forShort);
  328. turndown.setSubId(item.getSubId());
  329. turndown.setItemId(item.getId());
  330. turndown.setReason(item.getReason());
  331. turndown.setCreatedate(new Date());
  332. turndown.setCreaterCode(getUserId().toString());
  333. tPssrTurndownService.insertTPssrTurndown(turndown);
  334. }
  335. // 查询当前流程
  336. TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(subId);
  337. try {
  338. runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr1confirm");
  339. historyService.deleteHistoricProcessInstance(approve.getProcessId());
  340. } catch (Exception e) {
  341. logger.info("无运行时流程");
  342. }
  343. // 驳回 查询所有待审批的人员
  344. //查询所有确认人
  345. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
  346. exchanger.setSubId(approve.getSubId());
  347. exchanger.setApproveStatus(1L);
  348. TPssrOverhaulExchanger overhaul = tPssrOverhaulExchangerService.selectAllConfirmedPersonBySubId(exchanger);
  349. String confirmers = null;
  350. if (overhaul != null) {
  351. confirmers = overhaul.getConfirmedPerson();
  352. }
  353. logger.info("=======================confirmers:{}", confirmers);
  354. Set<String> confirmUsers1 = new HashSet<>();
  355. if (StringUtils.isNotEmpty(confirmers)) {
  356. confirmUsers1.addAll(Arrays.asList(confirmers.split(",")));
  357. }
  358. // 开始申请流程
  359. long businessKey = approve.getApproveId();
  360. //开始工作流、监听
  361. Authentication.setAuthenticatedUserId(userId);//设置当前申请人
  362. Map<String, Object> variables = new HashMap<>();
  363. variables.put("applyUser", userId);
  364. variables.put("confirmUsers", new ArrayList<>(confirmUsers1));
  365. variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
  366. variables.put("chargePerson", approve.getSubCharge());
  367. //采用key来启动流程定义并设置流程变量,返回流程实例
  368. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr1confirm", String.valueOf(businessKey), variables);
  369. // 修改审批表和sub表
  370. approve.setProcessId(pi.getProcessInstanceId());
  371. approve.setApproveStatus(1L);
  372. approve.setUpdatedate(new Date());
  373. approve.setUpdaterCode(getUserId().toString());
  374. tPssrApproveService.updateTPssrApprove(approve);
  375. TPssrSubcontent subcontent = new TPssrSubcontent();
  376. subcontent.setId(approve.getSubId());
  377. subcontent.setApproveStatus(1L);
  378. subcontent.setUpdatedate(new Date());
  379. subcontent.setUpdaterCode(getUserId().toString());
  380. tPssrSubcontentService.updateTPssrSubcontent(subcontent);
  381. return AjaxResult.success();
  382. }
  383. return AjaxResult.error();
  384. }
  385. /**
  386. * 批量导入
  387. */
  388. @PreAuthorize("@ss.hasPermi('pssr:overhaulExchanger:add')")
  389. @PostMapping("/importData")
  390. public AjaxResult importInterlockData(MultipartFile file, Long subId, Long devType) throws IOException {
  391. //获取操作人员ID
  392. Long userId = getUserId();
  393. //报错行数统计
  394. List<Integer> failRow = new ArrayList<Integer>();
  395. Workbook workbook = ExcelUtils.getWorkBook(file);
  396. Sheet sheet = workbook.getSheetAt(0);
  397. List<TPssrOverhaulExchanger> list = new ArrayList<TPssrOverhaulExchanger>();
  398. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  399. //部门查询
  400. List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
  401. int rowNum = sheet.getPhysicalNumberOfRows();
  402. int failNumber = 0;
  403. for (int i = 2; i <= rowNum; i++) {
  404. try {
  405. logger.info("读取行数:" + i);
  406. Row row = sheet.getRow(i);
  407. int cellNum = row.getLastCellNum();
  408. TPssrOverhaulExchanger entity = new TPssrOverhaulExchanger();
  409. entity.setDeptId(userService.selectUserById(getUserId()).getDeptId());
  410. entity.setSubId(subId);
  411. entity.setDevType(devType);
  412. entity.setApproveStatus(0L);
  413. for (int j = 0; j < cellNum; j++) {
  414. Cell cell = row.getCell(j);
  415. String cellValue = ExcelUtils.getCellValue(cell);
  416. logger.info("cellValue:" + cellValue);
  417. if (j == 0) {
  418. entity.setTagNo(cellValue);
  419. } else if (j == 1) {
  420. entity.setEquipmentName(cellValue);
  421. } else if (j == 2) {
  422. entity.setWorkDes(cellValue);
  423. } else if (j == 3) {
  424. entity.setPidNo(cellValue);
  425. }else if (j == 4) {
  426. entity.setConfirmedPerson(cellValue);
  427. }
  428. }
  429. entity.setCreaterCode(userId.toString());
  430. logger.info("entity:" + entity);
  431. list.add(entity);
  432. } catch (Exception e) {
  433. failNumber++;
  434. failRow.add(i + 1);
  435. }
  436. }
  437. int successNumber = 0;
  438. int failNum = 0;
  439. for (TPssrOverhaulExchanger t : list
  440. ) {
  441. failNum++;
  442. try {
  443. this.add(t);
  444. successNumber++;
  445. } catch (Exception e) {
  446. failNumber++;
  447. logger.info("e:" + e);
  448. failRow.add(failNum + 1);
  449. }
  450. }
  451. logger.info("list:" + JSON.toJSONString(list));
  452. logger.info("successNumber:" + String.valueOf(successNumber));
  453. logger.info("failNumber:" + String.valueOf(failNumber));
  454. logger.info("failRow:" + String.valueOf(failRow));
  455. return AjaxResult.success("导入成功行数:" + String.valueOf(successNumber));
  456. }
  457. }