From db67d2c23022fed302b8cb07f03076b07ab0941b Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期三, 16 十一月 2022 11:16:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/huacheng_test' into huacheng_test
---
flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 210 insertions(+), 10 deletions(-)
diff --git a/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java b/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
index 87ea3c5..f26d570 100644
--- a/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
+++ b/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
@@ -5,18 +5,22 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dg.core.db.gen.entity.*;
-import com.dg.core.db.gen.mapper.AutomessageTransactionEventInterviewMapper;
-import com.dg.core.db.gen.mapper.KeywordMapper;
-import com.dg.core.db.gen.mapper.OrganizationChartMapper;
-import com.dg.core.db.gen.mapper.TransactionEventMapper;
+import com.dg.core.db.gen.mapper.*;
import com.dg.core.db.manual.pojo.QueryResults;
import com.dg.core.db.manual.pojo.RecommendResult;
import com.dg.core.db.manual.pojo.Search;
import com.dg.core.service.ITransactionEventService;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import java.io.IOException;
+import java.io.InputStream;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -36,6 +40,14 @@
@Resource
private AutomessageTransactionEventInterviewMapper automessageTransactionEventInterviewMapper;
+
+
+ @Resource
+ private GuideRepairOrderMapper guideRepairOrderMapper;
+
+
+ @Resource
+ private AutomessagePolicyDocumentsMapper automessagePolicyDocumentsMapper;
@Override
public TransactionEvent selectConfigData(String Id, SysUser sysUser) {
@@ -88,7 +100,12 @@
@Override
public int deleteConfigById(String Id) {
- return baseMapper.deleteConfigById(Id);
+ List<GuideRepairOrder> guideRepairOrders = guideRepairOrderMapper
+ .selectList(new QueryWrapper<GuideRepairOrder>().lambda().eq(GuideRepairOrder::getMatterId, Id));
+ if (guideRepairOrders.size() == 0) {
+ return baseMapper.deleteConfigById(Id);
+ }
+ return 0;
}
@Override
@@ -136,6 +153,7 @@
for (Search search : searches) {
search.setTransactionEventList(baseMapper.queryMatterNameList(keyWord, search.getClassifyId().toString()));
}
+ queryResults.setOrganizationChartEntityList(organizationChartMapper.selectByKeyWord(keyWord));
queryResults.setSearchList(searches);
List<Search> searchesAssociate = baseMapper.selectSearchAssociateDistinct(keyWord);
for (Search search : searchesAssociate) {
@@ -143,6 +161,8 @@
}
queryResults.setTransactionEventList(searchesAssociate);
queryResults.setKeywordEntityList(keywordMapper.selectByName(keyWord));
+ queryResults.setAutomessagePolicyDocuments(automessagePolicyDocumentsMapper.selectConfigList(keyWord,"2",null));
+ queryResults.setRegulations(automessagePolicyDocumentsMapper.selectConfigList(keyWord,"1",null));
return queryResults;
}
@@ -152,15 +172,19 @@
RecommendResult recommendResult = new RecommendResult();
List<KeywordEntity> keywordEntityList = new ArrayList<>();
List<TransactionEvent> transactionEventEntities = baseMapper.queryMatterNameList(keyWord, null);
+ List<TransactionEvent> transactionEvents = baseMapper.queryAssociateNamesList(keyWord, null);
recommendResult.setTransactionEventList(transactionEventEntities);
List<String> list = new ArrayList<>();
- for (TransactionEvent transactionEvent : transactionEventEntities) {
- if (transactionEvent.getAssociateNames() != null) {
+ for (TransactionEvent transactionEvent : transactionEvents) {
+// 直接返回办事指南名称
+ list.add(transactionEvent.getMatterName());
+// 遍历关键词列表 可能后面流程更改会遇到暂时保存代码;
+ /* if (transactionEvent.getAssociateNames() != null) {
String[] associateNames = transactionEvent.getAssociateNames().split(",");
for (String associateName : associateNames) {
list.add(associateName);
}
- }
+ }*/
}
String[] keywords = list.stream().distinct().collect(Collectors.joining(",")).split(",");//去重
for (String keyword : keywords) {
@@ -172,6 +196,8 @@
}
recommendResult.setKeywordEntityList(keywordEntityList);
List<OrganizationChartEntity> organizationChartEntities = organizationChartMapper.selectByKeyWord(keyWord);
+ recommendResult.setAutomessagePolicyDocuments(automessagePolicyDocumentsMapper.selectConfigList(keyWord,"2",null));
+ recommendResult.setRegulations(automessagePolicyDocumentsMapper.selectConfigList(keyWord,"1",null));
recommendResult.setOrganizationChartEntityList(organizationChartEntities);
return recommendResult;
}
@@ -184,6 +210,11 @@
@Override
public List<String> selectclassifyId(String classifyId) {
return baseMapper.selectclassifyId(classifyId);
+ }
+
+ @Override
+ public List<TransactionEvent> selectClassifyList(List<String> ids) {
+ return baseMapper.selectClassifyList(ids);
}
@@ -225,7 +256,176 @@
}
@Override
- public List<TransactionEvent> selectList() {
- return baseMapper.selectList(new QueryWrapper<TransactionEvent>().lambda());
+ public List<TransactionEvent> selectList(String keyWord) {
+ if (keyWord != null && keyWord != "") {
+ return baseMapper.selectList(new QueryWrapper<TransactionEvent>().lambda().like(TransactionEvent::getMatterName, keyWord));
+ } else {
+ return baseMapper.selectList(new QueryWrapper<TransactionEvent>().lambda());
+ }
}
+
+
+ @Override
+ public Integer batchImport(String fileName, MultipartFile file) {
+ boolean notNull = false;
+ if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+ throw new RuntimeException("选择文件格式不正确,请下载模板上传");
+ }
+ boolean isExcel2003 = true;
+ if (fileName.matches("^.+\\.(?i)(xlsx)$")) {
+ isExcel2003 = false;
+ }
+ InputStream is = null;
+ try {
+ is = file.getInputStream();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ Workbook wb = null;
+
+ if (isExcel2003) {
+ try {
+ wb = new HSSFWorkbook(is);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ try {
+ wb = new XSSFWorkbook(is);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ Integer failNum = 0;//失败数量
+ // 获取excel的sheet页数
+ int numberOfSheets = wb.getNumberOfSheets();
+ for (int j = 0; j < numberOfSheets; j++) {
+ //获取excel字段名称进行比较
+ Sheet sheetAt = wb.getSheetAt(j);
+ if(sheetAt.getRow(2)!=null){
+ Row row1 = sheetAt.getRow(2);
+ TransactionEvent transactionEvent = baseMapper.selectOne(new QueryWrapper<TransactionEvent>().lambda().eq(TransactionEvent::getMatterName, new DataFormatter().formatCellValue(row1.getCell(1))));
+ boolean isAdd = false;
+ if (transactionEvent == null) {
+ transactionEvent = new TransactionEvent();
+ isAdd = true;
+ }
+ transactionEvent.setMatterName(new DataFormatter().formatCellValue(row1.getCell(1)));
+ Row row2 = sheetAt.getRow(3);
+ transactionEvent.setSetGist("<p>" + new DataFormatter().formatCellValue(row2.getCell(1)) + "</p>");
+ Row row3 = sheetAt.getRow(4);
+ Row row4 = sheetAt.getRow(5);
+ transactionEvent.setBasicInformation("<p> 事项名称:" + new DataFormatter().formatCellValue(row1.getCell(1)) + "<br />"
+ + new DataFormatter().formatCellValue(row3.getCell(0)) + ":" + new DataFormatter().formatCellValue(row3.getCell(1))+ "<br />"
+ + new DataFormatter().formatCellValue(row3.getCell(3)) + ":" + new DataFormatter().formatCellValue(row3.getCell(4)) + "<br />"
+ + new DataFormatter().formatCellValue(row4.getCell(0)) + ":" + new DataFormatter().formatCellValue(row4.getCell(1)) + "</p>");
+ int i = 7;
+ String applicationMaterial = "<p>";
+ while (true) {
+ Row row = sheetAt.getRow(i);
+ if (new DataFormatter().formatCellValue(row.getCell(0)).equals("办理途径、条件和注意事项")) {
+ i = i + 2;
+ break;
+ }
+ applicationMaterial = applicationMaterial + "办理区域:" + new DataFormatter().formatCellValue(row.getCell(0)) + "<br />"
+ + "部门名称:" + new DataFormatter().formatCellValue(row.getCell(1)) + "<br />"
+ + "咨询电话:" + new DataFormatter().formatCellValue(row.getCell(2)) + "<br />"
+ + "办公地址:" + new DataFormatter().formatCellValue(row.getCell(3)) + "<br />"
+ + "办公时间:" + new DataFormatter().formatCellValue(row.getCell(4)) + "<br />";
+ applicationMaterial = applicationMaterial + "<br />";
+ i++;
+ }
+ applicationMaterial = applicationMaterial + "</p>";
+ transactionEvent.setApplicationMaterial(applicationMaterial);
+ String acceptConditions = "<p>";
+ while (true) {
+ Row row = sheetAt.getRow(i);
+ if (new DataFormatter().formatCellValue(row.getCell(0)).equals("(二)网上申报")) {
+ i = i + 1;
+ break;
+ }
+ acceptConditions = acceptConditions + new DataFormatter().formatCellValue(row.getCell(0)) + " "
+ +new DataFormatter().formatCellValue( row.getCell(1)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(2)) + " "
+ +new DataFormatter().formatCellValue( row.getCell(3)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(4)) + " ";
+ acceptConditions = acceptConditions + "<br />";
+ i++;
+ }
+ acceptConditions = acceptConditions + "</p>";
+ transactionEvent.setAcceptConditions(acceptConditions);
+ String rates = "<p>";
+ while (true) {
+ Row row = sheetAt.getRow(i);
+ if (new DataFormatter().formatCellValue(row.getCell(0)).equals("(三)手机移动申报")) {
+ i = i + 1;
+ break;
+ }
+ rates = rates + new DataFormatter().formatCellValue(row.getCell(0)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(1)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(2)) + " "
+ +new DataFormatter().formatCellValue( row.getCell(3)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(4)) + " ";
+ rates = rates + "<br />";
+ i++;
+ }
+ rates = rates + "</p>";
+ transactionEvent.setRates(rates);
+ String transactionArea = "<p>";
+ while (true) {
+ Row row = sheetAt.getRow(i);
+ if (new DataFormatter().formatCellValue(row.getCell(0)).equals("(四)经营许可(备案)事项程序运行图谱(附电子版)")) {
+ i = i + 1;
+ break;
+ }
+ transactionArea = transactionArea + new DataFormatter().formatCellValue(row.getCell(0)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(1)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(2)) + " "
+ +new DataFormatter().formatCellValue( row.getCell(3)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(4)) + " ";
+ transactionArea = transactionArea + "<br />";
+ i++;
+ }
+ transactionArea = transactionArea + "</p>";
+ transactionEvent.setTransactionArea(transactionArea);
+ String handlingProcedures = "<p>";
+ while (true) {
+ Row row = sheetAt.getRow(i);
+ if (new DataFormatter().formatCellValue(row.getCell(0)).equals("(五)经营许可(备案)事项实施内容一览表(附电子版)")) {
+ i = i + 1;
+ break;
+ }
+ handlingProcedures = handlingProcedures + new DataFormatter().formatCellValue(row.getCell(0)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(1)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(2)) + " "
+ +new DataFormatter().formatCellValue( row.getCell(3)) + " "
+ + new DataFormatter().formatCellValue(row.getCell(4)) + " ";
+ handlingProcedures = handlingProcedures + "<br />";
+ i++;
+ }
+ handlingProcedures = handlingProcedures + "</p>";
+ transactionEvent.setHandlingProcedures(handlingProcedures);
+ int ans;
+ if (isAdd) {
+ ans = baseMapper.insert(transactionEvent);
+ } else {
+ ans = baseMapper.updateById(transactionEvent);
+ }
+ if (ans <= 0) {
+ failNum++;
+ }
+ }
+
+ }
+ if (failNum == 0) {//
+ return 3;//全部导入成功
+ } else if (failNum < numberOfSheets) {
+ return 2;//部分导入成功
+ } else if (failNum.equals(numberOfSheets)) {
+ return 0;//导入失败
+ }
+ return 0;
+ }
+
+
}
--
Gitblit v1.7.1