|
|
@@ -16,12 +16,10 @@ import com.yunfeiyun.agmp.iot.common.domain.reqvo.IotCbdrecogReqVo;
|
|
|
import com.yunfeiyun.agmp.iot.common.enums.EnumCbdMarkType;
|
|
|
import com.yunfeiyun.agmp.iot.common.enums.EnumCbdRecogType;
|
|
|
import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
|
|
|
-import com.yunfeiyun.agmp.common.service.WeatherService;
|
|
|
import com.yunfeiyun.agmp.iot.common.service.MongoService;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.domain.IotCbdrecogInfoResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.domain.IotCbdrecogResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.pest.service.IIotCbdrecogService;
|
|
|
-import com.yunfeiyun.agmp.iotm.device.pest.service.IIotPestService;
|
|
|
import com.yunfeiyun.agmp.iotm.mq.provider.IotsMqProviderService;
|
|
|
import com.yunfeiyun.agmp.iotm.util.FixedStringGeneratorUtil;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
|
|
|
@@ -55,14 +53,9 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
@Autowired
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
@Resource
|
|
|
- private IIotPestService iotPestService;
|
|
|
- @Resource
|
|
|
private IIotDeviceService iotDeviceService;
|
|
|
|
|
|
@Autowired
|
|
|
- private WeatherService weatherService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private MongoService mongoService;
|
|
|
|
|
|
@Resource
|
|
|
@@ -101,7 +94,7 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
|
|
|
iotCbdrecog.setCbdrecogModifier(SecurityUtils.getUserId());
|
|
|
if (StringUtils.isNotEmpty(cbdrecogManualBase64)) {
|
|
|
- String imgUrl = getPestRecogImgOssUrl(cbdrecogManualBase64, iotCbdrecog.getCbdrecogBid());
|
|
|
+ String imgUrl = getPestRecogImgOssUrl(cbdrecogManualBase64, iotCbdrecog.getCbdrecogBid(), iotCbdimg.getTid());
|
|
|
iotCbdrecog.setCbdrecogManualaddr(imgUrl);
|
|
|
}
|
|
|
|
|
|
@@ -113,16 +106,16 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
JSONArray recogArray = JSONArray.parseArray(cbdrecogManualmark);
|
|
|
Map<String, IotCbdPestrecog> cbdPestrecogMap = new LinkedHashMap<>();
|
|
|
long cbdrecogTotalnumManual = 0L;
|
|
|
- for(Object o : recogArray) {
|
|
|
+ for (Object o : recogArray) {
|
|
|
JSONObject point = (JSONObject) o;
|
|
|
- for(String pestName : point.keySet()) {
|
|
|
+ for (String pestName : point.keySet()) {
|
|
|
String province = iotDevice.getDevProvince();
|
|
|
String city = iotDevice.getDevCity();
|
|
|
String district = iotDevice.getDevDistrict();
|
|
|
BigDecimal lat = iotDevice.getDevLatalign() == null ? iotDevice.getDevLat() : iotDevice.getDevLatalign();
|
|
|
BigDecimal lng = iotDevice.getDevLngalign() == null ? iotDevice.getDevLng() : iotDevice.getDevLngalign();
|
|
|
IotCbdPestrecog cbdPestrecog = cbdPestrecogMap.get(pestName);
|
|
|
- if(!cbdPestrecogMap.containsKey(pestName)) {
|
|
|
+ if (!cbdPestrecogMap.containsKey(pestName)) {
|
|
|
cbdPestrecog = new IotCbdPestrecog();
|
|
|
cbdPestrecog.setPestrecogBid(iotCbdrecog.getCbdrecogBid());
|
|
|
cbdPestrecog.setTid(iotDevice.getTid());
|
|
|
@@ -144,7 +137,7 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
cbdPestrecog.setPestrecogCreatedDate(nowDate);
|
|
|
|
|
|
cbdPestrecogMap.put(pestName, cbdPestrecog);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
cbdPestrecog.setPestrecogNum(cbdPestrecog.getPestrecogNum() + 1);
|
|
|
}
|
|
|
cbdrecogTotalnumManual += 1;
|
|
|
@@ -157,7 +150,7 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
|
|
|
List<IotCbdPestrecog> pestrecogList = new ArrayList<>(cbdPestrecogMap.values());
|
|
|
Map<String, List<IotCbdPestrecog>> pestrecog = iotCbdrecog.getPestrecog();
|
|
|
- if(pestrecog == null){
|
|
|
+ if (pestrecog == null) {
|
|
|
pestrecog = new HashMap<>();
|
|
|
}
|
|
|
pestrecog.put(EnumCbdMarkType.HAND.getCode(), pestrecogList);
|
|
|
@@ -183,7 +176,7 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
|
|
|
Map<String, IotCbdrecog> cbdrecog = iotCbdimg.getCbdrecog();
|
|
|
IotCbdrecog iotCbdrecog = cbdrecog.get(cbdrecogType);
|
|
|
- if(iotCbdrecog == null) {
|
|
|
+ if (iotCbdrecog == null) {
|
|
|
return 1;
|
|
|
}
|
|
|
iotCbdrecog.setCbdrecogModifier(SecurityUtils.getUserId());
|
|
|
@@ -195,7 +188,7 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
iotCbdrecog.setCbdrecogPestnumManual(0L);
|
|
|
|
|
|
Map<String, List<IotCbdPestrecog>> pestrecog = iotCbdrecog.getPestrecog();
|
|
|
- if(pestrecog != null){
|
|
|
+ if (pestrecog != null) {
|
|
|
pestrecog.remove(cbdrecogMarktype);
|
|
|
}
|
|
|
iotCbdrecog.setPestrecog(pestrecog);
|
|
|
@@ -225,16 +218,16 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
IotCbdrecog iotCbdrecog = cbdrecogMap.getOrDefault(cbdrecogType, new IotCbdrecog());
|
|
|
Map<String, List<IotCbdPestrecog>> pestrecogMap = iotCbdrecog.getPestrecog();
|
|
|
List<IotCbdPestrecog> iotCbdPestrecogList = new ArrayList<>();
|
|
|
- try{
|
|
|
+ try {
|
|
|
iotCbdPestrecogList = pestrecogMap.getOrDefault(cbdrecogMarktype, new ArrayList<>());
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
IotCbdrecogInfoResVo resVo = new IotCbdrecogInfoResVo();
|
|
|
BeanUtils.copyProperties(iotCbdrecog, resVo);
|
|
|
BeanUtils.copyProperties(iotCbdimg, resVo);
|
|
|
- if(StringUtils.isEmpty(resVo.getCbdrecogModifieddate())){
|
|
|
+ if (StringUtils.isEmpty(resVo.getCbdrecogModifieddate())) {
|
|
|
resVo.setCbdrecogModifieddate(resVo.getCbdimgModifieddate());
|
|
|
}
|
|
|
resVo.setCbdrecogTotalnum(iotCbdimg.getCbdimgTotalnum());
|
|
|
@@ -357,14 +350,14 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
if (iotCbdimg == null) {
|
|
|
throw new IotBizException(ErrorCode.FAILURE.getCode(), "图片不存在");
|
|
|
}
|
|
|
- iotsMqProviderService.sendBaseDataToIots(IotActionEnums.DEVICE_CBD_AGAIN_RECORD,reqVo,"测报灯重新识别");
|
|
|
+ iotsMqProviderService.sendBaseDataToIots(IotActionEnums.DEVICE_CBD_AGAIN_RECORD, reqVo, "测报灯重新识别");
|
|
|
}
|
|
|
|
|
|
- public String getPestRecogImgOssUrl(String base64, String imgId) {
|
|
|
+ public String getPestRecogImgOssUrl(String base64, String imgId, String tid) {
|
|
|
if (base64.contains(",")) {
|
|
|
base64 = base64.split(",")[1];
|
|
|
}
|
|
|
byte[] bytesFile = Base64.decode(base64);
|
|
|
- return OSSFactory.build().uploadSuffix(bytesFile, "jpg", ResConstants.BizType.CBD_RECOGNITION_MARKERS_AI.getPath(), imgId);
|
|
|
+ return OSSFactory.build().uploadSuffixAndTenant(bytesFile, "jpg", ResConstants.BizType.CBD_RECOGNITION_MARKERS_AI.getPath(), imgId, tid);
|
|
|
}
|
|
|
}
|