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/disputeRecord/service/impl/DisputeRecordServiceImpl.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 98 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/springblade/modules/disputeRecord/service/impl/DisputeRecordServiceImpl.java b/src/main/java/org/springblade/modules/disputeRecord/service/impl/DisputeRecordServiceImpl.java
index c33ccca..47c54d5 100644
--- a/src/main/java/org/springblade/modules/disputeRecord/service/impl/DisputeRecordServiceImpl.java
+++ b/src/main/java/org/springblade/modules/disputeRecord/service/impl/DisputeRecordServiceImpl.java
@@ -5,14 +5,20 @@
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.tool.utils.BeanUtil;
import org.springblade.modules.backblast.entity.BackblastWarnHanRecEntity;
+import org.springblade.modules.community.dto.CommunityDTO;
import org.springblade.modules.disputeRecord.entity.DisputeRecordEntity;
import org.springblade.modules.disputeRecord.excel.DisputeRecordExcel;
import org.springblade.modules.disputeRecord.excel.ExportDisputeRecordExcel;
import org.springblade.modules.disputeRecord.vo.DisputeRecordVO;
import org.springblade.modules.disputeRecord.mapper.DisputeRecordMapper;
import org.springblade.modules.disputeRecord.service.IDisputeRecordService;
+import org.springblade.modules.system.entity.DictBiz;
+import org.springblade.modules.system.service.IDictBizService;
+import org.springblade.modules.task.entity.ECallEventEntity;
+import org.springblade.modules.task.service.IECallEventService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.transaction.annotation.Transactional;
@@ -79,8 +85,18 @@
*/
@Override
@Transactional(rollbackFor = Exception.class)
- public void importDisputeRecord(List<DisputeRecordExcel> data, Boolean isCovered) {
+ public String importDisputeRecord(List<DisputeRecordExcel> data, Boolean isCovered) {
+ int totalNum = data.size();
+ int importNum = 0;
+ int updateNum = 0;
+ int errorNum = 0;
for (DisputeRecordExcel disputeRecordExcel : data) {
+ // 判断地址,时间
+ if (Strings.isBlank(disputeRecordExcel.getAddress())
+ ) {
+ errorNum++;
+ continue;
+ }
// 获取转换数据对象
DisputeRecordEntity disputeRecordEntity
= Objects.requireNonNull(BeanUtil.copy(disputeRecordExcel, DisputeRecordEntity.class));
@@ -103,6 +119,24 @@
}
if (disputeRecordExcel.getInjuryFlag().equals("否")){
disputeRecordEntity.setInjuryFlag(0);
+ }
+ }
+ // 当事人1性别 1:男 2:女
+ if (!Strings.isBlank(disputeRecordExcel.getGenderOne())) {
+ if (disputeRecordExcel.getGenderOne().contains("男")){
+ disputeRecordEntity.setGenderOne(1);
+ }
+ if (disputeRecordExcel.getGenderOne().contains("女")){
+ disputeRecordEntity.setGenderOne(2);
+ }
+ }
+ // 当事人2性别 1:男 2:女
+ if (!Strings.isBlank(disputeRecordExcel.getGenderTwo())) {
+ if (disputeRecordExcel.getGenderTwo().contains("男")){
+ disputeRecordEntity.setGenderTwo(1);
+ }
+ if (disputeRecordExcel.getGenderTwo().contains("女")){
+ disputeRecordEntity.setGenderTwo(2);
}
}
// 处理结果 1:已化解 2:未化解 3:移送e呼即办
@@ -134,15 +168,30 @@
// 查询
List<DisputeRecordEntity> list = list(queryWrapper);
if (list.size()>0){
- // 更新
- disputeRecordEntity.setId(list.get(0).getId());
- // 更新
- updateById(disputeRecordEntity);
+ updateNum++;
+ if (isCovered) {
+ // 更新
+ disputeRecordEntity.setId(list.get(0).getId());
+ // 更新
+ updateById(disputeRecordEntity);
+ importNum++;
+ }
}else {
// 插入
save(disputeRecordEntity);
+ importNum ++;
}
}
+ StringBuilder builder = new StringBuilder("导入完成!");
+ builder.append("其中本次表格共有 ").append(totalNum).append(" 条数据,")
+ .append("成功导入 ").append(importNum).append(" 条数据。");
+ if (updateNum>0) {
+ builder.append("其中有 ").append(updateNum).append(" 条数据已存在。");
+ }
+ if (errorNum>0){
+ builder.append("共有 ").append(errorNum).append(" 条数据由于无地址信息未导入!");
+ }
+ return builder.toString();
}
/**
@@ -159,4 +208,48 @@
commonParamSet.getRegionChildCodesList(),
commonParamSet.getGridCodeList());
}
+
+ /**
+ * e呼即办数据临时转换到矛盾纠纷
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void eCallToDis() {
+ // 查询所有的e 呼即办数据
+ IECallEventService callEventService = SpringUtils.getBean(IECallEventService.class);
+ IDictBizService dictBizService = SpringUtils.getBean(IDictBizService.class);
+ // 查询所有
+ QueryWrapper<ECallEventEntity> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("is_deleted",0);
+ List<ECallEventEntity> eCallEventEntityList = callEventService.list(queryWrapper);
+ // 遍历处理
+ for (ECallEventEntity eCallEventEntity : eCallEventEntityList) {
+ if (eCallEventEntity.getName().contains("纠纷")) {
+ DisputeRecordEntity disputeRecordEntity = new DisputeRecordEntity();
+ disputeRecordEntity.setAddress(eCallEventEntity.getAddress());
+ disputeRecordEntity.setLng(eCallEventEntity.getLng());
+ disputeRecordEntity.setLat(eCallEventEntity.getLat());
+ disputeRecordEntity.setEventTime(eCallEventEntity.getOccurrenceTime());
+ disputeRecordEntity.setDisputeContent(eCallEventEntity.getRemark());
+ disputeRecordEntity.setAddress(eCallEventEntity.getAddress());
+ // 设置处置结果,暂时放在受伤结果里面
+ disputeRecordEntity.setInjuryDesc(eCallEventEntity.getDisRes());
+ // 设置网格,警格编号
+ GridSet gridSet
+ = new GridSet().invoke(DisputeRecordEntity.class, disputeRecordEntity, "lng", "lat", "gridCode", "jwGridCode");
+ // 纠纷类型转换
+ QueryWrapper<DictBiz> wrapper = new QueryWrapper<>();
+ wrapper.eq("code", "disputeType").eq("is_deleted", 0).eq("dict_value", eCallEventEntity.getName());
+ DictBiz one = dictBizService.getOne(wrapper);
+ if (null!=one){
+ disputeRecordEntity.setDisputeType(Integer.parseInt(one.getDictKey()));
+ }else {
+ // 设置为其他纠纷
+ disputeRecordEntity.setDisputeType(8);
+ }
+ // 保存
+ save(disputeRecordEntity);
+ }
+ }
+ }
}
--
Gitblit v1.9.3