|
@@ -1,48 +1,60 @@
|
|
package com.ruoyi.project.asset.controller;
|
|
package com.ruoyi.project.asset.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
+import com.ruoyi.project.asset.domain.TLeakagePoints;
|
|
import com.ruoyi.project.asset.domain.TLeakagePointsPatrol;
|
|
import com.ruoyi.project.asset.domain.TLeakagePointsPatrol;
|
|
|
|
+import com.ruoyi.project.asset.domain.TLeakagePointsRecord;
|
|
import com.ruoyi.project.asset.service.ITLeakagePointsPatrolService;
|
|
import com.ruoyi.project.asset.service.ITLeakagePointsPatrolService;
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
+import com.ruoyi.project.asset.service.ITLeakagePointsRecordService;
|
|
|
|
+import com.ruoyi.project.asset.service.ITLeakagePointsService;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 漏点巡检Controller
|
|
* 漏点巡检Controller
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @author ruoyi
|
|
* @author ruoyi
|
|
* @date 2024-04-01
|
|
* @date 2024-04-01
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/asset/pointPatrol")
|
|
@RequestMapping("/asset/pointPatrol")
|
|
-public class TLeakagePointsPatrolController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class TLeakagePointsPatrolController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITLeakagePointsPatrolService tLeakagePointsPatrolService;
|
|
private ITLeakagePointsPatrolService tLeakagePointsPatrolService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITLeakagePointsRecordService tLeakagePointsRecordService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITLeakagePointsService tLeakagePointsService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询漏点巡检列表
|
|
* 查询漏点巡检列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:list')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TLeakagePointsPatrol tLeakagePointsPatrol)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(TLeakagePointsPatrol tLeakagePointsPatrol) {
|
|
startPage();
|
|
startPage();
|
|
|
|
+ if (tLeakagePointsPatrol.getCheckDateM() == null) {
|
|
|
|
+ tLeakagePointsPatrol.setCheckDateM(new Date());
|
|
|
|
+ }
|
|
List<TLeakagePointsPatrol> list = tLeakagePointsPatrolService.selectTLeakagePointsPatrolList(tLeakagePointsPatrol);
|
|
List<TLeakagePointsPatrol> list = tLeakagePointsPatrolService.selectTLeakagePointsPatrolList(tLeakagePointsPatrol);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
+ TLeakagePointsRecord record = new TLeakagePointsRecord();
|
|
|
|
+ record.setPatrolId(list.get(0).getId());
|
|
|
|
+ list.get(0).setRecords(tLeakagePointsRecordService.selectTLeakagePointsRecordList(record));
|
|
|
|
+ }
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -52,8 +64,7 @@ public class TLeakagePointsPatrolController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:export')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:export')")
|
|
@Log(title = "漏点巡检", businessType = BusinessType.EXPORT)
|
|
@Log(title = "漏点巡检", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(HttpServletResponse response, TLeakagePointsPatrol tLeakagePointsPatrol)
|
|
|
|
- {
|
|
|
|
|
|
+ public void export(HttpServletResponse response, TLeakagePointsPatrol tLeakagePointsPatrol) {
|
|
List<TLeakagePointsPatrol> list = tLeakagePointsPatrolService.selectTLeakagePointsPatrolList(tLeakagePointsPatrol);
|
|
List<TLeakagePointsPatrol> list = tLeakagePointsPatrolService.selectTLeakagePointsPatrolList(tLeakagePointsPatrol);
|
|
ExcelUtil<TLeakagePointsPatrol> util = new ExcelUtil<TLeakagePointsPatrol>(TLeakagePointsPatrol.class);
|
|
ExcelUtil<TLeakagePointsPatrol> util = new ExcelUtil<TLeakagePointsPatrol>(TLeakagePointsPatrol.class);
|
|
util.exportExcel(response, list, "漏点巡检数据");
|
|
util.exportExcel(response, list, "漏点巡检数据");
|
|
@@ -64,8 +75,7 @@ public class TLeakagePointsPatrolController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:query')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return success(tLeakagePointsPatrolService.selectTLeakagePointsPatrolById(id));
|
|
return success(tLeakagePointsPatrolService.selectTLeakagePointsPatrolById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -75,9 +85,28 @@ public class TLeakagePointsPatrolController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:add')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:add')")
|
|
@Log(title = "漏点巡检", businessType = BusinessType.INSERT)
|
|
@Log(title = "漏点巡检", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TLeakagePointsPatrol tLeakagePointsPatrol)
|
|
|
|
- {
|
|
|
|
- return toAjax(tLeakagePointsPatrolService.insertTLeakagePointsPatrol(tLeakagePointsPatrol));
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody TLeakagePointsPatrol tLeakagePointsPatrol) {
|
|
|
|
+ tLeakagePointsPatrol.setCheckDateN(tLeakagePointsPatrol.getCheckDateM());
|
|
|
|
+ TLeakagePointsPatrol patrol = new TLeakagePointsPatrol();
|
|
|
|
+ patrol.setCheckDateM(tLeakagePointsPatrol.getCheckDateM());
|
|
|
|
+ List<TLeakagePointsPatrol> list = tLeakagePointsPatrolService.selectTLeakagePointsPatrolList(patrol);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
+ return AjaxResult.warn("当前日期已存在巡检记录!");
|
|
|
|
+ }
|
|
|
|
+ tLeakagePointsPatrolService.insertTLeakagePointsPatrol(tLeakagePointsPatrol);
|
|
|
|
+ TLeakagePoints tLeakagePoints = new TLeakagePoints();
|
|
|
|
+ tLeakagePoints.setLeakageEliminationResult("1,2");
|
|
|
|
+ for (TLeakagePoints leakagePoints : tLeakagePointsService.selectTLeakagePointsList(tLeakagePoints)) {
|
|
|
|
+ TLeakagePointsRecord record = new TLeakagePointsRecord();
|
|
|
|
+ record.setPatrolId(tLeakagePointsPatrol.getId());
|
|
|
|
+ record.setPointNo(leakagePoints.getPointNo());
|
|
|
|
+ record.setLeakagePosition(leakagePoints.getLeakagePosition());
|
|
|
|
+ record.setLeakageMedium(leakagePoints.getLeakageMedium());
|
|
|
|
+ record.setCreatedate(new Date());
|
|
|
|
+ record.setCreaterCode(getUserId().toString());
|
|
|
|
+ tLeakagePointsRecordService.insertTLeakagePointsRecord(record);
|
|
|
|
+ }
|
|
|
|
+ return toAjax(1);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -86,8 +115,14 @@ public class TLeakagePointsPatrolController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:edit')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:edit')")
|
|
@Log(title = "漏点巡检", businessType = BusinessType.UPDATE)
|
|
@Log(title = "漏点巡检", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody TLeakagePointsPatrol tLeakagePointsPatrol)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody TLeakagePointsPatrol tLeakagePointsPatrol) {
|
|
|
|
+ if (CollectionUtils.isNotEmpty(tLeakagePointsPatrol.getRecords())) {
|
|
|
|
+ tLeakagePointsPatrol.getRecords().forEach(item -> {
|
|
|
|
+ item.setUpdatedate(new Date());
|
|
|
|
+ item.setUpdaterCode(getUserId().toString());
|
|
|
|
+ tLeakagePointsRecordService.updateTLeakagePointsRecord(item);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return toAjax(tLeakagePointsPatrolService.updateTLeakagePointsPatrol(tLeakagePointsPatrol));
|
|
return toAjax(tLeakagePointsPatrolService.updateTLeakagePointsPatrol(tLeakagePointsPatrol));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -96,9 +131,8 @@ public class TLeakagePointsPatrolController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:remove')")
|
|
@PreAuthorize("@ss.hasPermi('asset:pointPatrol:remove')")
|
|
@Log(title = "漏点巡检", businessType = BusinessType.DELETE)
|
|
@Log(title = "漏点巡检", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{ids}")
|
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(tLeakagePointsPatrolService.deleteTLeakagePointsPatrolByIds(ids));
|
|
return toAjax(tLeakagePointsPatrolService.deleteTLeakagePointsPatrolByIds(ids));
|
|
}
|
|
}
|
|
}
|
|
}
|