linwe
2024-08-02 a1eede2f9f7c2590952ab1bdf34210020cdde7c6
src/main/java/org/springblade/modules/eCallEventTwo/service/impl/EcOrderServiceImpl.java
@@ -1,7 +1,6 @@
package org.springblade.modules.eCallEventTwo.service.impl;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -142,6 +141,7 @@
         recordEntityList.forEach(record -> {
            long count1 = ecOrderService.count(Wrappers.<ECallEventTwoEntity>lambdaQuery().eq(ECallEventTwoEntity::getOrderCode, record.getOrderCode()));
            if (count1 == 0) {
               setGridInfo(record);
               addList.add(record);
            } else {
               updateList.add(record);
@@ -172,24 +172,28 @@
    * @param ecOrderEntity
    */
   public void setGridInfo(ECallEventTwoEntity ecOrderEntity) {
      if (ecOrderEntity.getSceneGeoLng() == null || ecOrderEntity.getSceneGeoLat() == null) {
         return;
      }
      // 根据位置设置网格,警格编号
      IGridService gridService = SpringUtils.getBean(IGridService.class);
      IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
      String point = "'POINT(" + ecOrderEntity.getSceneGeoLng().toString() + " " + ecOrderEntity.getSceneGeoLat().toString() + ")'";
      // 点坐标解析网格
      List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
      if (gridEntityList.size() > 0) {
         GridEntity gridEntity = gridEntityList.get(0);
         ecOrderEntity.setGridCode(gridEntity.getGridCode());
      }
      // 点坐标解析警格
      List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point);
      if (policeAffairsGridEntityList.size() > 0) {
         PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0);
         ecOrderEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode());
      try {
         if (ecOrderEntity.getSceneGeoLng() == null || ecOrderEntity.getSceneGeoLat() == null) {
            return;
         }
         // 根据位置设置网格,警格编号
         IGridService gridService = SpringUtils.getBean(IGridService.class);
         IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
         String point = "'POINT(" + ecOrderEntity.getSceneGeoLng().toString() + " " + ecOrderEntity.getSceneGeoLat().toString() + ")'";
         // 点坐标解析网格
         List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
         if (gridEntityList.size() > 0) {
            GridEntity gridEntity = gridEntityList.get(0);
            ecOrderEntity.setGridCode(gridEntity.getGridCode());
         }
         // 点坐标解析警格
         List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point);
         if (policeAffairsGridEntityList.size() > 0) {
            PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0);
            ecOrderEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode());
         }
      } catch (Exception e) {
         System.out.println("获取警格网格信息失败" + e);
      }
   }