代码调整

This commit is contained in:
2023-04-18 11:42:16 +08:00
parent 41af9bb765
commit 728a03afde
10 changed files with 50 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package com.njcn.algorithm.api;
import com.njcn.algorithm.api.fallback.DevModelFeignClientFallbackFactory;
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
import com.njcn.algorithm.pojo.po.CsDevModelPO;
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
@@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
public interface DevModelFeignClient {
@PostMapping("/addDevModel")
HttpResult<Boolean> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm);
HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm);
@PostMapping("/queryDevModelOne")
HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm);

View File

@@ -18,4 +18,7 @@ public interface EquipmentFeignClient {
@PostMapping("/queryEquipmentByndid")
HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid") String ndid);
@PostMapping("/updateStatusBynDid")
HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status);
}

View File

@@ -3,6 +3,7 @@ package com.njcn.algorithm.api.fallback;
import com.njcn.algorithm.api.DevModelFeignClient;
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
import com.njcn.algorithm.pojo.po.CsDevModelPO;
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
@@ -35,7 +36,7 @@ public class DevModelFeignClientFallbackFactory implements FallbackFactory<DevMo
return new DevModelFeignClient() {
@Override
public HttpResult<Boolean> addDevModel(CsDevModelAddParm csDevModelAddParm) {
public HttpResult<CsDevModelPO> addDevModel(CsDevModelAddParm csDevModelAddParm) {
log.error("{}异常,降级处理,异常为:{}","新增装置模板版本信息",cause.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author xy
@@ -31,6 +32,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
log.error("{}异常,降级处理,异常为:{}","通过ndid查询出厂设备异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> updateStatusBynDid(String nDid, Integer status) {
log.error("{}异常,降级处理,异常为:{}","通过ndid修改装置的状态",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -5,6 +5,7 @@ import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
import com.njcn.algorithm.pojo.param.CsDevModelAuditParm;
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
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.service.CsDevModelService;
import com.njcn.common.pojo.annotation.OperateInfo;
@@ -45,10 +46,9 @@ public class DevModelController extends BaseController {
@PostMapping("/addDevModel")
@ApiOperation("新增设备模板")
@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");
Boolean flag = csDevModelService.addDevModel (csDevModelAddParm);
CsDevModelPO flag = csDevModelService.addDevModel (csDevModelAddParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}

View File

@@ -15,6 +15,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -95,6 +96,18 @@ public class EquipmentDeliveryController extends BaseController {
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);
}
}

View File

@@ -26,8 +26,8 @@ public interface CsDevModelService extends IService<CsDevModelPO>{
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2023/4/10
*/
Boolean addDevModel(CsDevModelAddParm csDevModelAddParm);
*/
CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm);
/**
* @Description: AuditDevModel
* @Param: [csDevModelAuditParm]

View File

@@ -54,4 +54,10 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
IPage<ProjectEquipmentVO> queryEquipmentByProject(ProjectEquipmentQueryParm projectEquipmentQueryParm);
Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm);
/**
* 根据网关id修改装置的状态
* @param nDid 网关id
*/
void updateStatusBynDid(String nDid,Integer status);
}

View File

@@ -29,13 +29,12 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean addDevModel(CsDevModelAddParm csDevModelAddParm) {
public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) {
CsDevModelPO csDevModelPO = new CsDevModelPO ();
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
csDevModelPO.setStatus ("1");
boolean save = this.save (csDevModelPO);
return save;
this.save (csDevModelPO);
return csDevModelPO;
}
@Override

View File

@@ -1,6 +1,8 @@
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.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -93,4 +95,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
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);
}
}