app直连设备接入接口支持
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/deviceUser", fallbackFactory = CsDeviceUserClientFallbackFactory.class,contextId = "deviceUser")
|
||||||
|
public interface CsDeviceUserFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/addList")
|
||||||
|
HttpResult<Boolean> add(@RequestBody List<CsDeviceUserPO> list);
|
||||||
|
}
|
||||||
@@ -3,8 +3,12 @@ package com.njcn.csdevice.api;
|
|||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,4 +20,7 @@ public interface CsLedgerFeignClient {
|
|||||||
@PostMapping("/findDevByLineId")
|
@PostMapping("/findDevByLineId")
|
||||||
HttpResult<String> findDevByLineId(@RequestParam("lineId") String lineId);
|
HttpResult<String> findDevByLineId(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
HttpResult<CsLedger> add(@RequestBody @Validated CsLedgerParam csLedgerParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
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.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -22,4 +29,7 @@ public interface CsLineFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/queryLineByDevId")
|
@PostMapping("/queryLineByDevId")
|
||||||
HttpResult<List<CsLinePO>> queryLineByDevId(@RequestParam("id") String id);
|
HttpResult<List<CsLinePO>> queryLineByDevId(@RequestParam("id") String id);
|
||||||
|
|
||||||
|
@PostMapping("/addList")
|
||||||
|
HttpResult<String> addLineList(@RequestBody List<CsLinePO> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/lineTopologyDiagram", fallbackFactory = CsLineTopologyClientFallbackFactory.class,contextId = "lineTopologyDiagram")
|
||||||
|
public interface CsLineTopologyFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/addList")
|
||||||
|
HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,20 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
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.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.api.fallback.DevModelRelationFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.DevModelRelationFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsDevModelRelationAddParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,4 +26,7 @@ public interface DevModelRelationFeignClient {
|
|||||||
@PostMapping("/getModelByDevId")
|
@PostMapping("/getModelByDevId")
|
||||||
HttpResult<CsDevModelRelationPO> getModelByDevId(@RequestParam("devId") String devId);
|
HttpResult<CsDevModelRelationPO> getModelByDevId(@RequestParam("devId") String devId);
|
||||||
|
|
||||||
|
@PostMapping("/addDevModelRelation")
|
||||||
|
HttpResult<CsDevModelRelationPO> addDevModelRelation(@RequestBody @Validated CsDevModelRelationAddParm addParm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
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.csdevice.api.CsDeviceUserFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsDeviceUserClientFallbackFactory implements FallbackFactory<CsDeviceUserFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsDeviceUserFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsDeviceUserFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> add(List<CsDeviceUserPO> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","批量新增用户设备关系",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -31,6 +33,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点获取装置",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点获取装置",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsLedger> add(CsLedgerParam csLedgerParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","新增台账数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
public HttpResult<List<CsLinePO>> queryLineByDevId(String id) {
|
public HttpResult<List<CsLinePO>> queryLineByDevId(String id) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum); }
|
throw new BusinessException(finalExceptionEnum); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> addLineList(List<CsLinePO> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","批量新增加监测点",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
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.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsLineTopologyClientFallbackFactory implements FallbackFactory<CsLineTopologyFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsLineTopologyFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsLineTopologyFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> addList(List<AppLineTopologyDiagramPO> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","新增监测点拓扑图关系表",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
import com.njcn.csdevice.api.DevModelRelationFeignClient;
|
import com.njcn.csdevice.api.DevModelRelationFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsDevModelRelationAddParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
@@ -32,6 +33,12 @@ public class DevModelRelationFeignClientFallbackFactory implements FallbackFacto
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据装置获取模板",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据装置获取模板",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsDevModelRelationPO> addDevModelRelation(CsDevModelRelationAddParm addParm) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","绑定设备与模板",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import javax.validation.constraints.Pattern;
|
|||||||
@Data
|
@Data
|
||||||
public class CsLedgerParam {
|
public class CsLedgerParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("Id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty("父Id")
|
@ApiModelProperty("父Id")
|
||||||
@NotBlank(message = "父Id不能为空")
|
@NotBlank(message = "父Id不能为空")
|
||||||
private String pid;
|
private String pid;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.po;
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -40,5 +38,11 @@ public class AppLineTopologyDiagramPO extends BaseEntity {
|
|||||||
@TableField(value = "status")
|
@TableField(value = "status")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@TableField(value = "lng")
|
||||||
|
private Double lng;
|
||||||
|
|
||||||
|
@TableField(value = "lat")
|
||||||
|
private Double lat;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.njcn.csdevice.pojo.po;
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -29,6 +31,7 @@ public class CsLedger extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentTransferAddParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentTransferAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||||
import com.njcn.csdevice.service.CsEquipmentTransferPOService;
|
import com.njcn.csdevice.service.CsEquipmentTransferPOService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -54,4 +55,14 @@ public class DeviceUserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addList")
|
||||||
|
@ApiOperation("批量新增用户设备关系")
|
||||||
|
@ApiImplicitParam(name = "list", value = "集合", required = true)
|
||||||
|
public HttpResult<Boolean> add(@RequestBody List<CsDeviceUserPO> list){
|
||||||
|
String methodDescribe = getMethodDescribe("add");
|
||||||
|
csDeviceUserPOService.saveBatch(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.mapper.AppProjectMapper;
|
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
@@ -72,10 +73,10 @@ public class CsLedgerController extends BaseController {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增台账信息")
|
@ApiOperation("新增台账信息")
|
||||||
@ApiImplicitParam(name = "csLedgerParam", value = "新增台账实体", required = true)
|
@ApiImplicitParam(name = "csLedgerParam", value = "新增台账实体", required = true)
|
||||||
public HttpResult<String> add(@RequestBody @Validated CsLedgerParam csLedgerParam){
|
public HttpResult<CsLedger> add(@RequestBody @Validated CsLedgerParam csLedgerParam){
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
csLedgerService.addLedgerTree(csLedgerParam);
|
CsLedger csLedger = csLedgerService.addLedgerTree(csLedgerParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csLedger, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
|||||||
@@ -13,10 +13,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -55,4 +52,14 @@ public class CslineController extends BaseController {
|
|||||||
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csLinePOS, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csLinePOS, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addList")
|
||||||
|
@ApiOperation("批量新增监测点")
|
||||||
|
@ApiImplicitParam(name = "list", value = "监测点数据集", required = true)
|
||||||
|
public HttpResult<String> addLineList(@RequestBody List<CsLinePO> list){
|
||||||
|
String methodDescribe = getMethodDescribe("addLineList");
|
||||||
|
csLinePOService.saveBatch(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.controller.project;
|
|||||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm;
|
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAuditParm;
|
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAuditParm;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -20,6 +21,8 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -71,4 +74,14 @@ public class LineTopologyDiagramController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appTopologyDiagramVO, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appTopologyDiagramVO, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addList")
|
||||||
|
@ApiOperation("批量新增监测点拓扑图关系")
|
||||||
|
@ApiImplicitParam(name = "list", value = "监测点拓扑图数据集", required = true)
|
||||||
|
public HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list){
|
||||||
|
String methodDescribe = getMethodDescribe("addList");
|
||||||
|
appLineTopologyDiagramService.saveBatch(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public interface ICsLedgerService {
|
|||||||
* 新增台账数据
|
* 新增台账数据
|
||||||
* @param csLedgerParam
|
* @param csLedgerParam
|
||||||
*/
|
*/
|
||||||
void addLedgerTree(CsLedgerParam csLedgerParam);
|
CsLedger addLedgerTree(CsLedgerParam csLedgerParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除台账数据
|
* 删除台账数据
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addLedgerTree(CsLedgerParam csLedgerParam) {
|
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
||||||
CsLedger csLedger = new CsLedger();
|
CsLedger csLedger = new CsLedger();
|
||||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||||
@@ -132,6 +132,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
csLedger.setPids(fatherCsLedger.getPids() + "," + csLedgerParam.getPid());
|
csLedger.setPids(fatherCsLedger.getPids() + "," + csLedgerParam.getPid());
|
||||||
}
|
}
|
||||||
this.save(csLedger);
|
this.save(csLedger);
|
||||||
|
return csLedger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user