diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java b/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java index ac38c9b79..64473adcf 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java @@ -23,6 +23,8 @@ public enum PvDeviceResponseEnum { DVE_CODE_REPEAT("A0355","终端编号重复"), USER_CODE_REPEAT("A0356","用户编号重复"), SUB_AREA_EMPTY("A0357","台区不能为空"), + VOLTAGE_PARAM_EMPTY("A0358","所属母线不可为空"), + VOLTAGE_PARAM_EMPTY_MUST("A0359","所属母线必须为空"), TEN_VOLTAGE_NULL("A0360","未查询到指定10kV线路"), @@ -34,7 +36,7 @@ public enum PvDeviceResponseEnum { DEV_NUM_NULL("A0366","当前装置监测点序号已存在"), ONE_SUB_VOLTAGE_EMPTY("A0367","I类监测点变电站母线不可为空"), TWO_SUB_VOLTAGE_EMPTY_MUST("A0368","II类监测点变电站母线必须为空"), - + LINE_DEVICE_NO_MATCH("A0369","监测点所属装置型号不匹配"), ; diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java index 490179862..8de3618d5 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java @@ -52,12 +52,7 @@ public class PvVoltageParam implements Serializable { @NotBlank(message = "电压等级不可为空") private String scale; - /** - * 母线模型(0:虚拟母线;1:实际母线)默认是实际母线 - */ - @ApiModelProperty(value = "母线模型(0:虚拟母线;1:实际母线)默认是实际母线",required = true) - @NotNull(message = "母线模型不可为空") - private Integer model; + @Data @EqualsAndHashCode(callSuper = true) diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java index 9e8fdf33a..7d41fd3dd 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java @@ -43,10 +43,7 @@ public class PvVoltage { */ private String scale; - /** - * 母线模型(0:虚拟母线;1:实际母线)默认是实际母线 - */ - private Integer model; + } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java index 9f09def6b..3ee9b8d08 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java @@ -39,12 +39,12 @@ public class PvUnitController extends BaseController { private final IPvUnitService iPvUnitService; - /** + /* *//** * 新增单位 * @param pvUnitParam 单位实体 * @author cdf * @date 2022/7/5 - */ + *//* @PostMapping("addUnit") @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) @ApiOperation("新增单位") @@ -58,11 +58,11 @@ public class PvUnitController extends BaseController { } - /** + *//** * 修改单位 * @author cdf * @date 2022/7/5 - */ + *//* @PostMapping("updateUnit") @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) @ApiOperation("修改单位") @@ -76,13 +76,13 @@ public class PvUnitController extends BaseController { } - /** + *//** * 查询所有单位 * @param baseParam 查询实体 * @author cdf * @date 2022/7/5 * @return Page - */ + *//* @PostMapping("getPvUnitList") @OperateInfo(info = LogEnum.SYSTEM_COMMON) @ApiOperation("查询所有单位") @@ -95,13 +95,13 @@ public class PvUnitController extends BaseController { } - /** + *//** * 根据单位id查询单位 * @param id 单位id * @author cdf * @date 2022/7/5 * @return PvUnit - */ + *//* @GetMapping("getPvUnitById") @OperateInfo(info = LogEnum.SYSTEM_COMMON) @ApiOperation("根据单位id查询单位") @@ -113,13 +113,13 @@ public class PvUnitController extends BaseController { } - /** + *//** * 删除单位 * @param id 单位id * @author cdf * @date 2022/7/5 * @return boolean - */ + *//* @DeleteMapping("delPvUnit") @OperateInfo(info = LogEnum.SYSTEM_COMMON) @ApiOperation("删除单位") @@ -129,6 +129,6 @@ public class PvUnitController extends BaseController { iPvUnitService.delPvUnit(id); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } - +*/ } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java index 969b40185..2a5fea2d2 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java @@ -9,6 +9,7 @@ import com.njcn.common.utils.PubUtils; import com.njcn.device.enums.PvDeviceResponseEnum; import com.njcn.device.pojo.param.pv.LineDetailQueryParam; import com.njcn.device.pojo.param.pv.PvLineDetailParam; +import com.njcn.device.pojo.po.pv.PvDevice; import com.njcn.device.pojo.po.pv.PvLineDetail; import com.njcn.device.pojo.po.pv.PvLineDetail; import com.njcn.device.pojo.vo.pv.PvLineAllDetailVO; @@ -30,7 +31,7 @@ import java.util.Objects; /** *

- * 监测点实现类 + * 监测点实现类 *

* * @author cdf @@ -55,7 +56,7 @@ public class PvLineDetailServiceImpl extends ServiceImpl query = new LambdaQueryWrapper<>(); - query.eq(PvLineDetail::getDevId,pvLineDetailParam.getDevId()) - .eq(PvLineDetail::getNum,pvLineDetailParam.getNum()) - .eq(PvLineDetail::getState,DataStateEnum.ENABLE.getCode()); - if(isUpdate){ - if(pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam){ - query.ne(PvLineDetail::getId,((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId()); + query.eq(PvLineDetail::getDevId, pvLineDetailParam.getDevId()) + .eq(PvLineDetail::getNum, pvLineDetailParam.getNum()) + .eq(PvLineDetail::getState, DataStateEnum.ENABLE.getCode()); + if (isUpdate) { + if (pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam) { + query.ne(PvLineDetail::getId, ((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId()); } } int count = this.count(query); @@ -110,9 +112,9 @@ public class PvLineDetailServiceImpl extends ServiceImpl getPvLineDetailList(LineDetailQueryParam subsAreaQueryParam) { - Page page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam),PageFactory.getPageSize(subsAreaQueryParam)); + Page page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam)); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - return this.page(page,lambdaQueryWrapper); + return this.page(page, lambdaQueryWrapper); } @Override @@ -131,11 +133,11 @@ public class PvLineDetailServiceImpl extends ServiceImpl getPvLineAllDetailMain(Integer pageNum,Integer pageSize,List subIds, List subAreaIds) { + public Page getPvLineAllDetailMain(Integer pageNum, Integer pageSize, List subIds, List subAreaIds) { - Page page = new Page<>(pageNum,pageSize); + Page page = new Page<>(pageNum, pageSize); - return this.baseMapper.getPvLineAllDetailMain(page,subIds,subAreaIds); + return this.baseMapper.getPvLineAllDetailMain(page, subIds, subAreaIds); } @@ -146,81 +148,120 @@ public class PvLineDetailServiceImpl extends ServiceImpl subAreaTreeList = pvSubAreaMapper.getSubAreaTreeList(); unitTreeList.addAll(subTreeList); unitTreeList.addAll(subAreaTreeList); - List newUnit = unitTreeList.stream().filter(item->item.getPid().equals("0")).peek(tem->tem.setChildren(getChildren(tem,unitTreeList))).collect(Collectors.toList()); - - return newUnit; + return unitTreeList.stream().filter(item->item.getPid().equals("0")).peek(tem->tem.setChildren(getChildren(tem,unitTreeList))).collect(Collectors.toList()); } @Override public Page lineDetailBySubId(PvTerminalBaseQuery pvTerminalBaseQuery) { List ids = pvTerminalBaseQuery.getId(); Integer level = pvTerminalBaseQuery.getLevel(); - if(level.equals(LineBaseEnum.PV_UNIT_LEVEL.getCode())){ //点击的是单位节点 LambdaQueryWrapper subQuery= new LambdaQueryWrapper<>(); @@ -80,20 +78,17 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService { areaQuery.in(PvSubArea::getUnitId,ids); List subAreaList = iPvSubAreaService.list(areaQuery); List subAreaIds = subAreaList.stream().map(PvSubArea::getId).collect(Collectors.toList()); - return iPvLineDetailService.getPvLineAllDetailMain(1,10,subIds,subAreaIds); + return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),subIds,subAreaIds); }else if(level.equals(LineBaseEnum.PV_SUB_LEVEL.getCode())){ - - return iPvLineDetailService.getPvLineAllDetailMain(1,10, ids,null); + return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery), ids,null); }else if(level.equals(LineBaseEnum.PV_SUB_AREA_LEVEL.getCode())){ - - return iPvLineDetailService.getPvLineAllDetailMain(1,10,null,ids); - + return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),null,ids); } throw new BusinessException(CommonResponseEnum.FAIL); } - private void diGui(List unitTreeList,List subTreeList,List subAreaTreeList) { + /* private void diGui(List unitTreeList,List subTreeList,List subAreaTreeList) { for (PvTerminalTreeVO unit : unitTreeList) { if (CollUtil.isNotEmpty(unit.getChildren())) { diGui(unit.getChildren(),subTreeList,subAreaTreeList); @@ -102,7 +97,7 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService { unit.setChildren(getChildren(unit, subAreaTreeList)); } } - } + }*/ private List getChildren(PvTerminalTreeVO tem, List children) { diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java index fb58c5832..ac34294bc 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java @@ -108,7 +108,7 @@ public class PvVoltageServiceImpl extends ServiceImpl 0) { throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT); - } + }*/ } } diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java index 940104894..a756404a7 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java @@ -31,8 +31,14 @@ public enum DicDataEnum { */ ONE_LINE("I类监测点","One_Line"), TWO_LINE("II类监测点","Two_Line"), - THREE_LINE("III类监测点","Three_Line") + THREE_LINE("III类监测点","Three_Line"), + /** + * 终端类型 + */ + DEV_QUALITY("电能质量监测终端","Dev_Quality"), + DEV_SMART("智能电表","Dev_Smart"), + DEV_MIX("智能融合终端","Dev_Mix"), ; private final String name; diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/api/DeptFeignClient.java b/pqs-user/user-api/src/main/java/com/njcn/user/api/DeptFeignClient.java index 68d3c4565..fef5b4a1b 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/api/DeptFeignClient.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/api/DeptFeignClient.java @@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory; import com.njcn.user.pojo.dto.DeptDTO; +import com.njcn.user.pojo.po.Dept; import com.njcn.user.pojo.vo.PvTerminalTreeVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -53,4 +54,10 @@ public interface DeptFeignClient { @GetMapping("/allDeptList") HttpResult> allDeptList(); + /** + * 获取所有部门 + */ + @GetMapping("/getDeptById") + HttpResult getDeptById(@RequestParam("deptId") String deptId); + } diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/DeptFeignClientFallbackFactory.java b/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/DeptFeignClientFallbackFactory.java index 466581baf..d769f265e 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/DeptFeignClientFallbackFactory.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/DeptFeignClientFallbackFactory.java @@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.dto.DeptDTO; +import com.njcn.user.pojo.po.Dept; import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.utils.UserEnumUtil; import feign.hystrix.FallbackFactory; @@ -62,6 +63,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory getDeptById(String deptId) { + log.error("{}异常,降级处理,异常为:{}","查询所部门异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/controller/DeptController.java b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/DeptController.java index 87c0ad458..21586430a 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/controller/DeptController.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/DeptController.java @@ -13,6 +13,7 @@ import com.njcn.common.utils.LogUtil; import com.njcn.system.pojo.dto.AreaTreeDTO; import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.param.DeptParam; +import com.njcn.user.pojo.po.Dept; import com.njcn.user.pojo.vo.DeptAllTreeVO; import com.njcn.user.pojo.vo.DeptTreeVO; import com.njcn.user.pojo.vo.DeptVO; @@ -269,5 +270,20 @@ public class DeptController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } + /** + * 根据部门获取部门信息 + * @author cdf + * @date 2022/7/12 + */ + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @GetMapping("/getDeptById") + @ApiOperation("获取所有单位") + public HttpResult getDeptById(@RequestParam("deptId")String deptId) { + String methodDescribe = getMethodDescribe("getDeptById"); + Dept result = deptService.getDeptById(deptId); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/IDeptService.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/IDeptService.java index 991fe28d7..d7a3cc5b9 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/IDeptService.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/IDeptService.java @@ -138,4 +138,13 @@ public interface IDeptService extends IService { * @date 2022/7/12 */ List allDeptList(); + + + + /** + * 根据部门id获取部门详情 + * @author cdf + * @date 2022/7/13 + */ + Dept getDeptById(String id); } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java index 7acd02484..7528d89e8 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java @@ -256,6 +256,13 @@ public class DeptServiceImpl extends ServiceImpl implements ID return this.baseMapper.allDeptList(); } + @Override + public Dept getDeptById(String id){ + return this.baseMapper.selectById(id); + } + + + /** * 校验参数,检查是否存在相同编码的部门 */