代码调整
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.algorithm.api;
|
|||||||
import com.njcn.algorithm.api.fallback.DevModelFeignClientFallbackFactory;
|
import com.njcn.algorithm.api.fallback.DevModelFeignClientFallbackFactory;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
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;
|
||||||
@@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
public interface DevModelFeignClient {
|
public interface DevModelFeignClient {
|
||||||
|
|
||||||
@PostMapping("/addDevModel")
|
@PostMapping("/addDevModel")
|
||||||
HttpResult<Boolean> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm);
|
HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm);
|
||||||
|
|
||||||
@PostMapping("/queryDevModelOne")
|
@PostMapping("/queryDevModelOne")
|
||||||
HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm);
|
HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm);
|
||||||
|
|||||||
@@ -18,4 +18,7 @@ public interface EquipmentFeignClient {
|
|||||||
@PostMapping("/queryEquipmentByndid")
|
@PostMapping("/queryEquipmentByndid")
|
||||||
HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid") String ndid);
|
HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid") String ndid);
|
||||||
|
|
||||||
|
@PostMapping("/updateStatusBynDid")
|
||||||
|
HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.algorithm.api.fallback;
|
|||||||
import com.njcn.algorithm.api.DevModelFeignClient;
|
import com.njcn.algorithm.api.DevModelFeignClient;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -35,7 +36,7 @@ public class DevModelFeignClientFallbackFactory implements FallbackFactory<DevMo
|
|||||||
return new DevModelFeignClient() {
|
return new DevModelFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<Boolean> addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
public HttpResult<CsDevModelPO> addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","新增装置模板版本信息",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","新增装置模板版本信息",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
@@ -31,6 +32,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
|||||||
log.error("{}异常,降级处理,异常为:{}","通过ndid查询出厂设备异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","通过ndid查询出厂设备异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> updateStatusBynDid(String nDid, Integer status) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","通过ndid修改装置的状态",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
|||||||
import com.njcn.algorithm.pojo.param.CsDevModelAuditParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelAuditParm;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||||
import com.njcn.algorithm.pojo.param.CsDevModelQueryParm;
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryParm;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
import com.njcn.algorithm.service.CsDevModelService;
|
import com.njcn.algorithm.service.CsDevModelService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -45,10 +46,9 @@ public class DevModelController extends BaseController {
|
|||||||
@PostMapping("/addDevModel")
|
@PostMapping("/addDevModel")
|
||||||
@ApiOperation("新增设备模板")
|
@ApiOperation("新增设备模板")
|
||||||
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
||||||
public HttpResult<Boolean> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm){
|
public HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm){
|
||||||
String methodDescribe = getMethodDescribe("addDevModel");
|
String methodDescribe = getMethodDescribe("addDevModel");
|
||||||
|
CsDevModelPO flag = csDevModelService.addDevModel (csDevModelAddParm);
|
||||||
Boolean flag = csDevModelService.addDevModel (csDevModelAddParm);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
|||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
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;
|
||||||
@@ -95,6 +96,18 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVOS, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVOS, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateStatusBynDid")
|
||||||
|
@ApiOperation("根据网关id调整设备状态")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "nDId", value = "网关id", required = true),
|
||||||
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){
|
||||||
|
String methodDescribe = getMethodDescribe("updateStatusBynDid");
|
||||||
|
csEquipmentDeliveryService.updateStatusBynDid(nDid,status);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public interface CsDevModelService extends IService<CsDevModelPO>{
|
|||||||
* @return: java.lang.Boolean
|
* @return: java.lang.Boolean
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/4/10
|
* @Date: 2023/4/10
|
||||||
*/
|
*/
|
||||||
Boolean addDevModel(CsDevModelAddParm csDevModelAddParm);
|
CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm);
|
||||||
/**
|
/**
|
||||||
* @Description: AuditDevModel
|
* @Description: AuditDevModel
|
||||||
* @Param: [csDevModelAuditParm]
|
* @Param: [csDevModelAuditParm]
|
||||||
|
|||||||
@@ -54,4 +54,10 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
IPage<ProjectEquipmentVO> queryEquipmentByProject(ProjectEquipmentQueryParm projectEquipmentQueryParm);
|
IPage<ProjectEquipmentVO> queryEquipmentByProject(ProjectEquipmentQueryParm projectEquipmentQueryParm);
|
||||||
|
|
||||||
Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm);
|
Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据网关id修改装置的状态
|
||||||
|
* @param nDid 网关id
|
||||||
|
*/
|
||||||
|
void updateStatusBynDid(String nDid,Integer status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,13 +29,12 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
||||||
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||||
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
|
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
|
||||||
csDevModelPO.setStatus ("1");
|
csDevModelPO.setStatus ("1");
|
||||||
boolean save = this.save (csDevModelPO);
|
this.save (csDevModelPO);
|
||||||
|
return csDevModelPO;
|
||||||
return save;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.algorithm.service.impl;
|
package com.njcn.algorithm.service.impl;
|
||||||
|
|
||||||
|
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.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -93,4 +95,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStatusBynDid(String nDId,Integer status) {
|
||||||
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId);
|
||||||
|
this.update(lambdaUpdateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user