|
|
@@ -33,7 +33,6 @@ import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
-import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -176,37 +175,39 @@ public class IotCbdrecogServiceImpl implements IIotCbdrecogService {
|
|
|
@Override
|
|
|
public int artificialReset(IotCbdrecogReqVo reqVo) {
|
|
|
String cbdrecogType = reqVo.getCbdrecogType();
|
|
|
- String cbdrecogMarktype = "0";
|
|
|
+ String cbdrecogMarktype = EnumCbdMarkType.HAND.getCode();
|
|
|
String cbdimgBid = reqVo.getCbdimgBid();
|
|
|
|
|
|
- Criteria cri = Criteria.where("cbdimgBid").is(cbdimgBid)
|
|
|
- .and("cbdrecogType").is(cbdrecogType)
|
|
|
- .and("cbdrecogMarktype").is(cbdrecogMarktype);
|
|
|
- IotCbdrecog iotCbdrecog = mongoTemplate.findOne(new Query(cri),
|
|
|
- IotCbdrecog.class, "IotCbdrecog");
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("cbdimgBid", cbdimgBid);
|
|
|
+ IotCbdimg iotCbdimg = (IotCbdimg) mongoService.findOne(IotCbdimg.class, map, null, null);
|
|
|
+ String nowDate = DateUtils.dateTimeNow();
|
|
|
+ iotCbdimg.setCbdimgModifieddate(nowDate);
|
|
|
|
|
|
- if (iotCbdrecog == null) {
|
|
|
+ Map<String, IotCbdrecog> cbdrecog = iotCbdimg.getCbdrecog();
|
|
|
+ IotCbdrecog iotCbdrecog = cbdrecog.get(cbdrecogType);
|
|
|
+ if(iotCbdrecog == null) {
|
|
|
return 1;
|
|
|
}
|
|
|
- Map<String, String> cbdpestMap = new HashMap<>();
|
|
|
- cbdpestMap.put("cbdrecogBid", iotCbdrecog.getCbdrecogBid());
|
|
|
- List<IotCbdpest> cbdpestList = mongoService.findAll(IotCbdpest.class, cbdpestMap);
|
|
|
- Set<String> pestrecogBidSet = new HashSet<>();
|
|
|
- Set<String> cbdpestBidSet = new HashSet<>();
|
|
|
- for (IotCbdpest cbdpest : cbdpestList) {
|
|
|
- pestrecogBidSet.add(cbdpest.getPestrecogBid());
|
|
|
- cbdpestBidSet.add(cbdpest.getCbdpestBid());
|
|
|
- }
|
|
|
- List<String> pestrecogBidList = new ArrayList<>(pestrecogBidSet);
|
|
|
- List<String> cbdpestBidList = new ArrayList<>(cbdpestBidSet);
|
|
|
+ iotCbdrecog.setCbdrecogModifier(SecurityUtils.getUserId());
|
|
|
+ iotCbdrecog.setCbdrecogModifieddate(nowDate);
|
|
|
+ iotCbdrecog.setCbdrecogManualmark("");
|
|
|
+ iotCbdrecog.setCbdrecogManualaddr("");
|
|
|
+ iotCbdrecog.setCbdrecogResultManual("");
|
|
|
+ iotCbdrecog.setCbdrecogTotalnumManual(0L);
|
|
|
+ iotCbdrecog.setCbdrecogTypenumManual(0L);
|
|
|
+ iotCbdrecog.setCbdrecogPestnumManual(0L);
|
|
|
|
|
|
- if (pestrecogBidList.size() > 0) {
|
|
|
- mongoService.removeAllByBatch("pestrecogBid", pestrecogBidList, "IotCbdpest");
|
|
|
- }
|
|
|
- if (cbdpestBidList.size() > 0) {
|
|
|
- mongoService.removeAllByBatch("cbdpestBid", cbdpestBidList, "IotCbdpest");
|
|
|
+ Map<String, List<IotCbdPestrecog>> pestrecog = iotCbdrecog.getPestrecog();
|
|
|
+ if(pestrecog != null){
|
|
|
+ pestrecog.remove(cbdrecogMarktype);
|
|
|
}
|
|
|
- mongoService.removeAllByParam("cbdrecogBid", iotCbdrecog.getCbdrecogBid(), "IotCbdrecog");
|
|
|
+ iotCbdrecog.setPestrecog(pestrecog);
|
|
|
+ cbdrecog.put(cbdrecogType, iotCbdrecog);
|
|
|
+ iotCbdimg.setCbdrecog(cbdrecog);
|
|
|
+
|
|
|
+ mongoService.removeAllByParam("cbdimgBid", cbdimgBid, "IotCbdimg");
|
|
|
+ mongoService.saveOne(iotCbdimg);
|
|
|
return 1;
|
|
|
}
|
|
|
|