From 764d883b5ea3bdc06abbec548b6df0511e567978 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Tue, 03 Sep 2024 09:46:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/binlog' into binlog

---
 src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java b/src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java
index 47310fc..4e4a7ed 100644
--- a/src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java
+++ b/src/main/java/org/springblade/modules/backblast/service/impl/BackblastPubRecordServiceImpl.java
@@ -1,30 +1,28 @@
 package org.springblade.modules.backblast.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.util.Strings;
 import org.springblade.common.param.CommonParamSet;
-import org.springblade.common.param.GridSet;
 import org.springblade.common.utils.SpringUtils;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.SpringUtil;
 import org.springblade.modules.backblast.entity.BackblastPubPersonEntity;
 import org.springblade.modules.backblast.entity.BackblastPubRecordEntity;
 import org.springblade.modules.backblast.excel.BackblastPubRecordExcel;
-import org.springblade.modules.backblast.service.IBackblastPubPersonService;
-import org.springblade.modules.backblast.vo.BackblastPubRecordVO;
 import org.springblade.modules.backblast.mapper.BackblastPubRecordMapper;
+import org.springblade.modules.backblast.service.IBackblastPubPersonService;
 import org.springblade.modules.backblast.service.IBackblastPubRecordService;
+import org.springblade.modules.backblast.vo.BackblastPubRecordVO;
 import org.springblade.modules.grid.entity.GridEntity;
 import org.springblade.modules.grid.service.IGridService;
-import org.springblade.modules.place.entity.PlacePractitionerEntity;
-import org.springblade.modules.place.service.IPlacePractitionerService;
 import org.springblade.modules.police.entity.PoliceAffairsGridEntity;
 import org.springblade.modules.police.service.IPoliceAffairsGridService;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IUserService;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -71,6 +69,8 @@
 		boolean flag = false;
 		// 点落面计算警格,网格,警格
 		setGridInfo(backblastPubRecord);
+		// "otherId":"\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"[1]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\"\""
+		backblastPubRecord.setOtherId(cleanEscapes(backblastPubRecord.getOtherId()));
 		// 设置民警姓名电话(非民警暂时也记录)
 		User user = SpringUtils.getBean(IUserService.class).getById(AuthUtil.getUserId());
 		if (null!=user){
@@ -88,6 +88,23 @@
 		updateBackblastPubPerson(backblastPubRecord);
 		// 返回
 		return flag;
+	}
+
+	/**
+	 * 清理字符串中的多余转义字符
+	 * @param originalStr 原始字符串
+	 * @return 清理后的字符串
+	 */
+	private static String cleanEscapes(String originalStr) {
+		if (StringUtils.isBlank(originalStr)) {
+			return "";
+		}
+		// 替换多个反斜杠为单个反斜杠
+		String replacedBackslashes = originalStr.replaceAll("\\\\+", "\\\\");
+		// 替换转义的双引号为空
+		String cleanedStr = replacedBackslashes.replaceAll("\\\\\"", "").replaceAll("\"", "");
+
+		return cleanedStr;
 	}
 
 	/**
@@ -158,11 +175,13 @@
 		IGridService gridService = SpringUtils.getBean(IGridService.class);
 		IPoliceAffairsGridService policeAffairsGridService = SpringUtils.getBean(IPoliceAffairsGridService.class);
 		String point = "'POINT(" + backblastPubRecord.getLng() + " " + backblastPubRecord.getLat() + ")'";
-		//点坐标解析网格
-		List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
-		if (gridEntityList.size()>0){
-			GridEntity gridEntity = gridEntityList.get(0);
-			backblastPubRecord.setGridCode(gridEntity.getGridCode());
+		if(StringUtils.isBlank(backblastPubRecord.getGridCode())){
+			//点坐标解析网格
+			List<GridEntity> gridEntityList = gridService.spatialAnalysis(point);
+			if (gridEntityList.size()>0){
+				GridEntity gridEntity = gridEntityList.get(0);
+				backblastPubRecord.setGridCode(gridEntity.getGridCode());
+			}
 		}
 		//点坐标解析警格
 		List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point);
@@ -192,12 +211,16 @@
 		// 再删除对应的宣传对象信息
 		if (flag){
 			IBackblastPubPersonService backblastPubPersonService = SpringUtil.getBean(IBackblastPubPersonService.class);
-			for (Long id : toLongList) {
 				// 删除所有
 				QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>();
-				wrapper.eq("backblast_pub_record_id", id);
+				wrapper.in("backblast_pub_record_id", toLongList);
 				backblastPubPersonService.remove(wrapper);
-			}
+			// for (Long id : toLongList) {
+			// 	// 删除所有
+			// 	QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>();
+			// 	wrapper.eq("backblast_pub_record_id", id);
+			// 	backblastPubPersonService.remove(wrapper);
+			// }
 		}
 		return flag;
 	}

--
Gitblit v1.9.3