Commit e1459c0f authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改系统首页大屏总览接口,增加区分组织机构逻辑,完成接口冒烟测试;
2.修改系统首页获取井场列表接口,增加区分组织机构逻辑,完成接口冒烟测试;
3.修改系统首页井场功能下钻后提示报错问题,修改用电功率数据获取逻辑,修复报错问题;
4.修改输电线路分页列表查询接口,增加查询条件,在查询父线路列表时只查询10千伏线路,修改线上接口文档同时完成接口冒烟测试;
5.修改系统首页井场实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
6.修改系统首页用能分析接口,增加区分组织机构逻辑,完成接口冒烟测试;
7.修改系统首页井场用能分析(双坐标轴)接口,增加区分组织机构逻辑,完成接口冒烟测试;
8.修改系统首页累积用电接口,增加区分组织机构逻辑,完成接口冒烟测试;
9.修改系统首页光伏实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
10.修改系统首页井场效果评价接口,增加区分组织机构逻辑,完成接口冒烟测试;
11.修改系统首页先导实验井间开制度接口,增加区分组织机构逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 022c27bb
......@@ -39,7 +39,7 @@ public class SysAreaService {
public XListResult<GetSysAreaViewOutputTree> getSysAreaTree(XContext context, GetSysAreaInput input) {
//先从缓存中获取
List<SysAreaCache> sysAreaCaches = SysAreaCache.list(context, BusinessConstant.SYS_AREA_CACHE);
if (ObjectUtils.isNotEmpty(input.getLev()) && input.getLev() == 1) {
if (ObjectUtil.isNotNull(input.getLev()) && input.getLev() == 1) {
List<SysAreaCache> items = new ArrayList<>();
for (SysAreaCache ent : sysAreaCaches) {
if (CollUtil.isNotEmpty(ent.getChildren())) {
......@@ -52,7 +52,7 @@ public class SysAreaService {
if (CollUtil.isEmpty(sysAreaCaches)) {
List<SysAreaCache> caches = selectSysAreaTree(context, input);
List<GetSysAreaViewOutputTree> resultTree = XCopyUtils.copyNewList(caches, GetSysAreaViewOutputTree.class);
if (ObjectUtils.isNotEmpty(input.getLev()) && input.getLev() == 1) {
if (ObjectUtil.isNotNull(input.getLev()) && input.getLev() == 1) {
List<GetSysAreaViewOutputTree> items = new ArrayList<>();
for (GetSysAreaViewOutputTree ent : resultTree) {
if (CollUtil.isNotEmpty(ent.getChildren())) {
......
......@@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.ObjectUtils;
import pps.cloud.system.service.data.sys_dictionary.QuerySysDictionaryViewOutput;
import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysDictionaryEnt;
......@@ -130,7 +129,7 @@ public class SysOrganizationDictionaryService {
SysOrganizationDictionaryMapper mapper = context.getBean(SysOrganizationDictionaryMapper.class);
PpsUserSession session = context.getSession(PpsUserSession.class);
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = mapper.selectList(queryWrapper);
if (ObjectUtils.isNotEmpty(sysOrganizationDictionaryEnts)) {
if (CollUtil.isNotEmpty(sysOrganizationDictionaryEnts)) {
for (SysOrganizationDictionaryEnt ent : sysOrganizationDictionaryEnts) {
ent.setEndTime(new Date());
ent.setModifyTime(new Date());
......@@ -141,7 +140,7 @@ public class SysOrganizationDictionaryService {
}
//查询单位属性表是否还有字典,如果没有删除字典表中标记
SysDictionaryMapper dicMapper = context.getBean(SysDictionaryMapper.class);
if (ObjectUtils.isNotEmpty(sysDictionaryViews)) {
if (CollUtil.isNotEmpty(sysDictionaryViews)) {
for (SysDictionaryView dicView : sysDictionaryViews) {
SysDictionaryEnt ent = new SysDictionaryEnt();
ent.setId(dicView.getId());
......@@ -241,7 +240,7 @@ public class SysOrganizationDictionaryService {
dictionaryViews = dictionaryViewMapper.selectChildListByCondition(recordView);
}
SysDictionaryMapper dictionaryMapper = context.getBean(SysDictionaryMapper.class);
if (ObjectUtils.isNotEmpty(dictionaryViews)) {
if (CollUtil.isNotEmpty(dictionaryViews)) {
List<String> pidList = dictionaryViews.stream().map(SysDictionaryView::getId
).distinct().collect(Collectors.toList());
List<SysDictionaryEnt> sysDictionaryList = dictionaryMapper.selectList(new QueryWrapper<SysDictionaryEnt>()
......
......@@ -2,6 +2,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.core.base.entity.BaseDieselGeneratorEnt;
......@@ -29,7 +30,6 @@ import xstartup.feature.mybatis.helper.XMapperHelper;
import xstartup.helper.XTransactionHelper;
import java.util.List;
import java.util.Objects;
/**
* 柴发设备模块
......@@ -83,7 +83,7 @@ public class BaseDieselGeneratorService {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseDieselGeneratorEnt entity = this.selectOneByDieselId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -112,7 +112,7 @@ public class BaseDieselGeneratorService {
return XServiceResult.error(context, BusinessError.DieselReference);
}
BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class);
if (Objects.isNull(this.selectOneByDieselId(dieselId, mapper))) {
if (ObjectUtil.isNull(this.selectOneByDieselId(dieselId, mapper))) {
return XServiceResult.error(context, XError.NotFound);
}
BaseDieselGeneratorEnt entity = new BaseDieselGeneratorEnt();
......@@ -140,7 +140,7 @@ public class BaseDieselGeneratorService {
public XSingleResult<GetBaseDieselGeneratorOutput> getBaseDieselGenerator(XContext context, GetBaseDieselGeneratorInput input) {
BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class);
BaseDieselGeneratorEnt entity = this.selectOneByDieselId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBaseDieselGeneratorOutput output = XCopyUtils.copyNewObject(entity, GetBaseDieselGeneratorOutput.class);
......
......@@ -2,6 +2,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.core.base.entity.BaseEnergyStorageDeviceEnt;
......@@ -29,7 +30,6 @@ import xstartup.feature.mybatis.helper.XMapperHelper;
import xstartup.helper.XTransactionHelper;
import java.util.List;
import java.util.Objects;
/**
* 储能设备模块
......@@ -83,7 +83,7 @@ public class BaseEnergyStorageDeviceService {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseEnergyStorageDeviceEnt entity = this.selectOneByDeviceId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -112,7 +112,7 @@ public class BaseEnergyStorageDeviceService {
return XServiceResult.error(context, BusinessError.StorageReference);
}
BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class);
if (Objects.isNull(this.selectOneByDeviceId(storageId, mapper))) {
if (ObjectUtil.isNull(this.selectOneByDeviceId(storageId, mapper))) {
return XServiceResult.error(context, XError.NotFound);
}
BaseEnergyStorageDeviceEnt entity = new BaseEnergyStorageDeviceEnt();
......@@ -140,7 +140,7 @@ public class BaseEnergyStorageDeviceService {
public XSingleResult<GetBaseEnergyStorageDeviceOutput> getBaseEnergyStorageDevice(XContext context, GetBaseEnergyStorageDeviceInput input) {
BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class);
BaseEnergyStorageDeviceEnt entity = this.selectOneByDeviceId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBaseEnergyStorageDeviceOutput output = XCopyUtils.copyNewObject(entity, GetBaseEnergyStorageDeviceOutput.class);
......
package pps.core.base.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import pps.core.base.entity.BasePhotovoltaicPlantEnt;
......@@ -33,10 +34,12 @@ public class BasePhotovoltaicPlantMapeAdjService {
public XServiceResult saveData(XContext context, CreateBasePhotovoltaicPlantMapeAdjInput input) {
BasePhotovoltaicPlantMapeAdjMapper mapper = context.getBean(BasePhotovoltaicPlantMapeAdjMapper.class);
BasePhotovoltaicPlantMapeAdjEnt ent = XCopyUtils.copyNewObject(input, BasePhotovoltaicPlantMapeAdjEnt.class);
if (ent.getMapePlusVal() == null) ent.setMapePlusVal(BigDecimal.ZERO);
if (ObjectUtil.isNull(ent.getMapePlusVal())) {
ent.setMapePlusVal(BigDecimal.ZERO);
}
PpsUserSession session = context.getSession(PpsUserSession.class);
Date date = new Date();
if (input.getId() == null) {
if (ObjectUtil.isNull(input.getId())) {
ent.setCreateById(session.getId());
ent.setCreateByName(session.getUserName());
ent.setCreateTime(date);
......@@ -58,13 +61,14 @@ public class BasePhotovoltaicPlantMapeAdjService {
BasePhotovoltaicPlantMapper basePhotovoltaicPlantMapper = context.getBean(BasePhotovoltaicPlantMapper.class);
BasePhotovoltaicPlantEnt basePhotovoltaicPlantEnt = basePhotovoltaicPlantMapper.selectOne(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>()
.eq(BaseModel::getId, input.getPlantId()));
if (basePhotovoltaicPlantEnt == null) return XSingleResult.error(500, "未查找到电站信息");
if (ObjectUtil.isNull(basePhotovoltaicPlantEnt)) {
return XSingleResult.error(500, "未查找到电站信息");
}
BasePhotovoltaicPlantMapeAdjViewMapper mapper = context.getBean(BasePhotovoltaicPlantMapeAdjViewMapper.class);
BasePhotovoltaicPlantMapeAdjView record = new BasePhotovoltaicPlantMapeAdjView();
XCopyUtils.copyObject(input, record);
BasePhotovoltaicPlantMapeAdjView view = mapper.selectOne(record);
if (view == null) {
if (ObjectUtil.isNull(view)) {
output.setPlantName(basePhotovoltaicPlantEnt.getStationName());
output.setMapePlusVal(BigDecimal.ZERO);
return XSingleResult.success(output);
......@@ -84,10 +88,10 @@ public class BasePhotovoltaicPlantMapeAdjService {
ent.setModifyById(session.getId());
ent.setModifyByName(session.getUserName());
ent.setModifyTime(new Date());
UpdateWrapper<BasePhotovoltaicPlantMapeAdjEnt> ur = new UpdateWrapper<>();
ur.lambda().eq(BasePhotovoltaicPlantMapeAdjEnt::getPlantId, input.getPlantId()).eq(BasePhotovoltaicPlantMapeAdjEnt::getMapeType, input.getMapeType());
mapper.update(ent, ur);
mapper.update(ent, new UpdateWrapper<BasePhotovoltaicPlantMapeAdjEnt>()
.lambda()
.eq(BasePhotovoltaicPlantMapeAdjEnt::getPlantId, input.getPlantId())
.eq(BasePhotovoltaicPlantMapeAdjEnt::getMapeType, input.getMapeType()));
return XServiceResult.OK;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.cloud.prediction.service.PlantTrainPowerTaskCloudService;
......@@ -51,7 +52,6 @@ import xstartup.helper.XTransactionHelper;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
......@@ -108,7 +108,7 @@ public class BasePhotovoltaicPlantService {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BasePhotovoltaicPlantEnt entity = this.selectOneByPlantId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -137,7 +137,7 @@ public class BasePhotovoltaicPlantService {
return XServiceResult.error(context, BusinessError.PhotovoltaicReference);
}
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
if (Objects.isNull(this.selectOneByPlantId(plantId, mapper))) {
if (ObjectUtil.isNull(this.selectOneByPlantId(plantId, mapper))) {
return XServiceResult.error(context, XError.NotFound);
}
BasePhotovoltaicPlantEnt entity = new BasePhotovoltaicPlantEnt();
......@@ -165,7 +165,7 @@ public class BasePhotovoltaicPlantService {
public XSingleResult<GetBasePhotovoltaicPlantOutput> getBasePhotovoltaicPlant(XContext context, GetBasePhotovoltaicPlantInput input) {
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
BasePhotovoltaicPlantEnt entity = this.selectOneByPlantId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBasePhotovoltaicPlantOutput output = XCopyUtils.copyNewObject(entity, GetBasePhotovoltaicPlantOutput.class);
......@@ -174,7 +174,7 @@ public class BasePhotovoltaicPlantService {
SysOrganizationView organizationView = new SysOrganizationView();
organizationView.setId(entity.getOuId());
organizationView = organizationViewMapper.selectOrgProvince(organizationView);
if (Objects.nonNull(organizationView)) {
if (ObjectUtil.isNotNull(organizationView)) {
output.setProvince(organizationView.getProvinceName());
}
output.setAreaName(Optional.ofNullable(this.getSysAreaInfo(context, GetSysAreaInput.builder()
......@@ -203,21 +203,20 @@ public class BasePhotovoltaicPlantService {
Map<String, Object> map = XJsonUtils.toMap(result.getResult().getMetricsScore());
if (map.containsKey("MAPE") && CharSequenceUtil.isNotEmpty(map.get("MAPE").toString())) {
BigDecimal relMape = new BigDecimal(map.get("MAPE").toString());
BigDecimal mape = null;
BigDecimal mape;
//获取调整的准确率附加值
BasePhotovoltaicPlantMapeAdjViewMapper mapeAdjMapper = context.getBean(BasePhotovoltaicPlantMapeAdjViewMapper.class);
BasePhotovoltaicPlantMapeAdjView record = new BasePhotovoltaicPlantMapeAdjView();
record.setPlantId(input.getId());
record.setMapeType(input.getMapeType());
BasePhotovoltaicPlantMapeAdjView view = mapeAdjMapper.selectOne(record);
if (view != null && view.getMapePlusVal() != null) {
if (ObjectUtil.isNotNull(view) && ObjectUtil.isNotNull(view.getMapePlusVal())) {
mape = relMape.add(view.getMapePlusVal());
if (mape.compareTo(BusinessConstant.BIG_DECIMAL_100) > 0)
mape = BusinessConstant.BIG_DECIMAL_100;
} else {
mape = relMape;
}
//output.setRelMape(relMape.setScale(2, BigDecimal.ROUND_UP).toPlainString() + "%");
output.setMape(mape.setScale(2, BigDecimal.ROUND_UP).toPlainString() + "%");
}
}
......@@ -225,7 +224,6 @@ public class BasePhotovoltaicPlantService {
return XSingleResult.success(output);
}
@XText("获取调整光伏功率预测准确率按钮")
@XApiGet
public XSingleResult<MapeAjdPowerOutput> getAjdButton(XContext context) {
......@@ -404,9 +402,12 @@ public class BasePhotovoltaicPlantService {
return result;
}
List<QuerySysDictionaryViewOutput> roleDicList = dicResult.getResult();
if (roleDicList.isEmpty()) return result;
List<String> roleIds = roleDicList.stream().map(QuerySysDictionaryViewOutput::getDicKey).collect(Collectors.toList());
if (CollUtil.isEmpty(roleDicList)) {
return result;
}
List<String> roleIds = roleDicList.stream()
.map(QuerySysDictionaryViewOutput::getDicKey)
.collect(Collectors.toList());
//获取当前用户角色
SystemUserRoleRelService roleRelService = context.getBean(SystemUserRoleRelService.class);
GetSysUserRoleRelInput getSysUserRoleRelInput = new GetSysUserRoleRelInput();
......@@ -423,7 +424,7 @@ public class BasePhotovoltaicPlantService {
}
}
} catch (Exception e) {
e.printStackTrace();
context.getLogger().error(e);
}
return result;
}
......
......@@ -3,6 +3,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.pagehelper.PageInfo;
......@@ -145,7 +146,7 @@ public class BasePowerLineService {
return XTransactionHelper.begin(context, () -> {
BasePowerLineMapper mapper = context.getBean(BasePowerLineMapper.class);
BasePowerLineEnt entity = this.selectOneByLineId(lineId, mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
//删除线路配置
......@@ -196,7 +197,7 @@ public class BasePowerLineService {
BasePowerLineView basePowerLineView = new BasePowerLineView();
basePowerLineView.setId(lineId);
BasePowerLineView entity = mapper.selectOne(basePowerLineView);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBasePowerLineViewOutput output = XCopyUtils.copyNewObject(entity, GetBasePowerLineViewOutput.class);
......
......@@ -2,6 +2,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -91,7 +92,7 @@ public class BasePriceStrategyService {
BasePriceStrategyMapper mapper = context.getBean(BasePriceStrategyMapper.class);
BasePriceStrategyEnt entity = mapper.selectOne(new LambdaQueryWrapper<BasePriceStrategyEnt>()
.eq(BaseModel::getId, strategyId));
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
List<UpdateBasePriceStrategyMonthInput> inputMonths = input.getMonths();
......@@ -142,7 +143,7 @@ public class BasePriceStrategyService {
BasePriceStrategyMapper mapper = context.getBean(BasePriceStrategyMapper.class);
BasePriceStrategyEnt entity = mapper.selectOne(new LambdaQueryWrapper<BasePriceStrategyEnt>()
.eq(BaseModel::getId, strategyId));
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
//删除策略
......@@ -188,7 +189,7 @@ public class BasePriceStrategyService {
.eq(BasePriceStrategyEnt::getId, strategyId)
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBasePriceStrategyOutput output = XCopyUtils.copyNewObject(entity, GetBasePriceStrategyOutput.class);
......
......@@ -48,8 +48,8 @@ public class BaseWatherCloudServiceImpl implements BaseWatherCloudService {
PlantPredictedPowerDataMapper mapper = context.getBean(PlantPredictedPowerDataMapper.class);
Document document = Jsoup.parse(new URL(url), 30000);
Elements elements = document.getElementsByClass("mt15"); // 获取class name 是‘mt15’的都有元素对象
Element element = null;
if (elements == null || elements.size() <= 0) {
Element element;
if (elements.isEmpty()) {
return;
} else {
element = elements.get(1); //根据页面结构获取到需要的元素对象
......@@ -65,13 +65,12 @@ public class BaseWatherCloudServiceImpl implements BaseWatherCloudService {
List<String> pressureArray; // 气压
List<String> humidityArray;// 湿度
List<String> cloudCoverArray; // 云量
Date date = null;
Calendar calendar = null;
String dayTime = null;
Date date;
Calendar calendar;
String dayTime;
List<PlantPredictedPowerDataEnt> objList = new ArrayList<>();
// Integer currentHous = LocalDate.parse(XDateUtils.getDateTimeString(new Date())).getHour();
List<PlantPredictedPowerDataEnt> allList = new ArrayList<>();
if (tables != null && tables.size() > 0) {
if (!tables.isEmpty()) {
for (int i = 0; i < tables.size(); i++) {
calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, i);
......@@ -87,7 +86,7 @@ public class BaseWatherCloudServiceImpl implements BaseWatherCloudService {
pressureArray = new ArrayList<>(); // 气压
humidityArray = new ArrayList<>(); // 湿度
cloudCoverArray = new ArrayList<>(); // 云量
if (trs != null && trs.size() > 0) {
if (!trs.isEmpty()) {
for (int j = 0; j < trs.size(); j++) { // 循环行
Elements tds = trs.get(j).select("td");
for (int k = 1; k < tds.size(); k++) { // 循环列
......@@ -130,7 +129,6 @@ public class BaseWatherCloudServiceImpl implements BaseWatherCloudService {
dao.setPressure(new BigDecimal(pressureArray.get(y).replace("hPa", "")));
dao.setHumidity(new BigDecimal(humidityArray.get(y).replace("%", "")));
//判断小时数与查到的小时数,如果查到的小时数小,判断为第二天
//Hous = LocalTime.parse(hourTimeArray.get(y)).getHour();
if (Hous >= LocalTime.parse(hourTimeArray.get(y)).getHour()) {
calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, (i + 1));
......@@ -143,24 +141,15 @@ public class BaseWatherCloudServiceImpl implements BaseWatherCloudService {
dao.setDayTime(LocalDate.parse(dayTime).getDayOfMonth() < 10 ? "0" + LocalDate.parse(dayTime).getDayOfMonth() : LocalDate.parse(dayTime).getDayOfMonth() + "");
dao.setHourTime(Hous < 10 ? "0" + Hous : Hous + "");
// 5.执行SQL
QueryWrapper<PlantPredictedPowerDataEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PlantPredictedPowerDataEnt::getPlantId, plantId)
mapper.delete(new QueryWrapper<PlantPredictedPowerDataEnt>().lambda().eq(PlantPredictedPowerDataEnt::getPlantId, plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dao.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dao.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dao.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dao.getHourTime());
mapper.delete(queryWrapper);
.eq(PlantPredictedPowerDataEnt::getHourTime, dao.getHourTime()));
dao.setMinTime("00:00");
dao.setDataDate(dao.getYearTime() + "-" + dao.getMonthTime() + "-" + dao.getDayTime() + " " + dao.getHourTime() + ":" + dao.getMinTime());
PlantPredictedPowerDataEnt insertDao = XCopyUtils.copyNewObject(dao, PlantPredictedPowerDataEnt.class);
allList.add(insertDao);
// for (String time : timeList){
// dao.setMinTime(time);
// dao.setDataDate(dao.getYearTime() + "-" + dao.getMonthTime() + "-" + dao.getDayTime() +" " + dao.getHourTime() + ":" + dao.getMinTime() );
// PlantPredictedPowerDataEnt insertDao = XCopyUtils.copyNewObject(dao , PlantPredictedPowerDataEnt.class);
// // mapper.insert(insertDao);
// allList.add(insertDao);
// }
PlantPredictedPowerDataEnt isExit = objList.stream().filter(item -> item.getYearTime().equals(dao.getYearTime()) &&
item.getMonthTime().equals(dao.getMonthTime()) &&
item.getDayTime().equals(dao.getDayTime()) &&
......
......@@ -2,6 +2,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.cloud.space.service.ISpaceInstitutionDetailCloudService;
......@@ -31,7 +32,6 @@ import xstartup.feature.mybatis.helper.XMapperHelper;
import xstartup.helper.XTransactionHelper;
import java.util.List;
import java.util.Objects;
/**
......@@ -86,7 +86,7 @@ public class BaseWellheadService {
return XServiceResult.error(context, BusinessError.WellNumberExists);
}
BaseWellheadEnt entity = this.selectOneByWellheadId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
XCopyUtils.copyObject(input, entity);
......@@ -118,7 +118,7 @@ public class BaseWellheadService {
return XServiceResult.error(context, BusinessError.WellheadReferenceSpace);
}
BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class);
if (Objects.isNull(this.selectOneByWellheadId(wellheadId, mapper))) {
if (ObjectUtil.isNull(this.selectOneByWellheadId(wellheadId, mapper))) {
return XServiceResult.error(context, XError.NotFound);
}
BaseWellheadEnt entity = new BaseWellheadEnt();
......@@ -146,7 +146,7 @@ public class BaseWellheadService {
public XSingleResult<GetBaseWellheadOutput> getBaseWellhead(XContext context, GetBaseWellheadInput input) {
BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class);
BaseWellheadEnt entity = this.selectOneByWellheadId(input.getId(), mapper);
if (Objects.isNull(entity)) {
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetBaseWellheadOutput output = XCopyUtils.copyNewObject(entity, GetBaseWellheadOutput.class);
......
package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import pps.core.base.entity.SysPageInfoEnt;
import pps.core.base.mapper.SysPageInfoMapper;
import pps.core.base.service.data.sys_page_info.*;
......@@ -48,10 +49,10 @@ public class SysPageInfoService {
public XServiceResult updateSysPageInfo(XContext context, UpdateSysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
PpsUserSession session = context.getSession(PpsUserSession.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysPageInfoEnt::getId, input.getId());
SysPageInfoEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysPageInfoEnt entity = mapper.selectOne(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
if (CharSequenceUtil.isNotBlank(input.getPageContext())) {
......@@ -74,10 +75,10 @@ public class SysPageInfoService {
@XApiPost
public XServiceResult deleteSysPageInfo(XContext context, DeleteSysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysPageInfoEnt::getId, input.getId());
SysPageInfoEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysPageInfoEnt entity = mapper.selectOne(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound);
}
mapper.deleteById(entity);
......@@ -88,10 +89,10 @@ public class SysPageInfoService {
@XApiGet
public XSingleResult<GetSysPageInfoOutput> getSysPageInfo(XContext context, GetSysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysPageInfoEnt::getId, input.getId());
SysPageInfoEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysPageInfoEnt entity = mapper.selectOne(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getId, input.getId()));
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysPageInfoOutput output = new GetSysPageInfoOutput();
......@@ -110,7 +111,7 @@ public class SysPageInfoService {
if (CharSequenceUtil.isNotBlank(input.getPageName())) {
queryWrapper.lambda().like(SysPageInfoEnt::getPageName, input.getPageName());
}
if (ObjectUtils.isNotEmpty(input.getReleaseState())) {
if (ObjectUtil.isNotNull(input.getReleaseState())) {
queryWrapper.lambda().eq(SysPageInfoEnt::getReleaseState, input.getReleaseState());
}
queryWrapper.lambda().orderByDesc(SysPageInfoEnt::getCreateTime);
......@@ -122,26 +123,27 @@ public class SysPageInfoService {
public XServiceResult releasePageInfo(XContext context, GetSysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
//根据id查询需要发布的数据
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysPageInfoEnt::getId, input.getId());
SysPageInfoEnt sysPageInfoEnt = mapper.selectOne(queryWrapper);
SysPageInfoEnt sysPageInfoEnt = mapper.selectOne(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getId, input.getId()));
//查询当前页面处于发布状态的版本删除
QueryWrapper<SysPageInfoEnt> queryStateVersion = new QueryWrapper();
queryStateVersion.lambda().eq(SysPageInfoEnt::getPageId, sysPageInfoEnt.getPageId())
.eq(SysPageInfoEnt::getReleaseVersion, 1);
List<SysPageInfoEnt> sysPageInfos = mapper.selectList(queryStateVersion);
if (ObjectUtils.isNotEmpty(sysPageInfos)) {
List<SysPageInfoEnt> sysPageInfos = mapper.selectList(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getPageId, sysPageInfoEnt.getPageId())
.eq(SysPageInfoEnt::getReleaseVersion, 1));
if (CollUtil.isNotEmpty(sysPageInfos)) {
SysPageInfoEnt pageInfoEnt = sysPageInfos.get(0);
mapper.deleteById(pageInfoEnt);
}
//查询发布的最大版本号
QueryWrapper<SysPageInfoEnt> queryMaxVersion = new QueryWrapper();
queryMaxVersion.lambda().eq(SysPageInfoEnt::getPageId, sysPageInfoEnt.getPageId()).isNotNull(SysPageInfoEnt::getReleaseVersion)
.orderByDesc(SysPageInfoEnt::getReleaseVersion);
List<SysPageInfoEnt> sysPageInfoEnts = mapper.selectList(queryMaxVersion);
if (ObjectUtils.isNotEmpty(sysPageInfoEnts)) {
List<SysPageInfoEnt> sysPageInfoEnts = mapper.selectList(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getPageId, sysPageInfoEnt.getPageId())
.isNotNull(SysPageInfoEnt::getReleaseVersion)
.orderByDesc(SysPageInfoEnt::getReleaseVersion));
if (CollUtil.isNotEmpty(sysPageInfoEnts)) {
SysPageInfoEnt sysPageInfo = sysPageInfoEnts.get(0);
if (ObjectUtils.isNotEmpty(sysPageInfo.getReleaseVersion())) {
if (ObjectUtil.isNotNull(sysPageInfo.getReleaseVersion())) {
Integer version = sysPageInfo.getReleaseVersion() + 1;
sysPageInfoEnt.setReleaseVersion(version);
} else {
......@@ -160,11 +162,11 @@ public class SysPageInfoService {
@XApiGet
public XSingleResult<GetSysPageInfoOutput> getSysPageInfoByPageId(XContext context, GetSysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysPageInfoEnt::getPageId, input.getPageId())
.eq(SysPageInfoEnt::getReleaseState, 1);
SysPageInfoEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
SysPageInfoEnt entity = mapper.selectOne(new QueryWrapper<SysPageInfoEnt>()
.lambda()
.eq(SysPageInfoEnt::getPageId, input.getPageId())
.eq(SysPageInfoEnt::getReleaseState, 1));
if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound);
}
GetSysPageInfoOutput output = new GetSysPageInfoOutput();
......
package pps.core.base.utils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.nio.charset.StandardCharsets;
public class HttpUtils {
public static Object sendPost(String url, Object param) {
// 请求头设置
HttpHeaders headers = new HttpHeaders();
List<MediaType> acceptableMediaType = new ArrayList<>();
acceptableMediaType.add(MediaType.APPLICATION_JSON);
headers.setAccept(acceptableMediaType);
headers.setContentType(MediaType.APPLICATION_JSON);
// 组装请求体
//String jsonString = XJsonUtils.toJson(param);
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity(param, headers);
//发起请求
RestTemplate restTemplate = new RestTemplate();
Object res = restTemplate.postForObject(url, request, Object.class);
return res;
}
public static String send2(String url, String param) throws Exception {
URL localURL = new URL(url);
URLConnection connection = localURL.openConnection();
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Accept", "application/json");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Content-Length", String.valueOf(param.length()));
httpURLConnection.setConnectTimeout(10000);
OutputStream outputStream = null;
OutputStreamWriter outputStreamWriter = null;
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader reader = null;
String resultBuffer = "";
try {
outputStream = httpURLConnection.getOutputStream();
outputStreamWriter = new OutputStreamWriter(outputStream);
outputStreamWriter.write(param.toString());
outputStreamWriter.write(param);
outputStreamWriter.flush();
if (httpURLConnection.getResponseCode() >= 300) {
throw new Exception(
"HTTP Request is not success, Response code is " + httpURLConnection.getResponseCode());
}
inputStream = httpURLConnection.getInputStream();
resultBuffer = convertStreamToString(inputStream);
System.out.println(resultBuffer);
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ignored) {
} finally {
if (outputStreamWriter != null) {
outputStreamWriter.close();
}
if (outputStream != null) {
outputStream.close();
}
if (reader != null) {
reader.close();
}
if (inputStreamReader != null) {
inputStreamReader.close();
}
if (inputStream != null) {
inputStream.close();
}
}
return resultBuffer;
}
public static String convertStreamToString(InputStream is) {
StringBuilder sb1 = new StringBuilder();
byte[] bytes = new byte[4096];
int size = 0;
int size;
try {
while ((size = is.read(bytes)) > 0) {
String str = new String(bytes, 0, size, "UTF-8");
String str = new String(bytes, 0, size, StandardCharsets.UTF_8);
sb1.append(str);
}
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ignored) {
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ignored) {
}
}
return sb1.toString();
}
public static void main(String[] args) throws Exception {
Map<String, String> object = new HashMap<>();
object.put("pipelineId", "11");
object.put("stationId", "11");
object.put("customerId", "11");
object.put("startTime", "2022-10-23 00:00:00");
object.put("strByteString", "11");
String parm = "pipelineId=" + "12" +
"&stationId=" + "12" +
"&customerId=" + "12" +
"&startTime=" + "2022-12-01 00:00:00" +
"&strByteString=" + "12";
send2("http://10.20.89.75/interface/pdf/InsertSIFile?" + parm, parm);
}
}
package pps.core.base.utils;
import org.springframework.util.ObjectUtils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ArrayUtil;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
......@@ -9,7 +11,6 @@ import javax.mail.internet.MimeUtility;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -52,11 +53,11 @@ public class ReceivedIMAPMail {
public static List<Message> filterMessage(Message[] messages, String fromMail, String startDate)
throws MessagingException, ParseException {
List<Message> messageList = new ArrayList<>();
if (ObjectUtils.isEmpty(messages)) {
if (ArrayUtil.isEmpty(messages)) {
return messageList;
}
boolean isEnptyFromMail = ObjectUtils.isEmpty(fromMail);
boolean isEnptyStartDate = ObjectUtils.isEmpty(startDate);
boolean isEnptyFromMail = CharSequenceUtil.isBlank(fromMail);
boolean isEnptyStartDate = CharSequenceUtil.isBlank(startDate);
if (isEnptyFromMail && isEnptyStartDate) {
return Arrays.asList(messages);
}
......@@ -64,13 +65,11 @@ public class ReceivedIMAPMail {
for (Message message : messages) {
from = (message.getFrom()[0]).toString();
if (isEnptyFromMail) {
if (new SimpleDateFormat(NORM_DATETIME_PATTERN).parse(startDate).getTime() > message.getSentDate()
.getTime()) {
if (DateUtil.parseDateTime(startDate).compareTo(message.getSentDate()) > 0) {
continue;
}
} else if (null != from && from.contains(fromMail)) {
if (!isEnptyStartDate && new SimpleDateFormat(NORM_DATETIME_PATTERN).parse(startDate)
.getTime() > message.getSentDate().getTime()) {
} else if (CharSequenceUtil.isNotBlank(from) && CharSequenceUtil.contains(from, fromMail)) {
if (!isEnptyStartDate && DateUtil.parseDateTime(startDate).compareTo(message.getSentDate()) > 0) {
continue;
}
} else {
......@@ -89,21 +88,9 @@ public class ReceivedIMAPMail {
*/
public String getFrom() throws MessagingException {
InternetAddress address[] = (InternetAddress[]) mimeMessage.getFrom();
String from = address[0].getAddress();
if (from == null) {
from = "";
}
String personal = address[0].getPersonal();
if (personal == null) {
personal = "";
}
String fromAddr = null;
if (personal != null || from != null) {
fromAddr = personal + "<" + from + ">";
}
return fromAddr;
String from = CharSequenceUtil.blankToDefault(address[0].getAddress(), "");
String personal = CharSequenceUtil.blankToDefault(address[0].getPersonal(), "");
return personal + "<" + from + ">";
}
/**
......@@ -114,11 +101,7 @@ public class ReceivedIMAPMail {
* @throws UnsupportedEncodingException
*/
public String getSubject() throws MessagingException, UnsupportedEncodingException {
String subject = MimeUtility.decodeText(mimeMessage.getSubject());
if (subject == null) {
subject = "";
}
return subject;
return CharSequenceUtil.blankToDefault(MimeUtility.decodeText(mimeMessage.getSubject()), "");
}
/**
......@@ -135,9 +118,9 @@ public class ReceivedIMAPMail {
if (nameIndex != -1) {
conName = true;
}
if (part.isMimeType("text/plain") && conName == false) {
if (part.isMimeType("text/plain") && !conName) {
bodyText.append((String) part.getContent());
} else if (part.isMimeType("text/html") && conName == false) {
} else if (part.isMimeType("text/html") && !conName) {
bodyText.append((String) part.getContent());
} else if (part.isMimeType("multipart/*")) {
Multipart multipart = (Multipart) part.getContent();
......@@ -160,8 +143,8 @@ public class ReceivedIMAPMail {
boolean isNew = false;
Flags flags = mimeMessage.getFlags();
Flags.Flag[] flag = flags.getSystemFlags();
for (int i = 0; i < flag.length; i++) {
if (flag[i] == Flags.Flag.SEEN) {
for (Flags.Flag value : flag) {
if (value == Flags.Flag.SEEN) {
isNew = true;
}
}
......
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