Commit 7a6088b5 authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.修改极短期间开预测定时任务逻辑,解决优化后部分优化结果时间段过短问题;
2.修改心知天气气象数据获取及接收定时任务,解决天气数据通过邮件下载后,部分数据精度丢失问题;
3.修改首页各个接口逻辑,对小数类型字段进行处理,修改首页接口,增加小时保留两位四舍五入逻辑,同时解决线路详情接口部分查询逻辑报错问题;
4.能耗分析模块,能耗概览接口修改,修改查询逻辑,修改数据获取逻辑及绿电占比计算逻辑;
5.能耗分析模块,消纳曲线用电趋势接口修改,修改查询逻辑,修改数据获取逻辑及绿电占比计算逻辑;
6.能耗分析模块,用电详情接口修改,修改查询逻辑,修改数据获取逻辑及绿电占比计算逻辑;
7.修改首页先导实验井间开制度模块接口查询逻辑,解决极短期间开优化修改后没有第一次开井时间标识导致数据查询不出来问题;
8.基础间开制度新增修改接口逻辑修改,删除防冻堵对井口处理逻辑;
9.极短期间开优化算法修改,增加防冻堵井开井时间优化逻辑;
10.提供长庆通过日期获取当日间开优化结果接口开发,完成接口冒烟测试并添加线上接口文档;
11.提供长庆1天光伏出力预测结果接口开发,完成接口冒烟测试并添加线上接口文档;
12.提供长庆15天光伏出力预测结果接口开发,完成接口冒烟测试并添加线上接口文档;
13.修改极短期间开优化算法,优化防冻堵策略;
14.开发第三方历史天气导入功能;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 1567d994
...@@ -64,38 +64,6 @@ public class LoginService { ...@@ -64,38 +64,6 @@ public class LoginService {
*/ */
private static final int EXPIRE_TIME = 6000000; private static final int EXPIRE_TIME = 6000000;
/**
* 平台用户类型(platformType):
* 1 PC端
* 2 BI查看 (仅BI)
* 4 移动端
* 5 BI数据分析(只可创建excel和自助数据集) (仅BI)
* 6 BI数据处理(可创建sql/db/excel/自助数据集)(仅BI)
*
* @return
*/
public static String getString(XContext context) {
PpsUserSession session = context.getSession(PpsUserSession.class);
HashMap<String, Object> map = new HashMap<>();
HashMap<String, Object> department = new HashMap<>();
String ouName = getDepartment(session.getOuId(), context);
department.put("name", ouName != null ? ouName : session.getOuName());
department.put("id", session.getOuId());
map.put("username", session.getLoginName());
map.put("department", department);
/* ArrayList<String> list1 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
list1.add("职员");
list2.add(1);
map.put("roles", list1);
map.put("platformType", list2);*/
String jsonString = JSONUtil.toJsonStr(map);
return jsonString;
}
@XText("获取最后一次登录信息") @XText("获取最后一次登录信息")
@XApiGet @XApiGet
public XSingleResult<GetLastLoginInfoOutput> getLastLoginInfo(XContext context, GetLastLoginInfoInput input) { public XSingleResult<GetLastLoginInfoOutput> getLastLoginInfo(XContext context, GetLastLoginInfoInput input) {
...@@ -166,7 +134,7 @@ public class LoginService { ...@@ -166,7 +134,7 @@ public class LoginService {
SysUserEnt sysUserEnt = sysUserResult.getResult(); SysUserEnt sysUserEnt = sysUserResult.getResult();
if (sysUserEnt.getStatus() != null && sysUserEnt.getStatus() == 1) if (sysUserEnt.getStatus() != null && sysUserEnt.getStatus() == 1)
return XSingleResult.error(context, LoginError.ISLOCKED); return XSingleResult.error(context, LoginError.ISLOCKED);
long getTime = new Date().getTime(); long getTime = System.currentTimeMillis();
if (sysUserEnt.getIsOuter() != null && sysUserEnt.getIsOuter() != 1) if (sysUserEnt.getIsOuter() != null && sysUserEnt.getIsOuter() != 1)
return XSingleResult.error(context, LoginError.ISOUT); return XSingleResult.error(context, LoginError.ISOUT);
Date now = new Date(); Date now = new Date();
...@@ -184,10 +152,8 @@ public class LoginService { ...@@ -184,10 +152,8 @@ public class LoginService {
long getOrgTime = new Date().getTime(); long getOrgTime = new Date().getTime();
long getOrgTimec = getTime - getOrgTime; long getOrgTimec = getTime - getOrgTime;
System.out.println("获取登录人组织机构信息:--------------------------上一步时间差--" + getOrgTimec + "------当前时间-" + getOrgTime); System.out.println("获取登录人组织机构信息:--------------------------上一步时间差--" + getOrgTimec + "------当前时间-" + getOrgTime);
XApiCookieConf apiCookieConf = XConfManager.getConf(XApiCookieConf.class); XApiCookieConf apiCookieConf = XConfManager.getConf(XApiCookieConf.class);
Integer expiresIn = apiCookieConf.getExpires(); Integer expiresIn = apiCookieConf.getExpires();
String userName = sysUserEnt.getUserName(); //姓名 String userName = sysUserEnt.getUserName(); //姓名
Long orgId = 1L; //组织机构id Long orgId = 1L; //组织机构id
Long roleId0 = 1L; //角色id1 Long roleId0 = 1L; //角色id1
...@@ -246,11 +212,9 @@ public class LoginService { ...@@ -246,11 +212,9 @@ public class LoginService {
if (StringUtils.isBlank(phone)) { if (StringUtils.isBlank(phone)) {
return XSingleResult.error(context, LoginError.NotExistPhone); return XSingleResult.error(context, LoginError.NotExistPhone);
} }
if (!PatternUtil.checkPhone(phone)) { if (!PatternUtil.checkPhone(phone)) {
return XSingleResult.error(context, LoginError.NotExistPhone); return XSingleResult.error(context, LoginError.NotExistPhone);
} }
ForgetPwdOutput output = new ForgetPwdOutput(); ForgetPwdOutput output = new ForgetPwdOutput();
output.setPhone(phone.substring(phone.length() - 4)); output.setPhone(phone.substring(phone.length() - 4));
return XSingleResult.success(output); return XSingleResult.success(output);
...@@ -331,7 +295,7 @@ public class LoginService { ...@@ -331,7 +295,7 @@ public class LoginService {
@XText("测试token是否有效") @XText("测试token是否有效")
@XApiPost @XApiPost
public XSingleResult<TestTokenOutput> testToken(XContext context) { public XSingleResult<TestTokenOutput> testToken(XContext context) {
PpsUserSession session = null; PpsUserSession session;
try { try {
session = context.getSession(PpsUserSession.class); session = context.getSession(PpsUserSession.class);
context.log().info("session:{}", session); context.log().info("session:{}", session);
...@@ -396,7 +360,6 @@ public class LoginService { ...@@ -396,7 +360,6 @@ public class LoginService {
FineReportThirdTokenCache cache = list.get(0); FineReportThirdTokenCache cache = list.get(0);
report.setThirdToken(cache.getCacheCode()); report.setThirdToken(cache.getCacheCode());
} }
} else { } else {
String string = getString(context); String string = getString(context);
System.out.println(string); System.out.println(string);
...@@ -420,7 +383,7 @@ public class LoginService { ...@@ -420,7 +383,7 @@ public class LoginService {
} }
} }
}*/ }*/
Date expireTime = new Date(new Date().getTime() + EXPIRE_TIME); Date expireTime = new Date(System.currentTimeMillis() + EXPIRE_TIME);
String third_token = ""; String third_token = "";
try { try {
third_token = io.jsonwebtoken.Jwts.builder() third_token = io.jsonwebtoken.Jwts.builder()
...@@ -431,7 +394,6 @@ public class LoginService { ...@@ -431,7 +394,6 @@ public class LoginService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
List<FineReportThirdTokenCache> list = new ArrayList<>(); List<FineReportThirdTokenCache> list = new ArrayList<>();
FineReportThirdTokenCache cache = new FineReportThirdTokenCache(); FineReportThirdTokenCache cache = new FineReportThirdTokenCache();
cache.setCacheKey(session.getLoginName()); cache.setCacheKey(session.getLoginName());
...@@ -464,7 +426,7 @@ public class LoginService { ...@@ -464,7 +426,7 @@ public class LoginService {
if (StringUtils.isBlank(loginParam)) { if (StringUtils.isBlank(loginParam)) {
return XSingleResult.error(context, LoginError.Trade_ParamIsNull); return XSingleResult.error(context, LoginError.Trade_ParamIsNull);
} }
String loginInfo = null; String loginInfo;
try { try {
String privateKey = LoginConfig.rsaPrivateKey.findValue(context); String privateKey = LoginConfig.rsaPrivateKey.findValue(context);
privateKey = XEncryptUtils.decrypt(privateKey); privateKey = XEncryptUtils.decrypt(privateKey);
...@@ -483,7 +445,6 @@ public class LoginService { ...@@ -483,7 +445,6 @@ public class LoginService {
context.getLogger().error("参数格式有误", e); context.getLogger().error("参数格式有误", e);
return XSingleResult.error(context, LoginError.Trade_ParamFormatError); return XSingleResult.error(context, LoginError.Trade_ParamFormatError);
} }
SysUserMapper mapper = context.getBean(SysUserMapper.class); SysUserMapper mapper = context.getBean(SysUserMapper.class);
QueryWrapper<SysUserEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysUserEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserEnt::getLoginName, tradeLoginInfo.getLoginName()) queryWrapper.lambda().eq(SysUserEnt::getLoginName, tradeLoginInfo.getLoginName())
...@@ -492,10 +453,8 @@ public class LoginService { ...@@ -492,10 +453,8 @@ public class LoginService {
SysUserEnt sysUserEnt = mapper.selectOne(queryWrapper); SysUserEnt sysUserEnt = mapper.selectOne(queryWrapper);
if (sysUserEnt == null) if (sysUserEnt == null)
return XSingleResult.error(context, LoginError.Trade_LoginError); return XSingleResult.error(context, LoginError.Trade_LoginError);
XApiCookieConf apiCookieConf = XConfManager.getConf(XApiCookieConf.class); XApiCookieConf apiCookieConf = XConfManager.getConf(XApiCookieConf.class);
Integer expiresIn = apiCookieConf.getExpires(); Integer expiresIn = apiCookieConf.getExpires();
String userName = sysUserEnt.getUserName(); //姓名 String userName = sysUserEnt.getUserName(); //姓名
Long orgId = LOGIN_FLAG_TRADE; //组织机构id - 交易平台登陆专用值 Long orgId = LOGIN_FLAG_TRADE; //组织机构id - 交易平台登陆专用值
Long roleId0 = 1L; //角色id1 Long roleId0 = 1L; //角色id1
...@@ -514,8 +473,7 @@ public class LoginService { ...@@ -514,8 +473,7 @@ public class LoginService {
userName, userName,
new XSsoAuth(uniqueId, ssoToken, ssoRefreshToken)); new XSsoAuth(uniqueId, ssoToken, ssoRefreshToken));
XSingleResult<XToken> saveUserResult = XTokenHelper.saveUser(context, user, expiresIn); XSingleResult<XToken> saveUserResult = XTokenHelper.saveUser(context, user, expiresIn);
saveUserResult.throwIfException(); saveUserResult.throwIfFail();
TradeLoginOutput output = new TradeLoginOutput(); TradeLoginOutput output = new TradeLoginOutput();
output.setExpiresIn(expiresIn); output.setExpiresIn(expiresIn);
output.setToken(saveUserResult.getResult().getToken()); output.setToken(saveUserResult.getResult().getToken());
...@@ -524,6 +482,35 @@ public class LoginService { ...@@ -524,6 +482,35 @@ public class LoginService {
/*------------------------------- private -------------------------------*/ /*------------------------------- private -------------------------------*/
/**
* 平台用户类型(platformType):
* 1 PC端
* 2 BI查看 (仅BI)
* 4 移动端
* 5 BI数据分析(只可创建excel和自助数据集) (仅BI)
* 6 BI数据处理(可创建sql/db/excel/自助数据集)(仅BI)
*
* @return
*/
private String getString(XContext context) {
PpsUserSession session = context.getSession(PpsUserSession.class);
HashMap<String, Object> map = new HashMap<>();
HashMap<String, Object> department = new HashMap<>();
String ouName = getDepartment(session.getOuId(), context);
department.put("name", ouName != null ? ouName : session.getOuName());
department.put("id", session.getOuId());
map.put("username", session.getLoginName());
map.put("department", department);
/* ArrayList<String> list1 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
list1.add("职员");
list2.add(1);
map.put("roles", list1);
map.put("platformType", list2);*/
String jsonString = JSONUtil.toJsonStr(map);
return jsonString;
}
private static String getDepartment(String ouId, XContext context) { private static String getDepartment(String ouId, XContext context) {
try { try {
SysOrganizationRelMapper bean = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper bean = context.getBean(SysOrganizationRelMapper.class);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment