|
@@ -9,6 +9,7 @@ import com.yunfeiyun.agmp.common.framework.oss.cloud.OSSFactory;
|
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
|
|
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
|
|
|
import com.yunfeiyun.agmp.iot.common.constant.mq.IotActionEnums;
|
|
import com.yunfeiyun.agmp.iot.common.constant.mq.IotActionEnums;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.*;
|
|
import com.yunfeiyun.agmp.iot.common.domain.*;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.reqvo.IotCbdrecogAgainReqVo;
|
|
import com.yunfeiyun.agmp.iot.common.domain.reqvo.IotCbdrecogAgainReqVo;
|
|
@@ -61,16 +62,27 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
@Resource
|
|
@Resource
|
|
|
private IotsMqProviderService iotsMqProviderService;
|
|
private IotsMqProviderService iotsMqProviderService;
|
|
|
|
|
|
|
|
|
|
+ private String getCbdrecogType(IotCbdrecogReqVo reqVo, String devBid){
|
|
|
|
|
+ String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
|
|
+ IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
|
|
+ if(iotDevice.getDevtypeBid().equals(IotDeviceDictConst.TYPE_YF_XCT)){
|
|
|
|
|
+ cbdrecogType = EnumCbdRecogType.A.getCode();
|
|
|
|
|
+ }
|
|
|
|
|
+ return cbdrecogType;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
|
@Override
|
|
@Override
|
|
|
public int artificialUpdate(IotCbdrecogReqVo reqVo) {
|
|
public int artificialUpdate(IotCbdrecogReqVo reqVo) {
|
|
|
- String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
|
String cbdrecogManualmark = reqVo.getCbdrecogManualmark();
|
|
String cbdrecogManualmark = reqVo.getCbdrecogManualmark();
|
|
|
String cbdrecogManualBase64 = reqVo.getCbdrecogManualBase64();
|
|
String cbdrecogManualBase64 = reqVo.getCbdrecogManualBase64();
|
|
|
String devBid = reqVo.getDevBid();
|
|
String devBid = reqVo.getDevBid();
|
|
|
|
|
|
|
|
|
|
+ IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
|
|
+ String cbdrecogType = getCbdrecogType(reqVo, reqVo.getDevBid());
|
|
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
|
IotCbdimg iotCbdimg = (IotCbdimg) mongoService.findOne(IotCbdimg.class, map, null, null);
|
|
IotCbdimg iotCbdimg = (IotCbdimg) mongoService.findOne(IotCbdimg.class, map, null, null);
|
|
@@ -102,7 +114,6 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
iotCbdrecog.setCbdrecogManualmark(cbdrecogManualmark);
|
|
iotCbdrecog.setCbdrecogManualmark(cbdrecogManualmark);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
|
|
JSONArray recogArray = JSONArray.parseArray(cbdrecogManualmark);
|
|
JSONArray recogArray = JSONArray.parseArray(cbdrecogManualmark);
|
|
|
Map<String, IotCbdPestrecog> cbdPestrecogMap = new LinkedHashMap<>();
|
|
Map<String, IotCbdPestrecog> cbdPestrecogMap = new LinkedHashMap<>();
|
|
|
long cbdrecogTotalnumManual = 0L;
|
|
long cbdrecogTotalnumManual = 0L;
|
|
@@ -166,7 +177,6 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int artificialReset(IotCbdrecogReqVo reqVo) {
|
|
public int artificialReset(IotCbdrecogReqVo reqVo) {
|
|
|
- String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
|
|
String cbdrecogMarktype = EnumCbdMarkType.HAND.getCode();
|
|
String cbdrecogMarktype = EnumCbdMarkType.HAND.getCode();
|
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
|
|
|
|
|
@@ -174,6 +184,9 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
|
IotCbdimg iotCbdimg = (IotCbdimg) mongoService.findOne(IotCbdimg.class, map, null, null);
|
|
IotCbdimg iotCbdimg = (IotCbdimg) mongoService.findOne(IotCbdimg.class, map, null, null);
|
|
|
|
|
|
|
|
|
|
+ String devBid = iotCbdimg.getDevBid();
|
|
|
|
|
+ String cbdrecogType = getCbdrecogType(reqVo, devBid);
|
|
|
|
|
+
|
|
|
Map<String, IotCbdrecog> cbdrecog = iotCbdimg.getCbdrecog();
|
|
Map<String, IotCbdrecog> cbdrecog = iotCbdimg.getCbdrecog();
|
|
|
IotCbdrecog iotCbdrecog = cbdrecog.get(cbdrecogType);
|
|
IotCbdrecog iotCbdrecog = cbdrecog.get(cbdrecogType);
|
|
|
if (iotCbdrecog == null) {
|
|
if (iotCbdrecog == null) {
|
|
@@ -206,7 +219,6 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public IotCbdrecogInfoResVo info(IotCbdrecogReqVo reqVo) {
|
|
public IotCbdrecogInfoResVo info(IotCbdrecogReqVo reqVo) {
|
|
|
- String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
|
|
String cbdrecogMarktype = reqVo.getCbdrecogMarktype();
|
|
String cbdrecogMarktype = reqVo.getCbdrecogMarktype();
|
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
|
|
|
|
|
@@ -214,6 +226,10 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
if (iotCbdimg == null) {
|
|
if (iotCbdimg == null) {
|
|
|
throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(), "未找到对应的图片记录");
|
|
throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(), "未找到对应的图片记录");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ String devBid = iotCbdimg.getDevBid();
|
|
|
|
|
+ String cbdrecogType = getCbdrecogType(reqVo, devBid);
|
|
|
|
|
+
|
|
|
Map<String, IotCbdrecog> cbdrecogMap = iotCbdimg.getCbdrecog();
|
|
Map<String, IotCbdrecog> cbdrecogMap = iotCbdimg.getCbdrecog();
|
|
|
IotCbdrecog iotCbdrecog = cbdrecogMap.getOrDefault(cbdrecogType, new IotCbdrecog());
|
|
IotCbdrecog iotCbdrecog = cbdrecogMap.getOrDefault(cbdrecogType, new IotCbdrecog());
|
|
|
Map<String, List<IotCbdPestrecog>> pestrecogMap = iotCbdrecog.getPestrecog();
|
|
Map<String, List<IotCbdPestrecog>> pestrecogMap = iotCbdrecog.getPestrecog();
|
|
@@ -331,18 +347,20 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public void againRecog(IotCbdrecogAgainReqVo reqVo) {
|
|
public void againRecog(IotCbdrecogAgainReqVo reqVo) {
|
|
|
- String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
|
String devBid = reqVo.getDevBid();
|
|
String devBid = reqVo.getDevBid();
|
|
|
|
|
|
|
|
- if (EnumCbdRecogType.findEnumByCode(cbdrecogType) == null) {
|
|
|
|
|
- throw new IotBizException(ErrorCode.FAILURE.getCode(), "识别类型错误");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
if (iotDevice == null) {
|
|
if (iotDevice == null) {
|
|
|
throw new IotBizException(ErrorCode.FAILURE.getCode(), "设备不存在");
|
|
throw new IotBizException(ErrorCode.FAILURE.getCode(), "设备不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+ IotCbdrecogReqVo req = new IotCbdrecogReqVo();
|
|
|
|
|
+ req.setCbdrecogType(reqVo.getCbdrecogType());
|
|
|
|
|
+ String cbdrecogType = getCbdrecogType(req, devBid);
|
|
|
|
|
+
|
|
|
|
|
+ if (EnumCbdRecogType.findEnumByCode(cbdrecogType) == null) {
|
|
|
|
|
+ throw new IotBizException(ErrorCode.FAILURE.getCode(), "识别类型错误");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
map.put("cbdimgBid", cbdimgBid);
|
|
@@ -350,6 +368,8 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
if (iotCbdimg == null) {
|
|
if (iotCbdimg == null) {
|
|
|
throw new IotBizException(ErrorCode.FAILURE.getCode(), "图片不存在");
|
|
throw new IotBizException(ErrorCode.FAILURE.getCode(), "图片不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+ reqVo.setCbdrecogType(cbdrecogType);
|
|
|
|
|
+ reqVo.setDevtypeBid(iotDevice.getDevtypeBid());
|
|
|
iotsMqProviderService.sendBaseDataToIots(IotActionEnums.DEVICE_CBD_AGAIN_RECORD, reqVo, "测报灯重新识别");
|
|
iotsMqProviderService.sendBaseDataToIots(IotActionEnums.DEVICE_CBD_AGAIN_RECORD, reqVo, "测报灯重新识别");
|
|
|
}
|
|
}
|
|
|
|
|
|