补充新更新

This commit is contained in:
2022-06-22 09:14:52 +08:00
parent 59da3376c1
commit 6870c2ccc3
323 changed files with 18518 additions and 441 deletions

View File

@@ -7,10 +7,12 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pojo.vo.ShowVersionVO;
import com.njcn.device.pojo.vo.VersionVO;
import com.njcn.device.service.ProgramVersionService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
@@ -66,6 +68,15 @@ public class ProgramVersionController extends BaseController {
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getProgramVersionById")
@ApiOperation("修改版本回显")
@ApiImplicitParam(name = "id", value = "终端版本id", required = true)
public HttpResult<ShowVersionVO> getProgramVersionById(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getProgramVersionById");
ShowVersionVO result = programService.getProgramVersionById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateProgramVersion")

View File

@@ -1,16 +1,21 @@
package com.njcn.device.controller;
import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.enums.DeviceResponseEnum;
import com.njcn.device.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pojo.param.TerminalParam;
import com.njcn.device.pojo.vo.TerminalMaintainVO;
import com.njcn.device.service.TerminalMaintainService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -21,6 +26,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* pqs
@@ -109,13 +115,17 @@ public class TerminalMaintainController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/updateRunFlagManage")
@ApiOperation("批量修改终端状态")
public HttpResult<List<TerminalMaintainVO>> updateRunFlagManage(@NotEmpty(message = "id不可为空") @RequestBody List<String> ids, @NotNull(message = "指标id不可为空") @RequestParam("runFlag") Integer runFlag) {
@ApiImplicitParam(name = "terminalParam", value = "实体", required = true)
public HttpResult<List<TerminalMaintainVO>> updateRunFlagManage(@RequestBody TerminalParam terminalParam) {
String methodDescribe = getMethodDescribe("updateRunFlagManage");
boolean res = terminalMaintainService.updateRunFlagManage(ids, runFlag);
if(Objects.isNull(terminalParam.getRunFlag())){
throw new BusinessException(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION);
}
boolean res = terminalMaintainService.updateRunFlagManage(terminalParam);
if (res) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
@@ -129,13 +139,17 @@ public class TerminalMaintainController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/updateDevFlowMeal")
@ApiOperation("批量修改终端流量套餐")
public HttpResult<Object> updateDevFlowMeal(@NotEmpty(message = "id不可为空") @RequestBody List<String> ids, @NotBlank(message = "基础流量id不可为空") @RequestParam("baseId") String baseId, @RequestParam(value = "reamId", required = false) String reamId) {
@ApiImplicitParam(name = "terminalParam", value = "实体", required = true)
public HttpResult<Object> updateDevFlowMeal(@RequestBody TerminalParam terminalParam) {
String methodDescribe = getMethodDescribe("updateDevFlowMeal");
boolean res = terminalMaintainService.updateFlowMeal(ids, baseId, reamId);
if(StrUtil.isBlank(terminalParam.getBaseMealId()) && StrUtil.isBlank(terminalParam.getExtendMealId())){
throw new BusinessException(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION);
}
boolean res = terminalMaintainService.updateFlowMeal(terminalParam);
if (res) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
@@ -149,13 +163,17 @@ public class TerminalMaintainController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/updateDevFlowStrategy")
@ApiOperation("批量修改终端流量策略")
public HttpResult<Object> updateDevFlowStrategy(@NotEmpty(message = "id不可为空") @RequestBody List<String> ids, @NotBlank(message = "指标id不可为空") @RequestParam("typeId") String typeId) {
@ApiImplicitParam(name = "terminalParam", value = "实体", required = true)
public HttpResult<Object> updateDevFlowStrategy(@RequestBody TerminalParam terminalParam) {
String methodDescribe = getMethodDescribe("updateDevFlowStrategy");
boolean res = terminalMaintainService.updateFlowStrategy(ids, typeId);
if(StrUtil.isBlank(terminalParam.getFlowStrategyId())){
throw new BusinessException(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION);
}
boolean res = terminalMaintainService.updateFlowStrategy(terminalParam);
if (res) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -15,6 +15,10 @@ public interface ProgramVersionMapper {
* 获取终端版本信息,根据装置型号查询
*/
List<VersionVO> getVersion(String devType);
// /**
// * 修改版本回显
// */
// ShowVersionVO getProgramVersionById(String id);
/**
* 修改程序版本状态
*/
@@ -23,4 +27,5 @@ public interface ProgramVersionMapper {
* 修改程序版本状态
*/
void updateVersionState(String id);
}

View File

@@ -27,6 +27,12 @@
</if>
</select>
<!-- <select id="getProgramVersionById" resultType="ShowVersionVO">-->
<!-- SELECT-->
<!-- FROM-->
<!-- WHERE-->
<!-- </select>-->
<update id="updateVersionFlag">
UPDATE
cld_version
@@ -43,5 +49,4 @@
WHERE Id = #{id}
</update>
</mapper>

View File

@@ -6,11 +6,12 @@
SELECT
a.id,
a.pid,
a.NAME devName,
a.NAME,
a.level,
b.run_flag,
b.com_flag,
e.NAME devType,
ifnull(g.name,'/') version,
ifnull(d.flow,(select flow from cld_flow_meal where type = 0 and flag = 1)) baseFlowMeal,
ifnull(d1.flow,0) reamFlowMeal,
FORMAT(ifnull(mo.statis_value,0)/1024/1024,2) as statisValue
@@ -21,6 +22,8 @@ FROM
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
LEFT JOIN sys_dict_data e ON b.dev_type = e.id
LEFT JOIN cld_dev_version f on a.id = f.line_id and f.flag = 1 and f.state = 1
LEFT JOIN cld_version g on f.version_id = g.id
LEFT JOIN
(select * from cld_month_flow where date_format(time_id,'%Y-%m' ) = date_format(CURRENT_TIME(),'%Y-%m')) mo on a.id = mo.line_id
where b.dev_model = 1
@@ -83,10 +86,12 @@ FROM
a.pid,
a.name,
a.level,
h.ip,
ifnull(f.Flow,(select flow from cld_flow_meal where type = 0 and flag = 1)) baseFlowMeal,
g.Flag reamFlowMeal
FROM
pq_line a
inner join pq_device h on a.id = h.id
Left join cld_dev_meal e on a.id = e.Line_Id
left join cld_flow_meal f on e.Base_Meal_Id = f.Id
left join cld_flow_meal g on e.Ream_Meal_Id = g.Id
@@ -103,7 +108,8 @@ FROM
a.pid,
a.name,
a.level,
ifnull(f.name,(select name from cld_flow_strategy where flag = 1 and state = 1)) flowStrategy
ifnull(f.name,(select name from cld_flow_strategy where flag = 1 and state = 1)) flowStrategy,
ifnull(f.flag,1) as strategyFlag
FROM
pq_line a
Left join cld_dev_strategy e on a.id = e.Line_Id

View File

@@ -1,6 +1,7 @@
package com.njcn.device.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.vo.ShowVersionVO;
import com.njcn.device.pojo.vo.VersionVO;
import org.springframework.web.multipart.MultipartFile;
@@ -23,6 +24,11 @@ public interface ProgramVersionService {
* @return
*/
boolean addProgramVersion(String name, String protocol, LocalDate date, String devType, String remark, String versionType, MultipartFile file);
/**
* 修改版本回显
* @return
*/
ShowVersionVO getProgramVersionById(String id);
/**
* 修改程序版本管理信息
* @return

View File

@@ -1,6 +1,7 @@
package com.njcn.device.service;
import com.njcn.device.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pojo.param.TerminalParam;
import com.njcn.device.pojo.vo.TerminalMaintainVO;
import java.util.List;
@@ -32,27 +33,22 @@ public interface TerminalMaintainService {
* 修改终端参数
* @author cdf
* @date 2022/5/12
* @param ids 装置ids;
* @param runFlag 运行状态
*/
boolean updateRunFlagManage(List<String> ids, Integer runFlag);
boolean updateRunFlagManage(TerminalParam terminalParam);
/**
* 修改终端流量
* @author cdf
* @date 2022/5/12
* @param typeId 基础流量id
* @param type2Id 扩展流量id
*/
boolean updateFlowMeal(List<String> ids,String typeId,String type2Id);
boolean updateFlowMeal(TerminalParam terminalParam);
/**
* 修改终端流量策略
* @author cdf
* @date 2022/5/12
* @param typeId 基础流量id
*/
boolean updateFlowStrategy(List<String> ids,String typeId);
boolean updateFlowStrategy(TerminalParam terminalParam);
}

View File

@@ -24,6 +24,7 @@ import com.njcn.device.service.LineService;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.Area;
import com.njcn.web.pojo.vo.LineDataVO;
import com.njcn.web.utils.GeneralUtil;
import com.njcn.web.utils.RequestUtil;
@@ -254,12 +255,27 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
//获取所有监测点
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
//根据部门id去获取省份信息
Area area = areaFeignClient.areaDeptPro(generalDeviceDTO.getIndex()).getData();
LineDistributionVO lineDistributionVO = new LineDistributionVO();
lineDistributionVO.setAreaName(generalDeviceDTO.getName());
lineDistributionVO.setLineNum(generalDeviceDTO.getLineIndexes().size());
lineDistributionVO.setName(generalDeviceDTO.getName());
lineDistributionVO.setValue(generalDeviceDTO.getLineIndexes().size());
lineDistributionVOList.add(lineDistributionVO);
}
return lineDistributionVOList;
List<LineDistributionVO> result =new ArrayList<LineDistributionVO>();
Map<String, Integer> map = new HashMap<String, Integer>();
for(LineDistributionVO lineDistributionVO:lineDistributionVOList){
if (map.containsKey(lineDistributionVO.getName())) {
map.put(lineDistributionVO.getName(), map.get(lineDistributionVO.getName())+lineDistributionVO.getValue());
} else {
map.put(lineDistributionVO.getName(), lineDistributionVO.getValue());
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
result.add(new LineDistributionVO(entry.getKey(),entry.getValue()));
}
return result;
}
@Override
@@ -395,7 +411,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
for (LineFlowMealDetailVO lineFlowMealDetailVO : monitorList) {
for (LineInfluxDbInegrityVO lineInfluxDbInegrity : lineInfluxDbInegrityVO) {
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbInegrity.getLineId())) {
lineFlowMealDetailVO.setIntegrity(lineInfluxDbInegrity.getIntegrity().floatValue());
BigDecimal flow =new BigDecimal(lineInfluxDbInegrity.getIntegrity().floatValue());
lineFlowMealDetailVO.setIntegrity(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
}
}
}
@@ -415,7 +432,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
for (LineInfluxDbOnlineVO lineInfluxDbOnline : lineInfluxDbOnlineVO) {
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbOnline.getDevIndex())) {
lineFlowMealDetailVO.setOnlineRate(lineInfluxDbOnline.getOnlineRate().floatValue());
BigDecimal flowValue =new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue());
lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
}
}
}

View File

@@ -10,6 +10,7 @@ import com.njcn.device.enums.DeviceResponseEnum;
import com.njcn.device.mapper.ProgramVersionMapper;
import com.njcn.device.mapper.VersionMapper;
import com.njcn.device.pojo.po.Version;
import com.njcn.device.pojo.vo.ShowVersionVO;
import com.njcn.device.pojo.vo.VersionVO;
import com.njcn.device.service.ProgramVersionService;
import com.njcn.web.utils.RequestUtil;
@@ -97,6 +98,14 @@ public class ProgramVersionServiceImpl extends ServiceImpl<VersionMapper, Versio
return true;
}
@Override
public ShowVersionVO getProgramVersionById(String id) {
// ShowVersionVO showVersionVO = programVersionMapper.getProgramVersionById(id);
return null;
}
@Override
public boolean updateProgramVersion(String id, String name, String protocol, LocalDate date, String devType, String remark, String versionType, MultipartFile file) {

View File

@@ -135,16 +135,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
if (Objects.nonNull(addTerminalParam.getProjectParam())) {
if (StrUtil.isBlank(projectIndex)) {
checkName(addTerminalParam, LineBaseEnum.PROJECT_LEVEL.getCode(), null);
/*Line line = new Line();
line.setPid("0");
line.setPids("0");
line.setLevel(LineBaseEnum.PROJECT_LEVEL.getCode());
line.setSort(addTerminalParam.getProjectParam().getSort());
line.setState(DataStateEnum.ENABLE.getCode());
line.setName(addTerminalParam.getProjectParam().getName());
line.setCreateTime(LocalDateTime.now());
this.save(line);*/
Line line = assembleLine(addTerminalParam.getProjectParam().getName(),LineBaseEnum.PROJECT_LEVEL.getCode(),"0","0",addTerminalParam.getProjectParam().getSort());
this.baseMapper.insert(line);
projectIndex = line.getId();
} else {
//throw new BusinessException(DeviceResponseEnum.REQUEST_DATA_ERROR);
@@ -160,15 +152,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
}
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
checkName(addTerminalParam, LineBaseEnum.PROVINCE_LEVEL.getCode(), projectIndex);
/*Line province = new Line();
province.setPid(projectIndex);
province.setPids(projectIndex);
province.setName(result.getId());
province.setLevel(LineBaseEnum.PROVINCE_LEVEL.getCode());
province.setSort(addTerminalParam.getProvinceParam().getSort());
province.setState(DataStateEnum.ENABLE.getCode());
province.setCreateTime(LocalDateTime.now());*/
Line province = assembleLine(result.getId(),LineBaseEnum.PROVINCE_LEVEL.getCode(),projectIndex,projectIndex,addTerminalParam.getProvinceParam().getSort());
this.baseMapper.insert(province);
provinceIndex = province.getId();
} else {
//throw new BusinessException(DeviceResponseEnum.REQUEST_DATA_ERROR);
@@ -178,18 +163,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
//供电公司
if (Objects.nonNull(addTerminalParam.getGdInformationParam())) {
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
checkName(addTerminalParam, LineBaseEnum.GD_LEVEL.getCode(), provinceIndex);
/*Line gdInformation = new Line();
gdInformation.setName(addTerminalParam.getGdInformationParam().getName());
gdInformation.setPid(provinceIndex);
gdInformation.setPids(projectIndex + "," + provinceIndex);
gdInformation.setLevel(LineBaseEnum.GD_LEVEL.getCode());
gdInformation.setState(DataStateEnum.ENABLE.getCode());
gdInformation.setSort(addTerminalParam.getGdInformationParam().getSort());
gdInformation.setCreateTime(LocalDateTime.now());
this.save(gdInformation);*/
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(),LineBaseEnum.GD_LEVEL.getCode(),provinceIndex,projectIndex + StrUtil.COMMA + provinceIndex,addTerminalParam.getGdInformationParam().getSort());
this.baseMapper.insert(gdInformation);
gdIndex = gdInformation.getId();
}
}
@@ -198,16 +174,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
if (Objects.nonNull(addTerminalParam.getSubStationParam())) {
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
/*Line subStation = new Line();
subStation.setPid(gdIndex);
subStation.setPids(projectIndex + "," + provinceIndex + "," + gdIndex);
subStation.setName(addTerminalParam.getSubStationParam().getName());
subStation.setLevel(LineBaseEnum.SUB_LEVEL.getCode());
subStation.setState(DataStateEnum.ENABLE.getCode());
subStation.setSort(addTerminalParam.getSubStationParam().getSort());
subStation.setCreateTime(LocalDateTime.now());
this.save(subStation);*/
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(),LineBaseEnum.SUB_LEVEL.getCode(),gdIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex,addTerminalParam.getSubStationParam().getSort());
this.baseMapper.insert(subStation);
subIndex = subStation.getId();
//变电站下的经纬度入库
@@ -270,16 +238,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
/* Line device = new Line();
device.setName(deviceParam.getName());
device.setPid(subIndex);
device.setPids(projectIndex + "," + provinceIndex + "," + gdIndex + "," + subIndex);
device.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode());
device.setState(DataStateEnum.ENABLE.getCode());
device.setSort(deviceParam.getSort());
device.setCreateTime(LocalDateTime.now());
this.save(device);*/
Line device = assembleLine(deviceParam.getName(),LineBaseEnum.DEVICE_LEVEL.getCode(),subIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex,deviceParam.getSort());
this.baseMapper.insert(device);
devIdIndex = device.getId();
//装置详情
@@ -361,16 +321,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
if (Objects.isNull(scaleRes.getData())) {
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
}
/*Line subVoltage = new Line();
subVoltage.setName(subVoltageParam.getName());
subVoltage.setPid(devIdIndex);
subVoltage.setPids(projectIndex + "," + provinceIndex + "," + gdIndex + "," + subIndex + "," + devIdIndex);
subVoltage.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
subVoltage.setSort(subVoltageParam.getSort());
subVoltage.setState(DataStateEnum.ENABLE.getCode());
subVoltage.setCreateTime(LocalDateTime.now());
this.save(subVoltage);*/
Line subVoltage = assembleLine(subVoltageParam.getName(),LineBaseEnum.SUB_V_LEVEL.getCode(),devIdIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex,subVoltageParam.getSort());
this.baseMapper.insert(subVoltage);
subvIndex = subVoltage.getId();
Voltage voltage = new Voltage();
voltage.setId(subVoltage.getId());
@@ -412,17 +364,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
listId.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
HttpResult<DictData> httpScale = dicDataFeignClient.getDicDataById(subVoltageParam.getScale());
Float jcap = DeviceUtil.getJCAPByScale(httpScale.getData().getName());
/* Line line = new Line();
line.setName(lineParam.getName());
line.setPid(subvIndex);
line.setPids(projectIndex + "," + provinceIndex + "," + gdIndex + "," + subIndex + "," + devIdIndex + "," + subvIndex);
line.setLevel(LineBaseEnum.LINE_LEVEL.getCode());
line.setState(DataStateEnum.ENABLE.getCode());
line.setSort(lineParam.getSort());
line.setCreateTime(LocalDateTime.now());
this.save(line);*/
Line line = assembleLine(lineParam.getName(),LineBaseEnum.LINE_LEVEL.getCode(),subvIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex+ StrUtil.COMMA + subvIndex,lineParam.getSort());
this.baseMapper.insert(line);
LineDetail lineDetail = new LineDetail();
BeanUtils.copyProperties(lineParam, lineDetail);
lineDetail.setId(line.getId());
@@ -714,77 +657,31 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
TerminalVO terminalVO = new TerminalVO();
if (obj.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())) {
//点击项目节点
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(obj.getId());
projectVO.setName(obj.getName());
projectVO.setSort(obj.getSort());
terminalVO.setProjectVO(projectVO);
assProject(obj,terminalVO);
} else if (obj.getLevel().equals(LineBaseEnum.PROVINCE_LEVEL.getCode())) {
//点击省份节点
Line project = this.getById(obj.getPid());
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(project.getId());
projectVO.setName(project.getName());
projectVO.setSort(project.getSort());
terminalVO.setProjectVO(projectVO);
ProvinceVO provinceVO = new ProvinceVO();
provinceVO.setProvinceIndex(obj.getId());
provinceVO.setName(obj.getName());
provinceVO.setSort(obj.getSort());
terminalVO.setProvinceVO(provinceVO);
assProject(project,terminalVO);
assProvince(obj,terminalVO);
} else if (obj.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())) {
//点击供电公司节点
GdInformationVO gdInformationVO = new GdInformationVO();
gdInformationVO.setGdIndex(obj.getId());
gdInformationVO.setName(obj.getName());
gdInformationVO.setSort(obj.getSort());
terminalVO.setGdInformationVO(gdInformationVO);
assGd(obj,terminalVO);
Line province = this.getById(obj.getPid());
ProvinceVO provinceVO = new ProvinceVO();
provinceVO.setProvinceIndex(province.getId());
provinceVO.setName(province.getName());
provinceVO.setSort(province.getSort());
terminalVO.setProvinceVO(provinceVO);
assProvince(province,terminalVO);
Line project = this.getById(province.getPid());
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(project.getId());
projectVO.setName(project.getName());
projectVO.setSort(project.getSort());
terminalVO.setProjectVO(projectVO);
assProject(project,terminalVO);
} else if (obj.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())) {
//变电站
Substation substation = substationMapper.selectById(obj.getId());
SubStationVO subStationVO = new SubStationVO();
subStationVO.setSubIndex(obj.getId());
subStationVO.setName(obj.getName());
subStationVO.setSort(obj.getSort());
BeanUtils.copyProperties(substation, subStationVO);
terminalVO.setSubStationVO(subStationVO);
assSub(obj,terminalVO);
Line gdInformation = this.getById(obj.getPid());
GdInformationVO gdInformationVO = new GdInformationVO();
gdInformationVO.setGdIndex(gdInformation.getId());
gdInformationVO.setName(gdInformation.getName());
gdInformationVO.setSort(gdInformation.getSort());
terminalVO.setGdInformationVO(gdInformationVO);
assGd(gdInformation,terminalVO);
Line province = this.getById(gdInformation.getPid());
ProvinceVO provinceVO = new ProvinceVO();
provinceVO.setProvinceIndex(province.getId());
provinceVO.setName(province.getName());
provinceVO.setSort(province.getSort());
terminalVO.setProvinceVO(provinceVO);
assProvince(province,terminalVO);
Line project = this.getById(province.getPid());
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(project.getId());
projectVO.setName(project.getName());
projectVO.setSort(project.getSort());
terminalVO.setProjectVO(projectVO);
assProject(project,terminalVO);
//展示所有下级装置母线监测点
lineLambdaQueryWrapper.clear();
@@ -2173,7 +2070,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
/**
* 根据传入的id获取
* 组装台账信息
*
* @author cdf
* @date 2022/2/14
@@ -2186,34 +2083,16 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Line subStation = this.getById(subId);
if (Objects.nonNull(subStation)) {
Substation substation = substationMapper.selectById(subStation.getId());
SubStationVO subStationVO = new SubStationVO();
subStationVO.setSubIndex(subStation.getId());
subStationVO.setName(subStation.getName());
subStationVO.setSort(subStation.getSort());
BeanUtils.copyProperties(substation, subStationVO);
terminalVO.setSubStationVO(subStationVO);
assSub(subStation,terminalVO);
Line gdInformation = this.getById(subStation.getPid());
GdInformationVO gdInformationVO = new GdInformationVO();
gdInformationVO.setGdIndex(gdInformation.getId());
gdInformationVO.setName(gdInformation.getName());
gdInformationVO.setSort(gdInformation.getSort());
terminalVO.setGdInformationVO(gdInformationVO);
assGd(gdInformation,terminalVO);
Line province = this.getById(gdInformation.getPid());
ProvinceVO provinceVO = new ProvinceVO();
provinceVO.setProvinceIndex(province.getId());
provinceVO.setName(province.getName());
provinceVO.setSort(province.getSort());
terminalVO.setProvinceVO(provinceVO);
assProvince(province,terminalVO);
Line project = this.getById(province.getPid());
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(project.getId());
projectVO.setName(project.getName());
projectVO.setSort(project.getSort());
terminalVO.setProjectVO(projectVO);
assProject(project,terminalVO);
return terminalVO;
} else {
@@ -2221,4 +2100,51 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
}
}
/**
* 组装项目
*/
private void assProject(Line project,TerminalVO terminalVO){
ProjectVO projectVO = new ProjectVO();
projectVO.setProjectIndex(project.getId());
projectVO.setName(project.getName());
projectVO.setSort(project.getSort());
terminalVO.setProjectVO(projectVO);
}
/**
* 组装省份
*/
private void assProvince(Line province,TerminalVO terminalVO){
ProvinceVO provinceVO = new ProvinceVO();
provinceVO.setProvinceIndex(province.getId());
provinceVO.setName(province.getName());
provinceVO.setSort(province.getSort());
terminalVO.setProvinceVO(provinceVO);
}
/**
* 组装供电公司
*/
private void assGd(Line gdInformation,TerminalVO terminalVO){
GdInformationVO gdInformationVO = new GdInformationVO();
gdInformationVO.setGdIndex(gdInformation.getId());
gdInformationVO.setName(gdInformation.getName());
gdInformationVO.setSort(gdInformation.getSort());
terminalVO.setGdInformationVO(gdInformationVO);
}
/**
* 组装变电站
*/
private void assSub(Line subStation,TerminalVO terminalVO){
Substation substation = substationMapper.selectById(subStation.getId());
SubStationVO subStationVO = new SubStationVO();
subStationVO.setSubIndex(subStation.getId());
subStationVO.setName(subStation.getName());
subStationVO.setSort(subStation.getSort());
BeanUtils.copyProperties(substation, subStationVO);
terminalVO.setSubStationVO(subStationVO);
}
}

View File

@@ -7,10 +7,12 @@ import com.njcn.device.enums.DeviceResponseEnum;
import com.njcn.device.enums.LineBaseEnum;
import com.njcn.device.mapper.TerminalMaintainMapper;
import com.njcn.device.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pojo.param.TerminalParam;
import com.njcn.device.pojo.po.DevMeal;
import com.njcn.device.pojo.po.DevStrategy;
import com.njcn.device.pojo.po.Device;
import com.njcn.device.pojo.vo.TerminalMaintainVO;
import com.njcn.device.pojo.vo.TerminalVersionVO;
import com.njcn.device.service.IDevMealService;
import com.njcn.device.service.IDevStrategyService;
import com.njcn.device.service.IDeviceService;
@@ -47,23 +49,26 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
@Override
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
List<TerminalMaintainVO> proList = terminalMaintainMapper.getProvList();
if(CollectionUtil.isEmpty(proList)){
throw new BusinessException(DeviceResponseEnum.PROVINCE_EMPTY);
}
List<TerminalMaintainVO> gdList = terminalMaintainMapper.getGdAndSubList(LineBaseEnum.GD_LEVEL.getCode());
if(CollectionUtil.isEmpty(gdList)){
throw new BusinessException(DeviceResponseEnum.GD_NO);
}
List<TerminalMaintainVO> subList = terminalMaintainMapper.getGdAndSubList(LineBaseEnum.SUB_LEVEL.getCode());
if(CollectionUtil.isEmpty(subList)){
throw new BusinessException(DeviceResponseEnum.SUB_NO);
}
List<TerminalMaintainVO> devList = terminalMaintainMapper.getTerminalDevInfo();
if(CollectionUtil.isEmpty(devList)){
throw new BusinessException(DeviceResponseEnum.DEVICE_EMPTY);
}
List<String> subIndexes = devList.stream().map(TerminalMaintainVO::getPid).collect(Collectors.toList());
List<TerminalMaintainVO> subList = terminalMaintainMapper.getPqLineGdAndSubList(subIndexes);
if(CollectionUtil.isEmpty(subList)){
throw new BusinessException(DeviceResponseEnum.SUB_NO);
}
List<String> gdIds = subList.stream().map(TerminalMaintainVO::getPid).collect(Collectors.toList());
List<TerminalMaintainVO> gdList = terminalMaintainMapper.getPqLineGdAndSubList(gdIds);
if(CollectionUtil.isEmpty(gdList)){
throw new BusinessException(DeviceResponseEnum.GD_NO);
}
List<String> proIds = gdList.stream().map(TerminalMaintainVO::getPid).collect(Collectors.toList());
List<TerminalMaintainVO> proList = terminalMaintainMapper.getPqLineProvList(proIds);
if(CollectionUtil.isEmpty(proList)){
throw new BusinessException(DeviceResponseEnum.PROVINCE_EMPTY);
}
List<TerminalMaintainVO> subListTem = subList.stream().peek(item->item.setChildren(getChildren(item.getId(),devList))).collect(Collectors.toList());
List<TerminalMaintainVO> gdListTem = gdList.stream().peek(item->item.setChildren(getChildren(item.getId(),subListTem))).collect(Collectors.toList());
return proList.stream().peek(item->item.setChildren(getChildren(item.getId(),gdListTem))).collect(Collectors.toList());
@@ -88,40 +93,40 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
}
@Override
public boolean updateRunFlagManage(List<String> ids, Integer runFlag){
public boolean updateRunFlagManage(TerminalParam terminalParam){
//终端状态管理
List<Device> tem = new ArrayList<>();
ids.forEach(item-> {
terminalParam.getIds().forEach(item-> {
Device device = new Device();
device.setId(item);
device.setRunFlag(runFlag);
device.setRunFlag(terminalParam.getRunFlag());
tem.add(device);
});
return iDeviceService.updateBatchById(tem);
}
@Override
public boolean updateFlowMeal(List<String> ids, String typeId, String type2Id) {
public boolean updateFlowMeal(TerminalParam terminalParam) {
List<DevMeal> tem = new ArrayList<>();
iDevMealService.removeByIds(ids);
ids.forEach(item-> {
iDevMealService.removeByIds(terminalParam.getIds());
terminalParam.getIds().forEach(item-> {
DevMeal devMeal = new DevMeal();
devMeal.setLineId(item);
devMeal.setBaseMealId(typeId);
devMeal.setReamMealId(type2Id);
devMeal.setBaseMealId(terminalParam.getBaseMealId());
devMeal.setReamMealId(terminalParam.getExtendMealId());
tem.add(devMeal);
});
return iDevMealService.saveBatch(tem);
}
@Override
public boolean updateFlowStrategy(List<String> ids, String typeId) {
public boolean updateFlowStrategy(TerminalParam terminalParam) {
List<DevStrategy> tem = new ArrayList<>();
iDevStrategyService.removeByIds(ids);
ids.forEach(item-> {
iDevStrategyService.removeByIds(terminalParam.getIds());
terminalParam.getIds().forEach(item-> {
DevStrategy devStrategy = new DevStrategy();
devStrategy.setLineId(item);
devStrategy.setStrategyId(typeId);
devStrategy.setStrategyId(terminalParam.getFlowStrategyId());
tem.add(devStrategy);
});
return iDevStrategyService.saveBatch(tem);