123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714 |
- package com.ruoyi.project.sems.controller;
- import com.alibaba.fastjson.JSON;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.ruoyi.common.utils.document.DocumentHandler;
- import com.ruoyi.common.utils.document.PDFTemplateUtil;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.framework.aspectj.lang.annotation.Log;
- 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.approve.damain.DevTask;
- import com.ruoyi.project.listener.semsApprove.*;
- import com.ruoyi.project.sems.domain.*;
- import com.ruoyi.project.sems.mapper.TApproveMapper;
- import com.ruoyi.project.sems.service.*;
- import com.ruoyi.project.system.domain.SysDictData;
- import com.ruoyi.project.system.domain.SysPlant;
- import com.ruoyi.project.system.domain.SysUser;
- import com.ruoyi.project.system.service.ISysDictTypeService;
- import com.ruoyi.project.system.service.ISysPlantService;
- import com.ruoyi.project.system.service.ISysUserService;
- import freemarker.template.Template;
- import org.activiti.engine.*;
- import org.activiti.engine.history.HistoricProcessInstance;
- import org.activiti.engine.history.HistoricTaskInstance;
- import org.activiti.engine.history.HistoricTaskInstanceQuery;
- import org.activiti.engine.impl.identity.Authentication;
- import org.activiti.engine.runtime.ProcessInstance;
- import org.activiti.engine.task.Comment;
- import org.activiti.engine.task.Task;
- import org.apache.commons.lang.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.io.OutputStream;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * 特种设备申请Controller
- *
- * @author ruoyi
- * @date 2021-08-05
- */
- @RestController
- @RequestMapping("/sems/home")
- public class SpecHomeController extends BaseController
- {
- @Autowired
- private ITApproveService tApproveService;
- @Autowired
- private RuntimeService runtimeService;
- @Autowired
- private HistoryService historyService;
- @Autowired
- private TaskService taskService;
- @Autowired
- private ITSpecdevDtService tSpecdevDtService;
- @Autowired
- private ITSpecdevDzsbService tSpecdevDzsbService;
- @Autowired
- private ITSpecdevGlService tSpecdevGlService;
- @Autowired
- private ITSpecdevYlgdService tSpecdevYlgdService;
- @Autowired
- private ITSpecdevYlrqService tSpecdevYlrqService;
- @Autowired
- private ITSpecdevCcService tSpecdevCcService;
- @Autowired
- private ITApproverFileService tApproverFileService;
- @Autowired
- private ISysUserService sysUserService;
- @Autowired
- private ISysPlantService sysPlantService;
- @Autowired
- private ISysDictTypeService iSysDictTypeService;
- /**
- * 查询装置管理列表
- */
- @GetMapping("/plantList")
- public AjaxResult list(SysPlant sysPlant)
- {
- List<SysPlant> list = sysPlantService.selectSysPlantList(sysPlant);
- return AjaxResult.success(list);
- }
- /**
- * 首页数据
- */
- @RequestMapping(value = "devData")
- public AjaxResult homeData(@RequestBody Map<String, Object> params) {
- logger.info(JSON.toJSONString(params));
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- //压力管道
- int ylgdAll = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .in("plant_code",plantIds)
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds).or().isNull("unit"))
- );
- //查询管道长度
- List<TSpecdevYlgd> gdList = tSpecdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- // .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds).or().isNull("unit"))
- );
- double allLength = 0;
- for (int i = 0; i < gdList.size(); i++) {
- double gdLength = 0;
- if (!StringUtils.isBlank(gdList.get(i).getLength())) {
- if (gdList.get(i).getLength().indexOf("\n") > -1) {
- String[] arr = gdList.get(i).getLength().split("\n");
- logger.info(JSON.toJSONString(arr));
- for (int j = 0; j < arr.length; j++) {
- gdLength += Double.parseDouble(arr[j]);
- }
- }else {
- gdLength = Double.parseDouble(gdList.get(i).getLength());
- }
- }
- allLength += gdLength;
- }
- Map<String, Object> mapylgd = new HashMap<String, Object>();
- mapylgd.put("ylgdAll_num", ylgdAll);
- mapylgd.put("ylgd_length", allLength);
- //压力容器
- int ylrqAll = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds).or().isNull("unit"))
- );
- Map<String, Object> mapylrq = new HashMap<String, Object>();
- mapylrq.put("ylrqAll_num", ylrqAll);
- //锅炉
- int glAll = tSpecdevGlService.count(new QueryWrapper<TSpecdevGl>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- Map<String, Object> mapgl = new HashMap<String, Object>();
- mapgl.put("glAll_num", glAll);
- //电梯
- int dtAll = tSpecdevDtService.count(new QueryWrapper<TSpecdevDt>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- Map<String, Object> mapdt = new HashMap<String, Object>();
- mapdt.put("dtAll_num", dtAll);
- //吊装设备
- int dzsbAll = tSpecdevDzsbService.count(new QueryWrapper<TSpecdevDzsb>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .like("CHECK_STRATEGY","强制")
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int dzsbUn = tSpecdevDzsbService.count(new QueryWrapper<TSpecdevDzsb>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .like("CHECK_STRATEGY","委托")
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- Map<String, Object> mapdzsb = new HashMap<String, Object>();
- mapdzsb.put("dzsbAll_num", dzsbAll);
- mapdzsb.put("dzsbUn_num", dzsbUn);
- //叉车
- int ccAll = tSpecdevCcService.count(new QueryWrapper<TSpecdevCc>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .in("plant_code",plantIds)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .and(unitIds.size()>0 ,i -> i.in("plant_code",unitIds))
- );
- Map<String, Object> mapcc = new HashMap<String, Object>();
- mapcc.put("ccAll_num", ccAll);
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("ylgdData", mapylgd);
- res.put("ylrqData", mapylrq);
- res.put("dtData", mapdt);
- res.put("dzsbData", mapdzsb);
- res.put("glData", mapgl);
- res.put("ccData" , mapcc);
- return AjaxResult.success(res);
- }
- /**
- * 压力容器数据
- */
- @RequestMapping(value = "devYlrqData")
- public AjaxResult devYlrqData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- Calendar now = Calendar.getInstance();
- int year = now.get(Calendar.YEAR);
- Map<String, Object> ylrqData = new HashMap<String, Object>();
- List yearList = new ArrayList();
- List countList = new ArrayList();
- String applySql = "to_char(NEXT_WARN_DATE,'yyyy') = {0}";
- for (int j = 0; j < 5; j++) {
- int num = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .apply(true,applySql,year)
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- yearList.add(year);
- countList.add(num);
- year++;
- }
- ylrqData.put("yearList" , yearList.toArray());
- ylrqData.put("countList" , countList.toArray());
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("ylrqData" , ylrqData);
- return AjaxResult.success(res);
- }
- /**
- * 锅炉数据
- */
- @RequestMapping(value = "devGlData")
- public AjaxResult devGlData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- Calendar now = Calendar.getInstance();
- int year = now.get(Calendar.YEAR);
- Map<String, Object> GlData = new HashMap<String, Object>();
- //内检
- List yearList = new ArrayList();
- List countList = new ArrayList();
- String applySql = "to_char(NEXT_WARN_DATE,'yyyy') = {0}";
- for (int i = 0; i < 5; i++) {
- int num = tSpecdevGlService.count(new QueryWrapper<TSpecdevGl>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .apply(true,applySql,year)
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- yearList.add(year);
- countList.add(num);
- year++;
- }
- //外检
- List yearList2 = new ArrayList();
- List countList2 = new ArrayList();
- year = now.get(Calendar.YEAR);
- String applySql2 = "to_char(OUT_NEXT_WARN_DATE,'yyyy') = {0}";
- for (int i = 0; i < 5; i++) {
- int num = tSpecdevGlService.count(new QueryWrapper<TSpecdevGl>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .apply(true,applySql2,year)
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- yearList2.add(year);
- countList2.add(num);
- year++;
- }
- GlData.put("yearList" , yearList.toArray());
- GlData.put("countList" , countList.toArray());
- GlData.put("yearList2" , yearList2.toArray());
- GlData.put("countList2" , countList2.toArray());
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("GlData" , GlData);
- return AjaxResult.success(res);
- }
- /**
- * 压力管道数据
- */
- @RequestMapping(value = "devYlgdData")
- public AjaxResult devYlgdData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- Calendar now = Calendar.getInstance();
- int year = now.get(Calendar.YEAR);
- Map<String, Object> ylrqData = new HashMap<String, Object>();
- List yearList = new ArrayList();
- List countList = new ArrayList();
- String applySql = "to_char(NEXT_WARN_DATE,'yyyy') = {0}";
- for (int i = 0; i < 5; i++) {
- int num = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .apply(true,applySql,year)
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- yearList.add(year);
- countList.add(num);
- year++;
- }
- ylrqData.put("yearList" , yearList.toArray());
- ylrqData.put("countList" , countList.toArray());
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("ylrqData" , ylrqData);
- return AjaxResult.success(res);
- }
- /**
- * 压力管道数据
- */
- @RequestMapping(value = "devOtherData")
- public AjaxResult devOtherData(@RequestBody Map<String, Object> params) {
- Calendar now = Calendar.getInstance();
- int year = now.get(Calendar.YEAR);
- int month = now.get(Calendar.MONTH) + 1;
- List<DevData> listcc = tSpecdevCcService.otherDevCount(params);
- List<DevData> listdzsb = tSpecdevDzsbService.otherDevCount(params);
- List<DevData> listdt = tSpecdevDtService.otherDevCount(params);
- List ccList = new ArrayList();
- List dzsbList = new ArrayList();
- List dtList = new ArrayList();
- List monthList = new ArrayList();
- for (int i = 0; i < 24; i++) {
- String devDate = year + String.valueOf(month);
- if (month < 10){
- devDate = year + "0" +String.valueOf(month);
- }
- boolean flag = true;
- for (DevData d: listcc
- ) {
- flag = true;
- if (devDate.equals(d.getYearM())){
- ccList.add(d.getNum());
- flag = false;
- break;
- }
- }
- if (flag == true) {
- ccList.add(0);
- }
- for (DevData d: listdzsb
- ) {
- flag = true;
- if (devDate.equals(d.getYearM())){
- dzsbList.add(d.getNum());
- flag = false;
- break;
- }
- }
- if (flag == true) {
- dzsbList.add(0);
- }
- for (DevData d: listdt
- ) {
- flag = true;
- if (devDate.equals(d.getYearM())){
- dtList.add(d.getNum());
- flag = false;
- break;
- }
- }
- if (flag == true) {
- dtList.add(0);
- }
- if (!(ccList.size() == 0 && dzsbList.size() == 0 &&dtList.size() == 0)) {
- monthList.add(devDate);
- }
- if (month == 12){
- year++;
- month = 1;
- }else {
- month ++;
- }
- }
- for (int i = 0; i < 10; i++) {
- if (String.valueOf(ccList.get(0)).equals("0") && String.valueOf(dzsbList.get(0)).equals("0") && String.valueOf(dtList.get(0)).equals("0")) {
- ccList.remove(0);
- dzsbList.remove(0);
- dtList.remove(0);
- monthList.remove(0);
- }else {
- break;
- }
- }
- Map<String, Object> devData = new HashMap<String, Object>();
- devData.put("monthList" , monthList.toArray());
- devData.put("ccList" , ccList.toArray());
- devData.put("dzsbList" , dzsbList.toArray());
- devData.put("dtList" , dtList.toArray());
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("otherDevData" ,devData);
- return AjaxResult.success(res);
- }
- /**
- * 首页申请数据
- */
- @RequestMapping(value = "finishApproveData")
- public AjaxResult finishApproveData(@RequestBody Map<String, Object> params) {
- Calendar now = Calendar.getInstance();
- int year = now.get(Calendar.YEAR);
- params.put("year",year);
- List<ApproveData> list =tApproveService.approveData(params);
- return AjaxResult.success(list);
- }
- /**
- * 数据
- */
- @RequestMapping(value = "devYlrqSafeData")
- public AjaxResult devYlrqSafeData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- int safe1 = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","1","1级","1.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe2 = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","2","2级","2.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe3 = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","3","3级","3.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe4 = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","4","4级","4.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe5 = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","5","5","5.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safeall = tSpecdevYlrqService.count(new QueryWrapper<TSpecdevYlrq>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safeNa = safeall - safe1 - safe2- safe3- safe4 - safe5;
- List safeList = new ArrayList();
- safeList.add(safe1);
- safeList.add(safe2);
- safeList.add(safe3);
- safeList.add(safe4);
- safeList.add(safe5);
- safeList.add(safeNa);
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("safeData", safeList);
- return AjaxResult.success(res);
- }
- /**
- * 数据
- */
- @RequestMapping(value = "devYlgdSafeData")
- public AjaxResult devYlgdSafeData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- int safe1 = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","1","1级","1.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe2 = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","2","2级","2.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe3 = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","3","3级","3.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safe4 = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("safe_class","4","4级","4.0")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safeall = tSpecdevYlgdService.count(new QueryWrapper<TSpecdevYlgd>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int safeNa = safeall - safe1 - safe2- safe3- safe4;
- List safeList = new ArrayList();
- safeList.add(safe1);
- safeList.add(safe2);
- safeList.add(safe3);
- safeList.add(safe4);
- safeList.add(safeNa);
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("safeData", safeList);
- return AjaxResult.success(res);
- }
- /**
- * 锅炉数据
- */
- @RequestMapping(value = "devGlPerData")
- public AjaxResult devGlPerData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- int all = tSpecdevGlService.count(new QueryWrapper<TSpecdevGl>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- int cc = tSpecdevGlService.count(new QueryWrapper<TSpecdevGl>()
- .eq("STATUS" , 1)
- .eq("del_flag" , 0)
- .eq(!StringUtils.isBlank((String)params.get("plantName")) , "plant_code" ,params.get("plantName"))
- .in("plant_code",plantIds)
- .in("CHECK_CONCLUSION","符合要求","允许运行")
- .and(unitIds.size()>0 ,j -> j.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- logger.info(all + ":::::::::::" +cc);
- String per = new BigDecimal(cc).multiply(new BigDecimal(100)).divide(new BigDecimal(all) ,2, BigDecimal.ROUND_HALF_UP).setScale(1,BigDecimal.ROUND_HALF_DOWN).toString();
- Map<String, Object> res = new HashMap<String, Object>();
- res.put("per" , per);
- return AjaxResult.success(res);
- }
- /**
- * 申请中数据
- */
- @RequestMapping(value = "devApproveData")
- public AjaxResult devApproveData(@RequestBody Map<String, Object> params) {
- List plantIds = (List) params.get("plantIds");
- List unitIds = (List) params.get("unitIds");
- List<String> info = new ArrayList<>();
- List<SysDictData> approveStatus = iSysDictTypeService.selectDictDataByType("spec_approve_status");
- //压力容器申请
- List<TSpecdevYlrq> ylrqList = tSpecdevYlrqService.list(new QueryWrapper<TSpecdevYlrq>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- if (ylrqList!= null){
- for (TSpecdevYlrq t: ylrqList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("压力容器:" + t.getDevname() + "-" + as);
- }
- }
- //压力管道申请
- List<TSpecdevYlgd> ylgdList = tSpecdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- if (ylgdList!= null){
- for (TSpecdevYlgd t: ylgdList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("压力管道:" + t.getDevname() + "-" + as);
- }
- }
- //锅炉申请
- List<TSpecdevGl> GlList = tSpecdevGlService.list(new QueryWrapper<TSpecdevGl>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- if (GlList!= null){
- for (TSpecdevGl t: GlList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("锅炉:" + t.getDevname() + "-" + as);
- }
- }
- //起重机械申请
- List<TSpecdevDzsb> dzsbList = tSpecdevDzsbService.list(new QueryWrapper<TSpecdevDzsb>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- if (dzsbList!= null){
- for (TSpecdevDzsb t: dzsbList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("起重机械:" + t.getDevname() + "-" + as);
- }
- }
- //电梯申请t
- List<TSpecdevDt> dtList = tSpecdevDtService.list(new QueryWrapper<TSpecdevDt>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- .and(unitIds.size()>0 ,i -> i.in("unit",unitIds).or().in("plant_code",unitIds))
- );
- if (dtList!= null){
- for (TSpecdevDt t: dtList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("电梯:" + t.getDevname() + "-" + as);
- }
- }
- //叉车申请t
- List<TSpecdevCc> ccList = tSpecdevCcService.list(new QueryWrapper<TSpecdevCc>()
- .notIn("APPROVE_STATUS" , 0)
- .in("plant_code",plantIds)
- .eq("del_flag" , 0)
- );
- if (ccList!= null){
- for (TSpecdevCc t: ccList
- ) {
- String as ="";
- for (SysDictData p : approveStatus) {
- if (p.getDictValue().equals(t.getApproveStatus().toString())) {
- as = p.getDictLabel();
- }
- }
- info.add("叉车:" + t.getDevname() + "-" + as);
- }
- }
- return AjaxResult.success(info);
- }
- }
|