代码优化
1.公共方法提取 2.装置类型判断
This commit is contained in:
@@ -58,4 +58,7 @@ public interface EquipmentFeignClient {
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getAll();
|
||||
|
||||
@PostMapping("/judgeDevModel")
|
||||
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> judgeDevModel(String nDid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public enum AlgorithmResponseEnum {
|
||||
FILE_BUSY("A00516","正在进行其他文件操作,请稍后重试"),
|
||||
RECORD_FILE_LOST("A00516","record.bin文件缺失,请检查上传文件夹"),
|
||||
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
|
||||
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -306,4 +306,13 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/judgeDevModel")
|
||||
@ApiOperation("判断设备型号")
|
||||
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
|
||||
String methodDescribe = getMethodDescribe("judgeDevModel");
|
||||
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,4 +128,9 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @return
|
||||
*/
|
||||
List<CsEquipmentDeliveryPO> getAll();
|
||||
|
||||
/**
|
||||
* 判断设备型号
|
||||
*/
|
||||
boolean judgeDevModel(String nDid);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -664,6 +665,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean judgeDevModel(String nDid) {
|
||||
boolean result = false;
|
||||
//获取装置id
|
||||
CsEquipmentDeliveryPO po = findDevByNDid(nDid);
|
||||
//设备型号
|
||||
String code = dictTreeFeignClient.queryById(po.getDevModel()).getData().getCode();
|
||||
if (Objects.equals(DicTreeEnum.PQ_COM.getCode(),code)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ndid生成二维码
|
||||
* @param ndid
|
||||
|
||||
Reference in New Issue
Block a user