1.实体调整
2.事件解析对外接口功能
This commit is contained in:
@@ -7,6 +7,7 @@ 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 org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,4 +19,7 @@ public interface CsDeviceUserFeignClient {
|
||||
|
||||
@PostMapping("/addList")
|
||||
HttpResult<Boolean> add(@RequestBody List<CsDeviceUserPO> list);
|
||||
|
||||
@PostMapping("/findUserById")
|
||||
HttpResult<List<String>> findUserById(@RequestParam("id") String id);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -27,4 +28,12 @@ public interface EquipmentFeignClient {
|
||||
|
||||
@PostMapping("/updateSoftInfoBynDid")
|
||||
HttpResult<Boolean> updateSoftInfoBynDid(@RequestParam("nDId") String nDid, @RequestParam("id") String id, @RequestParam("module") Integer module);
|
||||
|
||||
/**
|
||||
* 根据nDid查询设备信息
|
||||
* @param nDid
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findDevByNDid")
|
||||
HttpResult<CsEquipmentDeliveryPO> findDevByNDid(@RequestParam("nDid") String nDid);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ public class CsDeviceUserClientFallbackFactory implements FallbackFactory<CsDevi
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> findUserById(String id) {
|
||||
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.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -52,6 +53,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
log.error("{}异常,降级处理,异常为:{}","根据网关id调整软件信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEquipmentDeliveryPO> findDevByNDid(String nDid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","通过nDid查询设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -88,19 +88,19 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
* 出厂日期
|
||||
*/
|
||||
@TableField(value = "producte_time")
|
||||
private Date producteTime;
|
||||
private LocalDateTime producteTime;
|
||||
|
||||
/**
|
||||
* 检修日期
|
||||
*/
|
||||
@TableField(value = "check_time")
|
||||
private Date checkTime;
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 调试日期
|
||||
*/
|
||||
@TableField(value = "debug_time")
|
||||
private Date debugTime;
|
||||
private LocalDateTime debugTime;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
|
||||
@@ -130,4 +130,14 @@ public class DeviceUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devUserVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findUserById")
|
||||
@ApiOperation("根据设备Id查询用户集合")
|
||||
@ApiImplicitParam(name = "id", value = "设备Id", required = true)
|
||||
public HttpResult<List<String>> findUserById(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("findUserById");
|
||||
List<String> list = csDeviceUserPOService.findUserById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -179,4 +179,15 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findDevByNDid")
|
||||
@ApiOperation("通过nDid查询设备信息")
|
||||
@ApiImplicitParam(name = "nDid", value = "网关识别码", required = true)
|
||||
public HttpResult<CsEquipmentDeliveryPO> findDevByNDid(@RequestParam("nDid")String nDid){
|
||||
String methodDescribe = getMethodDescribe("findDevByNDid");
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,4 +41,11 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
Boolean recovery(String eid);
|
||||
|
||||
DevUserVO queryUserById(String devId);
|
||||
|
||||
/**
|
||||
* 根据设备id查询用户集合(主用户和子用户)
|
||||
* @param devId
|
||||
* @return
|
||||
*/
|
||||
List<String> findUserById(String devId);
|
||||
}
|
||||
|
||||
@@ -82,4 +82,11 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @param nDid 网关id
|
||||
*/
|
||||
void updateSoftInfoBynDid(String nDid,String id,Integer module);
|
||||
|
||||
/**
|
||||
* 通过nDid查询设备信息
|
||||
* @param nDid
|
||||
* @return
|
||||
*/
|
||||
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.cswarn.api.CsEquipmentAlarmFeignClient;
|
||||
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
@@ -36,7 +29,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.*;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -342,4 +335,14 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
devUser.setMasterUser(primaryUser.get(0));
|
||||
return devUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findUserById(String devId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId,devId).list();
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
result = list.stream().map(CsDeviceUserPO::getSubUserId).collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,6 +306,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEquipmentDeliveryPO findDevByNDid(String nDid) {
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getNdid,nDid).one();
|
||||
}
|
||||
|
||||
public InputStream bufferedImageToInputStream(BufferedImage image) {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
try {
|
||||
|
||||
@@ -54,18 +54,12 @@ public class CsEventPO {
|
||||
/**
|
||||
* 关联事件波形表id
|
||||
*/
|
||||
@TableField(value = "wave_id")
|
||||
private String waveId;
|
||||
@TableField(value = "wave_path")
|
||||
private String wavePath;
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_LINE_ID = "line_id";
|
||||
|
||||
public static final String COL_DEVICE_ID = "device_id";
|
||||
|
||||
public static final String COL_START_TIME = "start_time";
|
||||
|
||||
public static final String COL_TAG = "tag";
|
||||
|
||||
public static final String COL_WAVE_ID = "wave_id";
|
||||
/**
|
||||
* 关联事件波形表id
|
||||
*/
|
||||
@TableField(value = "type")
|
||||
private Integer type;
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -21,11 +17,6 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "cs_event_user")
|
||||
public class CsEventUserPO {
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
@TableField(value = "device_id")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
@@ -44,12 +35,4 @@ public class CsEventUserPO {
|
||||
*/
|
||||
@TableField(value = "`status`")
|
||||
private Integer status;
|
||||
|
||||
public static final String COL_DEVICE_ID = "device_id";
|
||||
|
||||
public static final String COL_USER_ID = "user_id";
|
||||
|
||||
public static final String COL_EVENT_ID = "event_id";
|
||||
|
||||
public static final String COL_STATUS = "status";
|
||||
}
|
||||
Reference in New Issue
Block a user