云前置改造-补召功能调整
This commit is contained in:
@@ -3,9 +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.CsTerminalReplyClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsTerminalReplyClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.param.IcdBzReplyParam;
|
||||||
|
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.RequestParam;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
@@ -15,6 +18,13 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
public interface CsTerminalReplyFeignClient {
|
public interface CsTerminalReplyFeignClient {
|
||||||
|
|
||||||
@PostMapping("/updateData")
|
@PostMapping("/updateData")
|
||||||
HttpResult<String> updateData(@RequestParam("id") String id,@RequestParam("state") Integer state,@RequestParam("deviceId") String deviceId);
|
@ApiOperation("更新推送结果")
|
||||||
|
HttpResult<String> updateData(@RequestBody @Validated IcdBzReplyParam param);
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/updateBzData")
|
||||||
|
@ApiOperation("更新补召推送结果")
|
||||||
|
HttpResult<String> updateBzData(@RequestBody @Validated IcdBzReplyParam param);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,27 @@ 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.CsTerminalLogsClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsTerminalLogsClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.api.fallback.IcdFallbackFactory;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
|
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.RequestParam;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csTerminalLogs", fallbackFactory = CsTerminalLogsClientFallbackFactory.class,contextId = "csTerminalLogs")
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/icd", fallbackFactory = IcdFallbackFactory.class,contextId = "icd")
|
||||||
|
|
||||||
public interface IcdFeignClient {
|
public interface IcdFeignClient {
|
||||||
|
|
||||||
@PostMapping("/updateLaterData")
|
@PostMapping("/bzEvent")
|
||||||
HttpResult<String> updateLaterData(@RequestParam("id") String id, @RequestParam("code") String code);
|
@ApiOperation("补召事件")
|
||||||
|
HttpResult<String> bzEvent(@RequestBody @Validated IcdBzParam param);
|
||||||
|
|
||||||
|
@PostMapping("/bzFile")
|
||||||
|
@ApiOperation("补召波形")
|
||||||
|
HttpResult<String> bzFile(@RequestBody @Validated IcdBzParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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.CsTerminalReplyFeignClient;
|
import com.njcn.csdevice.api.CsTerminalReplyFeignClient;
|
||||||
|
import com.njcn.csdevice.param.IcdBzReplyParam;
|
||||||
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;
|
||||||
@@ -23,9 +24,16 @@ public class CsTerminalReplyClientFallbackFactory implements FallbackFactory<CsT
|
|||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new CsTerminalReplyFeignClient() {
|
return new CsTerminalReplyFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> updateData(String id, Integer state, String deviceId) {
|
public HttpResult<String> updateData(IcdBzReplyParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","更新推送结果",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","更新推送结果异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> updateBzData(IcdBzReplyParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","更新补召推送结果异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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.IcdFeignClient;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class IcdFallbackFactory implements FallbackFactory<IcdFeignClient> {
|
||||||
|
@Override
|
||||||
|
public IcdFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new IcdFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> bzEvent(IcdBzParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","定时补召事件异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> bzFile(IcdBzParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","定时补召波形异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,4 +20,5 @@ public class IcdBzParam implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("结束时间")
|
@ApiModelProperty("结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IcdBzReplyParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("guid")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态")
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("响应码")
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
@ApiModelProperty("响应消息")
|
||||||
|
private String msg;
|
||||||
|
}
|
||||||
@@ -67,5 +67,15 @@ public class CsTerminalReply extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isReceived;
|
private Integer isReceived;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收消息状态码
|
||||||
|
*/
|
||||||
|
private Integer receivedCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收消息描述
|
||||||
|
*/
|
||||||
|
private String receivedMsg;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class CldLogsVo implements Serializable {
|
|||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
@ApiModelProperty("日志")
|
@ApiModelProperty("补召类型")
|
||||||
private String log;
|
private String log;
|
||||||
|
|
||||||
@ApiModelProperty("补召时间")
|
@ApiModelProperty("补召时间")
|
||||||
@@ -36,4 +36,7 @@ public class CldLogsVo implements Serializable {
|
|||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty("结果")
|
||||||
|
private String result;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
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.param.IcdBzParam;
|
||||||
|
import com.njcn.csdevice.param.IcdBzReplyParam;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
||||||
import com.njcn.csdevice.service.ICsTerminalReplyService;
|
import com.njcn.csdevice.service.ICsTerminalReplyService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -52,14 +54,10 @@ public class CsTerminalReplyController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/updateData")
|
@PostMapping("/updateData")
|
||||||
@ApiOperation("更新推送结果")
|
@ApiOperation("更新推送结果")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
@ApiImplicitParam(name = "id", value = "参数", required = true),
|
public HttpResult<String> updateData(@RequestBody @Validated IcdBzReplyParam param){
|
||||||
@ApiImplicitParam(name = "state", value = "状态", required = true),
|
|
||||||
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true)
|
|
||||||
})
|
|
||||||
public HttpResult<String> updateData(@RequestParam String id,@RequestParam Integer state,@RequestParam String deviceId){
|
|
||||||
String methodDescribe = getMethodDescribe("updateData");
|
String methodDescribe = getMethodDescribe("updateData");
|
||||||
csTerminalReplyService.updateReplyData(id,state,deviceId);
|
csTerminalReplyService.updateReplyData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,5 +71,15 @@ public class CsTerminalReplyController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateBzData")
|
||||||
|
@ApiOperation("更新补召推送结果")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<String> updateBzData(@RequestBody @Validated IcdBzReplyParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("updateBzData");
|
||||||
|
csTerminalReplyService.updateBzData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package com.njcn.csdevice.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
|
import com.njcn.csdevice.param.IcdBzReplyParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,10 +23,12 @@ public interface ICsTerminalReplyService extends IService<CsTerminalReply> {
|
|||||||
|
|
||||||
List<String> queryReplyData();
|
List<String> queryReplyData();
|
||||||
|
|
||||||
void updateReplyData(String id,Integer state,String deviceId);
|
void updateReplyData(IcdBzReplyParam param);
|
||||||
|
|
||||||
List<CsTerminalReply> getBzReplyData(String lineId);
|
List<CsTerminalReply> getBzReplyData(String lineId);
|
||||||
|
|
||||||
Page<CldLogsVo> getBzLogs(BaseParam param);
|
Page<CldLogsVo> getBzLogs(BaseParam param);
|
||||||
|
|
||||||
|
void updateBzData(IcdBzReplyParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import com.njcn.csdevice.param.IcdBzParam;
|
|||||||
import com.njcn.csdevice.param.IcdLedgerParam;
|
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||||
import com.njcn.csdevice.param.IcdParam;
|
import com.njcn.csdevice.param.IcdParam;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
import com.njcn.csdevice.mapper.CsTerminalReplyMapper;
|
import com.njcn.csdevice.mapper.CsTerminalReplyMapper;
|
||||||
|
import com.njcn.csdevice.param.IcdBzReplyParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
||||||
@@ -102,11 +103,13 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateReplyData(String id,Integer state,String deviceId) {
|
public void updateReplyData(IcdBzReplyParam param) {
|
||||||
LambdaUpdateWrapper<CsTerminalReply> wrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsTerminalReply> wrapper = new LambdaUpdateWrapper<>();
|
||||||
wrapper.set(CsTerminalReply::getIsReceived,state)
|
wrapper.set(CsTerminalReply::getIsReceived,param.getState())
|
||||||
.eq(CsTerminalReply::getReplyId,id)
|
.set(CsTerminalReply::getReceivedCode,param.getCode())
|
||||||
.eq(CsTerminalReply::getDeviceId,deviceId);
|
.set(CsTerminalReply::getReceivedMsg,param.getMsg())
|
||||||
|
.eq(CsTerminalReply::getReplyId,param.getId())
|
||||||
|
.eq(CsTerminalReply::getDeviceId,param.getDeviceId());
|
||||||
this.update(wrapper);
|
this.update(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +184,18 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
cldLogsVo.setLineName(ledgerMap.get(param.getSearchValue()).getName());
|
cldLogsVo.setLineName(ledgerMap.get(param.getSearchValue()).getName());
|
||||||
cldLogsVo.setLog(getLogDescription(item.getCode()));
|
cldLogsVo.setLog(getLogDescription(item.getCode()));
|
||||||
cldLogsVo.setLogTime(item.getCreateTime());
|
cldLogsVo.setLogTime(item.getCreateTime());
|
||||||
cldLogsVo.setStatus(Objects.equals(item.getIsReceived(), 0)?"补召已下发":"补召成功");
|
if (Objects.equals(item.getIsReceived(),0)) {
|
||||||
|
cldLogsVo.setStatus("补召已下发");
|
||||||
|
cldLogsVo.setResult("/");
|
||||||
|
} else {
|
||||||
|
if (item.getReceivedCode() == 200) {
|
||||||
|
cldLogsVo.setStatus("补召成功");
|
||||||
|
cldLogsVo.setResult("补召成功");
|
||||||
|
} else {
|
||||||
|
cldLogsVo.setStatus("补召失败");
|
||||||
|
cldLogsVo.setResult(item.getReceivedMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
cldLogsVos.add(cldLogsVo);
|
cldLogsVos.add(cldLogsVo);
|
||||||
});
|
});
|
||||||
page.setRecords(cldLogsVos);
|
page.setRecords(cldLogsVos);
|
||||||
@@ -191,6 +205,20 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBzData(IcdBzReplyParam param) {
|
||||||
|
LambdaUpdateWrapper<CsTerminalReply> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.set(CsTerminalReply::getIsReceived,param.getState())
|
||||||
|
.set(CsTerminalReply::getReceivedCode,param.getCode())
|
||||||
|
.set(CsTerminalReply::getReceivedMsg,param.getMsg())
|
||||||
|
.eq(CsTerminalReply::getReplyId,param.getId())
|
||||||
|
.eq(CsTerminalReply::getDeviceId,param.getDeviceId());
|
||||||
|
if (Objects.nonNull(param.getLineId()) && StringUtils.isNotBlank(param.getLineId())) {
|
||||||
|
wrapper.eq(CsTerminalReply::getLineId,param.getLineId());
|
||||||
|
}
|
||||||
|
this.update(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
public String getLogDescription(String code) {
|
public String getLogDescription(String code) {
|
||||||
String result;
|
String result;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.access.utils.ChannelObjectUtil;
|
import com.njcn.access.utils.ChannelObjectUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.param.IcdBzParam;
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
@@ -20,19 +19,16 @@ import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
|||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||||
import com.njcn.csdevice.pojo.vo.CldLogsVo;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csharmonic.api.EventFeignClient;
|
import com.njcn.csharmonic.api.EventFeignClient;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
|
||||||
import com.njcn.mq.message.BZEventMessage;
|
import com.njcn.mq.message.BZEventMessage;
|
||||||
import com.njcn.mq.template.BZEventMessageTemplate;
|
import com.njcn.mq.template.BZEventMessageTemplate;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -297,8 +293,8 @@ class IcdServiceImpl implements IcdService {
|
|||||||
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
||||||
logsToSave.add(log);
|
logsToSave.add(log);
|
||||||
|
|
||||||
CsTerminalReply reply = buildTerminalReply(uuid, device, csLineList);
|
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList);
|
||||||
repliesToSave.add(reply);
|
repliesToSave.addAll(reply);
|
||||||
}
|
}
|
||||||
csTerminalLogsService.saveBatch(logsToSave);
|
csTerminalLogsService.saveBatch(logsToSave);
|
||||||
csTerminalReplyService.saveBatch(repliesToSave);
|
csTerminalReplyService.saveBatch(repliesToSave);
|
||||||
@@ -341,25 +337,47 @@ class IcdServiceImpl implements IcdService {
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CsTerminalReply buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||||
List<CsLinePO> csLineList) {
|
List<CsLinePO> csLineList) {
|
||||||
|
List<CsTerminalReply> replies = new ArrayList<>();
|
||||||
List<String> lineIds = csLineList.stream()
|
List<String> lineIds = csLineList.stream()
|
||||||
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||||
.map(CsLinePO::getLineId)
|
.map(CsLinePO::getLineId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
lineIds.forEach(lineId -> {
|
||||||
CsTerminalReply reply = new CsTerminalReply();
|
CsTerminalReply reply = new CsTerminalReply();
|
||||||
reply.setId(IdUtil.simpleUUID());
|
reply.setId(IdUtil.simpleUUID());
|
||||||
reply.setReplyId(replyId);
|
reply.setReplyId(replyId);
|
||||||
reply.setNodeId(device.getNodeId());
|
reply.setNodeId(device.getNodeId());
|
||||||
reply.setProcessNo(device.getNodeProcess());
|
reply.setProcessNo(device.getNodeProcess());
|
||||||
reply.setDeviceId(device.getId());
|
reply.setDeviceId(device.getId());
|
||||||
reply.setLineId(String.join(",", lineIds));
|
reply.setLineId(lineId);
|
||||||
reply.setIsReceived(0);
|
reply.setIsReceived(0);
|
||||||
reply.setCode("allEvent");
|
reply.setCode("allEvent");
|
||||||
return reply;
|
replies.add(reply);
|
||||||
|
});
|
||||||
|
return replies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private CsTerminalReply buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||||
|
// List<CsLinePO> csLineList) {
|
||||||
|
// List<String> lineIds = csLineList.stream()
|
||||||
|
// .filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||||
|
// .map(CsLinePO::getLineId)
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// CsTerminalReply reply = new CsTerminalReply();
|
||||||
|
// reply.setId(IdUtil.simpleUUID());
|
||||||
|
// reply.setReplyId(replyId);
|
||||||
|
// reply.setNodeId(device.getNodeId());
|
||||||
|
// reply.setProcessNo(device.getNodeProcess());
|
||||||
|
// reply.setDeviceId(device.getId());
|
||||||
|
// reply.setLineId(String.join(",", lineIds));
|
||||||
|
// reply.setIsReceived(0);
|
||||||
|
// reply.setCode("allEvent");
|
||||||
|
// return reply;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void bzFile(IcdBzParam param) {
|
public void bzFile(IcdBzParam param) {
|
||||||
|
|||||||
Reference in New Issue
Block a user