TPssrOverhaulExchangerController.java 22 KB

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