|
@@ -8,15 +8,18 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
import com.ruoyi.framework.config.RuoYiConfig;
|
|
|
-import com.ruoyi.project.sems.domain.ParamData;
|
|
|
-import com.ruoyi.project.sems.domain.TReportThird;
|
|
|
-import com.ruoyi.project.sems.domain.TReportYlrq;
|
|
|
+import com.ruoyi.project.sems.domain.*;
|
|
|
+import com.ruoyi.project.sems.mapper.TReportYlgdMapper;
|
|
|
import com.ruoyi.project.sems.service.ITReportThirdService;
|
|
|
+import com.ruoyi.project.system.domain.SysDictData;
|
|
|
+import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
@@ -25,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
-import com.ruoyi.project.sems.domain.TReportYlgd;
|
|
|
import com.ruoyi.project.sems.service.ITReportYlgdService;
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
@@ -33,6 +35,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
/**
|
|
|
* 压力管道年检报告Controller
|
|
|
*
|
|
@@ -48,6 +52,10 @@ public class TReportYlgdController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ITReportThirdService itReportYlrqThirdService;
|
|
|
+ @Resource
|
|
|
+ private TReportYlgdMapper tReportYlgdMapper;
|
|
|
+ @Autowired
|
|
|
+ private ISysDictTypeService iSysDictTypeService;
|
|
|
|
|
|
/**
|
|
|
* 导出选中设备
|
|
@@ -74,10 +82,10 @@ public class TReportYlgdController extends BaseController {
|
|
|
Sheet sheet = wb.createSheet("sheet1");
|
|
|
//设置列的宽度,第一个参数为列的序号,从0开始,第二参数为列宽,单位1/256个字节
|
|
|
for (int i = 0; i < 27; i++) {
|
|
|
- if (i == 0 || i == 1 || i == 2 || i == 20 || i == 21 || i ==22 || i == 23 || i == 24 || i == 25 || i == 26) {
|
|
|
+ if (i == 0 || i == 1 || i == 2 || i == 20 || i == 21 || i == 22 || i == 23 || i == 24 || i == 25 || i == 26) {
|
|
|
sheet.setColumnWidth(i, 20 * 256);
|
|
|
} else {
|
|
|
- sheet.setColumnWidth(i, 10 * 256);
|
|
|
+ sheet.setColumnWidth(i, 10 * 256);
|
|
|
}
|
|
|
}
|
|
|
//设置开始行和开始列
|
|
@@ -173,28 +181,28 @@ public class TReportYlgdController extends BaseController {
|
|
|
if (i == 26) row4.createCell(i).setCellValue("3:不符合要求");
|
|
|
}
|
|
|
// 合并单元格
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,3,3));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,4,4));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,5,5));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,6,6));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,7,7));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,0,8,13));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,14,14));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,15,15));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,16,16));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,17,17));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,18,18));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,19,19));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,20,20));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,21,21));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,22,22));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,23,23));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,24,24));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,25,25));
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(0,1,26,26));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 6, 6));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 7, 7));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 0, 8, 13));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 14, 14));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 15, 15));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 16, 16));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 17, 17));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 18, 18));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 19, 19));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 20, 20));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 21, 21));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 22, 22));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 23, 23));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 24, 24));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 25, 25));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0, 1, 26, 26));
|
|
|
// 表头样式
|
|
|
for (int i = 0; i < 26; i++) {
|
|
|
if (i < 3) {
|
|
@@ -375,7 +383,51 @@ public class TReportYlgdController extends BaseController {
|
|
|
@Log(title = "压力管道年检报告", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TReportYlgd tReportYlgd) {
|
|
|
- return toAjax(tReportYlgdService.updateTReportYlgd(tReportYlgd));
|
|
|
+ tReportYlgdService.updateTReportYlgd(tReportYlgd);
|
|
|
+ new Thread(() -> {
|
|
|
+ sysnReport(String.valueOf(tReportYlgd.getId()));
|
|
|
+ }, "压力管道年检报告修改同步").start();
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步数据
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ */
|
|
|
+ public void sysnReport(Object[] ids) {
|
|
|
+ List<SysDictData> con = iSysDictTypeService.selectDictDataByType("REPORT_CON");
|
|
|
+ for (Object id : ids
|
|
|
+ ) {
|
|
|
+ TReportYlgd tReportYlgd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(id.toString()));
|
|
|
+ if (StringUtils.isNotEmpty(tReportYlgd.getCon())) {
|
|
|
+ for (SysDictData c : con) {
|
|
|
+ if (tReportYlgd.getCon().equals(c.getDictValue())) {
|
|
|
+ tReportYlgd.setCon(c.getDictLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tReportYlgdMapper.sysnReport(tReportYlgd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步数据
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ public void sysnReport(String id) {
|
|
|
+ List<SysDictData> con = iSysDictTypeService.selectDictDataByType("REPORT_CON");
|
|
|
+
|
|
|
+ TReportYlgd tReportYlgd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(id));
|
|
|
+ if (StringUtils.isNotEmpty(tReportYlgd.getCon())) {
|
|
|
+ for (SysDictData c : con) {
|
|
|
+ if (tReportYlgd.getCon().equals(c.getDictValue())) {
|
|
|
+ tReportYlgd.setCon(c.getDictLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tReportYlgdMapper.sysnReport(tReportYlgd);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -509,6 +561,7 @@ public class TReportYlgdController extends BaseController {
|
|
|
}
|
|
|
int successNumber = 0;
|
|
|
int failNum = 0;
|
|
|
+ CopyOnWriteArrayList<String> ids = new CopyOnWriteArrayList();
|
|
|
for (TReportYlgd t : list
|
|
|
) {
|
|
|
failNum++;
|
|
@@ -516,12 +569,16 @@ public class TReportYlgdController extends BaseController {
|
|
|
//根据使用证、注册编号、位号,进行数据更新
|
|
|
this.tReportYlgdService.updateForImport(t);
|
|
|
successNumber++;
|
|
|
+ ids.add(t.getId().toString());
|
|
|
} catch (Exception e) {
|
|
|
failNumber++;
|
|
|
logger.info("e:" + e);
|
|
|
failRow.add(failNum + 1);
|
|
|
}
|
|
|
}
|
|
|
+ new Thread(() -> {
|
|
|
+ sysnReport(ids.toArray());
|
|
|
+ }, "压力管道年检报告修改同步").start();
|
|
|
logger.info("list:" + JSON.toJSONString(list));
|
|
|
logger.info("successNumber:" + String.valueOf(successNumber));
|
|
|
logger.info("failNumber:" + String.valueOf(failNumber));
|