9a2d14c5 康伟

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	sk-module-equipment/src/main/java/com/skua/modules/equipment/entity/EquipmentInfo.java
2 个父辈 8eff13c1 9910378a
正在显示 20 个修改的文件 包含 390 行增加52 行删除
...@@ -287,7 +287,7 @@ public class SysCommandCentreController { ...@@ -287,7 +287,7 @@ public class SysCommandCentreController {
287 287
288 List<String> yaXisList = new ArrayList<String>(); 288 List<String> yaXisList = new ArrayList<String>();
289 yaXisList.addAll(fyList) ;//费用 289 yaXisList.addAll(fyList) ;//费用
290 yaXisList.addAll( waterList) ;//水 290 yaXisList.addAll(waterList) ;//水
291 stackedAreaChartDataVO.setYAxis( yaXisList ); 291 stackedAreaChartDataVO.setYAxis( yaXisList );
292 292
293 Result<StackedAreaChartDataVO> result = new Result<>(); 293 Result<StackedAreaChartDataVO> result = new Result<>();
......
1 package com.skua.modules.digitaltwins;
2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.skua.core.api.vo.Result;
5 import com.skua.core.api.vo.TransTreeModel;
6 import com.skua.core.api.vo.TreeData;
7 import com.skua.core.context.SpringContextUtils;
8 import com.skua.core.util.ConvertUtils;
9 import com.skua.core.util.TreeUtils;
10 import com.skua.modules.equipment.entity.EquipmentInfo;
11 import com.skua.modules.equipment.service.IEquipmentInfoService;
12 import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
13 import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService;
14 import io.swagger.annotations.Api;
15 import io.swagger.annotations.ApiOperation;
16 import lombok.extern.slf4j.Slf4j;
17 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.jdbc.core.JdbcTemplate;
19 import org.springframework.web.bind.annotation.GetMapping;
20 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.bind.annotation.RequestParam;
22 import org.springframework.web.bind.annotation.RestController;
23
24 import java.text.ParseException;
25 import java.util.*;
26 import java.util.stream.Collectors;
27
28 /**
29 * <pre>
30 * 设备中心
31 * </pre>
32 * @author Li Yuanyuan
33 * @version V0.1, 2024年8月5日 下午5:02:16
34 */
35 @Slf4j
36 @Api(tags="/数字孪生/设备中心")
37 @RestController
38 @RequestMapping("/v1/digital/equipmentAnalysis")
39 public class DigitalEquipmentController {
40 @Autowired
41 private IEquipmentInfoService equipmentInfoService;
42 @Autowired
43 private ISysMonitorMetricInfoService sysMonitorMetricInfoService;
44 /**
45 * 智能报警按构筑物统计
46 * @return
47 * @throws ParseException
48 * @author Li Yuanyuan, 2024年8月6日 下午2:54:53
49 * @Description: TODO(这里描述这个方法的需求变更情况)
50 */
51 @ApiOperation(value="构筑物设备树", notes="构造构筑物和设备分组树")
52 @GetMapping(value = "/getEquipmentTree")
53 public Result<List<TreeData>> getEquipmentTree() throws ParseException{
54 Result<List<TreeData>> result = new Result<List<TreeData>>();
55 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
56 //使用sql统计
57 String sql = "SELECT id,struct_name AS title,'root' AS pid,'struct' as tree_type FROM sys_struct_dict \r\n" +
58 "UNION ALL\r\n" +
59 "SELECT id,equipment_name,structures AS pid,'equipment' as tree_type FROM equipment_info where digital_twins_struct_code!='' and digital_twins_struct_code is not null";
60 List<Map<String,Object>> dataList = masterDB.queryForList(sql);
61 List<TransTreeModel> transTreeModels = dataList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
62 List<TreeData> treeList=TreeUtils.buildTreeForParentId(transTreeModels, "root");
63 result.setResult(treeList);
64 result.setSuccess(true);
65 return result;
66 }
67 /**
68 * 将SysDcodeConfig对象数据填充到TransTreeModel中
69 * @param dataMap
70 * @return
71 */
72 private TransTreeModel convertToTreeModel(Map<String,Object> dataMap) {
73 TransTreeModel transTreeModel = new TransTreeModel();
74 transTreeModel.setId(ConvertUtils.getString(dataMap.get("id")));
75 transTreeModel.setPid(ConvertUtils.getString(dataMap.get("pid")));
76 transTreeModel.setTitle(ConvertUtils.getString(dataMap.get("title")));
77 Map<String,String> map=new HashMap<String,String>();
78 map.put("treeType", ConvertUtils.getString(dataMap.get("tree_type")));
79 transTreeModel.setMap(map);
80 return transTreeModel;
81 }
82
83 /**
84 * 根据传入的构筑物id或设备id获取相关设备运行状态
85 * @param treeType
86 * @param ids
87 * @return
88 */
89 @ApiOperation(value = "设备-设备运行状态", notes = "设备-设备运行状态,根据构筑物id/设备id获取设备状态【0停止/1运行/2故障】")
90 @GetMapping(value = "/queryEquipmentStatusById")
91 public Result<Map<String,Object>> queryEquipmentStatusById(@RequestParam(value = "treeType") String treeType,@RequestParam(value = "ids") String ids) {
92 Result<Map<String,Object>> result = new Result<>();
93 //结果接收对象
94 Map<String,Object> resultMap = new HashMap<String,Object>();
95 List<EquipmentInfo> equipmentInfoList = new ArrayList<EquipmentInfo>();
96 //判断参数类型,如果是构筑物类型,则先获取设备id集合,如果是设备类型,则直接使用
97 if("struct".equals(treeType)) {
98 QueryWrapper<EquipmentInfo> equipmentQueryWrapper = new QueryWrapper<>();
99 equipmentQueryWrapper.isNotNull("digital_twins_struct_code");
100 equipmentQueryWrapper.ne("digital_twins_struct_code", "");
101 equipmentInfoList = equipmentInfoService.list(equipmentQueryWrapper);
102 }else {
103 List<String> idList = Arrays.asList(ids.split(","));
104 QueryWrapper<EquipmentInfo> equipmentQueryWrapper = new QueryWrapper<>();
105 equipmentQueryWrapper.in("id", idList);
106 equipmentInfoList = equipmentInfoService.list(equipmentQueryWrapper);
107 }
108 //获取已关联设备的运行状态点
109 List<String> equipmentIdList = new ArrayList<>();
110 for(EquipmentInfo equipmentInfo : equipmentInfoList) {
111 equipmentIdList.add(equipmentInfo.getId());
112 }
113 //根据设备id集合获取设备运行点位
114 QueryWrapper<SysMonitorMetricInfo> queryWrapper = new QueryWrapper<>();
115 queryWrapper.eq("metric_type", "1");
116 queryWrapper.ne("metric_express1", "");
117 queryWrapper.isNotNull("metric_express1");
118 queryWrapper.in("equipment_code", equipmentIdList);
119 List<SysMonitorMetricInfo> sysMonitorMetricInfoList = sysMonitorMetricInfoService.list(queryWrapper);
120
121 List<String> equipmentRunPointList = new ArrayList<>();
122 Map<String,String> equipmentToPointMap = new HashMap<String,String>();
123 for(SysMonitorMetricInfo sysMonitorMetricInfo : sysMonitorMetricInfoList) {
124 equipmentRunPointList.add(sysMonitorMetricInfo.getId());
125 equipmentToPointMap.put(sysMonitorMetricInfo.getEquipmentCode(), sysMonitorMetricInfo.getId());
126 }
127 Map<String, Map<String, Object>> tempEquipmentStateMap = sysMonitorMetricInfoService.getEquipRunState(equipmentRunPointList);
128
129 for(EquipmentInfo equipmentInfo : equipmentInfoList) {
130 String equipmentId = equipmentInfo.getId();
131 String point = equipmentToPointMap.get(equipmentId);
132 Map<String, Object> tempMap = tempEquipmentStateMap.get(point);
133 if(tempMap!=null&&tempMap.size()>0) {
134 resultMap.put(equipmentInfo.getId(), ConvertUtils.getString(tempMap.get("value")));
135 }else{
136 resultMap.put(equipmentInfo.getId(), "-1");
137 }
138 }
139 result.setResult(resultMap);
140 return result;
141 }
142
143 }
...@@ -336,7 +336,7 @@ ...@@ -336,7 +336,7 @@
336 SELECT 336 SELECT
337 RIGHT(LEFT( v.time, 7 ),2) AS time, 337 RIGHT(LEFT( v.time, 7 ),2) AS time,
338 v2.sjwscll, 338 v2.sjwscll,
339 v2.rwscll, 339 f.pro_scale AS rwscll,
340 v2.scsj, 340 v2.scsj,
341 ROUND(v2.scsj*f.pro_scale,2) AS wsclnl, 341 ROUND(v2.scsj*f.pro_scale,2) AS wsclnl,
342 ROUND( SUM( v.DLHJ ) / 10000, 2 ) AS dl, 342 ROUND( SUM( v.DLHJ ) / 10000, 2 ) AS dl,
......
...@@ -11,7 +11,6 @@ import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; ...@@ -11,7 +11,6 @@ import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
11 import com.skua.modules.custom.service.IFCustomReportDatasetService; 11 import com.skua.modules.custom.service.IFCustomReportDatasetService;
12 import com.skua.modules.custom.vo.DepartWeekReportVO; 12 import com.skua.modules.custom.vo.DepartWeekReportVO;
13 import com.skua.modules.custom.vo.FCustomReportDatasetVO; 13 import com.skua.modules.custom.vo.FCustomReportDatasetVO;
14
15 import java.text.DecimalFormat; 14 import java.text.DecimalFormat;
16 import java.time.LocalDate; 15 import java.time.LocalDate;
17 import java.time.format.DateTimeFormatter; 16 import java.time.format.DateTimeFormatter;
...@@ -22,14 +21,12 @@ import com.skua.modules.report.vo.*; ...@@ -22,14 +21,12 @@ import com.skua.modules.report.vo.*;
22 import com.skua.modules.report.vo.largeScreen.*; 21 import com.skua.modules.report.vo.largeScreen.*;
23 import com.skua.tool.util.DateUtils; 22 import com.skua.tool.util.DateUtils;
24 import com.skua.tool.util.JSUtils; 23 import com.skua.tool.util.JSUtils;
25 import io.swagger.annotations.ApiModelProperty; 24 import io.micrometer.core.instrument.util.TimeUtils;
26 import org.apache.commons.lang.StringUtils; 25 import org.apache.commons.lang.StringUtils;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.jdbc.core.BeanPropertyRowMapper; 26 import org.springframework.jdbc.core.BeanPropertyRowMapper;
29 import org.springframework.jdbc.core.JdbcTemplate; 27 import org.springframework.jdbc.core.JdbcTemplate;
30 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
31 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 29 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
32
33 import javax.annotation.Resource; 30 import javax.annotation.Resource;
34 31
35 /** 32 /**
...@@ -42,6 +39,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -42,6 +39,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
42 private FCustomReportDatasetMapper mapper; 39 private FCustomReportDatasetMapper mapper;
43 @Resource 40 @Resource
44 private CommonSqlMapper commonSqlMapper; 41 private CommonSqlMapper commonSqlMapper;
42 private static DecimalFormat df = new DecimalFormat("#.##");
43
45 /* (non-Javadoc) 44 /* (non-Javadoc)
46 * @see com.skua.modules.custom.service.IFCustomReportDatasetService#getFillReportList() 45 * @see com.skua.modules.custom.service.IFCustomReportDatasetService#getFillReportList()
47 */ 46 */
...@@ -111,7 +110,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -111,7 +110,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
111 " round(ifnull(v5.dlhj/tb.clsl_tb,0)/10000,2) qntqdh, " + 110 " round(ifnull(v5.dlhj/tb.clsl_tb,0)/10000,2) qntqdh, " +
112 " round(100*(v4.dlhj-ifnull(v5.dlhj,0))/ifnull(v5.dlhj,v4.dlhj),2) as dhdbbhl, " + 111 " round(100*(v4.dlhj-ifnull(v5.dlhj,0))/ifnull(v5.dlhj,v4.dlhj),2) as dhdbbhl, " +
113 " v6.dhgyqntqyy, " + 112 " v6.dhgyqntqyy, " +
114 " round(v4.yjhl/sum(v1.CSL),2) as yyh, " + 113 " round(v6.yyf/sum(v1.CSL),2) as yyh, " +
115 " v6.yyf," + 114 " v6.yyf," +
116 " round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " + 115 " round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " +
117 " round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " + 116 " round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " +
...@@ -603,21 +602,54 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -603,21 +602,54 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
603 public Map<String, Object> reportWeekShow(String dataTime, String week) { 602 public Map<String, Object> reportWeekShow(String dataTime, String week) {
604 Map<String, Object> map = new HashMap<>(); 603 Map<String, Object> map = new HashMap<>();
605 List<DepartWeekReportVO> list = new ArrayList<>(); 604 List<DepartWeekReportVO> list = new ArrayList<>();
605 List<DepartWeekReportVO> hbList = new ArrayList<>();
606 Map<String,String> weekMap = getWeekDate(dataTime,week); 606 Map<String,String> weekMap = getWeekDate(dataTime,week);
607 String startDate = weekMap.get("start"); 607 String startDate = weekMap.get("start");
608 String endDate = weekMap.get("end"); 608 String endDate = weekMap.get("end");
609 String startDateHb = getBeforeDate(startDate,7);
610 String endDateHb = getBeforeDate(endDate,7);
609 String field3a24 = ReportConstant.fieldDl + "," + ReportConstant.fieldYj + "," + ReportConstant.fieldWnl; 611 String field3a24 = ReportConstant.fieldDl + "," + ReportConstant.fieldYj + "," + ReportConstant.fieldWnl;
610 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDate, endDate); 612 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDate, endDate);
611 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDate, endDate); 613 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDate, endDate);
612 list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119); 614 list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119);
615 String dataViewName3a24Hb = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDateHb, endDateHb);
616 String dataViewName2119Hb = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDateHb, endDateHb);
617 hbList = mapper.getWeekReportData(startDateHb, endDateHb, dataViewName3a24Hb, dataViewName2119Hb);
618 Map<String, Object> totalMap = getTotalData(list);
619 Map<String, Object> totalMapHb = getTotalData(hbList);
613 map.put("start", startDate);//开始时间 620 map.put("start", startDate);//开始时间
614 map.put("end", endDate);//结束时间 621 map.put("end", endDate);//结束时间
615 map.put("zclsl", "776");//处理水量合计 622 String zclsl = totalMap.getOrDefault("zclsl","0").toString();
616 map.put("rjclsl", "110.7");//日均处理水量 623 map.put("zclsl", zclsl);//处理水量合计
617 map.put("rjclsl_hb", "2");//较上周增减量 624
618 map.put("dsdh", "0.329");//吨水电耗 625 String rjclsl = totalMap.getOrDefault("rjclsl","0").toString();
619 map.put("dsdh_hb", "0.002");//吨水电耗较上周增减量 626 map.put("rjclsl", rjclsl);//日均处理水量
620 map.put("cnl", "3978.8");//产泥量 627 String rjclslHb = totalMapHb.getOrDefault("rjclsl","0").toString();
628 String rjclslStr = "";//文字描述
629 String dsdhStr = "";//文字描述
630 //较上周增减量 rjclsl - rjclslHb
631 if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) > 0){
632 rjclslStr = "+"+df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
633 }else if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) < 0){
634 rjclslStr = df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
635 }else{
636 rjclslStr = "持平";
637 }
638 map.put("rjclsl_hb", rjclslStr);
639 String dsdh = totalMap.getOrDefault("dsdh","0").toString();
640 map.put("dsdh", dsdh);//吨水电耗
641 String dsdhHb = totalMapHb.getOrDefault("dsdh","0").toString();
642 //吨水电耗较上周增减量 dsdh - dsdhHb
643 if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) > 0){
644 dsdhStr = "+"+df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
645 }else if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) < 0){
646 dsdhStr = df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
647 }else{
648 dsdhStr = "持平";
649 }
650 map.put("dsdh_hb", dsdhStr);
651 String cnl = totalMap.getOrDefault("cnl","0").toString();
652 map.put("cnl", cnl);//产泥量
621 map.put("list", list); 653 map.put("list", list);
622 map.put("scqk", "(1)本周暂无生产情况说明");//生产情况 654 map.put("scqk", "(1)本周暂无生产情况说明");//生产情况
623 map.put("wxqk", "(1)本周暂无设备大修、更新情况");// 655 map.put("wxqk", "(1)本周暂无设备大修、更新情况");//
...@@ -625,4 +657,46 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -625,4 +657,46 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
625 map.put("qt", "(1)本周暂无其他情况说明");//其他 657 map.put("qt", "(1)本周暂无其他情况说明");//其他
626 return map; 658 return map;
627 } 659 }
660
661 private Map<String, Object> getTotalData(List<DepartWeekReportVO> list) {
662 Map<String, Object> map = new HashMap<>();
663 int num = 0;//计数
664 double zclsl = 0.00;//处理水量
665 double dsdh = 0.00;//吨水电耗
666 double cnl = 0.00;//产泥量
667 for (DepartWeekReportVO departWeekReportVO : list) {
668 num = num+1;
669 if(ConvertUtils.isNotEmpty(departWeekReportVO.getClsl())){
670 zclsl = zclsl + Double.parseDouble(departWeekReportVO.getClsl());
671 }
672 if(ConvertUtils.isNotEmpty(departWeekReportVO.getDsdh())){
673 dsdh = dsdh + Double.parseDouble(departWeekReportVO.getDsdh());
674 }
675 if(ConvertUtils.isNotEmpty(departWeekReportVO.getWnl())){
676 cnl = cnl + Double.parseDouble(departWeekReportVO.getWnl());
677 }
678 }
679 map.put("zclsl", df.format(zclsl));//处理水量合计
680 map.put("rjclsl", df.format(zclsl/num));//日均处理水量
681 map.put("dsdh", df.format(dsdh/num));//吨水电耗
682 map.put("cnl", df.format(cnl));//产泥量
683 return map;
684 }
685
686 /**
687 * 获取n天前的日期
688 * @param day
689 * @param num
690 * @return
691 */
692 public static String getBeforeDate(String day,int num) {
693 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
694 try {
695 LocalDate date = LocalDate.parse(day, formatter);
696 LocalDate daysAgo = date.minusDays(num);
697 return daysAgo.format(formatter);
698 } catch (Exception e) {
699 return day;
700 }
701 }
628 } 702 }
......
...@@ -6,6 +6,7 @@ import com.skua.common.constant.ReportConstant; ...@@ -6,6 +6,7 @@ import com.skua.common.constant.ReportConstant;
6 import com.skua.common.report.ReportViewUtil; 6 import com.skua.common.report.ReportViewUtil;
7 import com.skua.core.context.BaseContextHandler; 7 import com.skua.core.context.BaseContextHandler;
8 import com.skua.core.context.SpringContextUtils; 8 import com.skua.core.context.SpringContextUtils;
9 import com.skua.core.util.ConvertUtils;
9 import com.skua.core.util.DateUtils; 10 import com.skua.core.util.DateUtils;
10 import com.skua.modules.custom.service.IFCustomReportDatasetService; 11 import com.skua.modules.custom.service.IFCustomReportDatasetService;
11 import com.skua.modules.dataAnalysis.mapper.PowerAnalysisNewMapper; 12 import com.skua.modules.dataAnalysis.mapper.PowerAnalysisNewMapper;
...@@ -30,10 +31,10 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -30,10 +31,10 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
30 private PowerAnalysisNewMapper powerAnalysisNewMapper; 31 private PowerAnalysisNewMapper powerAnalysisNewMapper;
31 @Autowired 32 @Autowired
32 private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper; 33 private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper;
33 @Autowired 34 //时间格式
34 private IFCustomReportDatasetService fCustomReportDatasetService;
35
36 public static final SimpleDateFormat yyyyMM = new SimpleDateFormat("yyyy-MM"); 35 public static final SimpleDateFormat yyyyMM = new SimpleDateFormat("yyyy-MM");
36 //格式化小数
37 private static DecimalFormat df = new DecimalFormat("#.##");
37 38
38 /** 39 /**
39 * 功能描述: <br>电耗分析统计 40 * 功能描述: <br>电耗分析统计
...@@ -53,6 +54,12 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -53,6 +54,12 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
53 //本月总的电耗,处理水量,吨水电耗 54 //本月总的电耗,处理水量,吨水电耗
54 Map result = powerAnalysisNewMapper.totalPowerConsumptionAnalysis(thisDataViewName3a24, thisDataViewName2119, 55 Map result = powerAnalysisNewMapper.totalPowerConsumptionAnalysis(thisDataViewName3a24, thisDataViewName2119,
55 lastDataViewName3a24, lastDataViewName2119, thisMonth, lastMonth, departIds); 56 lastDataViewName3a24, lastDataViewName2119, thisMonth, lastMonth, departIds);
57
58 List<Map<String, Object>> thisList = powerAnalysisNewMapper.powerConsumptionDistribution(thisDataViewName3a24,thisDataViewName2119, thisMonth, departIds);
59 List<Map<String, Object>> lastList = powerAnalysisNewMapper.powerConsumptionDistribution(lastDataViewName3a24,lastDataViewName2119, lastMonth, departIds);
60
61 result = updateDSDH(result,thisList,lastList);
62
56 //向前6个月的电耗,处理水量分布 63 //向前6个月的电耗,处理水量分布
57 String precedingTime = getSixMonth(thisMonth); 64 String precedingTime = getSixMonth(thisMonth);
58 String start = precedingTime+"-01"; 65 String start = precedingTime+"-01";
...@@ -60,14 +67,47 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -60,14 +67,47 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
60 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, start, end); 67 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, start, end);
61 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, start, end); 68 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, start, end);
62 List<Map> SixMonthPowerConsumption = powerAnalysisNewMapper.querySixMonthPowerConsumption(dataViewName3a24, dataViewName2119, start, end, departIds); 69 List<Map> SixMonthPowerConsumption = powerAnalysisNewMapper.querySixMonthPowerConsumption(dataViewName3a24, dataViewName2119, start, end, departIds);
63
64
65 resultMap.put("totalResult", result); 70 resultMap.put("totalResult", result);
66 resultMap.put("dataList", SixMonthPowerConsumption); 71 resultMap.put("dataList", SixMonthPowerConsumption);
67 72
68 return resultMap; 73 return resultMap;
69 } 74 }
70 75
76 //更新吨水电耗计算逻辑
77 private Map updateDSDH(Map result, List<Map<String, Object>> thisList, List<Map<String, Object>> lastList) {
78 int thisnNum = 0;int lastNum = 0;//平均值计数
79 double thisDsdh = 0.00;double lastDsdh = 0.00;//吨水电耗
80 String bydsdh = "0.00";String sydsdh = "0.00";
81 for (Map<String, Object> map : thisList) {
82 if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){
83 if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){
84 thisDsdh = thisDsdh + Double.parseDouble(map.get("dsdh").toString());
85 thisnNum = thisnNum + 1;
86 }
87 }
88 }
89 if(thisnNum > 0){
90 bydsdh = df.format(thisDsdh/thisnNum);
91 result.put("BYDSHDL",bydsdh);
92 }
93 for (Map<String, Object> map : lastList) {
94 if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){
95 if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){
96 lastDsdh = lastDsdh + Double.parseDouble(map.get("dsdh").toString());
97 lastNum = lastNum + 1;
98 }
99 }
100 }
101 if(lastNum > 0){
102 sydsdh = df.format(lastDsdh/lastNum);
103 result.put("SYDSHDL",sydsdh);
104 }
105 bydsdh = result.get("BYDSHDL").toString();
106 sydsdh = result.get("SYDSHDL").toString();
107 result.put("DSHDLCZ",df.format(Double.parseDouble(bydsdh)-Double.parseDouble(sydsdh)));
108 return result;
109 }
110
71 public static String getSixMonth(String month) { 111 public static String getSixMonth(String month) {
72 try { 112 try {
73 Date currdate = yyyyMM.parse(month); 113 Date currdate = yyyyMM.parse(month);
...@@ -87,7 +127,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -87,7 +127,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
87 String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, time); 127 String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, time);
88 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, time); 128 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, time);
89 Map<String, Object> result = new HashMap<>(); 129 Map<String, Object> result = new HashMap<>();
90 List<Map<String, Object>> distributionMap = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds); 130 List<Map<String, Object>> distributionList = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds);
91 List<Map<String, Object>> keys = Lists.newArrayList(); 131 List<Map<String, Object>> keys = Lists.newArrayList();
92 Integer count1 = 0, count2 = 0, count3 = 0, count4 = 0; 132 Integer count1 = 0, count2 = 0, count3 = 0, count4 = 0;
93 Map<String, Object> tmp1 = Maps.newTreeMap(); 133 Map<String, Object> tmp1 = Maps.newTreeMap();
...@@ -107,7 +147,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -107,7 +147,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
107 tmp4.put("name", "高电耗"); 147 tmp4.put("name", "高电耗");
108 tmp4.put("id", "4"); 148 tmp4.put("id", "4");
109 149
110 for (Map<String, Object> v : distributionMap) { 150 for (Map<String, Object> v : distributionList) {
111 Double dsdh = (Double) v.get("dsdh"); 151 Double dsdh = (Double) v.get("dsdh");
112 if (dsdh > 0.7) { 152 if (dsdh > 0.7) {
113 count4++; 153 count4++;
...@@ -128,7 +168,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { ...@@ -128,7 +168,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
128 keys.add(tmp3); 168 keys.add(tmp3);
129 keys.add(tmp4); 169 keys.add(tmp4);
130 result.put("distributionMap", keys); 170 result.put("distributionMap", keys);
131 result.put("factoryDistributionList", distributionMap); 171 result.put("factoryDistributionList", distributionList);
132 return result; 172 return result;
133 } 173 }
134 174
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
54 <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> 54 <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
55 SELECT 55 SELECT
56 t.month AS time, 56 t.month AS time,
57 ROUND( SUM( IFNULL(t.cost,0) ), 2 ) AS value 57 ROUND( SUM( IFNULL(t.cost,0) )/10000, 2 ) AS value
58 FROM 58 FROM
59 report_electric_cost t 59 report_electric_cost t
60 WHERE 60 WHERE
......
...@@ -7,6 +7,7 @@ import java.util.*; ...@@ -7,6 +7,7 @@ import java.util.*;
7 import javax.servlet.http.HttpServletRequest; 7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse; 8 import javax.servlet.http.HttpServletResponse;
9 9
10 import cn.hutool.json.JSONObject;
10 import com.skua.core.context.BaseContextHandler; 11 import com.skua.core.context.BaseContextHandler;
11 import com.skua.core.query.QueryGenerator; 12 import com.skua.core.query.QueryGenerator;
12 import org.apache.commons.lang.StringUtils; 13 import org.apache.commons.lang.StringUtils;
...@@ -176,6 +177,12 @@ public class EquipmentController { ...@@ -176,6 +177,12 @@ public class EquipmentController {
176 public Result<List<EquipmentStatisticVO>> statisticsCtrl(EquipmentStatisticDTO equipmentStatisticDTO) throws Exception { 177 public Result<List<EquipmentStatisticVO>> statisticsCtrl(EquipmentStatisticDTO equipmentStatisticDTO) throws Exception {
177 Result<List<EquipmentStatisticVO>> result = new Result<>(); 178 Result<List<EquipmentStatisticVO>> result = new Result<>();
178 List<EquipmentStatisticVO> voList = new ArrayList<>(); 179 List<EquipmentStatisticVO> voList = new ArrayList<>();
180 String departs = "";//机构
181 if(ConvertUtils.isNotEmpty(equipmentStatisticDTO.getDepartId())){
182 departs = equipmentStatisticDTO.getDepartId();
183 }else{
184 departs = BaseContextHandler.getDeparts();
185 }
179 // 统计 departId => 所属机构 186 // 统计 departId => 所属机构
180 if (equipmentStatisticDTO.getShowDepartId()) { 187 if (equipmentStatisticDTO.getShowDepartId()) {
181 List<Map<String, Object>> departIdMapList = WrapperFactory.joinWrapper() 188 List<Map<String, Object>> departIdMapList = WrapperFactory.joinWrapper()
...@@ -185,6 +192,7 @@ public class EquipmentController { ...@@ -185,6 +192,7 @@ public class EquipmentController {
185 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) 192 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
186 .where() 193 .where()
187 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) 194 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
195 .in(true,"depart_id", Arrays.asList(departs.split(",")))
188 .groupBy(true, "depart_id") 196 .groupBy(true, "depart_id")
189 .queryWrapperForList(); 197 .queryWrapperForList();
190 EquipmentStatisticVO departIdVO = new EquipmentStatisticVO(); 198 EquipmentStatisticVO departIdVO = new EquipmentStatisticVO();
...@@ -213,6 +221,7 @@ public class EquipmentController { ...@@ -213,6 +221,7 @@ public class EquipmentController {
213 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) 221 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
214 .where() 222 .where()
215 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) 223 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
224 .in(true,"depart_id", Arrays.asList(departs.split(",")))
216 .groupBy(true, "asset_type") 225 .groupBy(true, "asset_type")
217 .queryWrapperForList(); 226 .queryWrapperForList();
218 EquipmentStatisticVO assetTypeVO = new EquipmentStatisticVO(); 227 EquipmentStatisticVO assetTypeVO = new EquipmentStatisticVO();
...@@ -238,6 +247,7 @@ public class EquipmentController { ...@@ -238,6 +247,7 @@ public class EquipmentController {
238 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) 247 .innerJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
239 .where() 248 .where()
240 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) 249 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
250 .in(true,"depart_id", Arrays.asList(departs.split(",")))
241 .eq(true, "asset_type", "assets-material-type") 251 .eq(true, "asset_type", "assets-material-type")
242 .groupBy(true, "supplies_type") 252 .groupBy(true, "supplies_type")
243 .queryWrapperForList(); 253 .queryWrapperForList();
...@@ -264,6 +274,7 @@ public class EquipmentController { ...@@ -264,6 +274,7 @@ public class EquipmentController {
264 .leftJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id")) 274 .leftJoin(EquipmentExt.class, EquipmentExt.class.getDeclaredField("infoId"), EquipmentInfo.class.getDeclaredField("id"))
265 .where() 275 .where()
266 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial()) 276 .eq(StringUtils.isNotEmpty(equipmentStatisticDTO.getIsSpecial()), "is_special", equipmentStatisticDTO.getIsSpecial())
277 .in(true,"depart_id", Arrays.asList(departs.split(",")))
267 .groupBy(true, "equipment_top_type") 278 .groupBy(true, "equipment_top_type")
268 .queryWrapperForList(); 279 .queryWrapperForList();
269 EquipmentStatisticVO equipmentTypeVO = new EquipmentStatisticVO(); 280 EquipmentStatisticVO equipmentTypeVO = new EquipmentStatisticVO();
...@@ -502,9 +513,8 @@ public class EquipmentController { ...@@ -502,9 +513,8 @@ public class EquipmentController {
502 .like(StringUtils.isNotEmpty(equipmentCode), "equipment_code", equipmentCode) 513 .like(StringUtils.isNotEmpty(equipmentCode), "equipment_code", equipmentCode)
503 .eq(StringUtils.isNotEmpty(equipmentStatus), "equipment_status", equipmentStatus) 514 .eq(StringUtils.isNotEmpty(equipmentStatus), "equipment_status", equipmentStatus)
504 .like(StringUtils.isNotEmpty(installPosition), EquipmentInfo::getInstallPosition, installPosition) 515 .like(StringUtils.isNotEmpty(installPosition), EquipmentInfo::getInstallPosition, installPosition)
505 516 .eq(StringUtils.isNotEmpty(equipmentDTO.getEquipmentInfo().getId()), "equipment_info.id", equipmentDTO.getEquipmentInfo().getId())
506 .eq(StringUtils.isNotEmpty(equipmentDTO.getEquipmentInfo().getId()), "equipment_info.id", equipmentDTO.getEquipmentInfo().getId()); 517 .orderBy(true,false,"equipment_info.create_time");
507
508 Page<Map<String, Object>> mapPage = (Page<Map<String, Object>>) base.queryForPage(new Page<>(equipmentDTO.getPageNo(), equipmentDTO.getPageSize())); 518 Page<Map<String, Object>> mapPage = (Page<Map<String, Object>>) base.queryForPage(new Page<>(equipmentDTO.getPageNo(), equipmentDTO.getPageSize()));
509 519
510 // 转义 520 // 转义
...@@ -818,4 +828,19 @@ public class EquipmentController { ...@@ -818,4 +828,19 @@ public class EquipmentController {
818 return result; 828 return result;
819 } 829 }
820 830
831 @ApiOperation(value = "设备台账-孪生体批量配置", notes = "设备台账-孪生体批量配置")
832 @PostMapping(value = "/batchConfigDigitaltwins")
833 public Result<String> batchConfigDigitaltwins(@RequestBody JSONObject jsonObject) {
834 Result<String> result = new Result<>();
835 try {
836 equipmentInfoService.batchConfigDigitaltwins(jsonObject);
837 result.setSuccess(true);
838 result.setResult("批量配置成功");
839 } catch (Exception e) {
840 e.printStackTrace();
841 result.error500("批量配置失败");
842 }
843 return result;
844 }
845
821 } 846 }
......
...@@ -120,7 +120,7 @@ public class EquipmentInController { ...@@ -120,7 +120,7 @@ public class EquipmentInController {
120 private ThreadPoolTaskExecutor taskExecutor; 120 private ThreadPoolTaskExecutor taskExecutor;
121 @Autowired 121 @Autowired
122 private ISuppliesWarehouseService suppliesWarehouseService; 122 private ISuppliesWarehouseService suppliesWarehouseService;
123 123
124 124
125 @CustomExceptionAnno(description = "入库-详情") 125 @CustomExceptionAnno(description = "入库-详情")
126 @AutoLog(value = "入库-详情") 126 @AutoLog(value = "入库-详情")
...@@ -147,7 +147,7 @@ public class EquipmentInController { ...@@ -147,7 +147,7 @@ public class EquipmentInController {
147 "\tINNER JOIN equipment_in_child AS eic ON ei.id = eic.in_id\n" + 147 "\tINNER JOIN equipment_in_child AS eic ON ei.id = eic.in_id\n" +
148 "\tLEFT JOIN equipment_sparepart_supplies AS es ON eic.sparepart_id = es.id\n" + 148 "\tLEFT JOIN equipment_sparepart_supplies AS es ON eic.sparepart_id = es.id\n" +
149 "\tLEFT JOIN equipment_sparepart_type tp ON es.sparepart_type = tp.id\n" + 149 "\tLEFT JOIN equipment_sparepart_type tp ON es.sparepart_type = tp.id\n" +
150 150
151 " WHERE ei.id in( '" + inId + "')"; 151 " WHERE ei.id in( '" + inId + "')";
152 List<Map<String, Object>> mapList = iCommonSqlService.queryForList(sql); 152 List<Map<String, Object>> mapList = iCommonSqlService.queryForList(sql);
153 JSONObject jsonObject = sysCommonDictService.translateTDictValue(equipmentIn); 153 JSONObject jsonObject = sysCommonDictService.translateTDictValue(equipmentIn);
...@@ -175,7 +175,6 @@ public class EquipmentInController { ...@@ -175,7 +175,6 @@ public class EquipmentInController {
175 Result<IPage<EquipmentInVO>> result = new Result<>(); 175 Result<IPage<EquipmentInVO>> result = new Result<>();
176 EquipmentIn equipmentIn = BeanExtUtils.bean2Bean(equipmentInDTO, EquipmentIn.class); 176 EquipmentIn equipmentIn = BeanExtUtils.bean2Bean(equipmentInDTO, EquipmentIn.class);
177 QueryWrapper<EquipmentIn> queryWrapper = QueryGenerator.initQueryWrapper(equipmentIn, req.getParameterMap()); 177 QueryWrapper<EquipmentIn> queryWrapper = QueryGenerator.initQueryWrapper(equipmentIn, req.getParameterMap());
178
179 if (StringUtils.isNotEmpty(equipmentInDTO.getStartTime())) { 178 if (StringUtils.isNotEmpty(equipmentInDTO.getStartTime())) {
180 queryWrapper.ge("in_date", equipmentInDTO.getStartTime() + " 00:00:00"); 179 queryWrapper.ge("in_date", equipmentInDTO.getStartTime() + " 00:00:00");
181 } 180 }
...@@ -190,8 +189,8 @@ public class EquipmentInController { ...@@ -190,8 +189,8 @@ public class EquipmentInController {
190 189
191 Page<EquipmentInVO> voPage = new Page<>(pageNo, pageSize); 190 Page<EquipmentInVO> voPage = new Page<>(pageNo, pageSize);
192 Page<EquipmentIn> page = new Page<EquipmentIn>(pageNo, pageSize); 191 Page<EquipmentIn> page = new Page<EquipmentIn>(pageNo, pageSize);
193 192 List<EquipmentIn> totalList = equipmentInService.list(queryWrapper);
194 IPage<EquipmentIn> equipmentInIPage = equipmentInService.page(page, queryWrapper); 193 IPage<EquipmentIn> equipmentInIPage = page.setRecords(totalList);
195 List<EquipmentIn> equipmentInList = equipmentInIPage.getRecords(); 194 List<EquipmentIn> equipmentInList = equipmentInIPage.getRecords();
196 equipmentInList.stream().map(data -> "'" + data.getId() + "'").collect(Collectors.joining(",")); 195 equipmentInList.stream().map(data -> "'" + data.getId() + "'").collect(Collectors.joining(","));
197 196
...@@ -199,7 +198,8 @@ public class EquipmentInController { ...@@ -199,7 +198,8 @@ public class EquipmentInController {
199 if ("departIdName".equals(targetFieldName) && srcFieldVal != null) { 198 if ("departIdName".equals(targetFieldName) && srcFieldVal != null) {
200 return sysDepartVal2KeyMap.getOrDefault(srcFieldVal, ""); 199 return sysDepartVal2KeyMap.getOrDefault(srcFieldVal, "");
201 } else if ("sparepartName".equals(targetFieldName)) { 200 } else if ("sparepartName".equals(targetFieldName)) {
202 String sql2 = "select es.sparepart_name as sparepartName ,es.sparepart_type from equipment_sparepart_supplies as es inner join (select sparepart_id from equipment_in_child where in_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id"; 201 String sql2 = "select es.sparepart_name as sparepartName ,es.sparepart_type from equipment_sparepart_supplies as es " +
202 "inner join (select sparepart_id from equipment_in_child where in_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id";
203 List<Map<String, Object>> sparePartList = iCommonSqlService.queryForList(sql2); 203 List<Map<String, Object>> sparePartList = iCommonSqlService.queryForList(sql2);
204 Map<String, Integer> name2CountMap = new HashMap<>(); 204 Map<String, Integer> name2CountMap = new HashMap<>();
205 if (sparePartList != null && !sparePartList.isEmpty() && sparePartList.get(0) != null) { 205 if (sparePartList != null && !sparePartList.isEmpty() && sparePartList.get(0) != null) {
...@@ -225,7 +225,7 @@ public class EquipmentInController { ...@@ -225,7 +225,7 @@ public class EquipmentInController {
225 if (StringUtils.isNotEmpty(equipmentInDTO.getSparepartName())) { 225 if (StringUtils.isNotEmpty(equipmentInDTO.getSparepartName())) {
226 equipmentInVOList = equipmentInVOList.stream().filter(item -> item.getSparepartName().contains(equipmentInDTO.getSparepartName())).collect(Collectors.toList()); 226 equipmentInVOList = equipmentInVOList.stream().filter(item -> item.getSparepartName().contains(equipmentInDTO.getSparepartName())).collect(Collectors.toList());
227 } 227 }
228 voPage.setTotal(equipmentInIPage.getTotal()); 228 voPage.setTotal(page.getTotal());
229 voPage.setRecords(equipmentInVOList); 229 voPage.setRecords(equipmentInVOList);
230 result.setResult(voPage); 230 result.setResult(voPage);
231 return result; 231 return result;
......
...@@ -34,4 +34,9 @@ public class EquipmentStatisticDTO { ...@@ -34,4 +34,9 @@ public class EquipmentStatisticDTO {
34 */ 34 */
35 private String isSpecial; 35 private String isSpecial;
36 36
37 /**
38 * 所属厂区
39 */
40 private String departId;
41
37 } 42 }
......
...@@ -290,7 +290,7 @@ public class EquipmentInfo { ...@@ -290,7 +290,7 @@ public class EquipmentInfo {
290 @ApiModelProperty(value = "企业负责人") 290 @ApiModelProperty(value = "企业负责人")
291 private String enterpriseManager; 291 private String enterpriseManager;
292 292
293 293 @ApiModelProperty(value = "数字孪生模型区域编码")
294 294 private java.lang.String digitalTwinsStructCode;
295 295
296 } 296 }
......
...@@ -23,4 +23,5 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> { ...@@ -23,4 +23,5 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
23 */ 23 */
24 List<EquipmentInfoForMonitorVO> queryCustomPageList(Page<EquipmentInfoForMonitorVO> pageList, EquipmentInfoForMonitorVO equipmentInfoForMonitorVO); 24 List<EquipmentInfoForMonitorVO> queryCustomPageList(Page<EquipmentInfoForMonitorVO> pageList, EquipmentInfoForMonitorVO equipmentInfoForMonitorVO);
25 25
26 void clearDigitaltwins();
26 } 27 }
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
23 </if> 23 </if>
24 <if test="equipmentInfoForMonitorVO.equipmentName!=null and equipmentInfoForMonitorVO.equipmentName!=''"> 24 <if test="equipmentInfoForMonitorVO.equipmentName!=null and equipmentInfoForMonitorVO.equipmentName!=''">
25 and a.equipment_name LIKE CONCAT(CONCAT('%', #{equipmentInfoForMonitorVO.equipmentName}),'%') 25 and a.equipment_name LIKE CONCAT(CONCAT('%', #{equipmentInfoForMonitorVO.equipmentName}),'%')
26 </if> 26 </if>
27 </select> 27 </select>
28 </mapper>
...\ No newline at end of file ...\ No newline at end of file
28 <update id="clearDigitaltwins">
29 update equipment_info set digital_twins_struct_code = ''
30 </update>
31 </mapper>
......
...@@ -4,6 +4,7 @@ import java.io.IOException; ...@@ -4,6 +4,7 @@ import java.io.IOException;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 import cn.hutool.json.JSONObject;
7 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 8 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 import com.baomidou.mybatisplus.extension.service.IService; 9 import com.baomidou.mybatisplus.extension.service.IService;
9 import com.skua.core.api.vo.Result; 10 import com.skua.core.api.vo.Result;
...@@ -84,4 +85,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> { ...@@ -84,4 +85,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
84 void importExcel(MultipartFile file, String departId) throws Exception; 85 void importExcel(MultipartFile file, String departId) throws Exception;
85 86
86 String reCreateQrCode(String id); 87 String reCreateQrCode(String id);
88
89 void batchConfigDigitaltwins(JSONObject jsonObject);
87 } 90 }
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
9 import java.util.Map; 9 import java.util.Map;
10 import java.util.Set; 10 import java.util.Set;
11 11
12 import cn.hutool.json.JSONObject;
12 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 13 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
13 import com.skua.core.context.BaseContextHandler; 14 import com.skua.core.context.BaseContextHandler;
14 import com.skua.core.excel.CustomExcelUtil; 15 import com.skua.core.excel.CustomExcelUtil;
...@@ -340,4 +341,23 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E ...@@ -340,4 +341,23 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
340 return qrCodePath; 341 return qrCodePath;
341 } 342 }
342 343
344 @Override
345 public void batchConfigDigitaltwins(JSONObject json) {
346 List<String> idList = (List<String>)json.get("equip_id_list");
347 //清空孪生体配置数据
348 equipmentInfoMapper.clearDigitaltwins();
349 //组装需要更新的设备集合
350 List<EquipmentInfo> equipmentInfoList = new ArrayList<EquipmentInfo>();
351 EquipmentInfo equipmentInfo = null;
352 for(String id : idList) {
353 equipmentInfo = new EquipmentInfo();
354 equipmentInfo.setId(id);
355 equipmentInfo.setDigitalTwinsStructCode(id);
356 equipmentInfoList.add(equipmentInfo);
357 }
358 if(equipmentInfoList!=null&&equipmentInfoList.size()>0) {
359 this.updateBatchById(equipmentInfoList);
360 }
361 }
362
343 } 363 }
......
...@@ -113,6 +113,8 @@ public class ShiroConfig { ...@@ -113,6 +113,8 @@ public class ShiroConfig {
113 // filterChainDefinitionMap.put("/v1/report/reportDisplay/**", "anon"); 113 // filterChainDefinitionMap.put("/v1/report/reportDisplay/**", "anon");
114 filterChainDefinitionMap.put("/v1/sys/factoryMonitorData/**", "anon"); 114 filterChainDefinitionMap.put("/v1/sys/factoryMonitorData/**", "anon");
115 filterChainDefinitionMap.put("/sys/dict/getDictItems/**", "anon"); 115 filterChainDefinitionMap.put("/sys/dict/getDictItems/**", "anon");
116 //数字孪生设备、孪生体批量关联
117 filterChainDefinitionMap.put("/equipment/batchConfigDigitaltwins", "anon");
116 //性能监控 118 //性能监控
117 filterChainDefinitionMap.put("/actuator/metrics/**", "anon"); 119 filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
118 filterChainDefinitionMap.put("/actuator/httptrace/**", "anon"); 120 filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
...@@ -124,6 +126,7 @@ public class ShiroConfig { ...@@ -124,6 +126,7 @@ public class ShiroConfig {
124 //flowable工作流权限过滤 126 //flowable工作流权限过滤
125 filterChainDefinitionMap.put("/process/diagram-view", "anon"); 127 filterChainDefinitionMap.put("/process/diagram-view", "anon");
126 filterChainDefinitionMap.put("/process/resource-view","anon");//工作流流程图 128 filterChainDefinitionMap.put("/process/resource-view","anon");//工作流流程图
129 // filterChainDefinitionMap.put("/report/headerConfig/**","anon");
127 130
128 filterChainDefinitionMap.put("/v1/monitor/**","anon");//点表初始化导入 131 filterChainDefinitionMap.put("/v1/monitor/**","anon");//点表初始化导入
129 filterChainDefinitionMap.put("/example/**","anon"); 132 filterChainDefinitionMap.put("/example/**","anon");
......
...@@ -76,6 +76,24 @@ public class SysDepartController { ...@@ -76,6 +76,24 @@ public class SysDepartController {
76 return result; 76 return result;
77 } 77 }
78 78
79 /**
80 * 查询数据 查出所有厂区
81 * @return
82 */
83 @RequestMapping(value = "/getDepartList", method = RequestMethod.GET)
84 public Result<List<SysDepart>> getDepartList() {
85 Result<List<SysDepart>> result = new Result<>();
86 try {
87 String departIds = BaseContextHandler.getDeparts();
88 List<SysDepart> list = sysDepartService.getDepartList(departIds);
89 result.setResult(list);
90 result.setSuccess(true);
91 } catch (Exception e) {
92 log.error(e.getMessage(), e);
93 }
94 return result;
95 }
96
79 @ApiOperation(value="无token获取全部机构", notes="无token获取全部机构") 97 @ApiOperation(value="无token获取全部机构", notes="无token获取全部机构")
80 @RequestMapping(value = "/getTreeList", method = RequestMethod.GET) 98 @RequestMapping(value = "/getTreeList", method = RequestMethod.GET)
81 public Result<List<SysDepartTreeModel>> getTreeList() { 99 public Result<List<SysDepartTreeModel>> getTreeList() {
......
...@@ -88,14 +88,6 @@ public class SysFactoryUserInfoController { ...@@ -88,14 +88,6 @@ public class SysFactoryUserInfoController {
88 HttpServletRequest req) { 88 HttpServletRequest req) {
89 Result<IPage<SysFactoryUserInfo>> result = new Result<IPage<SysFactoryUserInfo>>(); 89 Result<IPage<SysFactoryUserInfo>> result = new Result<IPage<SysFactoryUserInfo>>();
90 Page<SysFactoryUserInfo> page = new Page<SysFactoryUserInfo>(pageNo, pageSize); 90 Page<SysFactoryUserInfo> page = new Page<SysFactoryUserInfo>(pageNo, pageSize);
91 // QueryWrapper<SysFactoryUserInfo> queryWrapper = QueryGenerator.initQueryWrapper(sysFactoryUserInfo, req.getParameterMap());
92 // String departIds = BaseContextHandler.getDeparts();
93 // String[] departIdArray = departIds.split(",");
94 // if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
95 // queryWrapper.in("depart_id", departIdArray);
96 // }
97 // queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
98 // IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.page(page, queryWrapper);
99 IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.getPage(page, sysFactoryUserInfo); 91 IPage<SysFactoryUserInfo> pageList = sysFactoryUserInfoService.getPage(page, sysFactoryUserInfo);
100 result.setSuccess(true); 92 result.setSuccess(true);
101 result.setResult(pageList); 93 result.setResult(pageList);
...@@ -109,13 +101,6 @@ public class SysFactoryUserInfoController { ...@@ -109,13 +101,6 @@ public class SysFactoryUserInfoController {
109 Result<Map<String,Object>> result = new Result<Map<String,Object>>(); 101 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
110 Map<String,Object> map = new HashMap<>(); 102 Map<String,Object> map = new HashMap<>();
111 int female = 0;int male = 0; 103 int female = 0;int male = 0;
112 // QueryWrapper<SysFactoryUserInfo> queryWrapper = new QueryWrapper<>();
113 // String departIds = BaseContextHandler.getDeparts();
114 // String[] departIdArray = departIds.split(",");
115 // if(StringUtils.isEmpty(sysFactoryUserInfo.getDepartId())&&StringUtils.isNotBlank(departIds)) {
116 // queryWrapper.in("depart_id", departIdArray);
117 // }
118 // queryWrapper.eq(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId()),"depart_id",sysFactoryUserInfo.getDepartId());
119 List<SysFactoryUserInfo> list = sysFactoryUserInfoService.getList(sysFactoryUserInfo); 104 List<SysFactoryUserInfo> list = sysFactoryUserInfoService.getList(sysFactoryUserInfo);
120 if(list.size()>0){ 105 if(list.size()>0){
121 map.put("total", list.size()); 106 map.put("total", list.size());
......
...@@ -183,4 +183,6 @@ public interface ISysDepartService extends IService<SysDepart>{ ...@@ -183,4 +183,6 @@ public interface ISysDepartService extends IService<SysDepart>{
183 List<SysDepart> queryUserDepartList(String userId); 183 List<SysDepart> queryUserDepartList(String userId);
184 184
185 List<SysDepartTreeModel> getTreeList(); 185 List<SysDepartTreeModel> getTreeList();
186
187 List<SysDepart> getDepartList(String departIds);
186 } 188 }
......
...@@ -24,6 +24,7 @@ import com.skua.modules.system.util.FindsDepartsChildrenUtil; ...@@ -24,6 +24,7 @@ import com.skua.modules.system.util.FindsDepartsChildrenUtil;
24 import com.skua.modules.system.vo.DepartTree; 24 import com.skua.modules.system.vo.DepartTree;
25 import com.skua.modules.system.vo.SysDeptUserVO; 25 import com.skua.modules.system.vo.SysDeptUserVO;
26 import com.skua.tool.dfs.MapDFS; 26 import com.skua.tool.dfs.MapDFS;
27 import com.skua.tool.util.JSUtils;
27 import io.netty.util.internal.StringUtil; 28 import io.netty.util.internal.StringUtil;
28 import org.apache.commons.lang3.StringUtils; 29 import org.apache.commons.lang3.StringUtils;
29 import org.springframework.beans.factory.annotation.Autowired; 30 import org.springframework.beans.factory.annotation.Autowired;
...@@ -590,4 +591,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart ...@@ -590,4 +591,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
590 return listResult; 591 return listResult;
591 } 592 }
592 593
594 @Override
595 public List<SysDepart> getDepartList(String departIds) {
596 List<SysDepart> list = new ArrayList<>();
597 QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
598 queryWrapper.in("id", departIds.split(","));
599 queryWrapper.eq("depart_type","1");
600 queryWrapper.orderByAsc("depart_order");
601 list = sysDepartMapper.selectList(queryWrapper);
602 return list;
603 }
604
593 } 605 }
......
...@@ -3,6 +3,7 @@ package com.skua.modules.system.service.impl; ...@@ -3,6 +3,7 @@ package com.skua.modules.system.service.impl;
3 import com.baomidou.mybatisplus.core.metadata.IPage; 3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 import com.skua.core.context.BaseContextHandler; 5 import com.skua.core.context.BaseContextHandler;
6 import com.skua.modules.common.service.ICommonSqlService;
6 import com.skua.modules.system.entity.SysFactoryUserInfo; 7 import com.skua.modules.system.entity.SysFactoryUserInfo;
7 import com.skua.modules.system.entity.SysUser; 8 import com.skua.modules.system.entity.SysUser;
8 import com.skua.modules.system.mapper.SysFactoryUserInfoMapper; 9 import com.skua.modules.system.mapper.SysFactoryUserInfoMapper;
...@@ -24,6 +25,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf ...@@ -24,6 +25,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf
24 25
25 @Autowired 26 @Autowired
26 private SysFactoryUserInfoMapper sysFactoryUserInfoMapper; 27 private SysFactoryUserInfoMapper sysFactoryUserInfoMapper;
28 @Autowired
29 private ICommonSqlService commonSqlService;
27 30
28 @Override 31 @Override
29 public IPage<SysFactoryUserInfo> getPage(Page<SysFactoryUserInfo> page, SysFactoryUserInfo sysFactoryUserInfo) { 32 public IPage<SysFactoryUserInfo> getPage(Page<SysFactoryUserInfo> page, SysFactoryUserInfo sysFactoryUserInfo) {
...@@ -38,7 +41,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf ...@@ -38,7 +41,8 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf
38 List<SysFactoryUserInfo> list = new ArrayList<>(); 41 List<SysFactoryUserInfo> list = new ArrayList<>();
39 String departIds = BaseContextHandler.getDeparts(); 42 String departIds = BaseContextHandler.getDeparts();
40 if(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId())){ 43 if(StringUtils.isNotEmpty(sysFactoryUserInfo.getDepartId())){
41 departIds = sysFactoryUserInfo.getDepartId(); 44 String departId = sysFactoryUserInfo.getDepartId();
45 departIds = commonSqlService.getChildDepartId(departId);
42 } 46 }
43 list = sysFactoryUserInfoMapper.getList(departIds,sysFactoryUserInfo.getUserName()); 47 list = sysFactoryUserInfoMapper.getList(departIds,sysFactoryUserInfo.getUserName());
44 return list; 48 return list;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!