初始化项目

This commit is contained in:
root
2024-04-01 09:20:31 +08:00
commit fefd704e6e
4694 changed files with 1869737 additions and 0 deletions

217
pqs9300/pom.xml Normal file
View File

@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>system</artifactId>
<groupId>com.njcn</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pqs9300</artifactId>
<packaging>war</packaging>
<name>pqs9300 Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>comService</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
<!-- Java调用Kafka -->
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka_2.11 -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.12</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-svggen</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-awt-util</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-css</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-dom</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-gvt</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-parser</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-script</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-svg-dom</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-util</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-xml</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-codec</artifactId>
<version>1.7</version>
</dependency>
<!-- 此处不能使用2.9.1版本使用2.9.1生成png会失败 -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.axsl.org.w3c.dom.svg</groupId>
<artifactId>svg-dom-java</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.w3c.css</groupId>
<artifactId>sac</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.7</version>
</dependency>
</dependencies>
<build>
<finalName>pqs9300</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@@ -0,0 +1,219 @@
package com.pqs9300.controller;
import com.njcn.enums.ProjectEnum;
import com.njcn.pojo.commons.WebItem;
import com.njcn.pojo.system.SubSystem;
import com.njcn.service.system.SystemService;
import com.njcn.utils.AppConfig;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/**
* @author hongawen
* @date 2018/3/26 22:41
*/
@Controller
@RequestMapping("business")
public class BusinessController {
@Resource
private AppConfig appConfig;
@Resource
private SystemService systemService;
@GetMapping("/doBusiness")
public ModelAndView main() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("main");
//判断是否需要显示切换系统以及待切换的系统信息
List<SubSystem> subSystems = systemService.getActiveSystem();
List<WebItem> webItems=new ArrayList<>();
boolean displayFlag = false;
for (SubSystem subSystem : subSystems) {
if (!subSystem.getSystemEName().equalsIgnoreCase(ProjectEnum.PQS9300.getItem())) {
displayFlag = true;
WebItem webItem=new WebItem();
webItem.setItem(subSystem.getSystemEName());
webItem.setName(subSystem.getSystemEName().toUpperCase() + subSystem.getSystemName());
webItems.add(webItem);
}
}
modelAndView.addObject("webItems",webItems);
modelAndView.addObject("displayFlag", displayFlag);
return modelAndView;
}
/**
* 首页
*/
@GetMapping("/index")
public String Index() {
return "index";
}
/**
* @Author chendaofei
* @Description 跳转预警策略配置页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/earlywaring")
public String EarlyWarning() {
return "business/strategy/earlywarning";
}
/**
* @Author chendaofei
* @Description 打开预警策略新增页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/earlyup")
public String Earlyup() {
return "business/strategy/earlyup";
}
/**
* @Author chendaofei
* @Description 打开预警策略绑定页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/earlybind")
public String Earlybind() {
return "business/strategy/earlybind";
}
/**
* @Author chendaofei
* @Description 跳转告警策略配置页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/alarmwarning")
public String Alarmwarning() {
return "business/strategy/alarmwarning";
}
/**
* @Author chendaofei
* @Description 打开预警策略新增页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/alarmup")
public String Alarmup() {
return "business/strategy/alarmup";
}
/**
* @Author chendaofei
* @Description 打开预警策略绑定页面
* @Date 9:47 2020/6/17
**/
@GetMapping("/alarmbind")
public String Alarmbind() {
return "business/strategy/alarmbind";
}
/**
* @Author dhj
* @Description 跳转技术监督
* @Date 9:47 2020/6/19
**/
@GetMapping("/technical")
public String Technical() {
return "business/technical/technicalMange";
}
/**
* @Author gbl
* @Description 新建技术监督
**/
@GetMapping("/addtechnical")
public String addTechnical() {
return "business/technical/addTechnical";
}
/**
* @Author gbl
* @Description 技术监督详情
**/
@GetMapping("/technicaldetail")
public String technicalDetail(HttpSession session,String supIndex) {
session.setAttribute("supIndex", supIndex);
return "business/technical/technicalDetail";
}
/**
* @Author gbl
* @Description 技术监督详情
**/
@GetMapping("/modtechnical")
public String modTechnical(HttpSession session,String supIndex) {
session.setAttribute("supIndex", supIndex);
return "business/technical/modTechnical";
}
/**
* @Author dhj
* @Description 波形
* @Date 9:47 2020/6/19
**/
@GetMapping("/waveform")
public String Waveform() {
return "business/technical/waveform";
}
/**
* @Author dhj
* @Description 报表
* @Date 9:47 2020/6/19
**/
@GetMapping("/excel")
public String excel(HttpSession session,String lineIndex,String time) {
session.setAttribute("lineIndex", lineIndex);
session.setAttribute("time", time);
return "business/report/excel";
}
/**
* 跳转404页面
*/
@RequestMapping(value = "404")
public String notFound() {
return "business/error/404";
}
@PostMapping("getWebsocketURL")
@ResponseBody
public String getWebSocketURL() {
String socketUrl=appConfig.getWebsocket();
return socketUrl;
}
@RequestMapping("/userDetail")
public String userDetail(HttpSession session,String userIndex) {
session.setAttribute("userIndex", userIndex);
return "userDetail";
}
/**
* 跳转到修改密码
*/
@RequestMapping("updatePassWord")
public String updatePassWord(HttpSession session,String userIndex) {
session.setAttribute("userIndex", userIndex);
return "updatePassWord";
}
}

View File

@@ -0,0 +1,47 @@
package com.pqs9300.controller;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.service.system.ThemeService;
import com.njcn.utils.PubUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @author hongawen
* @date: 2019/9/27 10:47
*/
@Controller
@RequestMapping("theme")
public class ThemeController {
private static final Logger logger = LoggerFactory.getLogger(ThemeController.class);
@Resource
private ThemeService themeService;
/**
* 获取主题色
*/
@PostMapping("getColor")
@ResponseBody
public HttpResult getColor() {
HttpResult result;
String color;
try{
color=themeService.getThemeColor();
result= PubUtils.assignmentResult(color,200,"获取主题色成功");
}catch (Exception e){
logger.error(e.toString());
result= PubUtils.assignmentResult("#006565",500,"获取主题色失败");
}
return result;
}
}

View File

@@ -0,0 +1,248 @@
package com.pqs9300.controller.flowChart;
import com.njcn.enums.LogTypeEnum;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.shiro.token.TokenManager;
import com.njcn.utils.AppConfig;
import com.njcn.utils.PubUtils;
import com.pqs9300.controller.technical.TechnicalInfoController;
import com.pqs9300.controller.transaction.TransactionController;
import com.pqs9300.mapper.transaction.OverRunLogMapper;
import com.pqs9300.pojo.transaction.OverRunLogDetail;
import com.pqs9300.pojo.transaction.Supervise;
import com.pqs9300.service.flowChart.FlowChartService;
import com.pqs9300.service.transaction.SuperviseService;
import com.pqs9300.util.WordUtil2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.lang.Integer.parseInt;
@Controller
@RequestMapping("flowChart")
public class FlowChartController {
// 日志记录
private static final Logger logger = LoggerFactory.getLogger(TechnicalInfoController.class);
@Autowired
private FlowChartService flowChartService;
@Resource
private SuperviseService superviseService;
@Resource
private AppConfig appConfig;
@Resource
private OverRunLogMapper overRunLogMapper;
/**
* @Author: xuyang
* @Date: 2020/7/1 14:50
* @Description: 展示流程图
*/
@RequestMapping(value = "getFlowChart")
public String vdWaveform(HttpServletRequest request, HttpSession session,String flowChartSupIndex,int flowChartType,int flowChartProgress) {
String filePath = "";
session.setAttribute("flowChartSupIndex", flowChartSupIndex);
session.setAttribute("flowChartType", flowChartType);
session.setAttribute("flowChartProgress", flowChartProgress);
if (flowChartType == 0){
filePath = "business/flowChart/flowChart";
} else {
filePath = "business/flowChart/flowGaoJingChart";
}
return filePath;
}
/**
* @Author: xuyang
* @Date: 2020/7/2 12:57
* @Description: 根据supIndex获取当前电压等级
*/
@RequestMapping(value = "getPowerLever")
@ResponseBody
public String powerLever(@RequestParam("flowChartSupIndex") String flowChartSupIndex){
return flowChartService.getPowerLever(flowChartSupIndex);
}
/**
* 打开数据列表
*/
@GetMapping("/openFlowChartData")
public ModelAndView flowChartData(String supIndex, Integer excuteStep, String stepCount) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("supIndex", supIndex);
modelAndView.addObject("excuteStep", excuteStep);
modelAndView.addObject("stepCount", stepCount);
modelAndView.setViewName("business/flowChart/flowChartData");
return modelAndView;
}
/**
* 根据事务索引校验后台的事务索引和报告文档是否存在
* @param supIndex 事务索引
*/
@PostMapping("checkTransaction")
@ResponseBody
public HttpResult checkTransaction(String supIndex, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
//先判断事务是否存在
Supervise supervise;
try {
supervise = superviseService.isExist(supIndex);
if (null == supervise) {
result = PubUtils.assignmentResultLog(null, 500, "当前事务数据丢失", "预/告警单下载", "成功", result);
} else {
//再开始判断当前功能需求的模板文档是否存在
Integer type = supervise.getType();
InputStream ins;
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
String rtfPath = "";
if (type == 0) {
//去找预警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file"+ File.separator+"earlyWarn.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "预/告警单下载", "成功", result);
} else {
ins.close();
path = path + File.separator+"njcn"+File.separator+"transaction"+File.separator+"earlyWarn"+File.separator + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file"+File.separator+"earlyWarn.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
} else {
//去找告警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file"+File.separator+"alarm.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "预/告警单下载", "成功", result);
} else {
ins.close();
path = path + File.separator+"njcn"+File.separator+"transaction"+File.separator+"alarm"+File.separator + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file"+File.separator+"alarm.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
}
//获取所有的监测点越限信息
List<OverRunLogDetail> overRunLogList = overRunLogMapper.getMonitorDetailData(supIndex);
if (CollectionUtils.isEmpty(overRunLogList)) {
//该事物没有监测点预警或者告警信息
result = PubUtils.assignmentResultLog(null, 500, "该事件没有监测点详细越限数据", "预/告警单下载", "成功", result);
} else {
List<Map<String, Object>> totalData = new ArrayList<>();
for (OverRunLogDetail overRunLogDetail : overRunLogList) {
Map<String, Object> reportmap = new HashMap<>();
reportmap.put("date", PubUtils.date2String(overRunLogDetail.getOverRunLog().getUpdateTime(), "yyyy年MM月dd日"));
reportmap.put("gdName", overRunLogDetail.getGdName());
reportmap.put("deptsName", overRunLogDetail.getDeptsName());
reportmap.put("mark", overRunLogDetail.getOverRunLog().getOverRunDescribe());
reportmap.put("fileName", overRunLogDetail.getOverRunLog().getName() + ".docx");
totalData.add(reportmap);
}
//收集完信息,开始一个个的保存到对应的文件夹中,每个文件名:监测点名+年月日
WordUtil2 oRTF = new WordUtil2();
try {
oRTF.getWordWarn(rtfPath, totalData, path, response, session);
} catch (Exception e) {
}
result = PubUtils.assignmentResultLog(null, 200, "可以后台下载", "预/告警单下载", "成功", result);
}
}
} catch (Exception e) {
logger.error("获取出各监测点越限的详细数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "下载异常", "预/告警单下载", "失败", result);
}
return result;
}
/**
* 根据事务索引校验后台的报告文档是否存在
* @param supIndex 事务索引
*/
@PostMapping("checkTransactionNotice")
@ResponseBody
public HttpResult checkTransactionNotice(String supIndex, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
//先判断事务是否存在
Supervise supervise;
try {
supervise = superviseService.isExist(supIndex);
if (null == supervise) {
result = PubUtils.assignmentResultLog(null, 500, "当前事务数据丢失", "整改通知单下载", "成功", result);
} else {
//再开始判断当前功能需求的模板文档是否存在
Integer type = supervise.getType();
InputStream ins;
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
String rtfPath = "";
//去找预警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file"+File.separator+"notice.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "整改通知单下载", "成功", result);
} else {
ins.close();
path = path + File.separator+"njcn"+File.separator+"transaction"+File.separator+"notice"+File.separator + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file"+File.separator+"notice.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
//获取所有的监测点越限信息
List<OverRunLogDetail> overRunLogList = overRunLogMapper.getMonitorDetailData(supIndex);
if (CollectionUtils.isEmpty(overRunLogList)) {
//该事物没有监测点预警或者告警信息
result = PubUtils.assignmentResultLog(null, 500, "该事件没有监测点详细越限数据", "整改通知单下载", "成功", result);
} else {
List<Map<String, Object>> totalData = new ArrayList<>();
for (OverRunLogDetail overRunLogDetail : overRunLogList) {
Map<String, Object> reportmap = new HashMap<>();
reportmap.put("date", PubUtils.date2String(overRunLogDetail.getOverRunLog().getUpdateTime(), "yyyy年MM月dd日"));
reportmap.put("gdName", overRunLogDetail.getGdName());
reportmap.put("deptsName", overRunLogDetail.getDeptsName());
reportmap.put("mark", overRunLogDetail.getOverRunLog().getOverRunDescribe());
reportmap.put("fileName", overRunLogDetail.getOverRunLog().getName()+ ".docx");
totalData.add(reportmap);
}
//收集完信息,开始一个个的保存到对应的文件夹中,每个文件名:监测点名+年月日
WordUtil2 oRTF = new WordUtil2();
try {
oRTF.getWordWarn(rtfPath, totalData, path, response, session);
} catch (Exception e) {
logger.error("产生了异常,异常是"+e.getMessage());
}
result = PubUtils.assignmentResultLog(null, 200, "可以后台下载", "整改通知单下载", "成功", result);
//更新当前记录的各个状态,主表的流程+1监测点谐波详细表的文件路径
//superviseService.finishEarlyNotice(supervise);
}
}
} catch (Exception e) {
logger.error("获取出各监测点越限的详细数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "下载异常", "整改通知单下载", "失败", result);
}
return result;
}
@RequestMapping(value = "getProgress")
@ResponseBody
public Integer shiwuProgress(@RequestParam("supIndex") String supIndex){
return flowChartService.getProgress(supIndex);
}
}

View File

@@ -0,0 +1,944 @@
package com.pqs9300.controller.report;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.enums.LogTypeEnum;
import com.njcn.mapper.configuration.OverLimitMapper;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.pojo.commons.RedisDB;
import com.njcn.pojo.commons.device.MachineAccount;
import com.njcn.pojo.configuration.OverLimit;
import com.njcn.pojo.configuration.RptPloy;
import com.njcn.service.configuration.LineService;
import com.njcn.service.log.UserLogDetailService;
import com.njcn.shiro.token.TokenManager;
import com.njcn.utils.AppConfig;
import com.njcn.utils.COverlimit;
import com.njcn.utils.InstantiateUtil;
import com.njcn.utils.PubUtils;
import com.njcn.utils.redis.JedisManager;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.FpyDataByType;
import com.pqs9300.pojo.report.OverLimitInfo;
import com.pqs9300.pojo.report.Pass;
import com.pqs9300.pojo.report.PloySetting;
import com.pqs9300.pojo.report.ReportTarget;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.pojo.report.enumReport.EnumPass;
import com.pqs9300.service.report.ExcelReportService;
import com.pqs9300.service.report.GetDistortionDataService;
import com.pqs9300.service.report.GetFlickerDataService;
import com.pqs9300.service.report.GetFpyService;
import com.pqs9300.service.report.GetFrequencyDataService;
import com.pqs9300.service.report.GetICurrentService;
import com.pqs9300.service.report.GetOverLimitDataService;
import com.pqs9300.service.report.GetPowerDataService;
import com.pqs9300.service.report.GetThreephaseDataService;
import com.pqs9300.service.report.GetVdeviationDataService;
import com.pqs9300.service.report.GetVirtualDataService;
import com.pqs9300.service.report.GetVoltageRateService;
import com.pqs9300.util.ExcelUtil;
import com.pqs9300.util.TransformTime;
import net.sf.json.JSONObject;
@RestController
public class ExcelReportController {
private static final Logger logger = LoggerFactory.getLogger(ExcelReportController.class);
@Autowired
private GetVirtualDataService getVirtualDataService;
@Autowired
private GetPowerDataService getPowerDataService;
@Autowired
private GetOverLimitDataService getOverLimitDataService;
@Autowired
private GetFlickerDataService getFlickerDataService;
@Autowired
private GetDistortionDataService getDistortionDataService;
@Autowired
private GetVdeviationDataService getVdeviationDataService;
@Autowired
private GetFrequencyDataService getFrequencyDataService;
@Autowired
private GetThreephaseDataService getThreephaseDataService;
@Autowired
private GetICurrentService getICurrentService;
@Autowired
private GetVoltageRateService getVoltageRateService;
@Autowired
private ExcelReportService excelReportService;
@Autowired
private GetFpyService getFpyService;
@Autowired
private AppConfig appConfig;
@Autowired
private UserLogDetailService userLog;
@Autowired
private COverlimit cOverlimit;
@Autowired
private LineService lineService;
@Autowired
OverLimitMapper overLimitMapper;
@Autowired
private JedisManager jedisManager;
private InstantiateUtil<String> instantiateUtil;
private InstantiateUtil<List<ReportTarget>> listInstantiateUtil;
private InstantiateUtil<List<PloySetting>> listPloysetting;
private InstantiateUtil<List<FpyDataByType>> listFpydata;
private InstantiateUtil<OverLimitInfo> listOverlimit;
private InstantiateUtil<Condition> conditionInstantiateUtil;
//选中的模板信息
private byte[] ployGuid;//##为默认模板(展示所有指标)
//模板设置
private byte[] ploy;
//限值
private byte[] overlimit;
//缓存查询条件
private byte[] condi;
//Excel实例对象
Map<String, ExcelUtil> excelUtilMap;
//非谐波数据
private byte[] virtual;
private byte[] power;
private byte[] flicker;
private byte[] distortion;
private byte[] vdeviation;
private byte[] frequency;
private byte[] threephase;
//谐波电压数据
private byte[] voltageRate;
//谐波电流数据
private byte[] iCurrent;
//合格率数据
private byte[] fpy;
public ExcelReportController() {
instantiateUtil = new InstantiateUtil<>();
listInstantiateUtil = new InstantiateUtil<>();
listPloysetting = new InstantiateUtil<>();
listFpydata = new InstantiateUtil<>();
listOverlimit = new InstantiateUtil<>();
conditionInstantiateUtil = new InstantiateUtil<>();
ployGuid = instantiateUtil.instantiate("ployGuid");
ploy = instantiateUtil.instantiate("ploy");
overlimit = instantiateUtil.instantiate("overlimit");
condi = instantiateUtil.instantiate("condi");
virtual = instantiateUtil.instantiate("virtual");
power = instantiateUtil.instantiate("power");
flicker = instantiateUtil.instantiate("flicker");
distortion = instantiateUtil.instantiate("distortion");
vdeviation = instantiateUtil.instantiate("vdeviation");
frequency = instantiateUtil.instantiate("frequency");
threephase = instantiateUtil.instantiate("threephase");
voltageRate = instantiateUtil.instantiate("voltageRate");
iCurrent = instantiateUtil.instantiate("iCurrent");
fpy = instantiateUtil.instantiate("fpy");
excelUtilMap = new HashMap<>();
}
//获取模板配置信息
@PostMapping("getPloyData")
public HttpResult getPloyData() {
HttpResult httpResult = new HttpResult();
List<RptPloy> list;
try {
list = excelReportService.getPloyData();
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("模板获取失败.");
return httpResult;
}
httpResult.setCode(200);
httpResult.setMessage("模板获取成功.");
httpResult.setBody(list);
return httpResult;
}
//设置选中的模板
@PostMapping("setPloy")
@ResponseBody
public HttpResult setPloy(String guid) {
HttpResult httpResult = new HttpResult();
String userIndex = TokenManager.getUserId();
byte[] value = instantiateUtil.instantiate(guid);
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, ployGuid, value, RedisDB.SHORT_TIME);
if (guid.equals("##")) {
httpResult.setCode(200);
httpResult.setBody(null);
return httpResult;
}
try {
List<PloySetting> list = excelReportService.setPloy(guid);
httpResult.setBody(list);
byte[] valueset = listPloysetting.instantiate(list);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, ploy, valueset, RedisDB.SHORT_TIME);
} catch (Exception e) {
httpResult.setCode(500);
return httpResult;
}
httpResult.setCode(200);
return httpResult;
}
@PostMapping(value = "/createExcel")
public HttpResult createExcel(String pointInfo) {
HttpResult httpResult = new HttpResult();
JSONObject jsonObject = JSONObject.fromObject(pointInfo);
JSONObject json = (JSONObject) jsonObject.get("body");
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
ExcelUtil excelUtil = new ExcelUtil();
excelUtil.createWorkBook();
excelUtil.createSheet("非谐波");
excelUtil.createSheet("谐波电压");
excelUtil.createSheet("谐波电流");
excelUtil.createSheet("合格率");
excelUtil.setTableName(jsonObject.get("Name").toString());
OverLimitInfo overLimitIn = listOverlimit.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, overlimit));
excelUtil.setOverLimitInfo(overLimitIn);
for (XSSFSheet sheet : excelUtil.getListSheet()) {
excelUtil.createHeader(jsonObject, json, sheet);
}
String strPloyGuid = (instantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, ployGuid)) == null ? "##" : instantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, ployGuid)));
List<PloySetting> listPloy = instantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, ploy));
List<ReportTarget> listVirtual = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, virtual));
List<ReportTarget> listPower = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, power));
List<ReportTarget> listFlicker = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, flicker));
List<ReportTarget> listDistortion = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, distortion));
List<ReportTarget> listVdeviation = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, vdeviation));
List<ReportTarget> listFrequency = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, frequency));
List<ReportTarget> listThreephase = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, threephase));
List<ReportTarget> listVoltageRate = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, voltageRate));
List<ReportTarget> listICurrent = listInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, iCurrent));
List<FpyDataByType> listFpy = listFpydata.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, fpy));
//非谐波电流
excelUtil.writeNonHarmonics(excelUtil.getListSheet().get(0), listPloy, strPloyGuid, listVirtual, listPower, listFlicker, listDistortion, listVdeviation, listFrequency, listThreephase);
//谐波电压
excelUtil.writeHarmonics(excelUtil.getListSheet().get(1), listPloy, strPloyGuid, listVoltageRate, true);
//谐波电流
excelUtil.writeHarmonics(excelUtil.getListSheet().get(2), listPloy, strPloyGuid, listICurrent, false);
//合格率
excelUtil.writeFpyData(excelUtil.getListSheet().get(3), listPloy, strPloyGuid, listFpy);
excelUtilMap.put(userIndex, excelUtil);
httpResult.setCode(200);
return httpResult;
}
@GetMapping(value = "/exportExcel")
public void exportExcel(HttpServletResponse response, HttpServletRequest request) {
String userIndex = TokenManager.getUserId();
ExcelUtil excelUtil = excelUtilMap.get(userIndex);
excelUtil.exportFile(excelUtil.getWorkbook(), response, request);
}
private void splitTime(String strTime, List<TransformTime> list) throws Exception {
if (strTime.indexOf("") == -1) {
return;
}
String strArray[] = strTime.split("");
TransformTime TransformTime = new TransformTime(strArray[0], strArray[1]);
TransformTime.string2Date();
list.add(TransformTime);
}
private void transCondition(Condition condition, JSONObject jsonObject) throws Exception { //异常抛给上层处理
String startTime = jsonObject.get("startTime").toString();
String endTime = jsonObject.get("endTime").toString();
String first = jsonObject.get("first").toString();
String second = jsonObject.get("second").toString();
String thrid = jsonObject.get("thrid").toString();
String state = jsonObject.get("state").toString();
Integer pointIndex = Integer.valueOf(jsonObject.get("pointIndex").toString());
String mode = jsonObject.get("mode").toString();
TransformTime TransformTime = new TransformTime(startTime, endTime);
TransformTime.string2Date();
condition.setStart(TransformTime.getStart());
condition.setEnd(TransformTime.getEnd());
condition.setPointIndex(pointIndex);
condition.setB();
condition.setMode(mode);
if (state.equals("true")) {
splitTime(first, condition.getExceptTime());
splitTime(second, condition.getExceptTime());
splitTime(thrid, condition.getExceptTime());
}
}
@PostMapping(value = "/getOverLimitData")
public HttpResult getOverLimitData(String timeObj, HttpServletRequest request) {
HttpResult httpResult = new HttpResult();
JSONObject jsonObject = JSONObject.fromObject(timeObj);
Condition condition = new Condition(appConfig);
try {
transCondition(condition, jsonObject);
} catch (Exception e) {
condition = null;
logger.error("getLimitData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
userLog.getLog("查询excel报表", "失败", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
return httpResult;
}
condition.setB(false);
try {
OverLimit over = overLimitMapper.selectByPrimaryKey(condition.getPointIndex().longValue());
MachineAccount machineAccount = lineService.getLineName(condition.getPointIndex());
if (over == null) {
cOverlimit.addOverLimit(condition.getPointIndex(), machineAccount.getScale());
}
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("监测点限值无数据.");
userLog.getLog("查询excel报表", "失败", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
return httpResult;
}
OverLimitInfo overLimitInfo = getOverLimitDataService.getOverLimitData(condition);
overLimitInfo.setMode(condition.getMode());
List<String> list;
switch (condition.getMode()) {
case "0":
list = new ArrayList<>();
list.add("A");
list.add("B");
list.add("C");
overLimitInfo.setList(list);
break;
case "1":
list = new ArrayList<>();
list.add("AB");
list.add("BC");
list.add("CA");
overLimitInfo.setList(list);
break;
case "2":
list = new ArrayList<>();
list.add("AB");
list.add("BC");
list.add("-");
overLimitInfo.setList(list);
break;
}
condition.setCount(overLimitInfo.getCount());
condition.setPltCount(overLimitInfo.getPltCount());
condition.setPstCount(overLimitInfo.getPstCount());
if (0 == overLimitInfo.getOverLimitRate().size()) {
httpResult.setCode(500);
httpResult.setMessage("监测点限值无数据.");
userLog.getLog("查询excel报表", "失败", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
return httpResult;
}
httpResult.setCode(200);
httpResult.setBody(overLimitInfo);
userLog.getLog("查询excel报表", "成功", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, overlimit, listOverlimit.instantiate(overLimitInfo), RedisDB.SHORT_TIME);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, condi, conditionInstantiateUtil.instantiate(condition), RedisDB.SHORT_TIME);
return httpResult;
}
private void transformData(List<ReportTarget> list, List<ReportValue> listValue, List<Pass> listOverlimit, boolean... b) {
int offset = b[0] ? 3 : 1;
offset = (b.length == 2 && !b[1]) ? 4 : offset;
int i = 0;
for (int index = 0; index < listValue.size(); index += offset) {
ReportTarget reportTarget = new ReportTarget();
List<ReportValue> list1 = new ArrayList<>();
list1.addAll(listValue.subList(index, index + offset));
reportTarget.setList(list1);
Float overLimit = listOverlimit.get(i).getOverLimit();
reportTarget.setOverLimit(overLimit);
switch (listOverlimit.get(i).getCode()) {
case 1:
for (int k = 0; k < reportTarget.getList().size(); k++) {
if (null == reportTarget.getList().get(k).getFmaxValue()) {
break;
} else if (reportTarget.getList().get(k).getFmaxValue().floatValue() > overLimit.floatValue()) {
reportTarget.setPass(EnumPass.NOPASS.getCode());
break;
} else {
reportTarget.setPass(EnumPass.PASS.getCode());
}
}
break;
case 2:
for (int k = 0; k < reportTarget.getList().size(); k++) {
if (null == reportTarget.getList().get(k).getMinValue()) {
break;
} else if (reportTarget.getList().get(k).getMinValue().floatValue() > overLimit.floatValue()) {
reportTarget.setPass(EnumPass.NOPASS.getCode());
break;
} else {
reportTarget.setPass(EnumPass.PASS.getCode());
}
}
break;
case 3:
for (int k = 0; k < reportTarget.getList().size(); k++) {
if (null == reportTarget.getList().get(k).getMeanValue()) {
break;
} else if (reportTarget.getList().get(k).getMeanValue().floatValue() > overLimit.floatValue()) {
reportTarget.setPass(EnumPass.NOPASS.getCode());
break;
} else {
reportTarget.setPass(EnumPass.PASS.getCode());
}
}
break;
case 4:
for (int k = 0; k < reportTarget.getList().size(); k++) {
if (null == reportTarget.getList().get(k).getCp95Value()) {
break;
} else if (reportTarget.getList().get(k).getCp95Value().floatValue() > overLimit.floatValue()) {
reportTarget.setPass(EnumPass.NOPASS.getCode());
break;
} else {
reportTarget.setPass(EnumPass.PASS.getCode());
}
}
break;
default:
break;
}
i++;
list.add(reportTarget);
}
}
@PostMapping(value = "/getVirtualData")
public HttpResult getVirtualData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
if (condition == null) {
logger.error("getVirtualData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listVirtual;
try {
listVirtual = getVirtualDataService.getVirtualData(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("有效值获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 3; i++) {
Pass pass = new Pass(null);
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listVirtual, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, virtual, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("有效值获取成功.");
return httpResult;
}
@PostMapping(value = "/getPowerData")
public HttpResult getPowerData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
if (condition == null) {
logger.error("getPowerData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listPower;
try {
listPower = getPowerDataService.getPowerData(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("功率获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 4; i++) { //3-->4
Pass pass = new Pass(null);
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listPower, list, true, false);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, power, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("功率获取成功.");
return httpResult;
}
@PostMapping(value = "/getflickerData")
public HttpResult getFlickerData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getflickerData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listFlicker;
try {
listFlicker = getFlickerDataService.getFlickerData(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("电压闪变获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 2; i++) {
Pass pass;
if (i == 1) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getFlicker(), EnumPass.MAX.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listFlicker, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, flicker, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("电压闪变获取成功.");
return httpResult;
}
@PostMapping(value = "/getdistortionData")
public HttpResult getDistortionData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getDistortionData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listDistortion;
try {
listDistortion = getDistortionDataService.getDistortionData(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("畸变率获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 2; i++) {
Pass pass;
if (i == 0) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getUaberrance(), EnumPass.CP95.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listDistortion, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, distortion, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("畸变率获取成功.");
return httpResult;
}
@PostMapping(value = "/getVdeviationData")
public HttpResult getVdeviationData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getVdeviationData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listVdeviation;
try {
listVdeviation = getVdeviationDataService.getVdeviation(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("电压偏差获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 2; i++) {
Pass pass;
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getVoltageDev(), EnumPass.MAX.getCode());
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listVdeviation, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, vdeviation, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("电压偏差获取成功.");
return httpResult;
}
@PostMapping(value = "/getFrequencyData")
public HttpResult getFrequencyData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getFrequencyData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listFrequency;
try {
listFrequency = getFrequencyDataService.getFrequencyData(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("频率获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 2; i++) {
Pass pass;
if (i == 1) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getFreqDev(), EnumPass.MAX.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listFrequency, list, false);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, frequency, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("频率获取成功.");
return httpResult;
}
@PostMapping(value = "/getThreephaseData")
public HttpResult getThreephaseData() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getThreephaseData()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listThreephase;
try {
listThreephase = getThreephaseDataService.getThreephase(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("三相电压不平衡度获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 8; i++) {
Pass pass;
if (i == 0) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getUbalance(), EnumPass.CP95.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listThreephase, list, false);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, threephase, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("三相电压不平衡度获取成功.");
return httpResult;
}
@PostMapping(value = "/getICurrent")
public HttpResult getICurrent() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getICurrent()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
List<ReportValue> listICurrent;
try {
listICurrent = getICurrentService.getICurrent(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("谐波电流数据获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 50; i++) {
Pass pass;
if (i < overLimitInfo.getOverLimitRate().get(0).getIHarmList().size() + 1 && i > 0) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getIHarmList().get(i - 1), EnumPass.CP95.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listICurrent, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, iCurrent, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("谐波电流数据获取成功.");
return httpResult;
}
@PostMapping(value = "/getVoltageRate")
public HttpResult getVoltageRate() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
OverLimitInfo overLimitInfo = getOverlimitInfo();
if (condition == null) {
logger.error("getVoltageRate()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
condition.setB(false);
List<ReportValue> listVoltageRate;
try {
listVoltageRate = getVoltageRateService.getVoltageRate(condition);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("谐波电压数据获取失败");
return httpResult;
}
List<Pass> list = new ArrayList<>();
for (int i = 0; i < 51; i++) {
Pass pass;
if (i == 0) {
pass = new Pass(null);
} else if (i == 50) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getUaberrance(), EnumPass.MAX.getCode());
} else if (i < overLimitInfo.getOverLimitRate().get(0).getVHarmList().size() + 1) {
pass = new Pass(overLimitInfo.getOverLimitRate().get(0).getVHarmList().get(i - 1), EnumPass.CP95.getCode());
} else {
pass = new Pass(null);
}
list.add(pass);
}
List<ReportTarget> list1 = new ArrayList<>();
transformData(list1, listVoltageRate, list, true);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, voltageRate, listInstantiateUtil.instantiate(list1), RedisDB.SHORT_TIME);
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("谐波电压数据获取成功.");
return httpResult;
}
@PostMapping(value = "/getFpy")
public HttpResult getFpy() {
HttpResult httpResult = new HttpResult();
Condition condition = getCondition();
if (condition == null) {
logger.error("getFpy()方法时间转换失败.");
httpResult.setCode(500);
httpResult.setMessage("解析前台传递的时间有误");
return httpResult;
}
condition.setB(false);
List<FpyDataByType> list1 = new ArrayList<>();
try {
list1 = getFpyService.getFpy(condition);
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
jedisManager.hset(RedisDB.SHORT_TIME_QUERY, userIndexs, fpy, listFpydata.instantiate(list1), RedisDB.SHORT_TIME);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("合格率获取失败");
return httpResult;
}
httpResult.setCode(200);
httpResult.setBody(list1);
httpResult.setMessage("合格率获取成功.");
return httpResult;
}
private Condition getCondition() {
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
Condition condition = conditionInstantiateUtil.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, condi));
return condition;
}
private OverLimitInfo getOverlimitInfo() {
String userIndex = TokenManager.getUserId();
byte[] userIndexs = instantiateUtil.instantiate(userIndex);
OverLimitInfo overLimitInfo = listOverlimit.deInstantiate(jedisManager.hget(RedisDB.SHORT_TIME_QUERY, userIndexs, overlimit));
return overLimitInfo;
}
}

View File

@@ -0,0 +1,45 @@
package com.pqs9300.controller.report;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.pojo.pointInfo.PointInfo;
import com.njcn.service.point.PointBaseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: Sunwei 【sunW2016@163.com】
* @Description:
* @Date: Create in 13:22 2018/5/28
* @Modified By:
*/
@RestController
public class PointBaseInfoController {
@Autowired
private PointBaseInfoService pointBaseInfoService;
@PostMapping(value = "/getPointInfo")
public HttpResult getPointInfo(Integer pointIndex) {
HttpResult httpResult = new HttpResult();
PointInfo pointInfo;
try {
pointInfo = pointBaseInfoService.getPointInfo(pointIndex);
} catch (Exception e) {
httpResult.setCode(500);
httpResult.setMessage("监测点详情获取失败.");
return httpResult;
}
if (pointInfo != null) {
httpResult.setCode(200);
httpResult.setBody(pointInfo);
httpResult.setMessage("监测点详情获取成功.");
} else {
httpResult.setCode(500);
httpResult.setMessage("监测点详情获取失败.");
}
return httpResult;
}
}

View File

@@ -0,0 +1,56 @@
package com.pqs9300.controller.socket;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArraySet;
@Component
@ServerEndpoint("/websocket")
public class WebSocketServer {
private Session session;
/*线程安全set 存放每个客户端处理消息的对象*/
private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet();
/*websocket 连接建立成功后进行调用*/
@OnOpen
public void onOpen(Session session) {
this.session = session;
webSocketSet.add(this);
}
/*websocket 链接关闭调用的方法*/
@OnClose
public void onClose() {
webSocketSet.remove(this);
}
/*收到客户端消息后调用的方法*/
@OnMessage
public void onMessage(String message) throws IOException {
for (WebSocketServer socket : webSocketSet) {
socket.session.getBasicRemote().sendText("自己嘎给自己嘎发的消息:"+message);
}
}
/*websocket 发生错误时进行调用*/
@OnError
public void onError(Throwable error){
System.out.println("onError......"+error.getMessage());
}
public void sendMessage(String message) throws IOException {
for (WebSocketServer socket : webSocketSet) {
socket.session.getBasicRemote().sendText(message);
}
}
public Session getSession() {
return session;
}
public void setSession(Session session) {
this.session = session;
}
}

View File

@@ -0,0 +1,298 @@
package com.pqs9300.controller.strategy;
import com.njcn.pojo.advanced.PicDataObj;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.utils.PubUtils;
import com.njcn.utils.XssFilterUtil;
import com.pqs9300.pojo.strategy.*;
import com.pqs9300.service.strategy.AlarmStrategyService;
import org.slf4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.POST;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description 告警告警策略控制器
* @Author cdf
* @Date 2020/6/17 10:28
**/
@Controller
@RequestMapping("alarmstrategy")
public class AlarmStrategyController {
@Resource
private AlarmStrategyService alarmStrategyService;
/**
* @Author chendaofei
* @Description 新增告警策略
* @Date 15:27 2020/6/17
**/
@PostMapping("addAlarm")
@ResponseBody
public HttpResult addAlarm(@RequestBody ThsAlarmDTO thsAlarmDTO){
try {
if (PubUtils.isBlank(thsAlarmDTO.getAlarmName()) || thsAlarmDTO.getGrade() == null) {
return PubUtils.assignmentResult(null, 500, "参数不能为空");
}
String wname = XssFilterUtil.dealString(thsAlarmDTO.getAlarmName());
thsAlarmDTO.setAlarmName(wname);
String res = alarmStrategyService.addAlarm(thsAlarmDTO);
if ("新增成功".equals(res)) {
return PubUtils.assignmentResult(null, 200, res);
} else {
return PubUtils.assignmentResult(null, 500, res);
}
}catch (Exception e){
return PubUtils.assignmentResult(null, 500, "新增出错");
}
}
/**
* @Author chendaofei
* @Description 删除告警策略
* @Date 15:27 2020/6/17
**/
@GetMapping("delAlarm")
@ResponseBody
public HttpResult delAlarm(String alarmIndex){
HttpResult httpResult =new HttpResult();
if(PubUtils.isBlank(alarmIndex)){
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
try {
String res = alarmStrategyService.delAlarm(alarmIndex);
if ("删除成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
return PubUtils.assignmentResult(null, 500, "删除数据出错");
}
}
/**
* @Author chendaofei
* @Description 判断是否存在绑定事件
* @Date 15:27 2020/6/17
**/
@GetMapping("isExitBindEvent")
@ResponseBody
public HttpResult isExitBindEvent(String alarmIndex){
HttpResult httpResult = new HttpResult();
if (PubUtils.isBlank(alarmIndex)) {
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
int res = alarmStrategyService.isExitBindEvent(alarmIndex);
if(res>0){
httpResult.setCode(200);
httpResult.setMessage("存在绑定事件");
}else {
httpResult.setCode(500);
httpResult.setMessage("不存在存在绑定事件");
}
return httpResult;
}
/**
* @Author chendaofei
* @Description 修改告警策略
* @Date 15:27 2020/6/17
**/
@PostMapping("updateAlarm")
@ResponseBody
public HttpResult updateAlarm(@RequestBody ThsAlarmDTO thsAlarmDTO){
if(PubUtils.isBlank(thsAlarmDTO.getAlarmIndex())|| PubUtils.isBlank(thsAlarmDTO.getAlarmName())|| thsAlarmDTO.getGrade()==null){
return PubUtils.assignmentResult(null,500,"参数不能为空");
}
try {
String wname = XssFilterUtil.dealString(thsAlarmDTO.getAlarmName());
thsAlarmDTO.setAlarmName(wname);
String res = alarmStrategyService.updateAlarm(thsAlarmDTO);
if ("修改成功".equals(res)) {
return PubUtils.assignmentResult(null, 200, res);
} else {
return PubUtils.assignmentResult(null, 500, res);
}
}catch (Exception e){
return PubUtils.assignmentResult(null, 500, "修改数据失败");
}
}
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
@PostMapping("statusController")
@ResponseBody
public HttpResult statusController(String alarmIndex,Integer state){
HttpResult httpResult = new HttpResult();
try {
Integer res = alarmStrategyService.statusController(alarmIndex, state);
if (res == 1) {
httpResult.setCode(200);
httpResult.setMessage("转换成功");
} else {
httpResult.setCode(500);
httpResult.setMessage("转换失败");
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("异常,请联系管理员");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 获取告警列表
* @Date 15:27 2020/6/17
**/
@PostMapping("getAlarmList")
@ResponseBody
public HttpResult updateAlarm(Integer grade){
List<ThsAlarmDTO> list = alarmStrategyService.getAlarmList(grade);
return PubUtils.assignmentResult(list,200,"获取成功");
}
/**
* @Author chendaofei
* @Description 修改告警策略指标类型与或
* @Date 15:27 2020/6/17
**/
@PostMapping("updateAlarmAndOr")
@ResponseBody
public HttpResult updateAlarmAndOr(String alarmIndex,Integer operation){
HttpResult httpResult = new HttpResult();
if(PubUtils.isBlank(alarmIndex)||operation==null){
httpResult.setCode(500);
httpResult.setMessage("参数不可为空");
return httpResult;
}else {
Integer res = alarmStrategyService.updateAlarmAndOr(alarmIndex,operation);
if(res == 1){
httpResult.setCode(200);
httpResult.setMessage("修改成功");
}else {
httpResult.setCode(500);
httpResult.setMessage("修改失败");
}
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 通过id获取告警策略
* @Date 15:27 2020/6/17
**/
@GetMapping("getAlarmById")
@ResponseBody
public HttpResult getAlarmById(String alarmIndex){
if(PubUtils.isBlank(alarmIndex)){
return PubUtils.assignmentResult(null,500,"参数不可为空");
}
try {
ThsAlarmDTO thsAlarmDTO = alarmStrategyService.getAlarmById(alarmIndex);
return PubUtils.assignmentResult(thsAlarmDTO,200,"获取成功");
}catch (Exception e){
return PubUtils.assignmentResult(null,500,"获取失败");
}
}
/*------------------操作THS_FormAss表--------------------------*/
/**
* 获取字典表的指标类型数据
*/
@PostMapping("targetType")
@ResponseBody
public HttpResult targetType(@RequestParam("alarmIndex") String alarmIndex,@RequestParam("type") Integer type) {
HttpResult result;
List<DicStrategyRVO> targetTypes;
if(PubUtils.isBlank(alarmIndex)|| type ==null){
return PubUtils.assignmentResult(null, 500, "参数不可为空");
}
try {
targetTypes = alarmStrategyService.getAlarmAss(alarmIndex,type);
if (CollectionUtils.isEmpty(targetTypes)) {
result = PubUtils.assignmentResult(null, 500, "字典表没有类型数据");
} else {
result = PubUtils.assignmentResult(targetTypes, 200, "获取字典表类型成功");
}
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取字典表类型失败");
}
return result;
}
/**
* @Author chendaofei
* @Description 新增告警绑定关系
* @Date 8:48 2020/6/23
**/
@PostMapping("addAlarmAss")
@ResponseBody
public HttpResult addAlarmAss(@RequestBody ParamDataVO paramDataVO){
HttpResult httpResult = new HttpResult();
try {
List<ThsAlarmFormAss> list = paramDataVO.getList();
String alarmIndex = paramDataVO.getWfIndex();
Integer state = paramDataVO.getState();
if (PubUtils.isBlank(alarmIndex)|| state==null) {
httpResult.setCode(500);
httpResult.setMessage("参数不可为空");
return httpResult;
}
String res = alarmStrategyService.addAlarmAss(alarmIndex,state,list);
if ("配置成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("配置失败,请联系管理员");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 获取告警策略绑定的监测点
* @Date 15:27 2020/6/17
**/
@PostMapping("getStrategyLine")
@ResponseBody
public HttpResult getStrategyLine(String alarmIndex, Integer type){
if(PubUtils.isBlank(alarmIndex)|| type ==null){
return PubUtils.assignmentResult(null, 500, "参数不可为空");
}else {
List<ThsAlarmAss> list= new ArrayList<>();
list = alarmStrategyService.getStrategyLine(alarmIndex,type);
return PubUtils.assignmentResult(list,200,"获取成功");
}
}
}

View File

@@ -0,0 +1,329 @@
package com.pqs9300.controller.strategy;
import com.njcn.enums.LogTypeEnum;
import com.njcn.mapper.configuration.OverLimitMapper;
import com.njcn.mapper.user.UserMapper;
import com.njcn.pojo.commons.DatePojo;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.pojo.commons.device.*;
import com.njcn.pojo.configuration.DicData;
import com.njcn.pojo.configuration.HistoryResult;
import com.njcn.pojo.configuration.OverLimit;
import com.njcn.pojo.configuration.OverLimtResult;
import com.njcn.pojo.user.*;
import com.njcn.service.configuration.DeviceService;
import com.njcn.service.configuration.HistoryResultService;
import com.njcn.service.log.UserLogDetailService;
import com.njcn.shiro.token.TokenManager;
import com.njcn.sso.pojo.user.User;
import com.njcn.utils.PubUtils;
import com.njcn.utils.redis.RedisCacheUtil;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import javax.security.auth.login.AccountException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
import java.util.regex.Pattern;
@Controller
@RequestMapping(value = "device")
public class DeviceController {
// 日志记录
private static final Logger logger = LoggerFactory.getLogger(DeviceController.class);
@Resource
private DeviceService getDeviceInfo;
@Autowired
HistoryResultService historyResultService;
@Autowired
UserLogDetailService userLog;
@Autowired
private RedisCacheUtil redisCacheUtil;
@Autowired
private OverLimitMapper overLimitMapper;
@Autowired
private UserMapper userMapper;
/**
* 终端树
*
* @return
*/
@RequestMapping(value = "getTree", method = RequestMethod.POST)
@ResponseBody
public HttpResult getTree() {
HttpResult result;
User user = TokenManager.getToken();
List<Tree> data;
try {
data = getDeviceInfo.getStrategyTree(user.getLoginName());
result = PubUtils.assignmentResult(data, 200, "获取设备树信息成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 200, "获取设备树信息失败");
}
return result;
}
/**
* @return com.njcn.pojo.configuration.HistoryResult
* @Author denghuajun
* @Description //TODO 获取历史数据
* @Date 2018/9/26 10:13
* @Param [request, startTime, endTime, lineIndex, type, number]
**/
@RequestMapping(value = "getHistoryResult", method = RequestMethod.POST)
@ResponseBody
public HistoryResult getHistoryResult(HttpServletRequest request, String startTime, String endTime, Long lineIndex, String type,
String number, String obj) throws AccountException {
int num = 0;
HistoryResult result = new HistoryResult();
JSONArray json = JSONArray.fromObject(obj); //使用net.sf.json.JSONObject对象来解析json
List<List> listw = new ArrayList<List>();
String k = json.getJSONObject(0).getString("condition");
String o = String.valueOf(json.getJSONObject(0).getString("condition"));
String startT = (String) json.getJSONObject(0).get("startTime");
startTime = startT; //获取时间段的开始时间
String endT = (String) json.getJSONObject(0).get("endTime");
endTime = endT;
String start = (String) json.getJSONObject(0).get("start");
String end = (String) json.getJSONObject(0).get("end");
String point = json.getJSONObject(0).getString("point");
String[] pointid = null;
try {
int g = 0;
pointid = point.split(",");
g = pointid.length;
for (int j = 0; j < pointid.length; j++) {
lineIndex = Long.valueOf(pointid[j]);
HistoryResult resultTemp = new HistoryResult();
//datePojo=PubUtils.ChooseDate(startTime,endTime,"[-getHistoryData");
if (Integer.parseInt(o) == 41 || Integer.parseInt(o) == 42) {
number = String.valueOf(json.getJSONObject(0).get("harmonic"));
} else if (Integer.parseInt(o) == 43) {
number = String.valueOf(json.getJSONObject(0).get("inHarmonic"));
}else {
number = String.valueOf(0);
}
switch (Integer.parseInt(o)) {
case 11:
type = "getXVrValue"; //相电压有效值
break;
case 12:
type = "getLVrValue"; //线电压有效值
break;
case 13:
type = "getDypc"; //电压偏差
break;
case 15:
type = "getSxbphd"; //三相电压不平衡度
break;
case 16:
type = "getBphdy"; //电压不平衡
break;
case 17:
type = "getDyzjbl"; //电压总谐波畸变率
break;
case 21:
type = "getDlyxz"; //电流有效值
break;
case 22:
type = "getDlzjbl"; //电流总谐波畸变率
break;
case 31:
type = "getPl"; //频率
break;
case 41:
if (number.equalsIgnoreCase("1")) {
type = "getJbhyl";
} else {
type = "getXbhyl"; //谐波电压含有率(N次谐波)
}
break;
case 42:
type = "getXbdlfz"; //谐波电流幅值
break;
case 51:
type = "getYggl"; //三相有功功率
break;
case 52:
type = "getWggl"; //三相无功功率
break;
case 53:
type = "getSzgl"; //三相视在功率
break;
case 54:
type = "getYgzgl"; //三相有功总功率
break;
case 55:
type = "getWgzgl"; //三相无功总功率
break;
case 56:
type = "getSzzgl"; //三相视在总功率
break;
case 61:
type = "getDssb"; //短时电压闪变
break;
case 62:
type = "getCssb"; //长时电压闪变
break;
case 63:
type = "getDybd"; //电压波动
break;
default:
break;
}
num += 1;
//xuyang_add number增加正则判断只能读取非0的正整数
String pattern = "^\\+?[1-9][0-9]*$";
if (Integer.parseInt(o) == 41 || Integer.parseInt(o) == 42 || Integer.parseInt(o) == 43) {
if (Pattern.matches(pattern, number)) {
resultTemp = historyResultService.getHistroyResult(startTime, endTime, lineIndex, start, end, type, number, num, g, Integer.parseInt(o),0,0);
if (num == 2) {
result.setData2(resultTemp.getData2());
} else if (num == 3) {
result.setData3(resultTemp.getData3());
} else if (num == 1) {
result.setData1(resultTemp.getData1());
}
result.setData4(resultTemp.getData4());
}
} else {
resultTemp = historyResultService.getHistroyResult(startTime, endTime, lineIndex, start, end, type, number, num, g, Integer.parseInt(o),0,0);
if (num == 2) {
result.setData2(resultTemp.getData2());
} else if (num == 3) {
result.setData3(resultTemp.getData3());
} else if (num == 1) {
result.setData1(resultTemp.getData1());
}
result.setData4(resultTemp.getData4());
}
}
result.setMsg(String.valueOf(num));
result.setMsg1(String.valueOf(g));
//userLog.getLog("查询稳态趋势对比", "成功", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
} catch (Exception e) {
System.out.println(e.toString());
userLog.getLog("查询稳态趋势对比", "失败", PubUtils.getIpAddr(request), LogTypeEnum.BUSSINESS.toString(), 0);
logger.error("获取历史数据异常,异常是" + e.toString());
}
return result;
}
@RequestMapping(value = "getUserAll", method = RequestMethod.POST)
@ResponseBody
public UserDetail getUserAll(HttpServletRequest request, String userIndex) {
UserDetail result = new UserDetail();
try {
result = userMapper.getUserAll(userIndex);
} catch (Exception e) {
result = null;
}
return result;
}
//获取限值
@RequestMapping(value = "getXz", method = RequestMethod.POST)
@ResponseBody
public OverLimtResult getXz(HttpServletRequest request, Long lineIndex, String number, String obj) {
OverLimtResult result = new OverLimtResult();
JSONArray json = JSONArray.fromObject(obj); //使用net.sf.json.JSONObject对象来解析json
String point = (String) json.getJSONObject(0).get("point");
String[] pointid = point.split(",");
try {
for (int j = 0; j < pointid.length; j++) {
lineIndex = Long.valueOf(pointid[j]);
Example example = new Example(OverLimit.class);
example.createCriteria().andEqualTo("myIndex", lineIndex);
List<OverLimit> overLimit = overLimitMapper.selectByExample(example);
if (!overLimit.isEmpty()) {
for (int i = 0; i < overLimit.size(); i++) {
List<Float> list = new ArrayList<>();
list.add(overLimit.get(i).getFreqDev());//频率限值
list.add(overLimit.get(i).getUbalance());//三相电压不平衡度限值
list.add(overLimit.get(i).getFlicker());//闪变限值
list.add(overLimit.get(i).getUaberrance());//电压畸变限值
list.add(overLimit.get(i).getVoltageDev());//电压偏差限值
list.add(overLimit.get(i).getUharm_2());//2次谐波电压限值
list.add(overLimit.get(i).getUharm_3());//3次谐波电压限值
list.add(overLimit.get(i).getUharm_4());//4次谐波电压限值
list.add(overLimit.get(i).getUharm_5());//5次谐波电压限值
list.add(overLimit.get(i).getUharm_6());//6次谐波电压限值
list.add(overLimit.get(i).getUharm_7());//7次谐波电压限值
list.add(overLimit.get(i).getUharm_8());//8次谐波电压限值
list.add(overLimit.get(i).getUharm_9());//9次谐波电压限值
list.add(overLimit.get(i).getUharm_10());//10次谐波电压限值
list.add(overLimit.get(i).getUharm_11());//11次谐波电压限值
list.add(overLimit.get(i).getUharm_12());//12次谐波电压限值
list.add(overLimit.get(i).getUharm_13());//13次谐波电压限值
list.add(overLimit.get(i).getUharm_14());//14次谐波电压限值
list.add(overLimit.get(i).getUharm_15());//15次谐波电压限值
list.add(overLimit.get(i).getUharm_16());//16次谐波电压限值
list.add(overLimit.get(i).getUharm_17());//17次谐波电压限值
list.add(overLimit.get(i).getUharm_18());//18次谐波电压限值
list.add(overLimit.get(i).getUharm_19());//19次谐波电压限值
list.add(overLimit.get(i).getUharm_20());//20次谐波电压限值
list.add(overLimit.get(i).getUharm_21());//21次谐波电压限值
list.add(overLimit.get(i).getUharm_22());//22次谐波电压限值
list.add(overLimit.get(i).getUharm_23());//23次谐波电压限值
list.add(overLimit.get(i).getUharm_24());//24次谐波电压限值
list.add(overLimit.get(i).getUharm_25());//25次谐波电压限值
list.add(overLimit.get(i).getIharm_2());//2次谐波幅值限值
list.add(overLimit.get(i).getIharm_3());//3次谐波幅值限值
list.add(overLimit.get(i).getIharm_4());//4次谐波幅值限值
list.add(overLimit.get(i).getIharm_5());//5次谐波幅值限值
list.add(overLimit.get(i).getIharm_6());//6次谐波幅值限值
list.add(overLimit.get(i).getIharm_7());//7次谐波幅值限值
list.add(overLimit.get(i).getIharm_8());//8次谐波幅值限值
list.add(overLimit.get(i).getIharm_9());//9次谐波幅值限值
list.add(overLimit.get(i).getIharm_10());//10次谐波幅值限值
list.add(overLimit.get(i).getIharm_11());//11次谐波幅值限值
list.add(overLimit.get(i).getIharm_12());//12次谐波幅值限值
list.add(overLimit.get(i).getIharm_13());//13次谐波幅值限值
list.add(overLimit.get(i).getIharm_14());//14次谐波幅值限值
list.add(overLimit.get(i).getIharm_15());//15次谐波幅值限值
list.add(overLimit.get(i).getIharm_16());//16次谐波幅值限值
list.add(overLimit.get(i).getIharm_17());//17次谐波幅值限值
list.add(overLimit.get(i).getIharm_18());//18次谐波幅值限值
list.add(overLimit.get(i).getIharm_19());//19次谐波幅值限值
list.add(overLimit.get(i).getIharm_20());//20次谐波幅值限值
list.add(overLimit.get(i).getIharm_21());//21次谐波幅值限值
list.add(overLimit.get(i).getIharm_22());//22次谐波幅值限值
list.add(overLimit.get(i).getIharm_23());//23次谐波幅值限值
list.add(overLimit.get(i).getIharm_24());//24次谐波幅值限值
list.add(overLimit.get(i).getIharm_25());//25次谐波幅值限值
result.getData().add(list);
}
} else {
result.getData().add(null);
}
}
} catch (Exception e) {
logger.error("获取限值异常,异常是" + e.toString());
}
result.setMsg("200");
return result;
}
}

View File

@@ -0,0 +1,317 @@
package com.pqs9300.controller.strategy;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.utils.PubUtils;
import com.njcn.utils.XssFilterUtil;
import com.pqs9300.pojo.strategy.ParamDataVO;
import com.pqs9300.pojo.strategy.ThsAlarmFormAss;
import com.pqs9300.pojo.strategy.ThsAlarmFormDTO;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import com.pqs9300.pojo.transaction.OverRunLog;
import com.pqs9300.service.strategy.WarnStrategyService;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
/**
* @Description 预警告警策略控制器
* @Author cdf
* @Date 2020/6/17 10:28
**/
@Controller
@RequestMapping("strategy")
public class WarningStrategyController {
@Resource
private WarnStrategyService warnStrategyService;
/**
* @Author chendaofei
* @Description 新增预警策略
* @Date 15:27 2020/6/17
**/
@PostMapping("addEarlyWarn")
@ResponseBody
public HttpResult addEarlyWarn(@RequestBody ThsAlarmFormDTO thsAlarmFormDTO) {
HttpResult httpResult = new HttpResult();
try {
if (PubUtils.isBlank(thsAlarmFormDTO.getWfName()) || thsAlarmFormDTO.getGrade() == null) {
httpResult.setCode(500);
httpResult.setMessage("参数不能为空");
return httpResult;
}
String wname = XssFilterUtil.dealString(thsAlarmFormDTO.getWfName());
thsAlarmFormDTO.setWfName(wname);
String res = warnStrategyService.addEarlyWarn(thsAlarmFormDTO);
if ("新增成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("新增数据失败");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
@GetMapping("delEarlyWarn")
@ResponseBody
public HttpResult delEarlyWarn(String wfIndex) {
HttpResult httpResult = new HttpResult();
if (PubUtils.isBlank(wfIndex)) {
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
try {
String res = warnStrategyService.delEarlyWarn(wfIndex);
if ("删除成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("删除数据失败");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 判断是否存在绑定事件
* @Date 15:27 2020/6/17
**/
@GetMapping("isExitBindEvent")
@ResponseBody
public HttpResult isExitBindEvent(String wfIndex){
HttpResult httpResult = new HttpResult();
if (PubUtils.isBlank(wfIndex)) {
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
int res = warnStrategyService.isExitBindEvent(wfIndex);
if(res>0){
httpResult.setCode(200);
httpResult.setMessage("存在绑定事件");
}else {
httpResult.setCode(500);
httpResult.setMessage("不存在存在绑定事件");
}
return httpResult;
}
/**
* @Author chendaofei
* @Description 修改预警策略
* @Date 15:27 2020/6/17
**/
@PostMapping("updateEarlyWarn")
@ResponseBody
public HttpResult updateEarlyWarn(@RequestBody ThsAlarmFormDTO thsAlarmFormDTO) {
HttpResult httpResult = new HttpResult();
try {
if (PubUtils.isBlank(thsAlarmFormDTO.getWfIndex()) || PubUtils.isBlank(thsAlarmFormDTO.getWfName()) || thsAlarmFormDTO.getGrade() == null) {
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
String wname = XssFilterUtil.dealString(thsAlarmFormDTO.getWfName());
thsAlarmFormDTO.setWfName(wname);
String res = warnStrategyService.updateEarlyWarn(thsAlarmFormDTO);
if ("已存在此策略名".equals(res)) {
httpResult.setCode(500);
httpResult.setMessage(res);
} else if ("修改成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("修改失败");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
@PostMapping("statusController")
@ResponseBody
public HttpResult statusController(String wfIndex, Integer state) {
HttpResult httpResult = new HttpResult();
if (PubUtils.isBlank(wfIndex) || state == null) {
httpResult.setCode(500);
httpResult.setMessage("参数为空");
return httpResult;
}
Integer res = warnStrategyService.statusController(wfIndex, state);
if (res == 1) {
httpResult.setCode(200);
httpResult.setMessage("转换成功");
} else {
httpResult.setCode(500);
httpResult.setMessage("转换失败");
}
return httpResult;
}
/**
* @Author chendaofei
* @Description 获取预警策略列表
* @Date 15:27 2020/6/17
**/
@PostMapping("getEarlyWarnList")
@ResponseBody
public HttpResult getEarlyWarnList(@RequestParam(value = "grade") Integer grade) {
List<ThsAlarmFormDTO> list = warnStrategyService.getEarlyWarnList(grade);
return PubUtils.assignmentResult(list, 200, "获取成功");
}
/**
* @Author chendaofei
* @Description 修改预警策略指标类型与或
* @Date 15:27 2020/6/17
**/
@PostMapping("updateEarlyWarnAndOr")
@ResponseBody
public HttpResult updateEarlyWarnAndOr(String wfIndex, Integer operation) {
HttpResult httpResult = new HttpResult();
if (PubUtils.isBlank(wfIndex) || operation == null) {
httpResult.setCode(500);
httpResult.setMessage("参数不可为空");
return httpResult;
}
Integer res = warnStrategyService.updateEarlyWarnAndOr(wfIndex, operation);
if (res == 1) {
httpResult.setCode(200);
httpResult.setMessage("修改成功");
} else {
httpResult.setCode(500);
httpResult.setMessage("修改失败");
}
return httpResult;
}
/**
* @Author chendaofei
* @Description 通过id获取预警策略
* @Date 15:27 2020/6/17
**/
@GetMapping("getEarlyWarnById")
@ResponseBody
public HttpResult getEarlyWarnById(String wfIndex) {
if (PubUtils.isBlank(wfIndex)) {
return PubUtils.assignmentResult(null, 500, "参数为空");
}
try {
ThsAlarmFormDTO thsAlarmFormDTO = warnStrategyService.getEarlyWarnById(wfIndex);
return PubUtils.assignmentResult(thsAlarmFormDTO, 200, "获取成功");
}catch (Exception e){
return PubUtils.assignmentResult(null, 500, "获取数据失败");
}
}
/*------------------操作THS_WarnFormAss表--------------------------*/
/**
* 获取字典表的指标类型数据
*/
@PostMapping("targetType")
@ResponseBody
public HttpResult targetType(@RequestParam("wfIndex") String wfIndex, @RequestParam("type") Integer type) {
HttpResult result;
List<DicStrategyRVO> targetTypes;
if (PubUtils.isBlank(wfIndex) || type == null) {
return PubUtils.assignmentResult(null, 500, "参数不可为空");
}
try {
targetTypes = warnStrategyService.getEarlyWarnAss(wfIndex, type);
if (CollectionUtils.isEmpty(targetTypes)) {
result = PubUtils.assignmentResult(null, 500, "字典表没有类型数据");
} else {
result = PubUtils.assignmentResult(targetTypes, 200, "获取字典表类型成功");
}
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取字典表类型失败");
}
return result;
}
/**
* @Author chendaofei
* @Description 新增预警绑定关系
* @Date 8:48 2020/6/23
**/
@PostMapping("addEarlyWarnAss")
@ResponseBody
public HttpResult addEarlyWarnAss(@RequestBody ParamDataVO paramDataVO) {
HttpResult httpResult = new HttpResult();
try {
List<ThsAlarmFormAss> list = paramDataVO.getList();
String wfIndex = paramDataVO.getWfIndex();
Integer state = paramDataVO.getState();
if (PubUtils.isBlank(wfIndex)) {
httpResult.setCode(500);
httpResult.setMessage("参数不可为空");
return httpResult;
}
String res = warnStrategyService.addEarlyWarnAss(wfIndex, state, list);
if ("配置成功".equals(res)) {
httpResult.setCode(200);
httpResult.setMessage(res);
} else {
httpResult.setCode(500);
httpResult.setMessage(res);
}
return httpResult;
}catch (Exception e){
httpResult.setCode(500);
httpResult.setMessage("配置失败,请联系管理员");
return httpResult;
}
}
/**
* @Author chendaofei
* @Description 获取预警策略绑定的监测点
* @Date 15:27 2020/6/17
**/
@PostMapping("getStrategyLine")
@ResponseBody
public HttpResult getStrategyLine(String wfIndex, Integer type) {
if (PubUtils.isBlank(wfIndex) || type == null) {
return PubUtils.assignmentResult(null, 500, "参数不可为空");
}
List<ThsAlarmFormAss> list = new ArrayList<>();
list = warnStrategyService.getStrategyLine(wfIndex, type);
return PubUtils.assignmentResult(list, 200, "获取成功");
}
}

View File

@@ -0,0 +1,302 @@
package com.pqs9300.controller.technical;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.pqs9300.util.SocketSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.pojo.user.Depts;
import com.njcn.service.configuration.DeviceService;
import com.njcn.utils.PubUtils;
import com.pqs9300.pojo.technical.TechnicalInfo;
import com.pqs9300.pojo.transaction.OverRunLog;
import com.pqs9300.pojo.transaction.Supervise;
import com.pqs9300.service.formdata.FormDataService;
import com.pqs9300.service.technical.TechnicalInfoService;
import com.pqs9300.util.SocketSender;
import net.sf.json.JSONArray;
@Controller
@RequestMapping("technical")
public class TechnicalInfoController {
// 日志记录
private static final Logger logger = LoggerFactory.getLogger(TechnicalInfoController.class);
@Autowired
private TechnicalInfoService technicalInfoService;
@Autowired
private DeviceService deviceService;
@Autowired
private FormDataService formDataService;
@Autowired
private SocketSender socketSender;
@RequestMapping(value = "getTechnicalInfo", method = RequestMethod.POST)
@ResponseBody
public HttpResult getTechnicalInfo(HttpServletRequest request, String startTime, String endTime, Integer supType, Integer progress) {
HttpResult result = new HttpResult();
List<TechnicalInfo> technicalInfos = new ArrayList<>();
try {
technicalInfos = technicalInfoService.getTechnicalInfo(startTime, endTime, progress, supType);
result = PubUtils.assignmentResult(technicalInfos, 200, "获取数据成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取数据失败");
}
return result;
}
/**
* 获取技术监督详情
*
* @param request
* @param startTime
* @param deptIndex
* @return
*/
@RequestMapping(value = "getTechnicalDetail", method = RequestMethod.POST)
@ResponseBody
public HttpResult getTechnicalDetail(HttpServletRequest request, String startTime, String deptIndex, Integer type) {
HttpResult result = new HttpResult();
List<OverRunLog> overRunLog = new ArrayList<>();
try {
Date start = PubUtils.string2Date(startTime, "yyyy-MM-dd");
if (type == 0) {
overRunLog = formDataService.getTechnicalDetail(deptIndex, start);
} else {
overRunLog = formDataService.getTechnicalDetail(deptIndex, start, 1);
}
result = PubUtils.assignmentResult(overRunLog, 200, "获取技术监督详情成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取技术监督详情失败");
}
return result;
}
/**
* 保存技术监督详情
*
* @param request
* @param startTime
* @param deptIndex
* @return
*/
@RequestMapping(value = "saveTechnicalDetail", method = RequestMethod.POST)
@ResponseBody
public HttpResult saveTechnicalDetail(HttpServletRequest request, String startTime, String deptIndex, Integer type, @RequestParam("indexs[]") List<String> indexs) {
HttpResult result = new HttpResult();
String supIndex="";
try {
Date start = PubUtils.string2Date(startTime, "yyyy-MM-dd");
if (type == 0) {
supIndex=formDataService.saveOverRunLog(deptIndex, start, indexs);
} else {
supIndex=formDataService.saveOverRunLog(deptIndex, start, indexs, 1);
}
socketSender.sendSocketMsg("生成"+supIndex+"技术单");
result = PubUtils.assignmentResult("success", 200, "获取技术监督详情成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取技术监督详情失败");
}
return result;
}
/**
* 修改技术监督详情
*
* @param request
* @param startTime
* @param deptIndex
* @return
*/
@RequestMapping(value = "modTechnicalDetail", method = RequestMethod.POST)
@ResponseBody
public HttpResult modTechnicalDetail(HttpServletRequest request,String supIndex, String startTime, String deptIndex, Integer type, @RequestParam("indexs[]") List<String> indexs) {
HttpResult result = new HttpResult();
try {
Date start = PubUtils.string2Date(startTime, "yyyy-MM-dd");
if (type == 0) {
formDataService.modOverRunLog(supIndex,deptIndex, start, indexs);
} else {
formDataService.modOverRunLog(supIndex,deptIndex, start, indexs, 1);
}
result = PubUtils.assignmentResult("success", 200, "获取技术监督详情成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取技术监督详情失败");
}
return result;
}
/**
* 删除技术监督详情
*
* @param request
* @return
*/
@RequestMapping(value = "delTechnical", method = RequestMethod.POST)
@ResponseBody
public HttpResult delTechnical(HttpServletRequest request,String supIndex) {
HttpResult result = new HttpResult();
try {
formDataService.delTechnical(supIndex);
socketSender.sendSocketMsg("删除"+supIndex+"技术单");
result = PubUtils.assignmentResult("success", 200, "删除技术监督成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "删除技术监督失败");
}
return result;
}
/**
* 获取部门列表
*
* @param request
* @return
*/
@RequestMapping(value = "getDepts", method = RequestMethod.POST)
@ResponseBody
public HttpResult getDepts(HttpServletRequest request) {
HttpResult result = new HttpResult();
List<Depts> depts = new ArrayList<>();
try {
depts = technicalInfoService.getDepts();
result = PubUtils.assignmentResult(depts, 200, "获取部门列表成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取部门列表失败");
}
return result;
}
@PostMapping("getStartSwitch")
@ResponseBody
public HttpResult getStartSwitch(@RequestParam("index[]") List<String> index) {
HttpResult result;
if (CollectionUtils.isEmpty(index)) {
result = PubUtils.assignmentResult(null, 500, "请选中需要开启的流程");
return result;
}
try {
int re = technicalInfoService.getStartSwitch(index);
if (re == -1) {
result = PubUtils.assignmentResult(re, 200, "启动成功");
} else {
result = PubUtils.assignmentResult(re, 500, "启动失败");
socketSender.sendSocketMsg("开启"+index+"流程");
}
//下载前,清空备份
// String item = "njcntemp/waveTemp9000";
// FileUtil.clean(new File(appConfig.getTmppath() + item));
// Map<String, List<String>> indexList = waveService.getEventDetailIndexList(index);
// if (CollectionUtils.isEmpty(indexList)) {
// result = PubUtils.assignmentResult(null, 500, "没有波形数据");
// } else {
// result = PubUtils.assignmentResult(indexList, 200, "波形数据准备完毕");
// cache.set(TokenManager.getUserId() + TokenManager.getSysType() + "waveFiles9200", indexList);
// }
} catch (Exception e) {
logger.error("后台获取数据出错方法名为downloadWave异常为" + e);
result = PubUtils.assignmentResult(null, 500, "获取暂降事件数据出错,请联系管理员");
}
return result;
}
/**
* 根据ID获取技术监督详情
*
* @param request
* @return
*/
@RequestMapping(value = "getTechnicalByID", method = RequestMethod.POST)
@ResponseBody
public HttpResult getTechnicalByID(HttpServletRequest request, String supIndex) {
HttpResult result = new HttpResult();
Supervise technical = new Supervise();
try {
technical = formDataService.getTechnicalByID(supIndex);
result = PubUtils.assignmentResult(technical, 200, "获取技术监督详情成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取技术监督详情失败");
}
return result;
}
/**
* 根据ID和越限时间获取越限指标
*
* @param request
* @return
*/
@RequestMapping(value = "getOptions", method = RequestMethod.POST)
@ResponseBody
public HttpResult getOptions(HttpServletRequest request, Long lineIndex, String time) {
HttpResult result = new HttpResult();
List<String> options = new ArrayList<>();
try {
Date start = PubUtils.string2Date(time, "yyyy-MM-dd");
options = formDataService.getOptions(lineIndex, start);
result = PubUtils.assignmentResult(options, 200, "获取越限指标成功");
} catch (Exception e) {
result = PubUtils.assignmentResult(null, 500, "获取越限指标失败");
}
return result;
}
/**
* 获取接线方式
*
* @param request
* @return
*/
@RequestMapping(value = "getPttype", method = RequestMethod.POST)
@ResponseBody
public List<Integer> getPttype(HttpServletRequest request,String obj) {
JSONArray json = JSONArray.fromObject(obj); //使用net.sf.json.JSONObject对象来解析json
String points = (String) json.getJSONObject(0).get("point");
String[] pointid = points.split(",");
List<Integer> listw = new ArrayList<Integer>();
int point;
for (int i = 0; i < pointid.length; i++) {
point = Integer.parseInt(pointid[i]);
int pttype = deviceService.getConnect(Long.valueOf(point));
listw.add(pttype);
}
return listw;
}
/**
* @Author dhj
* @Description 跳转技术监督
* @Date 9:47 2020/7/14
**/
@GetMapping("/viewWave")
public String ViewWave() {
return "business/monitor/waveform";
}
}

View File

@@ -0,0 +1,398 @@
package com.pqs9300.controller.transaction;
import com.njcn.enums.LogTypeEnum;
import com.njcn.pojo.commons.DatePojo;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.shiro.token.TokenManager;
import com.njcn.utils.AppConfig;
import com.njcn.utils.PubUtils;
import com.njcn.utils.ZipUtils;
import com.pqs9300.mapper.transaction.OverRunLogMapper;
import com.pqs9300.pojo.transaction.IndexPojo;
import com.pqs9300.pojo.transaction.OverRunLogDetail;
import com.pqs9300.pojo.transaction.Supervise;
import com.pqs9300.pojo.transaction.TransactionData;
import com.pqs9300.service.transaction.OverRunLogService;
import com.pqs9300.service.transaction.SuperviseService;
import com.pqs9300.util.SocketSender;
import com.pqs9300.util.WordUtil2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipOutputStream;
/**
* @author hongawen
* @date: 2020/6/24 14:38
*/
@Controller
@RequestMapping("transaction")
public class TransactionController {
private static final Logger logger = LoggerFactory.getLogger(TransactionController.class);
@Resource
private SuperviseService superviseService;
@Resource
private OverRunLogService overRunLogService;
@Resource
private AppConfig appConfig;
@Resource
private OverRunLogMapper overRunLogMapper;
@Resource
private SocketSender socketSender;
/**
* @param supIndex 主表事务索引
* @param excuteStep 接下来的操作 1是执行当前操作 2是上一步操作的更新
*/
@GetMapping("/excuteNextStep")
public ModelAndView EarlyWarning(String supIndex, Integer excuteStep, String stepCount) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("supIndex", supIndex);
modelAndView.addObject("excuteStep", excuteStep);
modelAndView.addObject("stepCount", stepCount);
modelAndView.setViewName("business/transaction/indexNextStep");
return modelAndView;
}
/**
* 获取当前用户条件范围内的事务数据
*
* @param startTime 起始时间
* @param endTime 截止时间
* @param type 事务类型
* @param progress 事务当前流程
*/
@PostMapping("getTransactionData")
@ResponseBody
public HttpResult getTransactionData(String startTime, String endTime, Integer type, Integer progress, HttpServletRequest request) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
DatePojo datePojo;
datePojo = PubUtils.validateDate(startTime, endTime, "getTransactionData");
if (!StringUtils.isEmpty(datePojo.getMsg())) {
result = PubUtils.assignmentResult(null, 500, datePojo.getMsg());
return result;
}
IndexPojo indexPojo;
try {
indexPojo = superviseService.getTransactionData(datePojo.getStartTime(), datePojo.getEndTime(), type, progress);
if (CollectionUtils.isEmpty(indexPojo.getSuperviseList())) {
result = PubUtils.assignmentResultLog(indexPojo, 500, "获取当前用户条件范围内的事务数据为空", "获取当前用户条件范围内的事务数据", "成功", result);
} else {
result = PubUtils.assignmentResultLog(indexPojo, 200, "获取当前用户条件范围内的事务数据成功", "获取当前用户条件范围内的事务数据", "成功", result);
}
} catch (Exception e) {
logger.error("获取当前用户条件范围内的事务数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "获取当前用户条件范围内的事务数据异常", "获取当前用户条件范围内的事务数据", "失败", result);
}
return result;
}
/**
* 根据主表索引获取出各监测点越限的详细数据
*
* @param supIndex 事务索引
*/
@PostMapping("getMonitorDetailData")
@ResponseBody
public HttpResult getTransactionData(String supIndex, HttpServletRequest request) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
TransactionData transactionData;
try {
transactionData = overRunLogService.getMonitorDetailData(supIndex);
if (null == transactionData) {
result = PubUtils.assignmentResultLog(null, 500, "获取出各监测点越限的详细数据为空", "获取出各监测点越限的详细数据", "成功", result);
} else {
result = PubUtils.assignmentResultLog(transactionData, 200, "获取出各监测点越限的详细数据成功", "获取出各监测点越限的详细数据", "成功", result);
}
} catch (Exception e) {
logger.error("获取出各监测点越限的详细数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "获取出各监测点越限的详细数据异常", "获取出各监测点越限的详细数据", "失败", result);
}
return result;
}
/**
* 用户点击开始执行事务
*
* @param supIndex 事务索引
*/
@PostMapping("startDealTransaction")
@ResponseBody
public HttpResult startDealTransaction(String supIndex, HttpServletRequest request) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
try {
superviseService.startDealTransaction(supIndex);
result = PubUtils.assignmentResultLog(null, 200, "用户点击开始执行事务成功", "用户点击开始执行事务", "成功", result);
socketSender.sendSocketMsg("执行"+supIndex+"事务");
} catch (Exception e) {
logger.error("用户点击开始执行事务异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "用户点击开始执行事务异常", "用户点击开始执行事务", "失败", result);
}
return result;
}
/**
* 根据事务索引校验后台的事务索引和报告文档是否存在
*
* @param supIndex 事务索引
*/
@PostMapping("checkTransaction")
@ResponseBody
public HttpResult checkTransaction(String supIndex, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
//先判断事务是否存在
Supervise supervise;
try {
supervise = superviseService.isExist(supIndex);
if (null == supervise) {
result = PubUtils.assignmentResultLog(null, 500, "当前事务数据丢失", "预/告警单下载", "成功", result);
} else {
//再开始判断当前功能需求的模板文档是否存在
Integer type = supervise.getType();
InputStream ins;
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
String rtfPath = "";
if (type == 0) {
//去找预警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file/earlyWarn.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "预/告警单下载", "成功", result);
} else {
ins.close();
path = path + "/njcn/transaction/earlyWarn/" + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file/earlyWarn.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
} else {
//去找告警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file/alarm.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "预/告警单下载", "成功", result);
} else {
ins.close();
path = path + "/njcn/transaction/alarm/" + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file/alarm.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
}
//获取所有的监测点越限信息
List<OverRunLogDetail> overRunLogList = overRunLogMapper.getMonitorDetailData(supIndex);
if (CollectionUtils.isEmpty(overRunLogList)) {
//该事物没有监测点预警或者告警信息
result = PubUtils.assignmentResultLog(null, 500, "该事件没有监测点详细越限数据", "预/告警单下载", "成功", result);
} else {
List<Map<String, Object>> totalData = new ArrayList<>();
for (OverRunLogDetail overRunLogDetail : overRunLogList) {
Map<String, Object> reportmap = new HashMap<>();
reportmap.put("date", PubUtils.date2String(overRunLogDetail.getOverRunLog().getUpdateTime(), "yyyy年MM月dd日"));
reportmap.put("gdName", overRunLogDetail.getGdName());
reportmap.put("deptsName", overRunLogDetail.getDeptsName());
reportmap.put("mark", overRunLogDetail.getOverRunLog().getOverRunDescribe());
reportmap.put("fileName", overRunLogDetail.getOverRunLog().getName() + ".docx");
totalData.add(reportmap);
}
//收集完信息,开始一个个的保存到对应的文件夹中,每个文件名:监测点名+年月日
WordUtil2 oRTF = new WordUtil2();
try {
oRTF.getWordWarn(rtfPath, totalData, path, response, session);
} catch (Exception e) {
logger.error("产生了异常,异常是"+e.getMessage());
}
result = PubUtils.assignmentResultLog(null, 200, "可以后台下载", "预/告警单下载", "成功", result);
//更新当前记录的各个状态,主表的流程+1监测点谐波详细表的文件路径
superviseService.finishEarlyWarn(supervise);
}
}
} catch (Exception e) {
logger.error("获取出各监测点越限的详细数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "下载异常", "预/告警单下载", "失败", result);
}
return result;
}
/**
* 下载预警、告警单
* 找到指定文件夹,直接压缩下载
*
* @param supIndex 事务索引
*/
@RequestMapping("downTransactionWord")
public void downTransactionWord(HttpServletRequest request, HttpServletResponse response, String supIndex) throws IOException {
socketSender.sendSocketMsg("下发"+supIndex+"事务单");
Supervise supervise;
supervise = superviseService.isExist(supIndex);
Integer type = supervise.getType();
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
String zipName;
if (type == 0) {
path = path + "/njcn/transaction/earlyWarn/" + supervise.getName();
zipName = supervise.getName() + "预警单";
} else {
path = path + "/njcn/transaction/alarm/" + supervise.getName();
zipName = supervise.getName() + "告警单";
}
response.setContentType("APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition", "attachment; filename=" + encodeFileName(request, zipName) + ".zip");
ZipOutputStream out = new ZipOutputStream(response.getOutputStream());
try {
ZipUtils.doCompress(path, out);
response.flushBuffer();
} catch (Exception e) {
logger.error("下载预警单");
} finally {
out.close();
}
}
/**
* 根据事务索引校验后台的报告文档是否存在
*
* @param supIndex 事务索引
*/
@PostMapping("checkTransactionNotice")
@ResponseBody
public HttpResult checkTransactionNotice(String supIndex, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
HttpResult result = PubUtils.initResult(TokenManager.getToken().getLoginName(), request, LogTypeEnum.BUSSINESS.toString(), 0);
//先判断事务是否存在
Supervise supervise;
try {
supervise = superviseService.isExist(supIndex);
if (null == supervise) {
result = PubUtils.assignmentResultLog(null, 500, "当前事务数据丢失", "整改通知单下载", "成功", result);
} else {
//再开始判断当前功能需求的模板文档是否存在
Integer type = supervise.getType();
InputStream ins;
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
String rtfPath = "";
//去找预警模板
ins = TransactionController.class.getClassLoader().getResourceAsStream("file/notice.docx");
if (null == ins) {
result = PubUtils.assignmentResultLog(null, 500, "模板丢失", "整改通知单下载", "成功", result);
} else {
ins.close();
path = path + "/njcn/transaction/notice/" + supervise.getName();
rtfPath = getClass().getClassLoader().getResource("file/notice.docx").getPath();
rtfPath = rtfPath.replaceAll("%20", " ");
}
//获取所有的监测点越限信息
List<OverRunLogDetail> overRunLogList = overRunLogMapper.getMonitorDetailData(supIndex);
if (CollectionUtils.isEmpty(overRunLogList)) {
//该事物没有监测点预警或者告警信息
result = PubUtils.assignmentResultLog(null, 500, "该事件没有监测点详细越限数据", "整改通知单下载", "成功", result);
} else {
List<Map<String, Object>> totalData = new ArrayList<>();
for (OverRunLogDetail overRunLogDetail : overRunLogList) {
Map<String, Object> reportmap = new HashMap<>();
reportmap.put("date", PubUtils.date2String(overRunLogDetail.getOverRunLog().getUpdateTime(), "yyyy年MM月dd日"));
reportmap.put("gdName", overRunLogDetail.getGdName());
reportmap.put("deptsName", overRunLogDetail.getDeptsName());
reportmap.put("mark", overRunLogDetail.getOverRunLog().getOverRunDescribe());
reportmap.put("fileName", overRunLogDetail.getOverRunLog().getName()+ ".docx");
totalData.add(reportmap);
}
//收集完信息,开始一个个的保存到对应的文件夹中,每个文件名:监测点名+年月日
WordUtil2 oRTF = new WordUtil2();
try {
oRTF.getWordWarn(rtfPath, totalData, path, response, session);
} catch (Exception e) {
logger.error("产生了异常,异常是"+e.getMessage());
}
result = PubUtils.assignmentResultLog(null, 200, "可以后台下载", "整改通知单下载", "成功", result);
//更新当前记录的各个状态,主表的流程+1监测点谐波详细表的文件路径
superviseService.finishEarlyNotice(supervise);
}
}
} catch (Exception e) {
logger.error("获取出各监测点越限的详细数据异常,异常为:" + e.toString());
result = PubUtils.assignmentResultLog(null, 500, "下载异常", "整改通知单下载", "失败", result);
}
return result;
}
/**
* 下载整改通知单
* 找到指定文件夹,直接压缩下载
*
* @param supIndex 事务索引
*/
@RequestMapping("downTransactionWordNotice")
public void downTransactionWordNotice(HttpServletRequest request, HttpServletResponse response, String supIndex) throws IOException {
socketSender.sendSocketMsg("下发"+supIndex+"通知单");
Supervise supervise;
supervise = superviseService.isExist(supIndex);
response.setContentType("APPLICATION/OCTET-STREAM");
String zipName = supervise.getName() + "整改通知单";
response.setHeader("Content-Disposition", "attachment; filename=" + encodeFileName(request, zipName) + ".zip");
ZipOutputStream out = new ZipOutputStream(response.getOutputStream());
try {
//判断有文件后,进行文档准备,保存进指定文件夹,待会提供下载
String path = appConfig.getTmppath();
path = path + "/njcn/transaction/notice/" + supervise.getName();
ZipUtils.doCompress(path, out);
response.flushBuffer();
} catch (Exception e) {
logger.error("产生了异常,异常是"+e.getMessage());
} finally {
out.close();
}
}
/**
* 下载文件名中含有中文的处理
*/
public static String encodeFileName(HttpServletRequest req, String headName)
throws UnsupportedEncodingException {
String filename = "";//IE9之前包括IE9都包含MSIE;IE10之后都包含Trident;edge浏览器包含Edge
String userAgent = req.getHeader("User-Agent");
if (userAgent.contains("MSIE") || userAgent.contains("Trident") || userAgent.contains("Edge")) {
if (filename.length() > 150) {//解决IE 6.0 bug
filename = new String(headName.getBytes("UTF-8"), "ISO-8859-1");
} else {
filename = URLEncoder.encode(headName, "UTF-8");
}
} else {
filename = new String(headName.getBytes("UTF-8"), "ISO8859-1");
}
return filename;
}
}

View File

@@ -0,0 +1,93 @@
package com.pqs9300.controller.uploadFiles;
import com.pqs9300.service.uploadFiles.UploadFilesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;
/**
* @Author: xuyang
* @Description:
*/
@Controller
@RequestMapping("uploadFile")
public class UploadFilesController extends HttpServlet {
@Autowired
private UploadFilesService uploadFilesService;
@RequestMapping(value = "upload")
public String vdWaveform(HttpServletRequest request, HttpSession session) {
return "business/transaction/indexNextStep";
}
/**
* @Author: xuyang
* @Date: 2020/7/6 9:58
* @Description: 首页上传按钮发送的请求
*/
@RequestMapping(value = "oneFileUpload")
@ResponseBody
public Map<String,Object> oneFileUpload(@RequestParam(required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, String lineIndex, Integer stepCount, String updateTime){
return uploadFilesService.fileInformation(file, request, response, supIndex, lineIndex, stepCount,updateTime);
}
/**
* 单文件上传文件名确认修改
* @param file
* @param request
* @param response
* @param supIndex
* @param lineIndex
* @param stepCount
* @param updateTime
* @return
*/
@RequestMapping(value = "fileUploadCommit")
@ResponseBody
public Map<String,Object> FileUploadCommit(@RequestParam(required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, String lineIndex, Integer stepCount, String updateTime){
return uploadFilesService.fileCommit(file, request, response, supIndex, lineIndex, stepCount,updateTime);
}
/**
* 跳转多文件上传界面
* @param supIndex
* @param stepCount
* @return
*/
@RequestMapping(value = "uploadMoreFiles")
public ModelAndView uploadMoreFiles(String supIndex, Integer stepCount) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("supIndex", supIndex);
modelAndView.addObject("stepCount", stepCount);
modelAndView.setViewName("business/upload/uploadMoreFiles");
return modelAndView;
}
/**
* 多文件上传
* @param file
* @param request
* @param response
* @param supIndex
* @param stepCount
* @return
*/
@RequestMapping(value = "uploadMoreFile")
@ResponseBody
public Map<String,Object> uploadMoreFile(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, Integer stepCount) {
return uploadFilesService.uploadFiles(file, request, response, supIndex, stepCount);
}
}

View File

@@ -0,0 +1,386 @@
package com.pqs9300.controller.user;
import com.njcn.enums.CookieKeyEnum;
import com.njcn.enums.LogTypeEnum;
import com.njcn.enums.ProjectEnum;
import com.njcn.mapper.user.UserMapper;
import com.njcn.pojo.commons.HttpResult;
import com.njcn.pojo.commons.RedisDB;
import com.njcn.service.log.UserLogDetailService;
import com.njcn.service.log.UserLoginService;
import com.njcn.service.user.UserService;
import com.njcn.shiro.filter.KickoutSessionFilter;
import com.njcn.shiro.session.UserShiroSessionRepository;
import com.njcn.shiro.session.impl.JedisShiroSessionRepository;
import com.njcn.shiro.token.TokenManager;
import com.njcn.sso.pojo.user.User;
import com.njcn.utils.*;
import com.njcn.utils.redis.JedisManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.SimplePrincipalCollection;
import org.apache.shiro.subject.support.DefaultSubjectContext;
import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.*;
/**
* 管理用户的登录、增删改查、验证码获取等。
*/
@Controller
@RequestMapping("user")
public class UserController {
@Resource
UserUtil userUtil;
@Resource
UserLoginService userLoginService;
@Resource
private AppConfig appConfig;
@Resource
private UserShiroSessionRepository userShiroSessionRepository;
@Autowired
JedisManager jedisManager;
@Autowired
UserMapper um;
@Autowired
private UserService us;
@Autowired
UserLogDetailService userLogservice;
@Autowired
private UserMapper userMapper;
// 日志记录
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
@PostMapping("clear")
@ResponseBody
public String clear(){
TokenManager.clearNowUserAuth();
return "";
}
/**
* 用户注销统一重定向到sso中心在sso中心查询该用户所有对应的sessionID进行缓存清理以达到子系统全部注销
*/
@GetMapping("loginout")
public void loginOut(HttpServletRequest request, HttpServletResponse response) throws IOException {
boolean flag = appConfig.isOneContainer();
String url;
if (flag) {
String baseUrl = request.getRequestURL().toString();
url = baseUrl.substring(0, baseUrl.indexOf(ProjectEnum.PQS9300.getItem())) + ProjectEnum.PQS9300.getLoginOut();
} else {
url = appConfig.getSsoUrl() + "/loginout?item=pqs9300";
}
WebUtils.issueRedirect(request, response, url);
}
/**
* sso认证完成后访问子系统任然需要注册子系统包括当前用户在子系统下的权限
*/
@GetMapping("ssoRegister")
public void ssoRegister(HttpServletRequest request, HttpServletResponse response,String token) throws IOException {
//获取父容器的sessionID即token值
if (StringUtils.isBlank(token)) {
redirectSso(request, response);
} else {
//首先根据token去redis中查询有没有对应的session
Session session = userShiroSessionRepository.getSession(token);
//没有需要的共享会话,则重定向回登录中心
if (null == session) {
redirectSso(request, response);
} else {
//判断认证中心的会话是否被T被T子系统是不允许注册的返回认证中心登录页面
Boolean marker = (Boolean) session.getAttribute(KickoutSessionFilter.KICKOUT_STATUS);
if (null != marker && marker) {
redirectSso(request, response);
}
//获取session登录信息。
Object obj = session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
if (null == obj) {
//没有用户信息,则重定向回登录中心
redirectSso(request, response);
} else {
SimplePrincipalCollection spc = (SimplePrincipalCollection) obj;
obj = spc.getPrimaryPrincipal();
if (null == obj) {
//没有用户信息,则重定向回登录中心
redirectSso(request, response);
} else {
User ssoUser = (User) obj;
try {
TokenManager.login(ssoUser.getLoginName(),"",ssoUser.getPassword(),PubUtils.getIpAddr(request),ProjectEnum.PQS9300.getItem());
try {
userLoginService.insertLogin(ssoUser.getLoginName(), ProjectEnum.PQS9300.getItem());
} catch (Exception e) {
logger.error("用户登录成功后,保存记录出错。原因:" + e.toString());
}
saveSessionByUser(session,token, TokenManager.getUserId(), TokenManager.getSession().getId().toString());
userShiroSessionRepository.activeSession(session);
TokenManager.getSession().setAttribute(CookieKeyEnum.SSOLOGIN.getCookieKey(), token);
userUtil.saveRandomToken();
//认证成功重定向到业务主界面
WebUtils.issueRedirect(request, response, "/business/doBusiness");
} catch (Exception u) {
logger.error("子系统pqs9300注册时异常异常为" + response.toString());
}
}
}
}
}
}
/**
* 重定向到sso认证中心重新登录
*/
private void redirectSso(HttpServletRequest request, HttpServletResponse response) throws IOException {
boolean flag = appConfig.isOneContainer();
String url;
if (flag) {
String baseUrl = request.getRequestURL().toString();
url = baseUrl.substring(0, baseUrl.indexOf(ProjectEnum.PQS9300.getItem())) +ProjectEnum.SSO.getLoginUrl()+ProjectEnum.PQS9300.getItem() ;
} else {
url = appConfig.getSsoJudge();
}
WebUtils.issueRedirect(request, response, url);
}
/**
* 根据用户索引保存当前系统的sessionID以便注销系统时删除会话信息
*
* @param token 认证中心会话索引
* @param userId 用户索引
* @param sessionId 会话ID
*/
private void saveSessionByUser(Session session,String token, String userId, String sessionId) {
String key=token+userId;
List<String> infoMap= (List<String>) session.getAttribute(key);
//如果不存在,创建一个新的
infoMap = null == infoMap ? new ArrayList<>() : infoMap;
infoMap.add(JedisShiroSessionRepository.REDIS_SHIRO_SESSION + sessionId);
session.setAttribute(key,infoMap);
}
/**
* 用户没有权限提示的页面
*/
@GetMapping(value = "unauthorized")
public String unauthorized() {
return "auth/unauthorized";
}
/**
* 根据用户索引获取用户信息回显,以便修改
*
* @param userIndex 用户索引
*/
@ResponseBody
@PostMapping(value = "selectId")
public User selectId(String userIndex, int flag) {
return us.selectId(userIndex, flag);
}
/************************
* RSA
* 根据用户名生成秘钥对
* @param username 用户名
*************************/
@PostMapping("generateRSAKey")
@ResponseBody
public HttpResult generateRSAKey(String username, HttpServletRequest request) {
HttpResult result;
try {
username = DesUtils.aesDecrypt(username);
// 获取公钥和私钥
HashMap<String, Object> keys = RSAUtils.getKeys();
RSAPublicKey publicKey = (RSAPublicKey) keys.get("public");
RSAPrivateKey privateKey = (RSAPrivateKey) keys.get("private");
String ip = StringUtils.isBlank(PubUtils.getIpAddr(request)) ? "127.0.0.1" : PubUtils.getIpAddr(request);
//秘钥先删除再添加
jedisManager.deleteByKey(RedisDB.SHORT_TIME_QUERY, SerializeUtil.serialize(username + ip));
// 保存私钥到 redis也可以保存到数据库
jedisManager.saveValueByKey(RedisDB.SHORT_TIME_QUERY, SerializeUtil.serialize(username + ip), SerializeUtil.serialize(privateKey), -1);
// 将公钥传到前端
Map<String, String> map = new HashMap<String, String>();
// 注意返回modulus和exponent以16为基数的BigInteger的字符串表示形式
map.put("modulus", publicKey.getModulus().toString(16));
map.put("exponent", publicKey.getPublicExponent().toString(16));
result = PubUtils.assignmentResult(map, 200, "生成秘钥对成功!");
} catch (Exception u) {
result = PubUtils.assignmentResult(null, 500, u.getMessage());
}
return result;
}
/************************
* SM2
* 根据用户名生成秘钥对
* @param username 用户名
*************************/
@PostMapping("generateSM2Key")
@ResponseBody
public HttpResult generateSM2Key(String username, HttpServletRequest request) {
HttpResult result;
try {
if (PubUtils.isBlank(username)) {
result = PubUtils.assignmentResult(null, 500, "用户名非法!");
return result;
}
username = DesUtils.aesDecrypt(username);
// 获取公钥和私钥
Map<String, String> keyMap =PubUtils.getSM2CipHer();
String publicKey = keyMap.get("publicKey"); //加密密钥
String privateKey = keyMap.get("privateKey"); //解密密钥
String ip = PubUtils.isBlank(PubUtils.getIpAddr(request)) ? "127.0.0.1" : PubUtils.getIpAddr(request);
//秘钥先删除再添加
jedisManager.deleteByKey(RedisDB.SHORT_TIME_QUERY, SerializeUtil.serialize(username + ip));
// 保存私钥到 redis也可以保存到数据库
jedisManager.saveValueByKey(RedisDB.SHORT_TIME_QUERY, SerializeUtil.serialize(username + ip), SerializeUtil.serialize(privateKey), -1);
// 将公钥传到前端
result = PubUtils.assignmentResult(publicKey, 200, "生成秘钥对成功!");
} catch (Exception u) {
result = PubUtils.assignmentResult(null, 500, u.getMessage());
}
return result;
}
/**
* 确认密码
*/
@PostMapping(value = "confirmPwd")
@ResponseBody
public HttpResult confirmPwd(String password, HttpServletRequest request,HttpServletResponse response) {
String ip = PubUtils.getIpAddr(request);
String username = TokenManager.getToken().getLoginName();
password = XssFilterUtil.dealString(password);
HttpResult result=PubUtils.initResult(TokenManager.getToken().getLoginName(),request, LogTypeEnum.SYSTEM.toString(),2);
try {
//密码处理
String privateKey = jedisManager.getValueByKey(RedisDB.SHORT_TIME_QUERY, username + ip);
//秘钥用完即删
jedisManager.deleteByKey(RedisDB.SHORT_TIME_QUERY, username + ip);
//对SM2解密面进行验证
password = PubUtils.getPasswordSM2Verify(privateKey, password);
if (password == null && password.length() == 0) {
return PubUtils.assignmentResultLog(null, 500, "密码传输完整性被破坏","密码确认","失败",result);
}
us.judgeUsernameAndPwd(username, password);
response.setStatus(203);
result = PubUtils.assignmentResultLog(null, 200, "密码正确","密码确认","成功",result);
} catch (Exception e) {
if(e.getMessage().length()>12){
result = PubUtils.assignmentResultLog(null, 500, "密码确认异常","密码确认","失败",result);
}else{
result = PubUtils.assignmentResultLog(null, 500, e.getMessage(),"密码确认","失败",result);
}
}
return result;
}
//修改密码
@ResponseBody
@RequestMapping(value = "updatePassword", method = RequestMethod.POST)
public HttpResult updatePassword(HttpServletRequest request, @Param(value = "username") String username,
@Param(value = "passwordX") String passwordX,
String token) {
HttpResult result = new HttpResult();
// String sessionToken = (String) TokenManager.getSession().getAttribute("token");
// if (!token.equalsIgnoreCase(sessionToken)) {
// result = PubUtils.assignmentResult(null, 500, "非法访问");
// return result;
// }
//username = XssFilterUtil.dealString(username);
username = DesUtils.aesDecrypt(username);
passwordX = XssFilterUtil.dealString(passwordX);
String ip = StringUtils.isBlank(PubUtils.getIpAddr(request)) ? "127.0.0.1" : PubUtils.getIpAddr(request);
try {
//密码处理
String privateKey = jedisManager.getValueByKey(RedisDB.SHORT_TIME_QUERY, username + ip);
//秘钥用完即删
jedisManager.deleteByKey(RedisDB.SHORT_TIME_QUERY, username + ip);
//对SM2解密面进行验证
passwordX = PubUtils.getPasswordSM2Verify(privateKey, passwordX);
if (passwordX == null && passwordX.length() == 0) {
result = PubUtils.assignmentResult(null, 500, "密码传输完整性被破坏");
userLogservice.getLog("修改用户密码", "失败", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
return result;
}
//增加判断密码是否包含用户名
if (passwordX.indexOf(username) > -1) {
userLogservice.getLog("修改用户密码", "失败", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
return PubUtils.assignmentResult(null, 500, "用户密码包含登录名");
}
if (!(PubUtils.patternPassword(passwordX) || PubUtils.patternUsername(username))) {
userLogservice.getLog("修改用户密码", "失败", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
result = PubUtils.assignmentResult(null, 500, "用户名、密码格式不正确");
return result;
}
try {
us.modifyPassword(username, passwordX);
userLogservice.getLog("修改用户密码", "成功", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
result = PubUtils.assignmentResult(null, 200, "修改密码成功");
User user = new User();
user.setLoginName(username);
user = um.selectOne(user);
if (null != user) {
user.setState(1);
um.updateByPrimaryKeyBySql(user);
}
} catch (Exception e) {
userLogservice.getLog("修改用户密码", "失败", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
result = PubUtils.assignmentResult(null, 500, e.getMessage());
logger.error("用户修改密码成功后,保存记录出错。原因:" + e.toString());
}
} catch (Exception e) {
logger.error("更新密码出错,异常为:" + e.toString());
String eMessage = e.getMessage();
if (eMessage.length() > 20) {
eMessage = "内部出错";
}
result = PubUtils.assignmentResult(null, 500, eMessage);
try {
userLogservice.getLog("修改用户密码", "失败", PubUtils.getIpAddr(request), LogTypeEnum.SYSTEM.toString(), 1);
} catch (Exception u) {
logger.error("用户修改密码失败后,保存记录出错。原因:" + u.toString());
}
}
return result;
}
}

View File

@@ -0,0 +1,19 @@
package com.pqs9300.mapper.flowChart;
import org.apache.ibatis.annotations.Param;
/**
* @Author: xuyang
* @Description:
*/
public interface FlowChartMapper {
/**
* @Author: xuyang
* @Date: 2020/7/2 13:14
* @Description: 查找电压等级
*/
String getPowerLever(@Param(value = "flowChartSupIndex") String flowChartSupIndex);
Integer getProgress(@Param(value = "supIndex") String supIndex);
}

View File

@@ -0,0 +1,46 @@
package com.pqs9300.mapper.formdata;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.njcn.pojo.configuration.DicData;
import com.pqs9300.pojo.formdata.ConditionDataDto;
import com.pqs9300.pojo.formdata.FormData;
import com.pqs9300.pojo.formdata.LimitRateDto;
import com.pqs9300.pojo.transaction.OverRunLog;
public interface FormDataMapper {
List<FormData> getListDepts(@Param("sysType") String sysType); //获取有监测点配置的部门guid
List<FormData> getListDeptsByIndex(@Param("deptsIndex") List<String> deptsIndex); //获取部门guid
List<Long> getListLineByDepts(@Param("deptsIndex") String deptsIndex, @Param("sysType") String sysType, @Param("level") List<String> level);
List<LimitRateDto> getLimitRate(@Param("conditionData") ConditionDataDto conditionData);
List<String> getOptionList(@Param("list") List<String> list);
void insertSuperData(@Param("formData") FormData formData, @Param("type") Integer type);
void insertOverData(@Param("lineId") Integer lineId, @Param("supIndex") String supIndex, @Param("des") String des, @Param("time") Date time, @Param("times") Integer times, @Param("name") String name);
void deleteBySupIndex(@Param("supIndex") String supIndex);
List<String> getUserIndexByDeptsIndex(@Param("deptsIndex") String deptsIndex);
List<DicData> getLevel(@Param("name") String name);
List<OverRunLog> getExistLog(@Param("start") Date start,@Param("type") Integer type);
List<OverRunLog> getLogBySupIndex(@Param("supIndex") String supIndex);
/**
* 根据部门获取当前部门配置的所有监测点
*/
List<Long> getStrategyLineByDept(@Param("list")List<String> list,@Param("grade")Integer grade);
List<Long> getAlarmStrategyLineByDept(@Param("list")List<String> list,@Param("grade")Integer grade);
}

View File

@@ -0,0 +1,13 @@
package com.pqs9300.mapper.report;
import com.njcn.pojo.configuration.RptData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface ExcelReportMapper {
List<RptData> getDatasByPloy(@Param("guid") String guid);
List<RptData> getDatas(@Param("sets") Set<String> sets);
}

View File

@@ -0,0 +1,13 @@
package com.pqs9300.mapper.report;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GetDistortionDataMapper {
List<ReportValue> getDistortionData(@Param("condition") Condition condition, @Param("str") String str);
List<ReportValue> getHDistortionData(@Param("condition") Condition condition, @Param("str") String str);
}

View File

@@ -0,0 +1,18 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetFlickerDataMapper {
List<Map<String, Object>> getFlickerData(@Param("condition") Condition condition);
List<Map<String, Object>> getLFlickerData(@Param("condition") Condition condition);
List<Map<String, Object>> getLLFlickerData(@Param("condition") Condition condition);
List<Map<String, Object>> getPFlickerData(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,13 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetFpyMapper {
//flag标识查询方式
List<Map<String, Object>> getFpy(@Param("condition") Condition condition, @Param("list") List<Integer> list, @Param("flag") int flag);
}

View File

@@ -0,0 +1,14 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetFrequencyDataMapper {
List<Map<String, Object>> getFrequencyData(@Param("condition") Condition condition);
List<Map<String, Object>> getHFrequencyData(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,23 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetICurrentMapper {
List<Map<String, Object>> getICurrent(@Param("condition") Condition condition, @Param("listValue") List<Integer> list);
List<Map<String, Object>> getHICurrent(@Param("condition") Condition condition);
ReportValue VsideValue(@Param("condition") Condition condition);
ReportValue InsideValue(@Param("condition") Condition condition);
ReportValue PsideValue(@Param("condition") Condition condition);
ReportValue QsideValue(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetInICurrentMapper {
List<Map<String, Object>> getICurrent(@Param("condition") Condition condition, @Param("listValue") List<Integer> list);
}

View File

@@ -0,0 +1,15 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetInVoltageRateMapper {
List<Map<String, Object>> getInVoltageRate(@Param("condition") Condition condition, @Param("listValue") List<Integer> list);
List<ReportValue> getInFirstHarmonic(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.mapper.report;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetPowerDataMapper {
List<ReportValue> getPower(@Param("condition") Condition condition, @Param("str") String str);
}

View File

@@ -0,0 +1,14 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetThreephaseDataMapper {
List<Map<String, Object>> getThreephase(@Param("condition") Condition condition, @Param("str") String str);
List<Map<String, Object>> getHThreephase(@Param("condition") Condition condition, @Param("str") String str);
}

View File

@@ -0,0 +1,14 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
public interface GetVdeviationDataMapper {
List<Map<String, Object>> getVdeviationData(@Param("condition") Condition condition);
List<Map<String, Object>> getHVdeviationData(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,27 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
/**
* @Author: Sunwei 【sunW2016@163.com】
* @Description:
* @Date: Create in 10:46 2018/6/7
* @Modified By:
*/
public interface GetVirtualDataMapper {
Integer getTotalCP95(@Param("condition") Condition condition, @Param("tableName") String tableName);
Integer getTotalPltCP95(@Param("condition") Condition condition, @Param("tableName") String tableName);
Integer getTotalPstCP95(@Param("condition") Condition condition, @Param("tableName") String tableName);
List<ReportValue> getVirtualData(@Param("condition") Condition condition, @Param("tableName") String tableName);
Map<String, Object> getVVirtualData(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.mapper.report;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetVoltageMapper {
List<ReportValue> getVoltageData(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,17 @@
package com.pqs9300.mapper.report;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetVoltageRateMapper {
List<Map<String, Object>> getVoltageRate(@Param("condition") Condition condition, @Param("listValue") List<Integer> list);
List<ReportValue> getFirstHarmonic(@Param("condition") Condition condition);
List<Map<String, Object>> getHVoltageRate(@Param("condition") Condition condition);
}

View File

@@ -0,0 +1,4 @@
package com.pqs9300.mapper.strategy;
public interface AlarmImplWarning extends WarningStrategyMapper {
}

View File

@@ -0,0 +1,125 @@
package com.pqs9300.mapper.strategy;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import com.pqs9300.pojo.strategy.ThsAlarmAss;
import com.pqs9300.pojo.strategy.ThsAlarmFormAss;
import com.pqs9300.pojo.strategy.ThsAlarmDTO;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface AlarmStrategyMapper {
/*------------------操作ths_warnform表--------------------------*/
/**
* @Author chendaofei
* @Description 新增告警策略
* @Date 15:27 2020/6/17
**/
Integer addAlarm(ThsAlarmDTO thsAlarmDTO);
/**
* @Author chendaofei
* @Description 修改告警策略
* @Date 15:27 2020/6/17
**/
Integer updateAlarm(ThsAlarmDTO thsAlarmDTO);
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
Integer statusController(@Param("alarmIndex") String alarmIndex,@Param("state")Integer state);
/**
* @Author chendaofei
* @Description 修改告警策略指标类型与或
* @Date 15:27 2020/6/17
**/
Integer updateAlarmAndOr(@Param("alarmIndex") String alarmIndex, @Param("operation") Integer operation);
/**
* @Author chendaofei
* @Description 删除告警策略
* @Date 15:27 2020/6/17
**/
Integer delAlarm(@Param("alarmIndex") String alarmIndex);
/**
* @Author chendaofei
* @Description 获取告警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmDTO> getAlarmList(@Param("grade")Integer grade,@Param("alarmIndex") String alarmIndex,@Param("list") List<String> list);
/**
* @Author chendaofei
* @Description 通过id获取告警策略
* @Date 15:27 2020/6/17
**/
ThsAlarmDTO getAlarmById(@Param("alarmIndex") String alarmIndex);
/**
* @Author chendaofei
* @Description 判断策略名是否存在
* @Date 15:27 2020/6/17
**/
int isSameName(ThsAlarmDTO thsAlarmDTO);
/**
* @Author chendaofei
* @Description 获取数据字典里的指标类型数据
* @Date 15:27 2020/6/17
**/
List<DicStrategyRVO> getTartgetTypeForDic(@Param("type") String type);
/*------------------操作THS_WarnFormAss表--------------------------*/
/**
* @Author chendaofei
* @Description 新增告警策略关系表
* @Date 15:27 2020/6/17
**/
Integer addAlarmAss(@Param("list")List<ThsAlarmFormAss>list);
/**
* @Author chendaofei
* @Description 删除告警策略
* @Date 15:27 2020/6/17
**/
Integer delAlarmAss(String alarmIndex);
/**
* @Author chendaofei
* @Description 获取告警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmAss> getAlarmAss(@Param("alarmIndex") String alarmIndex, @Param("type") Integer type);
/**
* @Author chendaofei
* @Description 监测是否存在该监测点
* @Date 10:59 2020/6/23
**/
int isExitLine(@Param("list") List<ThsAlarmFormAss> list,@Param("grade")Integer grade,@Param("alarmIndex")String alarmIndex,@Param("type") int... type);
/**
* @Author chendaofei
* @Description 是否存在绑定事件
* @Date 10:59 2020/6/23
**/
int isExitBindEvent(@Param("alarmIndex") String alarmIndex);
}

View File

@@ -0,0 +1,132 @@
package com.pqs9300.mapper.strategy;
import com.pqs9300.pojo.strategy.ThsAlarmFormDTO;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import com.pqs9300.pojo.strategy.ThsAlarmFormAss;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface WarningStrategyMapper {
/*------------------操作ths_warnform表--------------------------*/
/**
* @Author chendaofei
* @Description 新增预警策略
* @Date 15:27 2020/6/17
**/
Integer addEarlyWarn(ThsAlarmFormDTO thsAlarmFormDTO);
/**
* @Author chendaofei
* @Description 修改预警策略
* @Date 15:27 2020/6/17
**/
Integer updateEarlyWarn(ThsAlarmFormDTO thsAlarmFormDTO);
/**
* @Author chendaofei
* @Description 修改预警策略指标类型与或
* @Date 15:27 2020/6/17
**/
Integer updateEarlyWarnAndOr(@Param("wfIndex") String wfIndex, @Param("operation") Integer operation);
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
Integer statusController(@Param("wfIndex") String wfIndex, @Param("state") Integer state);
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
Integer delEarlyWarn(@Param("wfIndex") String wfIndex);
/**
* @Author chendaofei
* @Description 获取预警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmFormDTO> getEarlyWarnList(@Param("grade")Integer grade,@Param("wfIndex")String wfIndex,@Param("list")List<String>list);
List<ThsAlarmFormDTO> getEarlyWarnListbyGrade(@Param("grade") Integer grade);
/**
* @Author chendaofei
* @Description 通过id获取预警策略
* @Date 15:27 2020/6/17
**/
ThsAlarmFormDTO getEarlyWarnById(@Param("wfIndex") String wfIndex);
/**
* @Author chendaofei
* @Description 判断策略名是否存在
* @Date 15:27 2020/6/17
**/
int isSameName(ThsAlarmFormDTO thsAlarmFormDTO);
/**
* @Author chendaofei
* @Description 获取数据字典里的指标类型数据
* @Date 15:27 2020/6/17
**/
List<DicStrategyRVO> getTartgetTypeForDic(@Param("type") String type);
/*------------------操作THS_WarnFormAss表--------------------------*/
/**
* @Author chendaofei
* @Description 新增预警策略关系表
* @Date 15:27 2020/6/17
**/
Integer addEarlyWarnAss(@Param("list") List<ThsAlarmFormAss> list);
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
Integer delEarlyWarnAss(@Param("wfIndex") String wfIndex);
/**
* @Author chendaofei
* @Description 获取预警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmFormAss> getEarlyWarnAss(@Param("wfIndex") String wfIndex, @Param("type") Integer type);
/**
* @Author chendaofei
* @Description 监测是否存在该监测点
* @Date 10:59 2020/6/23
**/
int isExitLine(@Param("list") List<ThsAlarmFormAss> list, @Param("grade") Integer grade, @Param("wfIndex") String wfIndex, @Param("type") int... type);
/**
* @Author chendaofei
* @Description 是否存在绑定事件
* @Date 10:59 2020/6/23
**/
int isExitBindEvent(@Param("wfIndex") String wfIndex);
List<ThsAlarmFormAss> getEarlyWarnAssBywfIndex(@Param("wfIndex") String wfIndex);
List<ThsAlarmFormAss> getEarlyWarnAssByGrade(@Param("grade") Integer grade);
}

View File

@@ -0,0 +1,19 @@
package com.pqs9300.mapper.technical;
import com.pqs9300.pojo.technical.TechnicalInfo;
import com.pqs9300.pojo.transaction.Supervise;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
public interface TechnicalInfoMapper extends Mapper<TechnicalInfo> {
//List<TechnicalInfo> getTechnicalInfo(@Param(value = "startTime") Date startTime, @Param(value = "endTime")Date endTime,@Param(value = "progress")List<Integer> progress,@Param(value = "supType")List<Integer> supType);
int getStartSwitch(@Param(value = "list") List<String> list);
List<TechnicalInfo> getTransactionDataByDepts(@Param("deptsIndexs")List<String> deptsIndexs, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")Integer type, @Param("progress")Integer progress);
List<TechnicalInfo> getTransactionDataByUserIndex(@Param("userIndex")String userIndex, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")Integer type, @Param("progress")Integer progress);
}

View File

@@ -0,0 +1,15 @@
package com.pqs9300.mapper.transaction;
import com.pqs9300.pojo.transaction.OverRunLog;
import com.pqs9300.pojo.transaction.OverRunLogDetail;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface OverRunLogMapper extends Mapper<OverRunLog> {
List<OverRunLogDetail> getMonitorDetailData(String subIndex);
}

View File

@@ -0,0 +1,17 @@
package com.pqs9300.mapper.transaction;
import com.pqs9300.pojo.transaction.Supervise;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
public interface SuperviseMapper extends Mapper<Supervise> {
List<Supervise> getTransactionDataByDepts(@Param("deptsIndexs")List<String> deptsIndexs, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")Integer type, @Param("progress")Integer progress);
List<Supervise> getTransactionDataByUserIndex(@Param("userIndex")String userIndex, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")Integer type, @Param("progress")Integer progress);
}

View File

@@ -0,0 +1,33 @@
package com.pqs9300.mapper.uploadFiles;
import com.pqs9300.pojo.transaction.OverRunLog;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* @Author: xuyang
* @Description:
*/
public interface UploadFilesMapper {
String getOverRunLogName(@Param("supIndex")String supIndex,@Param("lineIndex")String lineIndex,@Param("updateTime") Date updateTime);
Integer updateFeedbackUrl(@Param("filePath") String filePath, @Param("supIndex")String supIndex,@Param("lineIndex")String lineIndex, @Param("updateTime")Date updateTime);
Integer updateTestReportUrl(@Param("filePath")String filePath, @Param("supIndex")String supIndex,@Param("lineIndex")String lineIndex, @Param("updateTime")Date updateTime);
Integer updateReviseFeedbackUrl(@Param("filePath")String filePath, @Param("supIndex")String supIndex,@Param("lineIndex")String lineIndex, @Param("updateTime")Date updateTime);
//返回当前监督需要上传文件所有名字
List<String> getAllFileName(@Param("supIndex")String supIndex,@Param("stepCount")Integer stepCount);
//获取附表文件上传路径,判断是否需要改变文件状态
List<OverRunLog> getOverRunLog(@Param("supIndex")String supIndex);
Integer updateFilesFeedbackUrl(@Param("filePath") String filePath, @Param("fileName") String fileName, @Param("supIndex")String supIndex);
Integer updateFilesTestReportUrl(@Param("filePath")String filePath, @Param("fileName") String fileName, @Param("supIndex")String supIndex);
Integer updateFilesReviseFeedbackUrl(@Param("filePath")String filePath, @Param("fileName") String fileName, @Param("supIndex")String supIndex);
Integer updateProgress(@Param("supIndex")String supIndex,@Param("progress")Integer progress );
Integer getSuperviseType(@Param("supIndex")String supIndex);
}

View File

@@ -0,0 +1,143 @@
package com.pqs9300.pojo.formdata;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ConditionDataDto {
private List<Long> listNotExitsLine; //需要剔除的监测点ID
private List<Long> listExitsLine; //绑定的监测点ID
private List<String> listExitLoadType; //绑定的干扰源类型
private List<String> listNotExitsLoadType; //需要剔除的干扰源类型
private Integer operation; //0-与 1-或
private List<String> listExitOption; // 需要绑定的指标类型
private List<String> listNotExitOption; //剔除的指标类型
private String condition; //指标类型
private Date startTime; //查询开始时间
private Date endTime; //查询结束时间
private String deptsIndex; //部门索引
private String deptStreateIndex;//创建策略部门索引
private String sysType; //系统类型
private String conditionResult; //查询结果
public String getConditionResult() {
return conditionResult;
}
public void setConditionResult(String conditionResult) {
this.conditionResult = conditionResult;
}
public String getDeptsIndex() {
return deptsIndex;
}
public void setDeptsIndex(String deptsIndex) {
this.deptsIndex = deptsIndex;
}
public String getSysType() {
return sysType;
}
public void setSysType(String sysType) {
this.sysType = sysType;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public ConditionDataDto() {
listExitsLine = new ArrayList<>();
listExitLoadType = new ArrayList<>();
listNotExitsLine = new ArrayList<>();
listNotExitsLoadType = new ArrayList<>();
listExitOption = new ArrayList<>();
listNotExitOption = new ArrayList<>();
}
public Integer getOperation() {
return operation;
}
public void setOperation(Integer operation) {
this.operation = operation;
}
public List<String> getListExitOption() {
return listExitOption;
}
public void setListExitOption(List<String> listExitOption) {
this.listExitOption = listExitOption;
}
public List<String> getListNotExitOption() {
return listNotExitOption;
}
public void setListNotExitOption(List<String> listNotExitOption) {
this.listNotExitOption = listNotExitOption;
}
public List<Long> getListNotExitsLine() {
return listNotExitsLine;
}
public void setListNotExitsLine(List<Long> listNotExitsLine) {
this.listNotExitsLine = listNotExitsLine;
}
public List<Long> getListExitsLine() {
return listExitsLine;
}
public void setListExitsLine(List<Long> listExitsLine) {
this.listExitsLine = listExitsLine;
}
public List<String> getListExitLoadType() {
return listExitLoadType;
}
public void setListExitLoadType(List<String> listExitLoadType) {
this.listExitLoadType = listExitLoadType;
}
public List<String> getListNotExitsLoadType() {
return listNotExitsLoadType;
}
public void setListNotExitsLoadType(List<String> listNotExitsLoadType) {
this.listNotExitsLoadType = listNotExitsLoadType;
}
public String getDeptStreateIndex() {
return deptStreateIndex;
}
public void setDeptStreateIndex(String deptStreateIndex) {
this.deptStreateIndex = deptStreateIndex;
}
}

View File

@@ -0,0 +1,258 @@
package com.pqs9300.pojo.formdata;
import com.njcn.pojo.data.LimitRate;
import java.util.*;
public class FormData {
private Integer customDept; //是否自定义部门
private String deptsIndex; //部门guid
private String deptsName; //部门名称
private String supIndex; //技术监督guid
private String supName; //技术监督名称
private Map<Integer, Map<Date, resultPojo>> mapresultPojo;
private Date createTime; //创建时间
private String createUser;//创建用户
private Set<Date> setDate; //告警单使用
private Date eventDate;//预警/告警日期
public Integer getCustomDept() {
return customDept;
}
public void setCustomDept(Integer customDept) {
this.customDept = customDept;
}
public Set<Date> getSetDate() {
return setDate;
}
public void setSetDate(Set<Date> setDate) {
this.setDate = setDate;
}
public String getDeptsName() {
return deptsName;
}
public void setDeptsName(String deptsName) {
this.deptsName = deptsName;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getSupName() {
return supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public Map<Integer, Map<Date, resultPojo>> getMapresultPojo() {
return mapresultPojo;
}
public void setMapresultPojo(Map<Integer, Map<Date, resultPojo>> mapresultPojo) {
this.mapresultPojo = mapresultPojo;
}
public class resultPojo {
private LimitRate limitRate;
private StringBuilder description;
private String lineName;
private String bdName;
private String gdName;
private Integer count = 0;
private List<String> firstDes;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getFirstDes() {
return firstDes;
}
public void setFirstDes(List<String> firstDes) {
this.firstDes = firstDes;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public resultPojo() {
limitRate = new LimitRate();
description = new StringBuilder();
firstDes = new ArrayList<>();
}
public String getBdName() {
return bdName;
}
public void setBdName(String bdName) {
this.bdName = bdName;
}
public String getGdName() {
return gdName;
}
public void setGdName(String gdName) {
this.gdName = gdName;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public LimitRate getLimitRate() {
return limitRate;
}
public void setLimitRate(LimitRate limitRate) {
this.limitRate = limitRate;
}
public StringBuilder getDescription() {
return description;
}
public void setDescription(StringBuilder description) {
this.description = description;
}
private void packAge(Integer times, String des) {
if (times != null && times > 0) {
this.count += times.intValue();
this.firstDes.add(des);
this.description.append(des + "越限" + times + "次,");
}
}
}
public FormData() {
mapresultPojo = new HashMap<>();
setDate = new HashSet<>();
}
public String getDeptsIndex() {
return deptsIndex;
}
public void setDeptsIndex(String deptsIndex) {
this.deptsIndex = deptsIndex;
}
public String getSupIndex() {
return supIndex;
}
public void setSupIndex(String supIndex) {
this.supIndex = supIndex;
}
public Date getEventDate() {
return eventDate;
}
public void setEventDate(Date eventDate) {
this.eventDate = eventDate;
}
public void setValue() {
Iterator<Map.Entry<Integer, Map<Date, resultPojo>>> iterator = mapresultPojo.entrySet().iterator();
while (iterator.hasNext()) {
Iterator<Map.Entry<Date, resultPojo>> iterator1 = iterator.next().getValue().entrySet().iterator();
while (iterator1.hasNext()) {
resultPojo resultPojo = iterator1.next().getValue();
resultPojo.packAge(resultPojo.getLimitRate().getFreqDevOverTime(), "频率偏差");
resultPojo.packAge(resultPojo.getLimitRate().getVoltageDevOvertime(), "电压偏差");
resultPojo.packAge(resultPojo.getLimitRate().getUBalanceOverTime(), "电压不平衡");
resultPojo.packAge(resultPojo.getLimitRate().getFlickerOverTime(), "闪变");
resultPojo.packAge(resultPojo.getLimitRate().getUAberranceOverTime(), "电压谐波畸变率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm2OverTime(), "2次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm3OverTime(), "3次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm4OverTime(), "4次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm5OverTime(), "5次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm6OverTime(), "6次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm7OverTime(), "7次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm8OverTime(), "8次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm9OverTime(), "9次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm10OverTime(), "10次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm11OverTime(), "11次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm12OverTime(), "12次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm13OverTime(), "13次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm14OverTime(), "14次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm15OverTime(), "15次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm16OverTime(), "16次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm17OverTime(), "17次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm18OverTime(), "18次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm19OverTime(), "19次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm20OverTime(), "20次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm21OverTime(), "21次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm22OverTime(), "22次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm23OverTime(), "23次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm24OverTime(), "24次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getUHarm25OverTime(), "25次电压谐波含有率");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm2OverTime(), "2次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm3OverTime(), "3次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm4OverTime(), "4次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm5OverTime(), "5次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm6OverTime(), "6次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm7OverTime(), "7次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm8OverTime(), "8次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm9OverTime(), "9次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm10OverTime(), "10次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm11OverTime(), "11次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm12OverTime(), "12次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm13OverTime(), "13次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm14OverTime(), "14次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm15OverTime(), "15次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm16OverTime(), "16次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm17OverTime(), "17次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm18OverTime(), "18次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm19OverTime(), "19次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm20OverTime(), "20次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm21OverTime(), "21次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm22OverTime(), "22次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm23OverTime(), "23次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm24OverTime(), "24次电流谐波幅值");
resultPojo.packAge(resultPojo.getLimitRate().getIHarm25OverTime(), "25次电流谐波幅值");
resultPojo.getDescription().delete(resultPojo.getDescription().lastIndexOf(","), resultPojo.getDescription().length());
}
}
}
}

View File

@@ -0,0 +1,62 @@
package com.pqs9300.pojo.formdata;
import com.njcn.pojo.data.LimitRate;
import java.util.Date;
public class LimitRateDto {
private LimitRate limitRate;
private String lineName;
private Integer lineIndex;
private String bdName;
private String gdName;
private Date times;
public String getBdName() {
return bdName;
}
public void setBdName(String bdName) {
this.bdName = bdName;
}
public Integer getLineIndex() {
return lineIndex;
}
public void setLineIndex(Integer lineIndex) {
this.lineIndex = lineIndex;
}
public LimitRate getLimitRate() {
return limitRate;
}
public void setLimitRate(LimitRate limitRate) {
this.limitRate = limitRate;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getGdName() {
return gdName;
}
public void setGdName(String gdName) {
this.gdName = gdName;
}
public Date getTimes() {
return times;
}
public void setTimes(Date times) {
this.times = times;
}
}

View File

@@ -0,0 +1,131 @@
package com.pqs9300.pojo.report;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.njcn.utils.AppConfig;
import com.pqs9300.util.TransformTime;
public class Condition implements Serializable {
private Date start; //查询开始时间
private Date end; //查询结束时间
private List<TransformTime> exceptTime; //查询排除时间
private Integer pointIndex; //监测点ID
private Double count; //CP95使用
private Double pltCount; //pltCP95使用
private Double pstCount; //pstCP95使用
private Boolean b; //判断时间是否超过7天 >7返回false 大于7天查day表小于7天查总表
private AppConfig appConfig;
private String mode; //接线方式
private Integer times;//谐波次数
public AppConfig getAppConfig() {
return appConfig;
}
public void setAppConfig(AppConfig appConfig) {
this.appConfig = appConfig;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public Condition(AppConfig appConfig) {
super();
exceptTime = new ArrayList<>();
this.appConfig = appConfig;
}
public Condition() {
super();
exceptTime = new ArrayList<>();
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
}
public Integer getPointIndex() {
return pointIndex;
}
public void setPointIndex(Integer pointIndex) {
this.pointIndex = pointIndex;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public Date getEnd() {
return end;
}
public void setEnd(Date end) {
this.end = end;
}
public List<TransformTime> getExceptTime() {
return exceptTime;
}
public void setExceptTime(List<TransformTime> exceptTime) {
this.exceptTime = exceptTime;
}
public Boolean getB() {
return b;
}
public Double getPltCount() {
return pltCount;
}
public void setPltCount(Double pltCount) {
this.pltCount = pltCount;
}
public void setB(Boolean b) {
this.b = b;
}
public Double getPstCount() {
return pstCount;
}
public void setPstCount(Double pstCount) {
this.pstCount = pstCount;
}
public void setB() {
/*int days = (int) ((this.end.getTime() - this.start.getTime()) / (1000 * 3600 * 24));
this.b = (days > 7) ? new Boolean(false) : new Boolean(true);*/
//this.b = false;
int day = appConfig.getReportday();
int days = (int) ((this.end.getTime() - this.start.getTime()) / (1000 * 3600 * 24));
this.b = (days > day) ? new Boolean(false) : new Boolean(true);
}
}

View File

@@ -0,0 +1,83 @@
package com.pqs9300.pojo.report;
import java.io.Serializable;
import java.util.List;
import com.pqs9300.pojo.report.enumReport.EnumPass;
public class FpyDataByType implements Serializable {
private static final long serialVersionUID = -1071056270808019733L;
private EnumPass enumPass;
private List<FpyRate> listA; //A相
private List<FpyRate> listB; //B相
private List<FpyRate> listC; //C相
private List<FpyRate> listS; //总的合格率
private List<FpyRate> listT; //没有三相的合格率
private Integer fpy; //限值
public FpyDataByType(EnumPass enumPass) {//初始化
this.enumPass = enumPass;
this.listA = null;
this.listB = null;
this.listC = null;
this.listS = null;
this.listT = null;
this.fpy = EnumPass.FPYVALUE.getCode();
}
public Integer getFpy() {
return fpy;
}
public void setFpy(Integer fpy) {
this.fpy = fpy;
}
public EnumPass getEnumPass() {
return enumPass;
}
public void setEnumPass(EnumPass enumPass) {
this.enumPass = enumPass;
}
public List<FpyRate> getListA() {
return listA;
}
public void setListA(List<FpyRate> listA) {
this.listA = listA;
}
public List<FpyRate> getListB() {
return listB;
}
public void setListB(List<FpyRate> listB) {
this.listB = listB;
}
public List<FpyRate> getListC() {
return listC;
}
public void setListC(List<FpyRate> listC) {
this.listC = listC;
}
public List<FpyRate> getListS() {
return listS;
}
public void setListS(List<FpyRate> listS) {
this.listS = listS;
}
public List<FpyRate> getListT() {
return listT;
}
public void setListT(List<FpyRate> listT) {
this.listT = listT;
}
}

View File

@@ -0,0 +1,31 @@
package com.pqs9300.pojo.report;
import java.io.Serializable;
public class FpyRate implements Serializable {
private static final long serialVersionUID = -9195132863875548829L;
private Float rate; //合格率
private Long count; //采样点数
public Float getRate() {
return rate;
}
public void setRate(Float rate) {
if (rate == null) {
this.rate = rate;
}
float f1 = (float) (Math.round(rate.floatValue() * 100)) / 100;
this.rate = new Float(f1);
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}

View File

@@ -0,0 +1,119 @@
package com.pqs9300.pojo.report;
import java.util.ArrayList;
import java.util.List;
public class HistoryTableData {
private String name; //监测点名称
private String bdName; //变电站名称
private String voltage; //电压等级
private int lineId; //线路ID
private int pttype; //监测点接线方式
private List<data> list;
public int getPttype() {
return pttype;
}
public void setPttype(int pttype) {
this.pttype = pttype;
}
public int getLineId() {
return lineId;
}
public void setLineId(int lineId) {
this.lineId = lineId;
}
public String getBdName() {
return bdName;
}
public void setBdName(String bdName) {
this.bdName = bdName;
}
public String getVoltage() {
return voltage;
}
public void setVoltage(String voltage) {
this.voltage = voltage;
}
public class data {
private String targetName; //指标名称
private String unit; //单位
private int typeId; //类型id
private int timeId = 0; //谐波的下标
private List<ReportTarget> list;
public int getTimeId() {
return timeId;
}
public void setTimeId(int timeId) {
this.timeId = timeId;
}
public int getTypeId() {
return typeId;
}
public void setTypeId(int typeId) {
this.typeId = typeId;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getTargetName() {
return targetName;
}
public void setTargetName(String targetName) {
this.targetName = targetName;
}
public List<ReportTarget> getList() {
return list;
}
public void setList(List<ReportTarget> list) {
this.list = list;
}
}
public List<data> getList() {
return list;
}
public void setList(List<data> list) {
this.list = list;
}
public void setData(data data) {
if (this.list == null) {
this.list = new ArrayList<>();
}
this.list.add(data);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -0,0 +1,74 @@
package com.pqs9300.pojo.report;
import com.njcn.pojo.configuration.OverLimit;
import java.io.Serializable;
import java.util.List;
public class OverLimitInfo implements Serializable {
private static final long serialVersionUID = 7466469972886414616L;
private List<OverLimit> overLimitRate;
private Double count;
private Double pltCount;
private Double pstCount;
private List<String> list;
private String mode;
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
public List<OverLimit> getOverLimitRate() {
return overLimitRate;
}
public void setOverLimitRate(List<OverLimit> overLimitRate) {
this.overLimitRate = overLimitRate;
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
}
public Double getPltCount() {
return pltCount;
}
public void setPltCount(Double pltCount) {
this.pltCount = pltCount;
}
@Override
public String toString() {
return "OverLimitInfo{" +
"overLimitRate=" + overLimitRate +
", count=" + count +
", pltCount=" + pltCount +
", pstCount=" + pstCount +
'}';
}
public Double getPstCount() {
return pstCount;
}
public void setPstCount(Double pstCount) {
this.pstCount = pstCount;
}
}

View File

@@ -0,0 +1,26 @@
package com.pqs9300.pojo.report;
import com.pqs9300.pojo.report.enumReport.EnumPass;
public class Pass {
private Float overLimit;
private Integer code;
public Pass(Float overLimit) {
this.code = EnumPass.DEFAULT.getCode();
this.overLimit = overLimit;
}
public Pass(Float overLimit, Integer code) {
this.overLimit = overLimit;
this.code = code;
}
public Float getOverLimit() {
return overLimit;
}
public Integer getCode() {
return code;
}
}

View File

@@ -0,0 +1,26 @@
package com.pqs9300.pojo.report;
import java.io.Serializable;
import java.util.List;
public class PloySetting implements Serializable {
private static final long serialVersionUID = -2915250019147778282L;
private String name; //名称 谐波电压、谐波电流....
List<Integer> listTarget; //{1,2,3,4...} 最大值、最小值、平均值、CP95值...
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Integer> getListTarget() {
return listTarget;
}
public void setListTarget(List<Integer> listTarget) {
this.listTarget = listTarget;
}
}

View File

@@ -0,0 +1,48 @@
package com.pqs9300.pojo.report;
import java.io.Serializable;
import java.util.List;
public class ReportTarget implements Serializable {
private static final long serialVersionUID = -6931764660060228127L;
private List<ReportValue> list;
private Float overLimit; //指标的国标限值
private Integer pass;
public ReportTarget() {
this.pass = null;
}
public List<ReportValue> getList() {
return list;
}
public void setList(List<ReportValue> list) {
this.list = list;
}
public Float getOverLimit() {
return overLimit;
}
public void setOverLimit(Float overLimit) {
this.overLimit = overLimit;
}
public Integer getPass() {
return pass;
}
public void setPass(Integer pass) {
this.pass = pass;
}
@Override
public String toString() {
return "ReportTarget{" +
"list=" + list +
", overLimit=" + overLimit +
", pass=" + pass +
'}';
}
}

View File

@@ -0,0 +1,121 @@
package com.pqs9300.pojo.report;
import com.njcn.utils.PubUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.Date;
/**
* @Author: Sunwei 【sunW2016@163.com】
* @Description:
* @Date: Create in 10:54 2018/6/7
* @Modified By:
*/
public class ReportValue implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(ReportValue.class);
private static final long serialVersionUID = 1120649990440477224L;
private String phaseType; //A(AB)相B(BC)相C(CA)相T总功
private Float fmaxValue; //最大值
private Float minValue; //最小值
private Float meanValue; //平均值
private Float cp95Value; //CP95值
transient private Date timeid;//发生的时间
transient private String strTime; //一天一条数据
public String getStrTime() {
return strTime;
}
public void setStrTime(String strTime) {
this.strTime = strTime;
}
public Date getTimeid() {
return timeid;
}
public void setTimeid(Date timeid) {
try {
this.strTime = PubUtils.date2String(timeid, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("时间转换发生异常,异常是"+e.getMessage());
}
}
public ReportValue() {
super();
}
public ReportValue(String phaseType, Float maxValue, Float minValue, Float meanValue, Float cp95Value) {
this.phaseType = phaseType;
this.fmaxValue = transData(maxValue);
this.minValue = transData(minValue);
this.meanValue = transData(meanValue);
this.cp95Value = transData(cp95Value);
}
@Override
public String toString() {
return "ReportValue{" +
"phaseType='" + phaseType + '\'' +
", fmaxValue=" + fmaxValue +
", minValue=" + minValue +
", meanValue=" + meanValue +
", cp95Value=" + cp95Value +
", timeid=" + timeid +
", strTime='" + strTime + '\'' +
'}';
}
public String getPhaseType() {
return phaseType;
}
public void setPhaseType(String phaseType) {
this.phaseType = phaseType;
}
public Float getFmaxValue() {
return fmaxValue;
}
public void setFmaxValue(Float maxValue) {
this.fmaxValue = transData(maxValue);
}
public Float getMinValue() {
return minValue;
}
public void setMinValue(Float minValue) {
this.minValue = transData(minValue);
}
public Float getMeanValue() {
return meanValue;
}
public void setMeanValue(Float meanValue) {
this.meanValue = transData(meanValue);
}
public Float getCp95Value() {
return cp95Value;
}
public void setCp95Value(Float cp95Value) {
this.cp95Value = transData(cp95Value);
}
private Float transData(Float f) {
if (f == null) {
return f;
}
float f1 = (float) (Math.round(f.floatValue() * 100)) / 100;
return new Float(f1);
}
}

View File

@@ -0,0 +1,94 @@
package com.pqs9300.pojo.report;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 提取用采数据或者将用采数据写进excel的实体类
* @author hongawen
* @Date: 2019/4/11 10:43
*/
public class UserDataExcelBody extends BaseRowModel implements Serializable,Comparable<UserDataExcelBody> {
@ExcelProperty(index = 0)
private Date time;
@ExcelProperty(value = "瞬时有功" ,index = 1)
private BigDecimal work;
@ExcelProperty(value = "户号" ,index = 2)
private String userId;
@ExcelProperty(value = "测量点局号" ,index = 3)
private String line;
//事件发生时间的毫秒计时
@ExcelProperty(value = "户名" ,index = 4)
private String userName;
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public BigDecimal getWork() {
return work;
}
public void setWork(BigDecimal work) {
this.work = work;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
@Override
public String toString() {
return "UserDataExcelBody{" +
"time=" + time +
", work=" + work +
", userId='" + userId + '\'' +
", line='" + line + '\'' +
", userName='" + userName + '\'' +
'}';
}
@Override
public int compareTo(UserDataExcelBody o) {
if(time.getTime()>o.getTime().getTime()){
return 1;
}else if(time.getTime()==o.getTime().getTime()){
}
return -1;
}
}

View File

@@ -0,0 +1,35 @@
package com.pqs9300.pojo.report.enumReport;
public enum EnumPass {
MAX(1, "使用最大值与国标限值比较,判断指标是否合格"),
MIN(2, "使用最小值与国标限值比较,判断指标是否合格"),
MEAN(3, "使用平均值与国标限值比较,判断指标是否合格"),
CP95(4, "使用CP95值与国标限值比较判断指标是否合格"),
DEFAULT(5, "不作比较"),
PASS(0, "合格"),
FPYVALUE(98, "合格率限值"),
FPYV(1, "UHARM_0_OVERTIME"),
FPYI(2, "IHARM_0_OVERTIME"),
FPYVOLTAGE(3, "VOLTAGE_DEV_OVERTIME"),
FPYTHREE(4, "UBALANCE_OVERTIME"),
FPYTHDV(5, "UABERRANCE_OVERTIME"),
FPYRATE(6, "FREQ_DEV_OVERTIME"),
FPYFLICKER(7, "FLICKER_OVERTIME"),
NOPASS(-1, "不合格");
private Integer code;
private String describe;
EnumPass(Integer code, String describe) {
this.code = code;
this.describe = describe;
}
public Integer getCode() {
return code;
}
public String getDescribe() {
return describe;
}
}

View File

@@ -0,0 +1,59 @@
package com.pqs9300.pojo.strategy;
/**
* @Description 用于预警告警策略指标类型的实体
* @Author cdf
* @Date 2020/6/22 14:39
**/
public class DicStrategyRVO {
private String dicIndex;
private String dicName;
private String dicType;
private Integer dicNumber;
/*是否被选中*/
private Integer isCheck;
public String getDicIndex() {
return dicIndex;
}
public void setDicIndex(String dicIndex) {
this.dicIndex = dicIndex;
}
public String getDicName() {
return dicName;
}
public void setDicName(String dicName) {
this.dicName = dicName;
}
public String getDicType() {
return dicType;
}
public void setDicType(String dicType) {
this.dicType = dicType;
}
public Integer getDicNumber() {
return dicNumber;
}
public void setDicNumber(Integer dicNumber) {
this.dicNumber = dicNumber;
}
public Integer getIsCheck() {
return isCheck;
}
public void setIsCheck(Integer isCheck) {
this.isCheck = isCheck;
}
}

View File

@@ -0,0 +1,40 @@
package com.pqs9300.pojo.strategy;
import java.util.List;
/**
* @Description 用于接收前台传参
* @Author cdf
* @Date 2020/7/9 17:19
**/
public class ParamDataVO {
private String wfIndex;
private Integer state;
private List<ThsAlarmFormAss> list;
public String getWfIndex() {
return wfIndex;
}
public void setWfIndex(String wfIndex) {
this.wfIndex = wfIndex;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public List<ThsAlarmFormAss> getList() {
return list;
}
public void setList(List<ThsAlarmFormAss> list) {
this.list = list;
}
}

View File

@@ -0,0 +1,47 @@
package com.pqs9300.pojo.strategy;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @Description
* @Author cdf
* @Date 2020/6/22 15:08
**/
@Table(name="THS_AlarmAss")
public class ThsAlarmAss {
@Id
@Column(name="Alarm_Index")
private String alarmIndex;
@Column(name="AlarmAss_Index")
private String alarmassIndex;
@Column(name="Type")
private Integer type;
public String getAlarmIndex() {
return alarmIndex;
}
public void setAlarmIndex(String alarmIndex) {
this.alarmIndex = alarmIndex;
}
public String getAlarmassIndex() {
return alarmassIndex;
}
public void setAlarmassIndex(String alarmassIndex) {
this.alarmassIndex = alarmassIndex;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}

View File

@@ -0,0 +1,104 @@
package com.pqs9300.pojo.strategy;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
* @Description
* @Author cdf
* @Date 2020/6/17 14:46
**/
@Table(name="THS_Alarm")
public class ThsAlarmDTO {
@Id
@Column(name="Alarm_Index")
private String alarmIndex;
@Column(name="Alarm_Name")
private String alarmName;
@Column(name="Grade")
private Integer grade;
@Column(name="Operation")
private Integer operation;
@Column(name="State")
private Integer state;
@Column(name="User_Index")
private String userIndex;
@Column(name="Updatetime")
private Date updateTime;
@Transient
private String userName;
public String getAlarmIndex() {
return alarmIndex;
}
public void setAlarmIndex(String alarmIndex) {
this.alarmIndex = alarmIndex;
}
public String getAlarmName() {
return alarmName;
}
public void setAlarmName(String alarmName) {
this.alarmName = alarmName;
}
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
public Integer getOperation() {
return operation;
}
public void setOperation(Integer operation) {
this.operation = operation;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getUserIndex() {
return userIndex;
}
public void setUserIndex(String userIndex) {
this.userIndex = userIndex;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}

View File

@@ -0,0 +1,47 @@
package com.pqs9300.pojo.strategy;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @Description
* @Author cdf
* @Date 2020/6/22 15:08
**/
@Table(name="THS_WarnFormAss")
public class ThsAlarmFormAss {
@Id
@Column(name="WF_Index")
private String wfIndex;
@Column(name="WFAss_Index")
private String wfassIndex;
@Column(name="Type")
private Integer type;
public String getWfIndex() {
return wfIndex;
}
public void setWfIndex(String wfIndex) {
this.wfIndex = wfIndex;
}
public String getWfassIndex() {
return wfassIndex;
}
public void setWfassIndex(String wfassIndex) {
this.wfassIndex = wfassIndex;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}

View File

@@ -0,0 +1,106 @@
package com.pqs9300.pojo.strategy;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* @Description 预警单实体类
* @Author cdf
* @Date 2020/6/17 14:48
**/
@Table(name="THS_WarnForm")
public class ThsAlarmFormDTO {
@Id
@Column(name="WF_Index")
private String wfIndex;
@Column(name="WF_Name")
private String wfName;
@Column(name="Grade")
private Integer grade;
@Column(name="Operation")
private Integer operation;
@Column(name="State")
private Integer state;
@Column(name="User_Index")
private String userIndex;
@Column(name="Updatetime")
private Date updateTime;
@Transient
private String userName;
public String getWfIndex() {
return wfIndex;
}
public void setWfIndex(String wfIndex) {
this.wfIndex = wfIndex;
}
public String getWfName() {
return wfName;
}
public void setWfName(String wfName) {
this.wfName = wfName;
}
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
public Integer getOperation() {
return operation;
}
public void setOperation(Integer operation) {
this.operation = operation;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getUserIndex() {
return userIndex;
}
public void setUserIndex(String userIndex) {
this.userIndex = userIndex;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}

View File

@@ -0,0 +1,101 @@
package com.pqs9300.pojo.technical;
import java.util.Date;
import java.util.List;
import javax.persistence.Transient;
import com.pqs9300.pojo.transaction.OverRunLog;
public class TechnicalInfo {
private String supIndex;
private String supName;//技术监督名称
private String userName;//创建用户
private Date creatTime;//创建时间
private String deptName;//创建部门
private String deptIndex;//部门id
private Date modifyTime;//修改时间
private int supType;//类型
private String supDescribe;//描述
private int progress;//进度
public String getSupIndex() {
return supIndex;
}
public void setSupIndex(String supIndex) {
this.supIndex = supIndex;
}
public String getSupName() {
return supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDeptIndex() {
return deptIndex;
}
public void setDeptIndex(String deptIndex) {
this.deptIndex = deptIndex;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public int getSupType() {
return supType;
}
public void setSupType(int supType) {
this.supType = supType;
}
public String getSupDescribe() {
return supDescribe;
}
public void setSupDescribe(String supDescribe) {
this.supDescribe = supDescribe;
}
public int getProgress() {
return progress;
}
public void setProgress(int progress) {
this.progress = progress;
}
}

View File

@@ -0,0 +1,54 @@
package com.pqs9300.pojo.transaction;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @author hongawen
* @date: 2020/7/13 09:51
*/
public class IndexPojo implements Serializable {
//事务类型统计
private TransactionType transactionType;
//事务流程统计
private TransactionProgress transactionProgress;
//总的事务列表
private List<Supervise> superviseList = new ArrayList<>();
public TransactionType getTransactionType() {
return transactionType;
}
public void setTransactionType(TransactionType transactionType) {
this.transactionType = transactionType;
}
public TransactionProgress getTransactionProgress() {
return transactionProgress;
}
public void setTransactionProgress(TransactionProgress transactionProgress) {
this.transactionProgress = transactionProgress;
}
public List<Supervise> getSuperviseList() {
return superviseList;
}
public void setSuperviseList(List<Supervise> superviseList) {
this.superviseList = superviseList;
}
@Override
public String toString() {
return "IndexPojo{" +
"transactionType=" + transactionType +
", transactionProgress=" + transactionProgress +
", superviseList=" + superviseList +
'}';
}
}

View File

@@ -0,0 +1,220 @@
package com.pqs9300.pojo.transaction;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* @author hongawen
* @date: 2020/7/1 11:34
*/
@Table(name = "THS_OVERRUNLOG")
public class OverRunLog implements Serializable {
@Column(name="Line_Index")
private Integer lineIndex;
@Column(name="Name")
private String name;
@Column(name="Sup_Index")
private String supIndex;
@Column(name="UpdateTime")
private Date updateTime;
@Column(name="OverRunTimes")
private Integer overRunTimes;//越限总次数
@Column(name="OverRun_describe")
private String overRunDescribe;
@Column(name="AlarmTicket")
private String alarmTicket;
@Column(name="Feedback")
private String feedBack;
@Column(name="TestReport")
private String testReport;
@Column(name="ReviseNotice")
private String reviseNotice;
@Column(name="ReviseFeedback")
private String reviseFeedBack;
@Transient
private String gdName;
@Transient
private String subName;
@Transient
private String lineName;
@Transient
private String overRunDate;//越限日期
@Transient
private String firstDes;//首个指标
@Transient
private Boolean choosen = false;//是否被选中
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getLineIndex() {
return lineIndex;
}
public void setLineIndex(Integer lineIndex) {
this.lineIndex = lineIndex;
}
public String getSupIndex() {
return supIndex;
}
public void setSupIndex(String supIndex) {
this.supIndex = supIndex;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getOverRunTimes() {
return overRunTimes;
}
public void setOverRunTimes(Integer overRunTimes) {
this.overRunTimes = overRunTimes;
}
public String getOverRunDescribe() {
return overRunDescribe;
}
public void setOverRunDescribe(String overRunDescribe) {
this.overRunDescribe = overRunDescribe;
}
public String getAlarmTicket() {
return alarmTicket;
}
public void setAlarmTicket(String alarmTicket) {
this.alarmTicket = alarmTicket;
}
public String getFeedBack() {
return feedBack;
}
public void setFeedBack(String feedBack) {
this.feedBack = feedBack;
}
public String getTestReport() {
return testReport;
}
public void setTestReport(String testReport) {
this.testReport = testReport;
}
public String getReviseNotice() {
return reviseNotice;
}
public void setReviseNotice(String reviseNotice) {
this.reviseNotice = reviseNotice;
}
public String getReviseFeedBack() {
return reviseFeedBack;
}
public void setReviseFeedBack(String reviseFeedBack) {
this.reviseFeedBack = reviseFeedBack;
}
public String getGdName() {
return gdName;
}
public void setGdName(String gdName) {
this.gdName = gdName;
}
public String getSubName() {
return subName;
}
public void setSubName(String subName) {
this.subName = subName;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getOverRunDate() {
return overRunDate;
}
public void setOverRunDate(String overRunDate) {
this.overRunDate = overRunDate;
}
public String getFirstDes() {
return firstDes;
}
public void setFirstDes(String firstDes) {
this.firstDes = firstDes;
}
public Boolean getChoosen() {
return choosen;
}
public void setChoosen(Boolean choosen) {
this.choosen = choosen;
}
@Override
public String toString() {
return "OverRunLog{" +
"lineIndex=" + lineIndex +
", name='" + name + '\'' +
", supIndex='" + supIndex + '\'' +
", updateTime=" + updateTime +
", overRunTimes=" + overRunTimes +
", overRunDescribe='" + overRunDescribe + '\'' +
", alarmTicket='" + alarmTicket + '\'' +
", feedBack='" + feedBack + '\'' +
", testReport='" + testReport + '\'' +
", reviseNotice='" + reviseNotice + '\'' +
", reviseFeedBack='" + reviseFeedBack + '\'' +
'}';
}
}

View File

@@ -0,0 +1,69 @@
package com.pqs9300.pojo.transaction;
/**
* @author hongawen
* @date: 2020/7/3 11:32
*/
public class OverRunLogDetail {
private OverRunLog overRunLog;
private String gdName;
private String deptsName;
private String subName;
private String lineName;
public OverRunLog getOverRunLog() {
return overRunLog;
}
public void setOverRunLog(OverRunLog overRunLog) {
this.overRunLog = overRunLog;
}
public String getGdName() {
return gdName;
}
public void setGdName(String gdName) {
this.gdName = gdName;
}
public String getSubName() {
return subName;
}
public void setSubName(String subName) {
this.subName = subName;
}
public String getLineName() {
return lineName;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getDeptsName() {
return deptsName;
}
public void setDeptsName(String deptsName) {
this.deptsName = deptsName;
}
@Override
public String toString() {
return "OverRunLogDetail{" +
"overRunLog=" + overRunLog +
", gdName='" + gdName + '\'' +
", deptsName='" + deptsName + '\'' +
", subName='" + subName + '\'' +
", lineName='" + lineName + '\'' +
'}';
}
}

View File

@@ -0,0 +1,224 @@
package com.pqs9300.pojo.transaction;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author hongawen
* @date: 2020/7/1 11:27
*/
@Table(name="THS_SUPERVISE")
public class Supervise implements Serializable {
@Id
private String supIndex;
private String name;
private String depts;
private String createUser;
private Date createTime;
private String modifyUser;
private Date modifyTime;
private Integer type;
private String upUser;
private String nextUser;
private Integer progress;
private String supDescribe;
@Column(name="eventDate")
private Date eventDate;
@Transient
private String createTimeStr;
@Transient
private String modifyTimeStr;
@Transient
private String proceed;
@Transient
private String deptName;
@Transient
private List<OverRunLog> overRunLog;
public String getSupIndex() {
return supIndex;
}
public void setSupIndex(String supIndex) {
this.supIndex = supIndex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDepts() {
return depts;
}
public void setDepts(String depts) {
this.depts = depts;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getUpUser() {
return upUser;
}
public void setUpUser(String upUser) {
this.upUser = upUser;
}
public String getNextUser() {
return nextUser;
}
public void setNextUser(String nextUser) {
this.nextUser = nextUser;
}
public Integer getProgress() {
return progress;
}
public void setProgress(Integer progress) {
this.progress = progress;
}
public String getSupDescribe() {
return supDescribe;
}
public void setSupDescribe(String supDescribe) {
this.supDescribe = supDescribe;
}
public Date getEventDate() {
return eventDate;
}
public void setEventDate(Date eventDate) {
this.eventDate = eventDate;
}
public String getCreateTimeStr() {
return createTimeStr;
}
public void setCreateTimeStr(String createTimeStr) {
this.createTimeStr = createTimeStr;
}
public String getModifyTimeStr() {
return modifyTimeStr;
}
public void setModifyTimeStr(String modifyTimeStr) {
this.modifyTimeStr = modifyTimeStr;
}
public String getProceed() {
return proceed;
}
public void setProceed(String proceed) {
this.proceed = proceed;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public List<OverRunLog> getOverRunLog() {
return overRunLog;
}
public void setOverRunLog(List<OverRunLog> overRunLog) {
this.overRunLog = overRunLog;
}
@Override
public String toString() {
return "Supervise{" +
"supIndex='" + supIndex + '\'' +
", name='" + name + '\'' +
", depts='" + depts + '\'' +
", createUser='" + createUser + '\'' +
", createTime=" + createTime +
", modifyUser='" + modifyUser + '\'' +
", modifyTime=" + modifyTime +
", type=" + type +
", upUser='" + upUser + '\'' +
", nextUser='" + nextUser + '\'' +
", progress=" + progress +
", supDescribe='" + supDescribe + '\'' +
", eventDate='" + eventDate + '\'' +
'}';
}
}

View File

@@ -0,0 +1,52 @@
package com.pqs9300.pojo.transaction;
import java.util.ArrayList;
import java.util.List;
/**
* @author hongawen
* @date: 2020/7/1 16:28
*/
public class TransactionData {
/*事务名称*/
private String name;
/*创建时间*/
private String createTime;
/*该事务下监测点越限详细数据*/
private List<OverRunLogDetail> overRunLogList=new ArrayList<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<OverRunLogDetail> getOverRunLogList() {
return overRunLogList;
}
public void setOverRunLogList(List<OverRunLogDetail> overRunLogList) {
this.overRunLogList = overRunLogList;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "TransactionData{" +
"name='" + name + '\'' +
", overRunLogList=" + overRunLogList +
'}';
}
}

View File

@@ -0,0 +1,105 @@
package com.pqs9300.pojo.transaction;
import java.io.Serializable;
/**
* @author hongawen
* @date: 2020/7/13 09:54
*/
public class TransactionProgress implements Serializable {
private int total=0;
private int start=0;
private int alarmTicket=0;
private int feedBack=0;
private int testReport=0;
private int reviseNotice=0;
private int reviseFeedBack=0;
private int finish=0;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getAlarmTicket() {
return alarmTicket;
}
public void setAlarmTicket(int alarmTicket) {
this.alarmTicket = alarmTicket;
}
public int getFeedBack() {
return feedBack;
}
public void setFeedBack(int feedBack) {
this.feedBack = feedBack;
}
public int getTestReport() {
return testReport;
}
public void setTestReport(int testReport) {
this.testReport = testReport;
}
public int getReviseNotice() {
return reviseNotice;
}
public void setReviseNotice(int reviseNotice) {
this.reviseNotice = reviseNotice;
}
public int getReviseFeedBack() {
return reviseFeedBack;
}
public void setReviseFeedBack(int reviseFeedBack) {
this.reviseFeedBack = reviseFeedBack;
}
public int getFinish() {
return finish;
}
public void setFinish(int finish) {
this.finish = finish;
}
@Override
public String toString() {
return "TransactionProgress{" +
"total=" + total +
", start=" + start +
", alarmTicket=" + alarmTicket +
", feedBack=" + feedBack +
", testReport=" + testReport +
", reviseNotice=" + reviseNotice +
", reviseFeedBack=" + reviseFeedBack +
", finish=" + finish +
'}';
}
}

View File

@@ -0,0 +1,49 @@
package com.pqs9300.pojo.transaction;
import java.io.Serializable;
/**
* @author hongawen
* @date: 2020/7/13 09:53
*/
public class TransactionType implements Serializable {
private int total=0;
private int earlyWarn=0;
private int alarm=0;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getEarlyWarn() {
return earlyWarn;
}
public void setEarlyWarn(int earlyWarn) {
this.earlyWarn = earlyWarn;
}
public int getAlarm() {
return alarm;
}
public void setAlarm(int alarm) {
this.alarm = alarm;
}
@Override
public String toString() {
return "TransactionType{" +
"total=" + total +
", earlyWarn=" + earlyWarn +
", alarm=" + alarm +
'}';
}
}

View File

@@ -0,0 +1,18 @@
package com.pqs9300.service.flowChart;
/**
* @Author: xuyang
* @Description:
*/
public interface FlowChartService {
/**
* 获取电压等级 判断流程图的
* @param flowChartSupIndex
* @return
*/
String getPowerLever(String flowChartSupIndex);
Integer getProgress(String supIndex);
}

View File

@@ -0,0 +1,25 @@
package com.pqs9300.service.formdata;
import java.util.Date;
import java.util.List;
import com.pqs9300.pojo.transaction.OverRunLog;
import com.pqs9300.pojo.transaction.Supervise;
public interface FormDataService {
List<OverRunLog> getListOverRunLog(List<String> deptsIndex, Date time, int... type);//获取预警单数据 type = 1 告警单
void insertFormData(int... type);// 处理预警单数据 type = 1 告警单
String saveOverRunLog(String deptsIndex, Date time,List<String> indexs, int... type);
void modOverRunLog(String supIndex,String deptsIndex, Date time,List<String> indexs, int... type);
void delTechnical(String supIndex);
List<OverRunLog> getTechnicalDetail(String deptsIndex, Date time, int... type);//获取预警单数据 type = 1 告警单
Supervise getTechnicalByID(String supIndex);
List<String> getOptions(Long lineIndex,Date time);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.njcn.pojo.configuration.RptPloy;
import com.pqs9300.pojo.report.PloySetting;
public interface ExcelReportService {
List<RptPloy> getPloyData();
List<PloySetting> setPloy(String guid);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetDistortionDataService {
List<ReportValue> getDistortionData(Condition condition);
List<ReportValue> getDistortionData(Condition condition, String s);
}

View File

@@ -0,0 +1,15 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetFlickerDataService {
List<ReportValue> getFlickerData(Condition condition);
List<ReportValue> getPFlickerData(Condition condition);
List<ReportValue> getLLFlickerData(Condition condition);
}

View File

@@ -0,0 +1,10 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.FpyDataByType;
public interface GetFpyService {
List<FpyDataByType> getFpy(Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetFrequencyDataService {
List<ReportValue> getFrequencyData(Condition condition);
List<ReportValue> getFreqData(Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetICurrentService {
List<ReportValue> getICurrent(Condition condition);
List<ReportValue> getHICurrent(Condition condition,Integer times);
}

View File

@@ -0,0 +1,10 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetInICurrentService {
List<ReportValue> getInICurrent(Condition condition);
}

View File

@@ -0,0 +1,10 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetInVoltageRateService {
List<ReportValue> getInVoltageRate(Condition condition);
}

View File

@@ -0,0 +1,8 @@
package com.pqs9300.service.report;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.OverLimitInfo;
public interface GetOverLimitDataService {
OverLimitInfo getOverLimitData(Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetPowerDataService {
List<ReportValue> getPowerData(Condition condition);
List<ReportValue> getPower(Condition condition,String s);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetThreephaseDataService {
List<ReportValue> getThreephase(Condition condition);
List<ReportValue> getHThreephase(Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetVdeviationDataService {
List<ReportValue> getVdeviation(Condition condition);
List<ReportValue> getVdeviationData(Condition condition);
}

View File

@@ -0,0 +1,20 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
/**
* @Author: Sunwei 【sunW2016@163.com】
* @Description:
* @Date: Create in 10:45 2018/6/7
* @Modified By:
*/
public interface GetVirtualDataService {
List<ReportValue> getVirtualData(Condition condition);
List<ReportValue> getVirtualData(Condition condition, String tableName);
List<ReportValue> getVVirtualData(Condition condition);
}

View File

@@ -0,0 +1,10 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetVoltage {
List<ReportValue> getVoltageData(Condition condition);
}

View File

@@ -0,0 +1,12 @@
package com.pqs9300.service.report;
import java.util.List;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
public interface GetVoltageRateService {
List<ReportValue> getVoltageRate(Condition condition);
List<ReportValue> getHVoltageRate(Condition condition,Integer times);
}

View File

@@ -0,0 +1,10 @@
package com.pqs9300.service.report;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.util.Date;
import java.util.List;
public interface PercentService {
XWPFDocument createTable(Date start, Date end, List<Integer> pointList, int timeType, String factory, String listPointName, String lineName);
}

View File

@@ -0,0 +1,101 @@
package com.pqs9300.service.strategy;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import com.pqs9300.pojo.strategy.ThsAlarmAss;
import com.pqs9300.pojo.strategy.ThsAlarmFormAss;
import com.pqs9300.pojo.strategy.ThsAlarmDTO;
import java.util.List;
/**
* @Description
* @Author cdf
* @Date 2020/6/17 15:35
**/
public interface AlarmStrategyService {
/**
* @Author chendaofei
* @Description 新增告警策略
* @Date 15:27 2020/6/17
**/
String addAlarm(ThsAlarmDTO thsAlarmDTO);
/**
* @Author chendaofei
* @Description 修改告警策略
* @Date 15:27 2020/6/17
**/
String updateAlarm(ThsAlarmDTO thsAlarmDTO);
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
Integer statusController(String alarmIndex,Integer state);
/**
* @Author chendaofei
* @Description 修改告警策略指标类型与或
* @Date 15:27 2020/6/17
**/
Integer updateAlarmAndOr(String alarmIndex, Integer operation);
/**
* @Author chendaofei
* @Description 删除告警策略
* @Date 15:27 2020/6/17
**/
String delAlarm(String alarmIndex);
/**
* @Author chendaofei
* @Description 是否存在绑定事件
* @Date 15:27 2020/6/17
**/
Integer isExitBindEvent(String alarmIndex);
/**
* @Author chendaofei
* @Description 删除告警策略
* @Date 15:27 2020/6/17
**/
List<ThsAlarmDTO> getAlarmList(Integer grade);
/**
* @Author chendaofei
* @Description 通过id获取告警策略
* @Date 15:27 2020/6/17
**/
ThsAlarmDTO getAlarmById(String alarmIndex);
/*------------------操作THS_WarnFormAss表--------------------------*/
/**
* @Author chendaofei
* @Description 新增告警策略关系表
* @Date 15:27 2020/6/17
**/
String addAlarmAss(String alarmIndex,Integer state,List<ThsAlarmFormAss>list);
/**
* @Author chendaofei
* @Description 获取告警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmAss> getStrategyLine(String alarmIndex, Integer type);
/**
* @Author chendaofei
* @Description 获取告警策略列表
* @Date 15:27 2020/6/17
**/
List<DicStrategyRVO> getAlarmAss(String alarmIndex, Integer type);
}

View File

@@ -0,0 +1,107 @@
package com.pqs9300.service.strategy;
import com.pqs9300.pojo.strategy.ThsAlarmFormAss;
import com.pqs9300.pojo.strategy.ThsAlarmFormDTO;
import com.pqs9300.pojo.strategy.DicStrategyRVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description
* @Author cdf
* @Date 2020/6/17 15:35
**/
public interface WarnStrategyService {
/**
* @Author chendaofei
* @Description 新增预警策略
* @Date 15:27 2020/6/17
**/
String addEarlyWarn(ThsAlarmFormDTO thsAlarmFormDTO);
/**
* @Author chendaofei
* @Description 修改预警策略
* @Date 15:27 2020/6/17
**/
String updateEarlyWarn(ThsAlarmFormDTO thsAlarmFormDTO);
/**
* @Author chendaofei
* @Description 修改预警策略指标类型与或
* @Date 15:27 2020/6/17
**/
Integer updateEarlyWarnAndOr(String wfIndex,Integer operation);
/**
* @Author chendaofei
* @Description 控制是否启用策略
* @Date 15:27 2020/6/17
**/
Integer statusController(String wfIndex,Integer state);
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
String delEarlyWarn(String wfIndex);
/**
* @Author chendaofei
* @Description 是否存在绑定事件
* @Date 15:27 2020/6/17
**/
Integer isExitBindEvent(String wfIndex);
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
List<ThsAlarmFormDTO> getEarlyWarnList(Integer grade);
/**
* @Author chendaofei
* @Description 通过id获取预警策略
* @Date 15:27 2020/6/17
**/
ThsAlarmFormDTO getEarlyWarnById(String wfIndex);
/*------------------操作THS_WarnFormAss表--------------------------*/
/**
* @Author chendaofei
* @Description 新增预警策略关系表
* @Date 15:27 2020/6/17
**/
String addEarlyWarnAss(String wfIndex,Integer state,List<ThsAlarmFormAss> list);
/**
* @Author chendaofei
* @Description 删除预警策略
* @Date 15:27 2020/6/17
**/
/*String delEarlyWarnAss(String wfIndex,String wfassIndex,Integer type);*/
/**
* @Author chendaofei
* @Description 获取预警策略列表
* @Date 15:27 2020/6/17
**/
List<ThsAlarmFormAss> getStrategyLine(String wfIndex,Integer type);
/**
* @Author chendaofei
* @Description 获取预警策略列表
* @Date 15:27 2020/6/17
**/
List<DicStrategyRVO> getEarlyWarnAss(String wfIndex, Integer type);
}

View File

@@ -0,0 +1,16 @@
package com.pqs9300.service.technical;
import java.util.Date;
import java.util.List;
import com.njcn.pojo.user.Depts;
import com.pqs9300.pojo.technical.TechnicalInfo;
import com.pqs9300.pojo.transaction.OverRunLog;
public interface TechnicalInfoService {
List<TechnicalInfo> getTechnicalInfo(String startTime, String endTime, int progress,int supType);
int getStartSwitch(List<String> index);
List<Depts> getDepts();
}

View File

@@ -0,0 +1,11 @@
package com.pqs9300.service.transaction;
import com.pqs9300.pojo.transaction.TransactionData;
/**
* @author hongawen
* @date: 2020/7/1 11:41
*/
public interface OverRunLogService {
TransactionData getMonitorDetailData(String supIndex) throws Exception;
}

View File

@@ -0,0 +1,23 @@
package com.pqs9300.service.transaction;
import com.pqs9300.pojo.transaction.IndexPojo;
import com.pqs9300.pojo.transaction.Supervise;
import java.util.Date;
import java.util.List;
/**
* @author hongawen
* @date: 2020/7/1 11:41
*/
public interface SuperviseService {
IndexPojo getTransactionData(Date startTime, Date endTime, Integer type, Integer progress) throws Exception;
Supervise isExist(String supIndex);
void finishEarlyWarn(Supervise supervise) throws Exception;
void finishEarlyNotice(Supervise supervise) throws Exception;
void startDealTransaction(String supIndex);
}

View File

@@ -0,0 +1,116 @@
package com.pqs9300.service.uploadFiles;
import com.pqs9300.util.SocketSender;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* @Author: xuyang
* @Description:
*/
public interface UploadFilesService {
/**
* 单文件上传
* 获取文件信息
* @param file
* @param request
* @param response
* @param supIndex
* @param lineIndex
* @param stepCount
* @param updateTime
* @return
*/
Map<String, Object> fileInformation(MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, String lineIndex, Integer stepCount, String updateTime);
/**
* 判断上传的文件名和事务名称是否一致
* @param supIndex
* @param fileName
* @param lineIndex
* @param updateTime
* @return
*/
Boolean judgeFileName(String supIndex, String fileName,String lineIndex, String updateTime);
/**
* 单文件文件名不同,确认后修改文件名
* @param file
* @param request
* @param response
* @param supIndex
* @param lineIndex
* @param stepCount
* @param updateTime
* @return
*/
Map<String, Object> fileCommit(MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, String lineIndex, Integer stepCount, String updateTime);
/**
* 判断文件的类型
* 告警单/预警单/反馈单 pdf/jepg/jpg/png/bmp/JPG/PNG
* 测试报告 doc/docx/pdf
* @param subffix
* @return
*/
Boolean judgeFileType(String subffix);
/**
* 将上传文件的路径写入数据库
* @param stepCount
* @param filePath
* @param supIndex
* @param lineIndex
* @param updateTime
*/
void updateFileUrl(Integer stepCount, String filePath, String supIndex,String lineIndex, String updateTime);
/**
* 判断是否需要修改文件的状态
* @param supIndex
* @param stepCount
* @return
*/
Boolean overRunLogList(String supIndex, Integer stepCount);
/**
* 获取文件类型 0预警单 1告警单
* 判断预警单还是告警单 流程不同
* @param supIndex
* @return
*/
Integer supIndexType(String supIndex);
/**
* 上传成功改变文件流程状态,执行下一步
* @param supIndex
* @param stepCount
* @param type
*/
void updateFileProgress(String supIndex, Integer stepCount, Integer type, SocketSender socketSender);
/**
* 多文件上传
* @param file
* @param request
* @param response
* @param supIndex
* @param stepCount
* @return
*/
Map<String,Object> uploadFiles(MultipartFile file, HttpServletRequest request, HttpServletResponse response, String supIndex, Integer stepCount);
/**
* 多文件写入数据库
* @param stepCount
* @param filePath
* @param fileName
* @param supIndex
*/
void updateFilesUrl(Integer stepCount, String filePath, String fileName, String supIndex);
}

View File

@@ -0,0 +1,27 @@
package com.pqs9300.serviceimpl.flowChart;
import com.pqs9300.mapper.flowChart.FlowChartMapper;
import com.pqs9300.service.flowChart.FlowChartService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Author: xuyang
* @Description:
*/
@Service
public class FlowChartServiceImpl implements FlowChartService {
@Resource
private FlowChartMapper flowChartMapper;
@Override
public String getPowerLever(String flowChartSupIndex) {
return flowChartMapper.getPowerLever(flowChartSupIndex);
}
@Override
public Integer getProgress(String supIndex) { return flowChartMapper.getProgress(supIndex); }
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
package com.pqs9300.serviceimpl.report;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.njcn.mapper.configuration.RptDataMapper;
import com.njcn.mapper.configuration.RptPloyMapper;
import com.njcn.pojo.configuration.RptData;
import com.njcn.pojo.configuration.RptPloy;
import com.pqs9300.mapper.report.ExcelReportMapper;
import com.pqs9300.pojo.report.PloySetting;
import com.pqs9300.service.report.ExcelReportService;
@Service
public class ExcelReportServiceImpl implements ExcelReportService {
@Autowired
private RptPloyMapper rptPloyMapper;
@Autowired
private RptDataMapper rptDataMapper;
@Autowired
private ExcelReportMapper excelReportMapper;
@Override
public List<RptPloy> getPloyData() {
RptPloy rptPloy = new RptPloy();
rptPloy.setState(new Integer(1));
rptPloy.setPloyType(new Integer(2));
return rptPloyMapper.select(rptPloy);
}
@Override
public List<PloySetting> setPloy(String guid) {
//获取最后一层选择
List<RptData> list = excelReportMapper.getDatasByPloy(guid);
//筛选出parentId
Set<String> sets = new TreeSet<>();
for (RptData rptData : list) {
sets.add(rptData.getParentGUID());
}
//筛选的结果获取节点详细信息
List<RptData> list1 = excelReportMapper.getDatas(sets);
//转换结果
List<PloySetting> listPloys = new ArrayList<>();
for (RptData rptData : list1) {
PloySetting ploySetting = new PloySetting();
ploySetting.setName(rptData.getRdDescribe());
List<Integer> list2 = new ArrayList<>();
for (RptData rptData1 : list) {
if (rptData1.getParentGUID().equals(rptData.getRdIndex())) {
switch (rptData1.getRdDescribe()) {
case "最大值":
list2.add(new Integer(1));
break;
case "最小值":
list2.add(new Integer(2));
break;
case "平均值":
list2.add(new Integer(3));
break;
case "CP95值":
list2.add(new Integer(4));
break;
case "谐波电压含有率":
list2.add(new Integer(5));
break;
case "谐波电流含有率":
list2.add(new Integer(6));
break;
case "电压偏差":
list2.add(new Integer(7));
break;
case "三相电压不平衡度":
list2.add(new Integer(8));
break;
case "电压谐波畸变率":
list2.add(new Integer(9));
break;
case "频率偏差":
list2.add(new Integer(10));
break;
case "电压长时闪变":
list2.add(new Integer(11));
break;
}
}
}
ploySetting.setListTarget(list2);
listPloys.add(ploySetting);
}
return listPloys;
}
}

View File

@@ -0,0 +1,42 @@
package com.pqs9300.serviceimpl.report;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pqs9300.mapper.report.GetDistortionDataMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetDistortionDataService;
@Service
public class GetDistortionDataServiceImpl implements GetDistortionDataService {
@Autowired
private GetDistortionDataMapper getDistortionDataMapper;
@Override
public List<ReportValue> getDistortionData(Condition condition) {
List<ReportValue> list = new ArrayList<>();
//获取电压畸变率
List<ReportValue> listU = getDistortionDataMapper.getDistortionData(condition, "V");
//获取电流畸变率
List<ReportValue> listI = getDistortionDataMapper.getDistortionData(condition, "I");
//添加之前判断数据库是否有数据,如果没有数据模拟数据添加到集合中
RegroupData.regroupData(listU, true);
RegroupData.regroupData(listI, true);
list.addAll(listU);
list.addAll(listI);
return list;
}
@Override
public List<ReportValue> getDistortionData(Condition condition, String s) {
List<ReportValue> list = getDistortionDataMapper.getHDistortionData(condition, s);
return list;
}
}

View File

@@ -0,0 +1,129 @@
package com.pqs9300.serviceimpl.report;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.njcn.utils.PubUtils;
import com.pqs9300.mapper.report.GetFlickerDataMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetFlickerDataService;
@Service
public class GetFlickerDataServiceImpl implements GetFlickerDataService {
private static final Logger logger = LoggerFactory.getLogger(GetFlickerDataServiceImpl.class);
@Autowired
private GetFlickerDataMapper getFlickerDataMapper;
@Override
public List<ReportValue> getFlickerData(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<ReportValue> listPlt = new ArrayList<>();
List<ReportValue> listPst = new ArrayList<>();
//短时闪变
List<Map<String, Object>> listFlicker = getFlickerDataMapper.getFlickerData(condition);
//长时闪变
List<Map<String, Object>> listLFlicker = getFlickerDataMapper.getLFlickerData(condition);
//筛选结果为想要的数据格式
if (0 < listFlicker.size() && null != listFlicker.get(0)) {
transformData("S", listPst, listFlicker);
}
if (0 < listLFlicker.size() && null != listLFlicker.get(0)) {
transformData("L", listPlt, listLFlicker);
}
RegroupData.regroupData(listPst, true);
RegroupData.regroupData(listPlt, true);
list.addAll(listPst);
list.addAll(listPlt);
return list;
}
@Override
public List<ReportValue> getPFlickerData(Condition condition) {
List<ReportValue> listPst = new ArrayList<>();
/*List<Map<String, Object>> listFlicker = getFlickerDataMapper.getPFlickerData(condition);
//筛选结果为想要的数据格式
if (0 < listFlicker.size() && null != listFlicker.get(0)) {
transformData("S", listPst, listFlicker);
}
RegroupData.regroupData(listPst, true);*/
return listPst;
}
@Override
public List<ReportValue> getLLFlickerData(Condition condition) {
List<ReportValue> listPlt = new ArrayList<>();
List<Map<String, Object>> listLFlicker = getFlickerDataMapper.getLLFlickerData(condition);
if (0 < listLFlicker.size() && null != listLFlicker.get(0)) {
transformHData("L", listPlt, listLFlicker);
}
return listPlt;
}
private void transformHData(String str, List<ReportValue> list, List<Map<String, Object>> listMap) {
for (Map<String, Object> map : listMap) {
ReportValue value = new ReportValue();
setHData(str, value, list, map);
}
}
private void setHData(String str, ReportValue reportValue, List<ReportValue> list, Map<String, Object> map) {
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setMeanValue(new Float(((Double) map.get("P" + str + "T")).floatValue()));
reportValue.setFmaxValue(new Float(((Double) map.get("P" + str + "T_MAX")).floatValue()));
reportValue.setMinValue(new Float(((Double) map.get("P" + str + "T_MIN")).floatValue()));
try {
reportValue.setStrTime(PubUtils.date2String((Date) map.get("TIMEID"), "yyyy-MM-dd"));
} catch (Exception e) {
logger.error(e.getMessage());
}
if (map.containsKey("P" + str + "T_CP95")) {
reportValue.setCp95Value(new Float(((Double) map.get("P" + str + "T_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
private void transformData(String str, List<ReportValue> list, List<Map<String, Object>> listMap) {
for (Map<String, Object> map : listMap) {
ReportValue value = new ReportValue();
setData(str, value, list, map);
}
}
private void setData(String str, ReportValue reportValue, List<ReportValue> list, Map<String, Object> map) {
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setMeanValue(new Float(((BigDecimal) map.get("P" + str + "T")).floatValue()));
reportValue.setFmaxValue(new Float(((BigDecimal) map.get("P" + str + "T_MAX")).floatValue()));
reportValue.setMinValue(new Float(((BigDecimal) map.get("P" + str + "T_MIN")).floatValue()));
if (map.containsKey("P" + str + "T_CP95")) {
reportValue.setCp95Value(new Float(((BigDecimal) map.get("P" + str + "T_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}

View File

@@ -0,0 +1,134 @@
package com.pqs9300.serviceimpl.report;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pqs9300.mapper.report.GetFpyMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.FpyDataByType;
import com.pqs9300.pojo.report.FpyRate;
import com.pqs9300.pojo.report.enumReport.EnumPass;
import com.pqs9300.service.report.GetFpyService;
@Service
public class GetFpyServiceImpl implements GetFpyService {
@Autowired
private GetFpyMapper getFpyMapper;
@Override
public List<FpyDataByType> getFpy(Condition condition) {
FpyDataByType[] fpyDataByTypes = new FpyDataByType[]{
new FpyDataByType(EnumPass.FPYV),
new FpyDataByType(EnumPass.FPYI),
new FpyDataByType(EnumPass.FPYVOLTAGE),
new FpyDataByType(EnumPass.FPYTHREE),
new FpyDataByType(EnumPass.FPYTHDV),
new FpyDataByType(EnumPass.FPYRATE),
new FpyDataByType(EnumPass.FPYFLICKER),
};
List<FpyDataByType> list = Arrays.asList(fpyDataByTypes);
//sql谐波电压、电流指标查询拼接
List<Integer> list1 = new ArrayList<>();
for (int i = 2; i < 26; i++) {
list1.add(new Integer(i));
}
//有三相
List<Map<String, Object>> listResult = getFpyMapper.getFpy(condition, list1, 1);
translateData(listResult, list, 1);
//无三相
List<Map<String, Object>> list2 = getFpyMapper.getFpy(condition, null, 2);
translateData(list2, list, 2);
return list;
}
private void translateData(List<Map<String, Object>> list, List<FpyDataByType> listFpy, int type) {
Iterator<FpyDataByType> fpyDataByTypeIterator = listFpy.iterator();
while (fpyDataByTypeIterator.hasNext()) {//外层指标循环
FpyDataByType fpyDataByType = fpyDataByTypeIterator.next();
Iterator<Map<String, Object>> iterator = list.iterator();
while (iterator.hasNext()) {//内层查询结果循环
Map<String, Object> map = iterator.next();
switch (fpyDataByType.getEnumPass().getCode()) {
case 1:
case 2:
case 3:
case 5:
case 7: {
if (type == 1) {
switch (map.get("PHASETYPE").toString()) {
case "A": {
fpyDataByType.setListA(getData(map, fpyDataByType.getEnumPass()));
break;
}
case "B": {
fpyDataByType.setListB(getData(map, fpyDataByType.getEnumPass()));
break;
}
case "C": {
fpyDataByType.setListC(getData(map, fpyDataByType.getEnumPass()));
break;
}
case "T": {
fpyDataByType.setListS(getData(map, fpyDataByType.getEnumPass()));
break;
}
}
}
break;
}
case 4:
case 6: {
if (type == 2) {
fpyDataByType.setListT(getData(map, fpyDataByType.getEnumPass()));
}
}
}
}
}
}
private List<FpyRate> getData(Map<String, Object> map, EnumPass enumPass) {
Long allTime = enumPass.getCode() == 7 ? Long.valueOf(map.get("FLICKET_ALLTIME").toString()) :Long.valueOf(map.get("ALLTIME").toString());
List<FpyRate> list = new ArrayList<>();
if (allTime.longValue() == 0) {//如果采样点数为0则直接return
return null;
}
int length = 3;
if (enumPass.getCode() == EnumPass.FPYV.getCode() || enumPass.getCode() == EnumPass.FPYI.getCode()) {
length = 26;
}
for (int j = 2; j < length; j++) {
FpyRate fpyData = new FpyRate();
Long l = Long.valueOf(map.get(length > 3 ? enumPass.getDescribe().replace("0", String.valueOf(j)) : enumPass.getDescribe()).toString());
fpyData.setCount(allTime);
fpyData.setRate(judgeRate(l, allTime));
list.add(fpyData);
}
return list;
}
private Float judgeRate(Long l, Long l1) {
float d = 100.0f - (l.longValue() * 1.0f / l1.longValue()) * 100.0f;
return new Float(d < 0.0f ? 0.0f : d);
}
}

View File

@@ -0,0 +1,113 @@
package com.pqs9300.serviceimpl.report;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.njcn.utils.PubUtils;
import com.pqs9300.mapper.report.GetFrequencyDataMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetFrequencyDataService;
@Service
public class GetFrequencyDataServiceImpl implements GetFrequencyDataService {
private static final Logger logger = LoggerFactory.getLogger(GetFrequencyDataServiceImpl.class);
@Autowired
private GetFrequencyDataMapper getFrequencyDataMapper;
@Override
public List<ReportValue> getFrequencyData(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<Map<String, Object>> listFre = getFrequencyDataMapper.getFrequencyData(condition);
if (0 < listFre.size() && null != listFre.get(0)) {
transformData(list, listFre);
}
if (0 == list.size()) {
for (int i = 0; i < 2; i++) {
List<ReportValue> list1 = new ArrayList<>();
RegroupData.regroupData(list1, false);
list.addAll(list1);
}
}
return list;
}
@Override
public List<ReportValue> getFreqData(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<Map<String, Object>> listFre = getFrequencyDataMapper.getHFrequencyData(condition);
if (0 < listFre.size() && null != listFre.get(0)) {
transform(list, listFre);
}
return list;
}
private void transform(List<ReportValue> list1, List<Map<String, Object>> list) {
for (Map<String, Object> map : list) {
//频率
ReportValue reportValue1 = new ReportValue();
setHData(reportValue1, "_DEV", list1, map);
}
}
private void setHData(ReportValue reportValue, String str, List<ReportValue> list, Map<String, Object> map) {
reportValue.setFmaxValue(new Float(((Double) map.get("FREQ" + str + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((Double) map.get("FREQ" + str + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((Double) map.get("FREQ" + str)).floatValue()));
try {
reportValue.setStrTime(PubUtils.date2String((Date) map.get("TIMEID"), "yyyy-MM-dd"));
} catch (Exception e) {
logger.error(e.getMessage());
}
if (map.containsKey("FREQ" + str + "_CP95")) {
reportValue.setCp95Value(new Float(((Double) map.get("FREQ" + str + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
private void transformData(List<ReportValue> list1, List<Map<String, Object>> list) {
for (Map<String, Object> map : list) {
//频率
ReportValue reportValue1 = new ReportValue();
//频率偏差
ReportValue reportValue2 = new ReportValue();
setData(reportValue1, "", list1, map);
setData(reportValue2, "_DEV", list1, map);
}
}
private void setData(ReportValue reportValue, String str, List<ReportValue> list, Map<String, Object> map) {
reportValue.setFmaxValue(new Float(((BigDecimal) map.get("FREQ" + str + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((BigDecimal) map.get("FREQ" + str + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((BigDecimal) map.get("FREQ" + str)).floatValue()));
if (map.containsKey("FREQ" + str + "_CP95")) {
reportValue.setCp95Value(new Float(((BigDecimal) map.get("FREQ" + str + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}

View File

@@ -0,0 +1,105 @@
package com.pqs9300.serviceimpl.report;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.njcn.utils.PubUtils;
import com.pqs9300.mapper.report.GetICurrentMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetICurrentService;
@Service
public class GetICurrentServiceImpl implements GetICurrentService {
private static final Logger logger = LoggerFactory.getLogger(GetICurrentServiceImpl.class);
@Autowired
private GetICurrentMapper getICurrentMapper;
@Override
public List<ReportValue> getICurrent(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<Integer> listValue = new ArrayList<>();
for (int i = 1; i < 51; i++) {
listValue.add(new Integer(i));
}
//获取电流幅值,包含基波
List<Map<String, Object>> listResult = getICurrentMapper.getICurrent(condition, listValue);
if (0 == listResult.size() || null == listResult.get(0)) {
for (int i = 0; i < 50; i++) {
RegroupData.regroupData(list, true, true);
}
} else {
transformData(list, listResult, listValue);
}
return list;
}
private void transformData(List<ReportValue> list, List<Map<String, Object>> maps, List<Integer> listValue) {
for (Integer integer : listValue) {
for (Map<String, Object> map : maps) {
ReportValue reportValue = new ReportValue();
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setFmaxValue(new Float(((BigDecimal) map.get("I_" + integer + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((BigDecimal) map.get("I_" + integer + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((BigDecimal) map.get("I_" + integer)).floatValue()));
if (map.containsKey("I_" + integer + "_CP95")) {
reportValue.setCp95Value(new Float(((BigDecimal) map.get("I_" + integer + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}
}
@Override
public List<ReportValue> getHICurrent(Condition condition, Integer times) {
List<ReportValue> list = new ArrayList<>();
condition.setTimes(times);
List<Map<String, Object>> listResult = getICurrentMapper.getHICurrent(condition);
if (0 < listResult.size() && null != listResult.get(0)) {
transformHData(list, listResult, times);
}
return list;
}
private void transformHData(List<ReportValue> list, List<Map<String, Object>> maps, Integer integer) {
for (Map<String, Object> map : maps) {
ReportValue reportValue = new ReportValue();
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setFmaxValue(new Float(((Double) map.get("I_" + integer + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((Double) map.get("I_" + integer + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((Double) map.get("I_" + integer)).floatValue()));
try {
reportValue.setStrTime(PubUtils.date2String((Date) map.get("TIMEID"), "yyyy-MM-dd"));
} catch (Exception e) {
logger.error(e.getMessage());
}
if (map.containsKey("I_" + integer + "_CP95")) {
reportValue.setCp95Value(new Float(((Double) map.get("I_" + integer + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}
}

View File

@@ -0,0 +1,63 @@
package com.pqs9300.serviceimpl.report;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pqs9300.mapper.report.GetInICurrentMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetInICurrentService;
@Service
public class GetInICurrentServiceImpl implements GetInICurrentService {
@Autowired
private GetInICurrentMapper getICurrentMapper;
@Override
public List<ReportValue> getInICurrent(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<Integer> listValue = new ArrayList<>();
for (int i = 1; i < 51; i++) {
listValue.add(new Integer(i));
}
//获取间谐波电流幅值
List<Map<String, Object>> listResult = getICurrentMapper.getICurrent(condition, listValue);
if (0 == listResult.size() || null == listResult.get(0)) {
for (int i = 0; i < 50; i++) {
RegroupData.regroupData(list, true, true);
}
} else {
transformData(list, listResult, listValue);
}
return list;
}
private void transformData(List<ReportValue> list, List<Map<String, Object>> maps, List<Integer> listValue) {
for (Integer integer : listValue) {
for (Map<String, Object> map : maps) {
ReportValue reportValue = new ReportValue();
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setFmaxValue(new Float(((BigDecimal) map.get("I_" + integer + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((BigDecimal) map.get("I_" + integer + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((BigDecimal) map.get("I_" + integer)).floatValue()));
if (map.containsKey("I_" + integer + "_CP95")) {
reportValue.setCp95Value(new Float(((BigDecimal) map.get("I_" + integer + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}
}
}

View File

@@ -0,0 +1,80 @@
package com.pqs9300.serviceimpl.report;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pqs9300.mapper.report.GetDistortionDataMapper;
import com.pqs9300.mapper.report.GetInVoltageRateMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.ReportValue;
import com.pqs9300.service.report.GetInVoltageRateService;
@Service
public class GetInVoltageRateServiceImpl implements GetInVoltageRateService {
@Autowired
private GetInVoltageRateMapper getInVoltageRateMapper;
@Autowired
private GetDistortionDataMapper getDistortionDataMapper;
@Override
public List<ReportValue> getInVoltageRate(Condition condition) {
List<ReportValue> list = new ArrayList<>();
List<Integer> listValue = new ArrayList<>();
for (int i = 2; i < 51; i++) {
listValue.add(new Integer(i));
}
//获取基波电压幅值单位kV
List<ReportValue> listFirstHarmonic = getInVoltageRateMapper.getInFirstHarmonic(condition);
if (0 == listFirstHarmonic.size() || listFirstHarmonic.get(0) == null) {
RegroupData.regroupData(list, true, true);
} else {
list.addAll(getInVoltageRateMapper.getInFirstHarmonic(condition));
}
//获取间谐波电压含有率
List<Map<String, Object>> listRate = getInVoltageRateMapper.getInVoltageRate(condition, listValue);
if (0 == listRate.size() || null == listRate.get(0)) {
for (int i = 0; i < 49; i++) {
RegroupData.regroupData(list, true, true);
}
} else {
transformData(list, listRate, listValue);
}
//获取电压畸变率
List<ReportValue> listU = getDistortionDataMapper.getDistortionData(condition, "V");
RegroupData.regroupData(listU, true);
list.addAll(listU);
return list;
}
private void transformData(List<ReportValue> list, List<Map<String, Object>> maps, List<Integer> listValue) {
for (Integer integer : listValue) {
for (Map<String, Object> map : maps) {
ReportValue reportValue = new ReportValue();
reportValue.setPhaseType(map.get("PHASETYPE").toString());
reportValue.setFmaxValue(new Float(((BigDecimal) map.get("V_" + integer + "_MAX")).floatValue()));
reportValue.setMinValue(new Float(((BigDecimal) map.get("V_" + integer + "_MIN")).floatValue()));
reportValue.setMeanValue(new Float(((BigDecimal) map.get("V_" + integer)).floatValue()));
if (map.containsKey("V_" + integer + "_CP95")) {
reportValue.setCp95Value(new Float(((BigDecimal) map.get("V_" + integer + "_CP95")).floatValue()));
} else {
reportValue.setCp95Value(null);
}
list.add(reportValue);
}
}
}
}

View File

@@ -0,0 +1,49 @@
package com.pqs9300.serviceimpl.report;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.njcn.mapper.configuration.OverLimitMapper;
import com.njcn.pojo.configuration.OverLimit;
import com.pqs9300.mapper.report.GetVirtualDataMapper;
import com.pqs9300.pojo.report.Condition;
import com.pqs9300.pojo.report.OverLimitInfo;
import com.pqs9300.service.report.GetOverLimitDataService;
import tk.mybatis.mapper.entity.Example;
@Service
public class GetOverLimitDataServiceImpl implements GetOverLimitDataService {
@Autowired
private OverLimitMapper overLimitMapper;
@Autowired
private GetVirtualDataMapper getVirtualDataMapper;
@Override
public OverLimitInfo getOverLimitData(Condition condition) {
OverLimitInfo overLimitInfo = new OverLimitInfo();
//查询监测点限值
Example example = new Example(OverLimit.class);
example.createCriteria().andEqualTo("myIndex", condition.getPointIndex());
List<OverLimit> overLimit = overLimitMapper.selectByExample(example);
overLimitInfo.setOverLimitRate(overLimit);
//查询时间段内共有多少条记录,并*0.95取整处理用来计算CP95值 降序*0.05进一位计算
//plt单独查询
String tableName = condition.getB() ? "data_v" : "day_v";
double count = Math.ceil(getVirtualDataMapper.getTotalCP95(condition, tableName).intValue() * 0.05);
overLimitInfo.setCount(count);
String tablename = condition.getB() ? "data_plt" : "day_plt";
double pltCount = Math.ceil(getVirtualDataMapper.getTotalPltCP95(condition, tablename).intValue() * 0.05);
overLimitInfo.setPltCount(pltCount);
String pstName = condition.getB() ? "data_flicker" : "day_flicker";
double pstCount = Math.ceil(getVirtualDataMapper.getTotalPstCP95(condition, pstName).intValue() * 0.05);
overLimitInfo.setPstCount(pstCount);
return overLimitInfo;
}
}

Some files were not shown because too many files have changed in this diff Show More