1.谐波溯源算法
2.北京暂降平台
This commit is contained in:
@@ -195,6 +195,9 @@ public class HarmonicUpServiceImpl extends ServiceImpl<UpHarmonicDetailMapper,Up
|
|||||||
|
|
||||||
// 1. 获取线路ID和台账基础信息
|
// 1. 获取线路ID和台账基础信息
|
||||||
List<String> lineIds = commGeneralService.getRunLineIdsByDept(param.getDeptId());
|
List<String> lineIds = commGeneralService.getRunLineIdsByDept(param.getDeptId());
|
||||||
|
if(CollUtil.isEmpty(lineIds)){
|
||||||
|
throw new BusinessException(CommonResponseEnum.FAIL,"当前部门未绑定监测点");
|
||||||
|
}
|
||||||
List<LedgerBaseInfo> ledgerBaseInfoList = ledgerScaleMapper.getLedgerBaseInfo(lineIds);
|
List<LedgerBaseInfo> ledgerBaseInfoList = ledgerScaleMapper.getLedgerBaseInfo(lineIds);
|
||||||
|
|
||||||
if (CollUtil.isEmpty(ledgerBaseInfoList)) {
|
if (CollUtil.isEmpty(ledgerBaseInfoList)) {
|
||||||
@@ -558,10 +561,6 @@ public class HarmonicUpServiceImpl extends ServiceImpl<UpHarmonicDetailMapper,Up
|
|||||||
.sorted(Comparator.comparing(AnomalyInfo::getTime))
|
.sorted(Comparator.comparing(AnomalyInfo::getTime))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if(sortedAnomalies.get(0).getLineId().equals("9686e66738bab8516ff2c2e9fedc0518")){
|
|
||||||
System.out.println(555);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否连续
|
// 检查是否连续
|
||||||
List<List<AnomalyInfo>> infoList =findAllContinuousAnomalies(sortedAnomalies,ledgerBaseInfoMap);
|
List<List<AnomalyInfo>> infoList =findAllContinuousAnomalies(sortedAnomalies,ledgerBaseInfoMap);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.product.advance.responsility.pojo.constant;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum CalculationType {
|
||||||
|
|
||||||
|
PW_TYPE(0,"配网类型"),
|
||||||
|
SYSTEM_TYPE(1,"系统类型")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
CalculationType(int code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,5 +25,7 @@ public class RespDataDTO extends RespData implements Serializable {
|
|||||||
|
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,4 +52,9 @@ public class RespData extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0/null:配网 1:系统)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
|
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.product.advance.responsility.mapper.RespDataResultMapper;
|
import com.njcn.product.advance.responsility.mapper.RespDataResultMapper;
|
||||||
|
import com.njcn.product.advance.responsility.pojo.constant.CalculationType;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.ResponsibilityResult;
|
import com.njcn.product.advance.responsility.pojo.dto.ResponsibilityResult;
|
||||||
@@ -48,11 +49,11 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<ResponsibilityResult> displayHistoryData(String id, Integer time) {
|
public List<ResponsibilityResult> displayHistoryData(String id, Integer time) {
|
||||||
List<ResponsibilityResult> responsibilityResults = new ArrayList<>();
|
List<ResponsibilityResult> responsibilityResults = new ArrayList<>();
|
||||||
if (Objects.isNull(time)) {
|
//if (Objects.isNull(time)) {
|
||||||
RespData respData = respDataService.getById(id);
|
RespData respDataQuery = respDataService.getById(id);
|
||||||
String[] split = respData.getDataTimes().split(StrPool.COMMA);
|
String[] split = respDataQuery.getDataTimes().split(StrPool.COMMA);
|
||||||
time = Integer.parseInt(split[0]);
|
time = Integer.parseInt(split[0]);
|
||||||
}
|
//}
|
||||||
LambdaQueryWrapper<RespDataResult> respDataResultLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RespDataResult> respDataResultLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
respDataResultLambdaQueryWrapper.eq(RespDataResult::getResDataId, id)
|
respDataResultLambdaQueryWrapper.eq(RespDataResult::getResDataId, id)
|
||||||
.eq(RespDataResult::getTime, time);
|
.eq(RespDataResult::getTime, time);
|
||||||
@@ -74,12 +75,17 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
|||||||
InputStream userDetailStream = fileStorageUtil.getFileStream(respDataResult.getUserDetailData());
|
InputStream userDetailStream = fileStorageUtil.getFileStream(respDataResult.getUserDetailData());
|
||||||
String userDetailStr = IoUtil.readUtf8(userDetailStream);
|
String userDetailStr = IoUtil.readUtf8(userDetailStream);
|
||||||
List<CustomerData> customerData = JSONArray.parseArray(userDetailStr, CustomerData.class);
|
List<CustomerData> customerData = JSONArray.parseArray(userDetailStr, CustomerData.class);
|
||||||
responsibilityResult.setDatas(customerData);
|
|
||||||
//处理排名前10数据
|
//处理排名前10数据
|
||||||
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
||||||
String respStr = IoUtil.readUtf8(respStream);
|
String respStr = IoUtil.readUtf8(respStream);
|
||||||
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
||||||
|
if(Objects.nonNull(respDataQuery.getType()) && respDataQuery.getType().equals(CalculationType.SYSTEM_TYPE.getCode())){
|
||||||
|
customerData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||||
|
respData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||||
|
}
|
||||||
responsibilityResult.setResponsibilities(respData);
|
responsibilityResult.setResponsibilities(respData);
|
||||||
|
responsibilityResult.setDatas(customerData);
|
||||||
|
|
||||||
responsibilityResults.add(responsibilityResult);
|
responsibilityResults.add(responsibilityResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.FileUtil;
|
import com.njcn.common.utils.FileUtil;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
@@ -41,6 +42,7 @@ import com.njcn.product.advance.responsility.pojo.bo.RespCommon;
|
|||||||
import com.njcn.product.advance.responsility.pojo.bo.RespHarmData;
|
import com.njcn.product.advance.responsility.pojo.bo.RespHarmData;
|
||||||
import com.njcn.product.advance.responsility.pojo.bo.UserDataExcel;
|
import com.njcn.product.advance.responsility.pojo.bo.UserDataExcel;
|
||||||
import com.njcn.product.advance.responsility.pojo.constant.CalculationStatus;
|
import com.njcn.product.advance.responsility.pojo.constant.CalculationStatus;
|
||||||
|
import com.njcn.product.advance.responsility.pojo.constant.CalculationType;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.RespDataDTO;
|
import com.njcn.product.advance.responsility.pojo.dto.RespDataDTO;
|
||||||
@@ -121,6 +123,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
public final static int INTERVAL_TIME_1 = 1;
|
public final static int INTERVAL_TIME_1 = 1;
|
||||||
public final static int INTERVAL_TIME_3 = 3;
|
public final static int INTERVAL_TIME_3 = 3;
|
||||||
public final static int INTERVAL_TIME_5 = 5;
|
public final static int INTERVAL_TIME_5 = 5;
|
||||||
|
public final static int INTERVAL_TIME_10 = 10;
|
||||||
public final static int INTERVAL_TIME_15 = 15;
|
public final static int INTERVAL_TIME_15 = 15;
|
||||||
public final static int INTERVAL_TIME_30 = 30;
|
public final static int INTERVAL_TIME_30 = 30;
|
||||||
public final static int WINDOW_96 = 96;
|
public final static int WINDOW_96 = 96;
|
||||||
@@ -453,8 +456,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
int pNode, pNum, win, harmNum;
|
int pNode, pNum, win, harmNum;
|
||||||
float harmMk;
|
float harmMk;
|
||||||
List<UserDataExcel> userDataExcels = new ArrayList<>();
|
List<UserDataExcel> userDataExcels = new ArrayList<>();
|
||||||
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==1){
|
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||||
userDataExcels = test(responsibilityCalculateParam.getUserList(),responsibilityCalculateParam.getSearchBeginTime(),responsibilityCalculateParam.getSearchEndTime());
|
userDataExcels = sysMonitorDataGet(responsibilityCalculateParam.getUserList(),responsibilityCalculateParam.getSearchBeginTime(),responsibilityCalculateParam.getSearchEndTime());
|
||||||
}else {
|
}else {
|
||||||
userDataExcels = respUserDataService.getUserDataExcelList(responsibilityCalculateParam.getUserDataId());
|
userDataExcels = respUserDataService.getUserDataExcelList(responsibilityCalculateParam.getUserDataId());
|
||||||
|
|
||||||
@@ -618,6 +621,12 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
customerData.add(customerDataT);
|
customerData.add(customerDataT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||||
|
customerData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||||
|
customerResponsibilities.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||||
|
}
|
||||||
|
|
||||||
result.setDatas(customerData);
|
result.setDatas(customerData);
|
||||||
result.setTimeDatas(timeDatas);
|
result.setTimeDatas(timeDatas);
|
||||||
result.setResponsibilities(customerResponsibilities);
|
result.setResponsibilities(customerResponsibilities);
|
||||||
@@ -643,6 +652,11 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
responsibilityData.setDataTimes(responsibilityCalculateParam.getTime().toString());
|
responsibilityData.setDataTimes(responsibilityCalculateParam.getTime().toString());
|
||||||
responsibilityData.setTimeWindow(timeWin);
|
responsibilityData.setTimeWindow(timeWin);
|
||||||
responsibilityData.setState(DataStateEnum.ENABLE.getCode());
|
responsibilityData.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||||
|
responsibilityData.setType(CalculationType.SYSTEM_TYPE.getCode());
|
||||||
|
}else {
|
||||||
|
responsibilityData.setType(CalculationType.PW_TYPE.getCode());
|
||||||
|
}
|
||||||
//进行插入操作
|
//进行插入操作
|
||||||
this.baseMapper.insert(responsibilityData);
|
this.baseMapper.insert(responsibilityData);
|
||||||
} else {
|
} else {
|
||||||
@@ -1435,7 +1449,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(lineId);
|
LineDetailDataVO lineDetailData = lineService.getLineDetailData(lineId);
|
||||||
int lineInterval = lineDetailData.getTimeInterval();
|
int lineInterval = lineDetailData.getTimeInterval();
|
||||||
int userIntervalTime;
|
int userIntervalTime;
|
||||||
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5) {
|
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5 || lineInterval == INTERVAL_TIME_10) {
|
||||||
userIntervalTime = INTERVAL_TIME_15;
|
userIntervalTime = INTERVAL_TIME_15;
|
||||||
pNum = dateStr.size() * WINDOW_96;
|
pNum = dateStr.size() * WINDOW_96;
|
||||||
} else {
|
} else {
|
||||||
@@ -1474,7 +1488,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
* 获取背景用户的下级用户及其数据
|
* 获取背景用户的下级用户及其数据
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public List<UserDataExcel> test(List<String> userList, String startTime, String endTime){
|
public List<UserDataExcel> sysMonitorDataGet(List<String> userList, String startTime, String endTime){
|
||||||
List<UserDataExcel> userDataExcelList = new ArrayList<>();
|
List<UserDataExcel> userDataExcelList = new ArrayList<>();
|
||||||
PHistoryHarmParam param = new PHistoryHarmParam();
|
PHistoryHarmParam param = new PHistoryHarmParam();
|
||||||
param.setSearchBeginTime(startTime);
|
param.setSearchBeginTime(startTime);
|
||||||
@@ -1485,7 +1499,9 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
List<DataHarmPowerP> result = new ArrayList<>();
|
List<DataHarmPowerP> result = new ArrayList<>();
|
||||||
collect.forEach((k,v)->{
|
collect.forEach((k,v)->{
|
||||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(k);
|
LineDetailDataVO lineDetailData = lineService.getLineDetailData(k);
|
||||||
|
if(v.stream().mapToDouble(DataHarmPowerP::getP).min().getAsDouble() < 0){
|
||||||
|
throw new BusinessException(CommonResponseEnum.FAIL,lineDetailData.getLineName()+"功率数据异常");
|
||||||
|
}
|
||||||
//数据补全
|
//数据补全
|
||||||
List<DataHarmPowerP> dataHarmPowerPList = linearInterpolate(startTime.concat(InfluxDBTableConstant.START_TIME), endTime.concat(InfluxDBTableConstant.END_TIME), lineDetailData.getTimeInterval()*60, v);
|
List<DataHarmPowerP> dataHarmPowerPList = linearInterpolate(startTime.concat(InfluxDBTableConstant.START_TIME), endTime.concat(InfluxDBTableConstant.END_TIME), lineDetailData.getTimeInterval()*60, v);
|
||||||
//数据间隔转换成15分钟
|
//数据间隔转换成15分钟
|
||||||
|
|||||||
@@ -480,16 +480,9 @@ public class LedgerScaleServiceImpl implements LedgerScaleService {
|
|||||||
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
||||||
String respStr = IoUtil.readUtf8(respStream);
|
String respStr = IoUtil.readUtf8(respStream);
|
||||||
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
||||||
List<String> userNos = respData.stream().map(it -> it.getCustomerName().substring(it.getCustomerName().indexOf("(") + 1, it.getCustomerName().indexOf(")"))).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<LedgerBaseInfo> ledgerBaseInfoList = lineMapper.queryMonitorByUser(userNos);
|
|
||||||
Map<String, LedgerBaseInfo> ledgerBaseInfoMap = ledgerBaseInfoList.stream().collect(Collectors.toMap(LedgerBaseInfo::getUserNo, Function.identity()));
|
|
||||||
respData.forEach(it -> {
|
respData.forEach(it -> {
|
||||||
String tem = it.getCustomerName().substring(it.getCustomerName().indexOf("(") + 1, it.getCustomerName().indexOf(")"));
|
String tem = it.getCustomerName().substring(it.getCustomerName().indexOf("(") + 1, it.getCustomerName().indexOf(")"));
|
||||||
if (ledgerBaseInfoMap.containsKey(tem)) {
|
it.setMonitorId(tem);
|
||||||
LedgerBaseInfo ledgerBaseInfo = ledgerBaseInfoMap.get(tem);
|
|
||||||
it.setMonitorId(ledgerBaseInfo.getLineId());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return respData;
|
return respData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,11 +93,6 @@ public class UserReportPO extends BaseEntity {
|
|||||||
@TableField(value = "voltage_level")
|
@TableField(value = "voltage_level")
|
||||||
private String voltageLevel;
|
private String voltageLevel;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户编号
|
|
||||||
*/
|
|
||||||
@TableField(value = "user_no")
|
|
||||||
private String userNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工程名称
|
* 工程名称
|
||||||
|
|||||||
@@ -242,6 +242,19 @@ public class LargeScreenCountController extends BaseController {
|
|||||||
Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam);
|
Page<EventDetailVO> result = largeScreenCountService.eventPage(largeScreenCountParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/eventPageExport")
|
||||||
|
@ApiOperation("导出暂降事件报告")
|
||||||
|
@ApiImplicitParam(name = "largeScreenCountParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<EventDetailVO>> eventPageExport(@RequestBody LargeScreenCountParam largeScreenCountParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("eventPageExport");
|
||||||
|
List<EventDetailVO> result = largeScreenCountService.eventPageExport(largeScreenCountParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/devicePage")
|
@PostMapping("/devicePage")
|
||||||
@ApiOperation("终端分页查询")
|
@ApiOperation("终端分页查询")
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
|||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
System.out.println(55);
|
|
||||||
|
|
||||||
final String authorizationHeader = request.getHeader("Authorization");
|
final String authorizationHeader = request.getHeader("Authorization");
|
||||||
String username = null;
|
String username = null;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public class EventDetailVO {
|
|||||||
private String pointname;
|
private String pointname;
|
||||||
private String gdName;
|
private String gdName;
|
||||||
private String busName;
|
private String busName;
|
||||||
|
private String busVoltageLevel;
|
||||||
|
|
||||||
private String devName;
|
private String devName;
|
||||||
|
|
||||||
private String persisttime;
|
private String persisttime;
|
||||||
|
|||||||
@@ -36,21 +36,27 @@ public class AuthController extends BaseController {
|
|||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/cn_authenticate")
|
@PostMapping("/cn_authenticate")
|
||||||
@ApiOperation("登录认证")
|
@ApiOperation("登录认证")
|
||||||
public HttpResult<AuthResponse> createAuthenticationToken(@RequestBody @Validated AuthRequest authRequest) {
|
public HttpResult<AuthResponse> createAuthenticationToken(@RequestBody @Validated AuthRequest authRequest) {
|
||||||
String methodDescribe = getMethodDescribe("createAuthenticationToken");
|
String methodDescribe = getMethodDescribe("createAuthenticationToken");
|
||||||
//log.info("Authentication request - username: {}, password: {}",authRequest.getUsername(),authRequest.getPassword());
|
//log.info("Authentication request - username: {}, password: {}",authRequest.getUsername(),authRequest.getPassword());
|
||||||
try {
|
try {
|
||||||
boolean hasFlag = redisUtil.hasKey(eventRedisKey+authRequest.getUsername());
|
boolean hasFlag;
|
||||||
if(hasFlag){
|
String pass;
|
||||||
String pass = redisUtil.getRawValue(eventRedisKey+authRequest.getUsername());
|
//针对系统推送的认证特殊处理
|
||||||
|
if ("system_event".equals(authRequest.getUsername())) {
|
||||||
|
pass = authRequest.getPassword();
|
||||||
|
} else {
|
||||||
|
hasFlag = redisUtil.hasKey(eventRedisKey + authRequest.getUsername());
|
||||||
|
if (hasFlag) {
|
||||||
|
pass = redisUtil.getRawValue(eventRedisKey + authRequest.getUsername());
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 执行认证,内部会调用 UserDetailsService 加载用户信息
|
// 执行认证,内部会调用 UserDetailsService 加载用户信息
|
||||||
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(authRequest.getUsername(),pass));
|
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(authRequest.getUsername(), pass));
|
||||||
|
|
||||||
// 将认证信息存入 SecurityContext
|
// 将认证信息存入 SecurityContext
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
@@ -67,9 +73,7 @@ public class AuthController extends BaseController {
|
|||||||
authResponse.setToken(jwt);
|
authResponse.setToken(jwt);
|
||||||
authResponse.setDeptId(department);
|
authResponse.setDeptId(department);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, authResponse, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, authResponse, methodDescribe);
|
||||||
}else {
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ public class MyUserDetailsService implements UserDetailsService {
|
|||||||
|
|
||||||
|
|
||||||
if("system_event".equals(username)){
|
if("system_event".equals(username)){
|
||||||
return new MyUserDetails("12345678910","system_event", "@#001njcnpqs","10001",
|
PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
String encodedPassword = passwordEncoder.encode("@#001njcnpqs");
|
||||||
|
return new MyUserDetails("12345678910","system_event",encodedPassword,"10001",
|
||||||
new ArrayList<>());
|
new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.csrf().disable()
|
http.csrf().disable()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
//.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg").permitAll() // 允许访问认证接口
|
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg").permitAll() // 允许访问认证接口
|
||||||
.antMatchers("/**").permitAll() // 允许访问认证接口
|
//.antMatchers("/**").permitAll() // 允许访问认证接口
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.sessionManagement()
|
.sessionManagement()
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ public interface LargeScreenCountService {
|
|||||||
|
|
||||||
Page<EventDetailVO> eventPage(LargeScreenCountParam largeScreenCountParam);
|
Page<EventDetailVO> eventPage(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|
||||||
|
List<EventDetailVO> eventPageExport(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|
||||||
|
|
||||||
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
|
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|
||||||
Page<EventDetailVO> userEventList(LargeScreenCountParam largeScreenCountParam);
|
Page<EventDetailVO> userEventList(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user