|
@@ -10,8 +10,10 @@ import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
+import com.ruoyi.project.pssr.domain.TPssrApprove;
|
|
|
import com.ruoyi.project.pssr.domain.TPssrSafetyBrust;
|
|
|
import com.ruoyi.project.pssr.mapper.TPssrSafetyBrustMapper;
|
|
|
+import com.ruoyi.project.pssr.service.ITPssrApproveService;
|
|
|
import com.ruoyi.project.pssr.service.ITPssrFileService;
|
|
|
import com.ruoyi.project.pssr.service.ITPssrSafetyBrustService;
|
|
|
import com.ruoyi.project.pssr.service.ITPssrTurndownService;
|
|
@@ -19,6 +21,10 @@ import com.ruoyi.project.system.domain.SysDept;
|
|
|
import com.ruoyi.project.system.domain.SysUser;
|
|
|
import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysUserService;
|
|
|
+import org.activiti.engine.ProcessEngine;
|
|
|
+import org.activiti.engine.ProcessEngines;
|
|
|
+import org.activiti.engine.TaskService;
|
|
|
+import org.activiti.engine.task.Task;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
@@ -35,7 +41,6 @@ import java.io.OutputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
* 安全设施-爆破片Controller
|
|
@@ -47,10 +52,13 @@ import java.util.UUID;
|
|
|
@RequestMapping("/pssr/safetyBrust")
|
|
|
public class TPssrSafetyBrustController extends BaseController {
|
|
|
@Resource
|
|
|
- private TPssrSafetyBrustMapper tPssrSafetyBrustMapper;
|
|
|
+ private TPssrSafetyBrustMapper tPssrSafetyBrustMapper;
|
|
|
@Autowired
|
|
|
private ITPssrFileService tPssrFileService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITPssrApproveService tPssrApproveService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ITPssrTurndownService tPssrTurndownService;
|
|
|
@Autowired
|
|
@@ -71,12 +79,11 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('pssr:safetyBrust:add')")
|
|
|
@PostMapping("/importData")
|
|
|
- public AjaxResult importInterlockData(MultipartFile file, Long subId) throws IOException
|
|
|
- {
|
|
|
+ public AjaxResult importInterlockData(MultipartFile file, Long subId) throws IOException {
|
|
|
//获取操作人员ID
|
|
|
Long userId = getUserId();
|
|
|
//报错行数统计
|
|
|
- List<Integer> failRow =new ArrayList<Integer>();
|
|
|
+ List<Integer> failRow = new ArrayList<Integer>();
|
|
|
Workbook workbook = ExcelUtils.getWorkBook(file);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
List<TPssrSafetyBrust> list = new ArrayList<TPssrSafetyBrust>();
|
|
@@ -107,15 +114,15 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
} else if (j == 3) {
|
|
|
entity.setInstallLocation(cellValue);
|
|
|
} else if (j == 4) {
|
|
|
- entity.setSetPressure(cellValue);
|
|
|
- }
|
|
|
+ entity.setSetPressure(cellValue);
|
|
|
+ }
|
|
|
}
|
|
|
entity.setCreaterCode(userId.toString());
|
|
|
logger.info("entity:" + entity);
|
|
|
list.add(entity);
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
failNumber++;
|
|
|
- failRow.add(i+1);
|
|
|
+ failRow.add(i + 1);
|
|
|
}
|
|
|
}
|
|
|
int successNumber = 0;
|
|
@@ -126,16 +133,16 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
try {
|
|
|
this.add(t);
|
|
|
successNumber++;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
failNumber++;
|
|
|
logger.info("e:" + e);
|
|
|
- failRow.add(failNum+1);
|
|
|
+ failRow.add(failNum + 1);
|
|
|
}
|
|
|
}
|
|
|
logger.info("list:" + JSON.toJSONString(list));
|
|
|
- logger.info("successNumber:" +String.valueOf(successNumber));
|
|
|
- logger.info("failNumber:" +String.valueOf(failNumber));
|
|
|
- logger.info("failRow:" +String.valueOf(failRow));
|
|
|
+ logger.info("successNumber:" + String.valueOf(successNumber));
|
|
|
+ logger.info("failNumber:" + String.valueOf(failNumber));
|
|
|
+ logger.info("failRow:" + String.valueOf(failRow));
|
|
|
return AjaxResult.success("导入成功行数:" + String.valueOf(successNumber));
|
|
|
}
|
|
|
|
|
@@ -145,6 +152,27 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('pssr:safetyBrust:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
+ try {
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyBrust.getSubId());
|
|
|
+ if (approve != null) {
|
|
|
+ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
+ TaskService taskService = processEngine.getTaskService();
|
|
|
+ Task task = processEngine.getTaskService()//获取任务service
|
|
|
+ .createTaskQuery()//创建查询对象
|
|
|
+ .taskAssignee(getUserId().toString())
|
|
|
+ .processInstanceId(approve.getProcessId()).singleResult();
|
|
|
+ if (task != null) {
|
|
|
+ if (task.getName().equals("确认人1")) {
|
|
|
+ tPssrSafetyBrust.setConfirmer1(getUserId().toString());
|
|
|
+ } else if (task.getName().equals("确认人2")) {
|
|
|
+ tPssrSafetyBrust.setConfirmer2(getUserId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("待办确认人查询报错:{}", e.getMessage());
|
|
|
+ }
|
|
|
startPage();
|
|
|
List<TPssrSafetyBrust> list = tPssrSafetyBrustService.selectTPssrSafetyBrustList(tPssrSafetyBrust);
|
|
|
list.forEach(item -> {
|
|
@@ -222,7 +250,7 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
num++;
|
|
|
rowIndex++;
|
|
|
}
|
|
|
- filename = "PSSR_14_安全设施_爆破片" + ".xlsx";
|
|
|
+ filename = "PSSR_14_安全设施_爆破片" + ".xlsx";
|
|
|
out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
|
|
|
wb.write(out);
|
|
|
wb.close();
|
|
@@ -241,8 +269,8 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
TPssrSafetyBrust item = tPssrSafetyBrustService.selectTPssrSafetyBrustById(id);
|
|
|
item.setFileList(tPssrFileService.selectTPssrFileListByItem(item.getSubId(), item.getId(), "aqss-bt"));
|
|
|
- if (item.getApproveStatus() != 2)
|
|
|
- item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-bt"));
|
|
|
+ if (item.getApproveStatus() != 2)
|
|
|
+ item.setReason(tPssrTurndownService.selectTPssrTurndownByItem(item.getSubId(), item.getId(), "aqss-bt"));
|
|
|
return AjaxResult.success(item);
|
|
|
}
|
|
|
|
|
@@ -253,7 +281,7 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
@Log(title = "安全设施-爆破片", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
- if (StringUtils.isNotEmpty(tPssrSafetyBrust.getConfirmer1())&&tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())) {
|
|
|
+ if (StringUtils.isNotEmpty(tPssrSafetyBrust.getConfirmer1()) && tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
tPssrSafetyBrust.setApproveStatus(0L);
|
|
@@ -267,7 +295,7 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
@Log(title = "安全设施-爆破片", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
- if (tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())){
|
|
|
+ if (tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
tPssrFileService.updateFileRelevance(tPssrSafetyBrust.getFileIds(), "aqss-bt", tPssrSafetyBrust.getId(), tPssrSafetyBrust.getSubId());
|
|
@@ -281,11 +309,12 @@ public class TPssrSafetyBrustController extends BaseController {
|
|
|
@Log(title = "安全设施-爆破片", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/editBatch")
|
|
|
public AjaxResult editb(@RequestBody TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
- if (tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())){
|
|
|
+ if (tPssrSafetyBrust.getConfirmer1().equals(tPssrSafetyBrust.getConfirmer2())) {
|
|
|
return AjaxResult.error("确认人不能为同一人,请重新选择!");
|
|
|
}
|
|
|
return toAjax(tPssrSafetyBrustMapper.updateTPssrSafetyBrustByIds(tPssrSafetyBrust));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 删除安全设施-爆破片
|
|
|
*/
|