Merge remote-tracking branch 'origin/develop_1' into develop_3

This commit is contained in:
zhaokaiyao@91isoft.com
2021-08-23 10:59:03 +08:00
4 changed files with 231 additions and 43 deletions
@@ -317,7 +317,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
for (String s : split) {
for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(s)) {
s = map1.get("label");
s = map1.get("value");
builder.append(s + ",");
break;
}
@@ -331,7 +331,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
} else {
for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(list1.getCountryArea())) {
list1.setCountryArea(map1.get("label"));
list1.setCountryArea(map1.get("value"));
break;
}
}
@@ -346,14 +346,159 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override
public String updateList(DetailedUpDto detailedUpDto) {
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
wrapper.select("DISTINCT country_area,car_type");
List<SarLawsDetailedList> sarLawsDetailedLists = sarLawsDetailedListDao.selectList(wrapper);
//list是数据库里根据id查出来的数据;detailedUpDto是页面传回来的数据
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
System.out.println("数据库里存的当前数据"+list.getCountryArea());
System.out.println("页面现在的数据"+detailedUpDto.getCountryArea());
//国家/地区清单 多选是否可以添加的标识,true表示可以添加,false表示不许添加
boolean multiEditFlag = true;
//国家/地区清单 单选是否可以添加的标识,true表示可以添加,false表示不许添加
boolean singleEditFlag = true;
//车型类别是否可以添加的标识,true表示可以添加,false表示不许添加
boolean carEditFlag = true;
if (detailedUpDto.getCountryArea() == null && detailedUpDto.getCarType() == null) {
//下面放修改的具体方法
//国家或地区
//如果页面的国家地区为空,就把数据库里的国家地区字段也设为空
updateListMethod(detailedUpDto);
return "其他清单添加成功";
}
//如果是车辆修改
else if (detailedUpDto.getCarType() != null) {
//就判断页面的值和数据库里的值是否相等
for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//判断数据库里的数据的车型类别字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCarType()){
System.out.println("数据库里第" + (i + 1) + "条的车型类别字段长度为空,不重复,目前可以添加");
}
else if (Objects.equals(detailedUpDto.getCarType(), list.getCarType())){
System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交");
}
//相等就不许添加
else if (!Objects.equals(detailedUpDto.getCarType(), list.getCarType()) && Objects.equals(detailedUpDto.getCarType(), sarLawsDetailedLists.get(i).getCarType())) {
System.out.println("数据库里第" + (i + 1) + "条的车型类别字段和页面一样,重复,不许添加");
carEditFlag = false;
}
}
}
//如果是国家修改
else if (detailedUpDto.getCountryArea() != null) {
for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//就先判断数据库里的数据的国家/地区字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCountryArea()) {
System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度为空,不重复,目前可以添加");
}
else if (Objects.equals(detailedUpDto.getCountryArea(), list.getCountryArea())){
System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交");
}
//再判断页面字段长度是否与数据库里的长度一样,如果长度不一样,允许新增
else if (detailedUpDto.getCountryArea().length() != sarLawsDetailedLists.get(i).getCountryArea().length()) {
System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度和页面的国家地区字段长度不一样,不重复,目前可以添加");
}
//如果不为空且长度一样
else {
//判断页面的国家地区是单选还是多选(判断能不能拆)
if (detailedUpDto.getCountryArea().contains(",")) {
System.out.println("页面是多选");
//如果数据库里的国家地区字段存在",",说明是多选,如果不存在说明是单选
if (sarLawsDetailedLists.get(i).getCountryArea().contains(",")) {
System.out.println("数据库是多选,如果页面字段拆分之后都包含于数据库字段拆分之后,则说明重复,目前不许添加");
System.out.println("页面字段为" + detailedUpDto.getCountryArea());
//页面字段以“,”为分隔符拆分后的结果
String[] frontCountryArea = detailedUpDto.getCountryArea().split(",");
//数据库字段以“,”为分隔符拆分后的结果
String[] databaseCountryArea = sarLawsDetailedLists.get(i).getCountryArea().split(",");
//如果页面字段拆分之后都包含于数据库字段拆分之后,则说明重复,不许添加
for (int j = 0; j < frontCountryArea.length; j++) {
//如果数据库包含了页面字段的所有值,说明这俩完全相同,重复,不许添加
List<String> databaseCountryAreaList = Arrays.asList(databaseCountryArea);
if (!Objects.equals(detailedUpDto.getCountryArea(), list.getCountryArea()) && databaseCountryAreaList.contains(frontCountryArea[j])) {
System.out.println("数据库" + databaseCountryAreaList);
System.out.println("页面" + frontCountryArea[j]);
System.out.println("数据库里的字段包含页面里的字段,可能重复,目前不许修改");
multiEditFlag = false;
} else {
System.out.println("数据库" + databaseCountryAreaList);
System.out.println("页面" + frontCountryArea[j]);
System.out.println("数据库里的字段和页面字段虽然长度相同,但是里面有不一样的元素,可以修改");
multiEditFlag = true;
}
}
if (multiEditFlag == true) {
System.out.println("长度相同,只要有一个不重复,就可以添加");
} else {
System.out.println("长度相同,整个循环下来都重复,说明两个字段重复,不许添加");
break;
}
}
} else {
System.out.println("页面是单选");
//如果数据库里的国家地区字段存在",",说明是多选,如果不存在说明是单选
if (sarLawsDetailedLists.get(i).getCountryArea().contains(",")) {
System.out.println("数据库是多选,肯定不重复,目前可以添加");
} else {
System.out.println("数据库是单选,如果数据库里的字段和页面的字段相等,重复,不许添加");
//如果数据库里的字段和页面的字段相等,重复,不许添加
if (!Objects.equals(detailedUpDto.getCountryArea(), list.getCountryArea()) && Objects.equals(sarLawsDetailedLists.get(i).getCountryArea(), detailedUpDto.getCountryArea())) {
System.out.println("数据库里的字段和页面的字段相等,重复,不许添加");
singleEditFlag = false;
break;
} else {
System.out.println("数据库里的字段和页面的字段不相等,不重复,允许添加");
}
}
}
}
}
}
//如果整个循环下来都没有重复,则可以添加,不然就说明有重复,不能添加
if (carEditFlag == true && multiEditFlag == true && singleEditFlag == true) {
//下面放添加的具体方法
//国家或地区
//如果页面的国家地区为空,就把数据库里的国家地区字段也设为空
updateListMethod(detailedUpDto);
return "车型类别清单修改成功";
//添加方法结束
} else if (carEditFlag == false){
//0表示添加成功,1表示添加失败
return "车型类别清单修改失败";
}
//如果循环完整个数据库,都没有重复使当前数据无法添加,则添加
if (multiEditFlag == true && singleEditFlag == true && carEditFlag == true) {
//下面放添加的具体方法
//国家或地区
//如果页面的国家地区为空,就把数据库里的国家地区字段也设为空
updateListMethod(detailedUpDto);
//0表示添加成功,1表示添加失败
return "国家/地区清单修改成功";
//添加方法结束
} else {
//0表示添加成功,1表示添加失败
return "国家/地区清单修改失败";
}
}
private void updateListMethod(DetailedUpDto detailedUpDto) {
//list是数据库里根据id查出来的数据;detailedUpDto是页面传回来的数据
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
//国家或地区
//如果页面的国家地区为空,就把数据库里的国家地区字段也设为空
if (StringUtils.isBlank(detailedUpDto.getCountryArea())) list.setCountryArea(null);
else if ("null".equals(detailedUpDto.getCountryArea())) ;
//把数据库里的国家地区字段设为页面的国家地区
//把数据库里的国家地区字段设为页面的国家地区
else list.setCountryArea(detailedUpDto.getCountryArea());
//车型类别
if (StringUtils.isBlank(detailedUpDto.getCarType())) list.setCarType(null);
@@ -435,9 +580,9 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
}
service.updateDetailedLaws(detailedUpDto.getId(), timeDto);
}
return "修改成功";
}
@Override
public SarLawsDetailedList selSarLawDetailById(String id) {
return baseMapper.selectById(id);
@@ -1,5 +1,6 @@
package com.adc.da.slrs.standardSplit.dao;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.standardSplit.dto.FileSplitItemsExportDto;
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsEO;
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsEOPage;
@@ -21,6 +22,8 @@ public interface SarFileSplitItemsEODao extends BaseMapper<SarFileSplitItemsEO>
int insertForeach(List<SarFileSplitItemsEO> list);
int insertStandSplitForeach(@Param(value = "list") List<SarStandItems> list);
int deleteByIds(SarFileSplitItemsEO sarFileSplitItemsEO);
int deleteByItemsIds(SarFileSplitItemsEO sarFileSplitItemsEO);
@@ -2,6 +2,7 @@ package com.adc.da.slrs.standardSplit.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.person.entity.PersonMsgEO;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.standardSplit.dao.*;
import com.adc.da.slrs.standardSplit.service.SarLawsInfoEOService;
import com.adc.da.att.entity.AttFileEO;
@@ -31,10 +32,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.adc.da.common.SplitFilePragraTypeEnum;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.adc.da.person.dao.PersonShareEODao;
import com.adc.da.person.dao.PersonCollectEODao;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -105,7 +108,12 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
@Override
@Transactional
public int fileAplit(SarFileSplitInfoEO sarFileSplitInfoEO){
public int fileAplit(SarFileSplitInfoEO sarFileSplitInfoEO) {
//用来往标准分解单里添加数据
List<SarStandItems> standList = new ArrayList<>();
// 拆分文件主表中插入数据
sarFileSplitInfoEO.setId(UUIDUtils.randomUUID20());
sarFileSplitInfoEO.setValidFlag(0);
@@ -244,8 +252,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList, p.getText());
}
}
}
else if (messageNumber>=3){
} else if (messageNumber >= 3) {
ptest = Pattern.compile("^[\\d.]*$");
boolean hasGoIf = false;
for (int i=0;i<nowStart.size();i++){
@@ -326,6 +333,24 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
sarFileSplitMenuEODao.insertForeach(treeList);
sarFileSplitItemsEODao.insertForeach(messageList);
sarFileSplitItemsValEODao.insertForeach(itemValList);
//用来往标准分解单插入数据
messageList.forEach(item -> {
//new一个对象
SarStandItems standItems1 = new SarStandItems();
//standItems1里的这个值为messageList里的ItermsConditions
standItems1.setId(UUIDUtils.randomUUID20())
.setFileType(sarFileSplitInfoEO.getFileType())
.setStandId(sarFileSplitInfoEO.getStandId())
.setItemsNum(item.getItemsNum())
.setItemsName(item.getItemsName())
.setTermsConditions(item.getItermsConditions());
standList.add(standItems1);
});
sarFileSplitItemsEODao.insertStandSplitForeach(standList);
} else {
return -1;
}
@@ -368,7 +393,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
if (o instanceof CTDrawing) {
CTDrawing drawing = (CTDrawing) o;
CTInline[] ctInlines = drawing.getInlineArray();
CTAnchor[] ctAnchors = drawing.getAnchorArray();
CTAnchor[] ctAnchors = drawing.getAnchorArray();
for (CTInline ctInline : ctInlines) {
CTGraphicalObject graphic = ctInline.getGraphic();
//
@@ -398,7 +423,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
}
}
}
} else if (o instanceof CTLevelText){
} else if (o instanceof CTLevelText) {
logger.info(((CTLevelText) o).getVal());
}
}
@@ -407,14 +432,14 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
}
// 像每个条款中依次插入每一段的内容
private void addItermsConditionsImage(SarFileSplitItemsEO message,List<SarFileSplitItemsValEO> itemsValList,XWPFParagraph p,List<String> imageBundleList) {
private void addItermsConditionsImage(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFParagraph p, List<String> imageBundleList) {
for (String pictureId : imageBundleList) {
XWPFPictureData pictureData = p.getDocument().getPictureDataByID(pictureId);
String imageName = UUIDUtils.randomUUID10() + pictureData.getFileName();
byte[] bytev = pictureData.getData();
String outPath = filePath + "/img/";
File file1 = new File(outPath);
if(!file1.exists()){
if (!file1.exists()) {
file1.mkdirs();
}
String filepathandname = filePath + "/img/" + imageName;
@@ -425,14 +450,14 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
String imgCon = "<img class=\'wordImg\' src=\'" + path + "\'>";
message.getItemsCondi().add(imgCon);
message.setItermsConditions(message.getItermsConditions() + imgCon);
itemsValList.add(getSplitItemsValObject(message.getId(),SplitFilePragraTypeEnum.IMG.getValue(),imgCon,message.getItemsCondi().size(),null));
itemsValList.add(getSplitItemsValObject(message.getId(), SplitFilePragraTypeEnum.IMG.getValue(), imgCon, message.getItemsCondi().size(), null));
} catch (IOException e) {
e.printStackTrace();
}
}
}
private SarFileSplitItemsValEO getSplitItemsValObject (String itemId,String type,String itemContent,int disPlaySql,List<SarFileSplitItemsTableEO> tableList) {
private SarFileSplitItemsValEO getSplitItemsValObject(String itemId, String type, String itemContent, int disPlaySql, List<SarFileSplitItemsTableEO> tableList) {
SarFileSplitItemsValEO sarFileSplitItemsValEO = new SarFileSplitItemsValEO();
sarFileSplitItemsValEO.setId(UUIDUtils.randomUUID20());
sarFileSplitItemsValEO.setValidFlag(0);
@@ -444,13 +469,13 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
sarFileSplitItemsValEO.setType(type);
sarFileSplitItemsValEO.setDisplaySeq(disPlaySql);
sarFileSplitItemsValEO.setItemContent(itemContent);
return sarFileSplitItemsValEO;
return sarFileSplitItemsValEO;
}
// 像每个条款中依次插入每一段的内容
private void addItermsConditionsText(SarFileSplitItemsEO message,List<SarFileSplitItemsValEO> itemsValList,String p) {
private void addItermsConditionsText(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, String p) {
message.getItemsCondi().add(p);
message.setItermsConditions(message.getItermsConditions() + "<p>"+p+ "<p>");
message.setItermsConditions(message.getItermsConditions() + "<p>" + p + "<p>");
// 判断message中是否引用到其他标准
// String testString = p;
// Pattern ptest = Pattern.compile("[A-Z]{1,}/{0,1}[A-Z]{1,}\\s{0,1}[0-9]\\d*\\.?\\d*");
@@ -473,51 +498,52 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
// message.setReferenceStand(matcher.group());
// }
// }
itemsValList.add(getSplitItemsValObject(message.getId(),SplitFilePragraTypeEnum.TEXT.getValue(),p,message.getItemsCondi().size(),null));
itemsValList.add(getSplitItemsValObject(message.getId(), SplitFilePragraTypeEnum.TEXT.getValue(), p, message.getItemsCondi().size(), null));
}
private SarFileSplitMenuEO getTreeList(String name, List<SarFileSplitMenuEO> treeList,String generalCatalogueId,SarFileSplitInfoEO sarFileSplitInfoEO ,Long treeListDisplay,String itemName){
SarFileSplitMenuEO documentTreeEO = new SarFileSplitMenuEO(UUIDUtils.randomUUID20(),name,sarFileSplitInfoEO.getId(),treeListDisplay,itemName);
private SarFileSplitMenuEO getTreeList(String name, List<SarFileSplitMenuEO> treeList, String generalCatalogueId, SarFileSplitInfoEO sarFileSplitInfoEO, Long treeListDisplay, String itemName) {
SarFileSplitMenuEO documentTreeEO = new SarFileSplitMenuEO(UUIDUtils.randomUUID20(), name, sarFileSplitInfoEO.getId(), treeListDisplay, itemName);
// 用现在得name 和之前得name 做比较,确定,parentId
if (name.indexOf(".")>=0) {
if (name.indexOf(".") >= 0) {
for (SarFileSplitMenuEO forDocumentTree : treeList) {
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
documentTreeEO.setPId(forDocumentTree.getId());
break;
}
}
}else {
} else {
documentTreeEO.setPId(generalCatalogueId);
}
return documentTreeEO;
return documentTreeEO;
}
/**
* 通过传递过来的编号,得出下次可能出现的编号
*
* @param nowStart
* @return
*/
private List<String> getNewNowStart(String nowStart){
private List<String> getNewNowStart(String nowStart) {
List<String> nowStartList = new ArrayList<>();
List<String> nowResultStartList = new ArrayList<>();
String[] numberStr = nowStart.split("\\.");
String startnumber = "";
for(int i=0;i<numberStr.length;i++) {
if (i==0) {
for (int i = 0; i < numberStr.length; i++) {
if (i == 0) {
startnumber = "";
} else if (i==1) {
} else if (i == 1) {
startnumber = numberStr[0];
} else {
startnumber = startnumber +"." +numberStr[i-1];
startnumber = startnumber + "." + numberStr[i - 1];
}
Integer lastnumber = Integer.valueOf(numberStr[i])+1;
nowResultStartList.add((startnumber.equals("")?"":(startnumber+".")) + lastnumber);
Integer lastnumber = Integer.valueOf(numberStr[i]) + 1;
nowResultStartList.add((startnumber.equals("") ? "" : (startnumber + ".")) + lastnumber);
}
nowResultStartList.add(nowStart+".1");
nowResultStartList.add(nowStart + ".1");
return nowResultStartList;
}
private void addItermsConditionsOfTable(SarFileSplitItemsEO message,List<SarFileSplitItemsValEO> itemsValList,XWPFTable table) throws IOException {
private void addItermsConditionsOfTable(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFTable table) throws IOException {
StringBuilder tabaleStringNew = new StringBuilder("");
//将表格转为html字符串
ReadWordTable readWordTable = new ReadWordTable();
@@ -525,25 +551,25 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
tabaleStringNew.append(tableStr);
message.getItemsCondi().add(table.getText());
message.setItermsConditions(message.getItermsConditions() + tabaleStringNew);
itemsValList.add(getSplitItemsValObject(message.getId(),SplitFilePragraTypeEnum.TABLE.getValue(),tabaleStringNew.toString(),message.getItemsCondi().size(),null));
itemsValList.add(getSplitItemsValObject(message.getId(), SplitFilePragraTypeEnum.TABLE.getValue(), tabaleStringNew.toString(), message.getItemsCondi().size(), null));
}
@Override
public List<SarFileSplitInfoEO> queryByPageOwn(SarFileSplitInfoEOPage page){
public List<SarFileSplitInfoEO> queryByPageOwn(SarFileSplitInfoEOPage page) {
int rowCount = sarFileSplitInfoEODao.queryByCountOwn(page);
page.getPager().setRowCount(rowCount);
List<SarFileSplitInfoEO> rows = sarFileSplitInfoEODao.queryByPageOwn(page);
Map<String,String> map = new HashMap<>();
map.put("CA","草稿");
map.put("ZQYJG","征求意见稿");
map.put("BPG","报批稿");
map.put("SSG","送审稿");
map.put("FBGBJBD","发布稿(必读)");
Map<String, String> map = new HashMap<>();
map.put("CA", "草稿");
map.put("ZQYJG", "征求意见稿");
map.put("BPG", "报批稿");
map.put("SSG", "送审稿");
map.put("FBGBJBD", "发布稿(必读)");
if (rows != null && !rows.isEmpty()) {
for (SarFileSplitInfoEO infoEO : rows) {
infoEO.setFileTypeShow(String.valueOf(map.get(infoEO.getFileType())));
infoEO.setFileTypeShow(String.valueOf(map.get(infoEO.getFileType())));
// if (!infoEO.getSplitStatus().equals("0") && infoEO.getShowNumber() == null){
// SarLawsInfoEOPage sarLawsInfoEOPage = new SarLawsInfoEOPage();
// sarLawsInfoEOPage.setId(infoEO.getStandId());
@@ -571,7 +597,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
}
@Override
public int deleteByIds(String ids){
public int deleteByIds(String ids) {
String[] infoIds = ids.split(",");
// 删除info表数据
SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO();