Commit 683131a1 by xuchengsi

Merge remote-tracking branch 'origin/master'

parents f3b93dd1 c52dab0c
......@@ -404,7 +404,7 @@ public class AvailCapMain {
// hardLine为重载线路列表数据,属性devName;substation;maxI;switchName;ratedCurrent对应界面表格中
// 线路名、所属变电站、最大电流、智能开关、限额
SqliteDb sqliteDb = new SqliteDb(args[1]);
List<WarnLine> hardLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 1);
List<WarnLine> hardLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 1,-1,-1);
System.out.println(hardLine.size());
break;
}
......@@ -413,7 +413,7 @@ public class AvailCapMain {
// overLine为超载线路列表数据,属性devName;substation;maxI;switchName;ratedCurrent对应界面表格中
// 线路名、所属变电站、最大电流、智能开关、限额
SqliteDb sqliteDb = new SqliteDb(args[1]);
List<WarnLine> overLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 2);
List<WarnLine> overLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 2,-1,-1);
System.out.println(overLine.size());
break;
}
......@@ -422,7 +422,7 @@ public class AvailCapMain {
// hardTf为重载公变列表数据,属性devName;lineName;substation;maxLoad;ratedCap对应界面表格中
// 配变名、线路、变电站、最大负荷、容量
SqliteDb sqliteDb = new SqliteDb(args[1]);
List<WarnTf> hardTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 1);
List<WarnTf> hardTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 1,-1,-1);
System.out.println(hardTf.size());
break;
}
......@@ -430,7 +430,7 @@ public class AvailCapMain {
// allPsOverTf为查询所有馈线超载公变。args[1]为存储所有馈线数据的数据库文件的路径
// overTf为超载公变列表数据,属性devName;lineName;substation;maxLoad;ratedCap对应界面表格中配变名、线路、变电站、最大负荷、容量
SqliteDb sqliteDb = new SqliteDb(args[1]);
List<WarnTf> overTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 2);
List<WarnTf> overTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 2,-1,-1);
System.out.println(overTf.size());
break;
}
......
......@@ -1055,15 +1055,49 @@ public class SqliteDb {
return warnLines;
}
/**
* 查询按过载情况查询预警线路
* @param tableName 表名
* @return
*/
public int queryWarnLineCount(String tableName, int loadState) {
List<WarnLine> warnLines = new LinkedList<>();
Connection conn = createConn();
String sql = "select count(*) from " + tableName + " where loadState=" + loadState;
Statement stmt = null;
ResultSet rs = null;
int count=0;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
rs.next();
count = rs.getInt(1);
} catch (SQLException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
} catch (SQLException e) {
}
}
return count;
}
/**
* 查询按过载情况查询预警线路
* @param tableName 表名
* @return
*/
public List<WarnLine> queryWarnLine(String tableName, int loadState) {
public List<WarnLine> queryWarnLine(String tableName, int loadState,int page,int rows) {
List<WarnLine> warnLines = new LinkedList<>();
Connection conn = createConn();
String sql = "select * from " + tableName + " where loadState=" + loadState;
if(page>0 && rows>0){
sql +=" limit " + (page-1)*rows + "," + rows;
}
Statement stmt = null;
ResultSet rs = null;
try {
......@@ -1135,15 +1169,50 @@ public class SqliteDb {
return warnTfs;
}
/**
* 查询预警公变
* @param tableName 表名
* @return
*/
public int queryWarnTfCount(String tableName, int loadState) {
Connection conn = createConn();
String sql = "select count(*) from " + tableName + " where loadState=" + loadState;
Statement stmt = null;
ResultSet rs = null;
int count = 0;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
rs.next();
count = rs.getInt(1);
} catch (SQLException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
} catch (SQLException e) {
}
}
return count;
}
/**
* 查询预警公变
* @param tableName 表名
* @return
*/
public List<WarnTf> queryWarnTf(String tableName, int loadState) {
public List<WarnTf> queryWarnTf(String tableName, int loadState,int page,int rows) {
List<WarnTf> warnTfs = new LinkedList<>();
Connection conn = createConn();
String sql = "select * from " + tableName + " where loadState=" + loadState;
if(page>0 && rows>0){
sql +=" limit " + (page-1)*rows + "," + rows;
}
Statement stmt = null;
ResultSet rs = null;
try {
......
package com.jinyun.web.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.maxAge(3600)
.allowCredentials(true);
}
}
......@@ -25,8 +25,8 @@ public class LoadPosController {
@ApiOperation(value = "分析结果列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",required = true),
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/loadPosList",method = RequestMethod.GET)
public Object loadPosSeason(@RequestParam("page") int page,@RequestParam("rows") int rows) {
......@@ -51,8 +51,8 @@ public class LoadPosController {
@ApiOperation(value = "负荷接入分析", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineName", value = "线路名称", dataType = "string", paramType = "query",required = true),
@ApiImplicitParam(name = "cap", value = "负荷容量", dataType = "int", paramType = "query",required = true),
@ApiImplicitParam(name = "type", value = "负荷特征(1为峰用电,2为谷用电,3为峰谷用电)", dataType = "int", paramType = "query",required = true),
@ApiImplicitParam(name = "cap", value = "负荷容量", dataType = "int", paramType = "query",example = "0",required = true),
@ApiImplicitParam(name = "type", value = "负荷特征(1为峰用电,2为谷用电,3为峰谷用电)", dataType = "int", paramType = "query",example = "0",required = true),
})
@RequestMapping(value = "/loadPosAnalysis",method = RequestMethod.GET)
public Object loadPosAnalysis(@RequestParam("lineName") String lineName,@RequestParam("cap") int cap,@RequestParam("type") int type) {
......
......@@ -2,10 +2,14 @@ package com.jinyun.web.controller;
import com.jinyun.web.service.CapService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -31,30 +35,74 @@ public class MainPageController {
}
@ApiOperation(value = "重载线路列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/hardLineList",method = RequestMethod.GET)
public Object hardLineList() {
List result = capService.hardLineList();
public Object hardLineList(@RequestParam("page") int page,@RequestParam("rows") int rows) {
int total = capService.hardLineListCount();
List hardLineList = new ArrayList();
if(total>0){
hardLineList = capService.hardLineList(page,rows);
}
Map<String,Object> result = new HashMap<>();
result.put("total",total);
result.put("rows",hardLineList);
return result;
}
@ApiOperation(value = "重载配变列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/hardTransformerList",method = RequestMethod.GET)
public Object hardTransformerList() {
List result = capService.hardTransformerList();
public Object hardTransformerList(@RequestParam("page") int page,@RequestParam("rows") int rows) {
int total = capService.hardTransformerListCount();
List hardTransformerList = new ArrayList();
if(total>0){
hardTransformerList = capService.hardTransformerList(page,rows);
}
Map<String,Object> result = new HashMap<>();
result.put("total",total);
result.put("rows",hardTransformerList);
return result;
}
@ApiOperation(value = "超载线路列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/overLineList",method = RequestMethod.GET)
public Object overLineList() {
List result = capService.overLineList();
public Object overLineList(@RequestParam("page") int page,@RequestParam("rows") int rows) {
int total = capService.overLineListCount();
List overLineList = new ArrayList();
if(total>0){
overLineList = capService.overLineList(page,rows);
}
Map<String,Object> result = new HashMap<>();
result.put("total",total);
result.put("rows",overLineList);
return result;
}
@ApiOperation(value = "超载配变列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/overTransformerList",method = RequestMethod.GET)
public Object overTransformerList() {
List result = capService.overTransformerList();
public Object overTransformerList(@RequestParam("page") int page,@RequestParam("rows") int rows) {
int total = capService.overTransformerListCount();
List overTransformerList = new ArrayList();
if(total>0){
overTransformerList = capService.overTransformerList(page,rows);
}
Map<String,Object> result = new HashMap<>();
result.put("total",total);
result.put("rows",overTransformerList);
return result;
}
......@@ -67,9 +115,13 @@ public class MainPageController {
}
@ApiOperation(value = "配变三相不平衡度列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
@ApiImplicitParam(name = "rows", value = "行数", dataType = "int", paramType = "query",example = "0",defaultValue = "0",required = true),
})
@RequestMapping(value = "/transformerUnbalanceList",method = RequestMethod.GET)
public Object transformerUnbalanceList() {
List result = capService.transformerUnbalanceList();
public Object transformerUnbalanceList(@RequestParam("page") int page,@RequestParam("rows") int rows) {
Map<String,Object> result = capService.transformerUnbalanceList(page,rows);
return result;
}
......
......@@ -11,10 +11,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
/**
* @author jinbin
* @date 2018-07-08 20:52
*/
@Service("CapService")
public class CapService {
static String allFeederNameTable = "所有馈线名称";
......@@ -42,9 +38,17 @@ public class CapService {
static String loadPosTable = "负荷接入位置";
static String allPsDbFile = "D:\\others\\yunqi\\项目\\缙云项目\\test\\allPsDb\\allPs.db";
static String feederDbFile = "D:\\others\\yunqi\\项目\\缙云项目\\test\\feederDb";
public static void setFeederDbName(String feederDbName) {
CapService.feederDbName = feederDbName;
}
static String feederDbName = "溪南G134线";
static String cimFile = "D:\\others\\yunqi\\项目\\缙云项目\\test\\CIM";
public Map<String, Object> gridStatistics() {
Map<String,Object> result = new HashMap<>();
result.put("110StationCount",25);
......@@ -80,7 +84,7 @@ public class CapService {
Map<String,Object> result = new HashMap<>();
int count = 0;
for(TfUb tfUb:tfUbs){
if(count == 3) break;
if(count == 5) break;
if(result.containsKey(tfUb.getDevName()))
continue;
result.put(tfUb.getDevName(),tfUb.getUb());
......@@ -89,38 +93,73 @@ public class CapService {
return result;
}
public List transformerUnbalanceList() {
public Map<String,Object> transformerUnbalanceList(int page, int rows) {
SqliteDb allPsDb = new SqliteDb(allPsDbFile);
List<String> feeders = allPsDb.queryAllFeederName(allFeederNameTable); // 查询馈线名称
List<TfUb> tfUbs = new LinkedList<>();
int startRow = (page-1)*rows;
int endRow = startRow+rows;
for (String feeder : feeders) {
SqliteDb sqliteDb = new SqliteDb(feederDbFile + "\\" + feeder + ".db");
tfUbs.addAll(sqliteDb.queryTfMonthUb(feeder + tfMonthUbTableName));
List<TfUb> c = sqliteDb.queryTfMonthUb(feeder + tfMonthUbTableName);
tfUbs.addAll(c);;
}
return tfUbs;
List<TfUb> result = new LinkedList<>();
for(int i=startRow;i<endRow;i++){
result.add(tfUbs.get(i));
}
Map<String,Object> result1 = new HashMap<>();
result1.put("total",tfUbs.size());
result1.put("rows",result);
return result1;
}
public int hardLineListCount() {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
int total = sqliteDb.queryWarnLineCount(allPsLineWarnTable, 1);
return total;
}
public List hardLineList() {
public List hardLineList(int page, int rows) {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
List<WarnLine> hardLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 1);
List<WarnLine> hardLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 1,page,rows);
return hardLine;
}
public List hardTransformerList() {
public int hardTransformerListCount() {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
List<WarnLine> overLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 2);
return overLine;
int total = sqliteDb.queryWarnTfCount(allPsTfWarnTable, 1);
return total;
}
public List overLineList() {
public List hardTransformerList(int page, int rows) {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
List<WarnTf> hardTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 1);
List<WarnTf> hardTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 1,page,rows);
return hardTf;
}
public List overTransformerList() {
public int overLineListCount() {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
int count = sqliteDb.queryWarnLineCount(allPsLineWarnTable, 2);
return count;
}
public List overLineList(int page, int rows) {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
List<WarnLine> overLine = sqliteDb.queryWarnLine(allPsLineWarnTable, 2,page,rows);
return overLine;
}
public int overTransformerListCount() {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
int count = sqliteDb.queryWarnTfCount(allPsTfWarnTable, 2);
return count;
}
public List overTransformerList(int page, int rows) {
SqliteDb sqliteDb = new SqliteDb(allPsDbFile);
List<WarnTf> overTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 2);
List<WarnTf> overTf = sqliteDb.queryWarnTf(allPsTfWarnTable, 2,page,rows);
return overTf;
}
......
package com.jinyin.web
import com.alibaba.fastjson.JSONObject
import com.jinyun.web.annotation.UserLoginToken
import com.jinyun.web.entity.User
import com.jinyun.web.service.TokenService
import com.jinyun.web.service.UserService
import io.swagger.annotations.Api
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.RequestMapping
import org.springframework.web.bind.annotation.RestController
@Api(value = "desc of class", tags = arrayOf("Login1"), description = "登录")
@RestController
@RequestMapping("login1")
class LoginController {
@Autowired
var userService: UserService? = null
@Autowired
var tokenService: TokenService? = null
//登录
@PostMapping("/login1")
fun login(user: User): Any {
val jsonObject = JSONObject()
val userForBase = userService!!.findByUsername(user)
return if (userForBase == null) {
jsonObject["message"] = "登录失败,用户不存在"
jsonObject
} else {
// if (userForBase.password != user.password) {
// jsonObject["message"] = "登录失败,密码错误"
// jsonObject
// } else {
// val token = tokenService!!.getToken(userForBase)
// jsonObject["token"] = token
// jsonObject["user"] = userForBase
// jsonObject
// }
}
}
@get:GetMapping("/getMessage1")
@get:UserLoginToken
val message: String
get() = "你已通过验证"
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论