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