代码提交
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2023/9/27 10:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "cs_dev_capacity")
|
||||||
|
public class CsDevCapacityPO {
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
@TableField(value = "line_id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块(0:表示主模块,其余数字表示当前模块,例如,1表示模块1)
|
||||||
|
*/
|
||||||
|
@TableField(value = "cldid")
|
||||||
|
private Integer cldid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备容量
|
||||||
|
*/
|
||||||
|
@TableField(value = "capacity")
|
||||||
|
private Double capacity;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.njcn.csdevice.controller.equipment;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
|
import com.njcn.csdevice.service.CsDevCapacityPOService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/3/27 15:31【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/capacity")
|
||||||
|
@Api(tags = "设备电流限值")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CsDevCapacityController extends BaseController {
|
||||||
|
|
||||||
|
private final CsDevCapacityPOService csDevCapacityPOService;
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDevCapacity")
|
||||||
|
@ApiOperation("根据设备id获取电流限值")
|
||||||
|
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
||||||
|
public HttpResult<Double> getDevCapacity(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getDevCapacity");
|
||||||
|
Double limit = csDevCapacityPOService.getDevCapacity(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, limit, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2023/9/27 10:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsDevCapacityPOMapper extends BaseMapper<CsDevCapacityPO> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.csdevice.mapper.CsDevCapacityPOMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.njcn.csdevice.pojo.po.CsDevCapacityPO">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table cs_dev_capacity-->
|
||||||
|
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||||
|
<result column="cldid" jdbcType="INTEGER" property="cldid" />
|
||||||
|
<result column="capacity" jdbcType="DECIMAL" property="capacity" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
line_id, cldid, capacity
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2023/9/27 10:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsDevCapacityPOService extends IService<CsDevCapacityPO>{
|
||||||
|
|
||||||
|
|
||||||
|
Double getDevCapacity(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.mapper.CsDevCapacityPOMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
|
||||||
|
import com.njcn.csdevice.service.CsDevCapacityPOService;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2023/9/27 10:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMapper, CsDevCapacityPO> implements CsDevCapacityPOService{
|
||||||
|
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Double getDevCapacity(String id) {
|
||||||
|
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||||
|
|
||||||
|
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
|
|
||||||
|
Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
|
List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||||
|
/*治理侧监测点*/
|
||||||
|
CsLinePO csLinePO = collect1.get(0);
|
||||||
|
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||||
|
Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
||||||
|
|
||||||
|
|
||||||
|
return Double.valueOf(df.format(one.getCapacity()*0.1));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,9 @@ import com.njcn.system.pojo.po.EleEvtParm;
|
|||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -202,9 +204,25 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
if(!StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())){
|
if(!StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())){
|
||||||
list =list.stream().filter(temp->Objects.equals(temp.getDeviceId(),csEventUserQueryPage.getDeviceId())).collect(Collectors.toList());
|
list =list.stream().filter(temp->Objects.equals(temp.getDeviceId(),csEventUserQueryPage.getDeviceId())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
returnpage.setRecords (list);
|
List list1 = this.startPage(list, csEventUserQueryPage.getPageNum(), csEventUserQueryPage.getPageSize());
|
||||||
|
returnpage.setRecords (list1);
|
||||||
returnpage.setTotal(list.size());
|
returnpage.setTotal(list.size());
|
||||||
|
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List startPage(List list, Integer pageNum,
|
||||||
|
Integer pageSize) {
|
||||||
|
int total = list.size();
|
||||||
|
int size = pageNum * pageSize > total ? total : pageNum * pageSize;
|
||||||
|
|
||||||
|
int startNum = (pageNum - 1) * pageSize;
|
||||||
|
if (startNum > size){
|
||||||
|
startNum = 1;
|
||||||
|
}
|
||||||
|
List dataList = list.subList(startNum, size);
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||||
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||||
collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
|
// collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user