代码优化
This commit is contained in:
@@ -13,10 +13,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -44,4 +41,14 @@ public class WaveController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/channelWave")
|
||||
@ApiOperation("处理录波事件")
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true)
|
||||
public HttpResult<String> channelWave(@RequestParam("nDid") String nDid){
|
||||
String methodDescribe = getMethodDescribe("channelWave");
|
||||
csWaveService.channelWave(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class CsWaveAnalysisServiceImpl implements ICsWaveAnalysisService {
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final ChannelObjectUtil channelObjectUtil;
|
||||
private final MqttUtil mqttUtil;
|
||||
private static Integer mid = 1;
|
||||
|
||||
@Override
|
||||
public void analysis(AppEventMessage appEventMessage) {
|
||||
@@ -112,8 +113,18 @@ public class CsWaveAnalysisServiceImpl implements ICsWaveAnalysisService {
|
||||
if (Objects.isNull(obj)) {
|
||||
List<WaveTimeDto> list = channelObjectUtil.objectToList( redisUtil.getObjectByKey("eventFile:" + nDid),WaveTimeDto.class);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Object object = channelObjectUtil.getDeviceMid(nDid);
|
||||
if (!Objects.isNull(object)) {
|
||||
mid = (Integer) object;
|
||||
}
|
||||
WaveTimeDto dto = list.get(0);
|
||||
askFileInfo(nDid,1,dto.getFileName());
|
||||
redisUtil.saveByKeyWithExpire("fileMid:" + nDid,mid + "concat" +dto.getFileName(),60L);
|
||||
askFileInfo(nDid,mid,dto.getFileName());
|
||||
mid = mid + 1;
|
||||
if (mid > 10000) {
|
||||
mid = 1;
|
||||
}
|
||||
redisUtil.saveByKey(AppRedisKey.DEVICE_MID + nDid,mid);
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
|
||||
Reference in New Issue
Block a user