|
@@ -1,24 +1,23 @@
|
|
package com.ruoyi.project.pssr.controller;
|
|
package com.ruoyi.project.pssr.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-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.utils.poi.ExcelUtil;
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
-import com.ruoyi.project.pssr.domain.TPssrBlind;
|
|
|
|
-import com.ruoyi.project.pssr.service.ITPssrBlindService;
|
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
|
+import com.ruoyi.project.pssr.domain.TPssrApprove;
|
|
|
|
+import com.ruoyi.project.pssr.domain.TPssrBlind;
|
|
|
|
+import com.ruoyi.project.pssr.service.ITPssrApproveService;
|
|
|
|
+import com.ruoyi.project.pssr.service.ITPssrBlindService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashSet;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 盲板Controller
|
|
* 盲板Controller
|
|
@@ -28,18 +27,19 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/pssr/blind")
|
|
@RequestMapping("/pssr/blind")
|
|
-public class TPssrBlindController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class TPssrBlindController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITPssrBlindService tPssrBlindService;
|
|
private ITPssrBlindService tPssrBlindService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITPssrApproveService tPssrApproveService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询盲板列表
|
|
* 查询盲板列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:list')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TPssrBlind tPssrBlind)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(TPssrBlind tPssrBlind) {
|
|
startPage();
|
|
startPage();
|
|
List<TPssrBlind> list = tPssrBlindService.selectTPssrBlindList(tPssrBlind);
|
|
List<TPssrBlind> list = tPssrBlindService.selectTPssrBlindList(tPssrBlind);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -51,8 +51,7 @@ public class TPssrBlindController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:export')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:export')")
|
|
@Log(title = "盲板", businessType = BusinessType.EXPORT)
|
|
@Log(title = "盲板", businessType = BusinessType.EXPORT)
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
- public AjaxResult export(TPssrBlind tPssrBlind)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult export(TPssrBlind tPssrBlind) {
|
|
List<TPssrBlind> list = tPssrBlindService.selectTPssrBlindList(tPssrBlind);
|
|
List<TPssrBlind> list = tPssrBlindService.selectTPssrBlindList(tPssrBlind);
|
|
ExcelUtil<TPssrBlind> util = new ExcelUtil<TPssrBlind>(TPssrBlind.class);
|
|
ExcelUtil<TPssrBlind> util = new ExcelUtil<TPssrBlind>(TPssrBlind.class);
|
|
return util.exportExcel(list, "blind");
|
|
return util.exportExcel(list, "blind");
|
|
@@ -63,8 +62,7 @@ public class TPssrBlindController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:query')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return AjaxResult.success(tPssrBlindService.selectTPssrBlindById(id));
|
|
return AjaxResult.success(tPssrBlindService.selectTPssrBlindById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,8 +72,8 @@ public class TPssrBlindController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:add')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:add')")
|
|
@Log(title = "盲板", businessType = BusinessType.INSERT)
|
|
@Log(title = "盲板", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TPssrBlind tPssrBlind)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody TPssrBlind tPssrBlind) {
|
|
|
|
+ tPssrBlind.setApproveStatus(0L);
|
|
return toAjax(tPssrBlindService.insertTPssrBlind(tPssrBlind));
|
|
return toAjax(tPssrBlindService.insertTPssrBlind(tPssrBlind));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -85,8 +83,7 @@ public class TPssrBlindController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:edit')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:edit')")
|
|
@Log(title = "盲板", businessType = BusinessType.UPDATE)
|
|
@Log(title = "盲板", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody TPssrBlind tPssrBlind)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody TPssrBlind tPssrBlind) {
|
|
return toAjax(tPssrBlindService.updateTPssrBlind(tPssrBlind));
|
|
return toAjax(tPssrBlindService.updateTPssrBlind(tPssrBlind));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -95,9 +92,99 @@ public class TPssrBlindController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind:remove')")
|
|
@PreAuthorize("@ss.hasPermi('pssr:blind: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(tPssrBlindService.deleteTPssrBlindByIds(ids));
|
|
return toAjax(tPssrBlindService.deleteTPssrBlindByIds(ids));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 确认检修项目-换热器
|
|
|
|
+ */
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:blind:edit')")
|
|
|
|
+ @Log(title = "盲板", businessType = BusinessType.UPDATE)
|
|
|
|
+ @PutMapping("/confirmBlind")
|
|
|
|
+ public AjaxResult confirmBlind(@RequestBody TPssrBlind tPssrBlind) {
|
|
|
|
+ if (tPssrBlind.getIds() != null && tPssrBlind.getIds().length > 0) {
|
|
|
|
+ for (Long id : tPssrBlind.getIds()) {
|
|
|
|
+ TPssrBlind blind = tPssrBlindService.selectTPssrBlindById(id);
|
|
|
|
+ if (tPssrBlind.getTaskType() == 0) {
|
|
|
|
+ if (blind.getInstallDate() == null) {
|
|
|
|
+ blind.setInstallDate(new Date());
|
|
|
|
+ }
|
|
|
|
+ blind.setApproveStatus(2L);
|
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
|
+ blind.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
|
+ tPssrBlindService.updateTPssrBlind(blind);
|
|
|
|
+ } else if (tPssrBlind.getTaskType() == 1) {
|
|
|
|
+ if (blind.getRemovedDate() == null) {
|
|
|
|
+ blind.setRemovedDate(new Date());
|
|
|
|
+ }
|
|
|
|
+ blind.setApproveStatus(3L);
|
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
|
+ blind.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
|
+ tPssrBlindService.updateTPssrBlind(blind);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ TPssrBlind blind = new TPssrBlind();
|
|
|
|
+ blind.setSubId(tPssrBlind.getSubId());
|
|
|
|
+ blind.setCurrentUser(getUserId().toString());
|
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
|
+ for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(blind)) {
|
|
|
|
+ if (tPssrBlind.getTaskType() == 0) {
|
|
|
|
+ if (blind.getInstallDate() == null) {
|
|
|
|
+ blind.setInstallDate(new Date());
|
|
|
|
+ }
|
|
|
|
+ blind.setApproveStatus(2L);
|
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
|
+ blind.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
|
+ tPssrBlindService.updateTPssrBlind(blind);
|
|
|
|
+ } else if (tPssrBlind.getTaskType() == 1) {
|
|
|
|
+ if (blind.getRemovedDate() == null) {
|
|
|
|
+ blind.setRemovedDate(new Date());
|
|
|
|
+ }
|
|
|
|
+ blind.setApproveStatus(3L);
|
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
|
+ blind.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
|
+ tPssrBlindService.updateTPssrBlind(blind);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //查询当前待审批的确认人
|
|
|
|
+ TPssrBlind entity = new TPssrBlind();
|
|
|
|
+ entity.setSubId(tPssrBlind.getSubId());
|
|
|
|
+ entity.setApproveStatus(1L);
|
|
|
|
+ Set<String> installer = new HashSet<>();
|
|
|
|
+ Set<String> remover = new HashSet<>();
|
|
|
|
+ for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(entity)) {
|
|
|
|
+ // 安装人员
|
|
|
|
+ installer.add(item.getInConfirm1());
|
|
|
|
+ installer.add(item.getInConfirm2());
|
|
|
|
+ installer.add(item.getInContractor());
|
|
|
|
+ installer.add(item.getInProcess());
|
|
|
|
+ installer.add(item.getInCoordinator());
|
|
|
|
+
|
|
|
|
+ //拆除人员
|
|
|
|
+ remover.add(item.getReConfirm1());
|
|
|
|
+ remover.add(item.getReConfirm2());
|
|
|
|
+ remover.add(item.getReContractor());
|
|
|
|
+ remover.add(item.getReProcess());
|
|
|
|
+ remover.add(item.getReCoordinator());
|
|
|
|
+ }
|
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
|
+ if (installer.contains(getUserId().toString())) {
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+ if (remover.contains(getUserId().toString())) {
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
|
+ approve.setSubId(tPssrBlind.getSubId());
|
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
}
|
|
}
|