合并分支 'dev_foton_CD' 到 'fix_foton'

Dev foton cd

查看合并请求 laws-foton-slrs/foton-slrs-system-rest!16
This commit is contained in:
高嵩
2023-01-12 15:16:16 +08:00
10 changed files with 150 additions and 21 deletions
@@ -10,18 +10,21 @@ import com.adc.da.slrs.sarUser.dao.TsUserDao;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.slrs.zlTree.service.IZlTreeService;
import com.adc.da.util.LoginUserUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.management.Query;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -44,6 +47,8 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
private ITsPositionService tsPositionService;
@Autowired
private ITsRoleMenuDataService iTsRoleMenuDataService;
@Autowired
private IZlTreeService zlTreeService;
@Override
@@ -70,12 +75,27 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
if(StringUtils.isEmpty(queryPage.getTreeId())) {
queryPage.setTreeIdList(treeIdList);
} else {
// 查看菜单是否有数据权限
if (!treeIdList.contains(queryPage.getTreeId())) {
//通过当前treeId查询该节点及下级节点的全部数据
List<String> treeIds = new ArrayList<>();
zlTreeService.subordinateTreeNodes(treeIds, queryPage.getTreeId());
if (ObjectUtils.isEmpty(treeIds)) {
return null;
}
// 查看菜单是否有数据权限
treeIds = treeIds.stream().filter(treeId -> treeIdList.contains(treeId)).collect(Collectors.toList());
if (ObjectUtils.isEmpty(treeIds)) {
return null;
}
queryPage.setTreeIdList(treeIds);
}
return fileMaterialDao.getFileMaterialPage(page,queryPage);
queryPage.setTreeId(null);
IPage<FileMaterial> fileMaterialPage = fileMaterialDao.getFileMaterialPage(page, queryPage);
if (ObjectUtils.isNotEmpty(queryPage.getDataType())) {
List<FileMaterial> fileMaterials = fileMaterialPage.getRecords().stream().filter(fileMaterial -> fileMaterial.getDataType().equals(queryPage.getDataType())).collect(Collectors.toList());
fileMaterialPage.setRecords(fileMaterials);
fileMaterialPage.setTotal(fileMaterials.size());
}
return fileMaterialPage;
}
@Override
@@ -3042,7 +3042,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
QueryWrapper<SarMenuStandard> wrapper=new QueryWrapper<>();
wrapper.in("MENU_NAME",sarStandardsInfoEO.getStandSystem());
wrapper.eq("DIC_ID","wnt12e6n258qkqgcl742");
wrapper.eq("DIC_ID","9m4qqqaansxmox5e82zm");
wrapper.orderByDesc("length(PARENT_IDS)");
List<SarMenuStandard> standards=iSarMenuStandardService.list(wrapper);
if (null!=standards && standards.size() == 1) {
@@ -270,6 +270,41 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
content = content.substring(0,content.lastIndexOf("\n"));
}
}
//处理上下角标
List<SplitFont> subList = new ArrayList<>();
List<SplitFont> supList = new ArrayList<>();
boolean handleCorner = false;
if (content.contains("<span class=sup>")) {
handleCornerMarkers(content, supList, "<span class=sup>","<span class=sub>");
}
if (content.contains("<span class=sub>")) {
handleCornerMarkers(content, subList, "<span class=sub>","<span class=sub>");
}
if (subList.size() > 0 || supList.size() > 0) {
content = content.replaceAll("<span class=sup>", "");
content = content.replaceAll("<span class=sub>", "");
content = content.replaceAll("</span>", "");
//设置角标font
HSSFFont fontSub = workbook.createFont();
fontSub.setTypeOffset(HSSFFont.SS_SUB);
HSSFFont fontSup = workbook.createFont();
fontSup.setTypeOffset(HSSFFont.SS_SUPER);
RichTextString richTextString = new HSSFRichTextString(content);
if (subList.size() > 0) {
for (SplitFont splitFont : subList) {
richTextString.applyFont(splitFont.getStartIndex(),splitFont.getEndIndex(),fontSub);
}
}
if (supList.size() > 0) {
for (SplitFont splitFont : supList) {
richTextString.applyFont(splitFont.getStartIndex(),splitFont.getEndIndex(),fontSup);
}
}
cell2.setCellValue(richTextString);
handleCorner = true;
}
if("TABLE".equals(valList.get(valRow).getValType())){
/* 连接跳转*/
CreationHelper createHelper = workbook.getCreationHelper();
@@ -287,7 +322,9 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
cell2.setHyperlink(hyperlink1);// 链接
row1.getCell(2).setCellStyle(cellStyleLink);
}
cell2.setCellValue(content);
if (!handleCorner) {
cell2.setCellValue(content);
}
row1.createCell(3).setCellValue(exportDto.getResponsibleUnitShow());
@@ -414,6 +451,23 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
}
}
private void handleCornerMarkers(String content, List<SplitFont> splitFontList, String label,String remove) {
content = content.replaceAll(remove, "");
String[] split = content.split(label);
split[0] = split[0].replaceAll("</span>", "");
int index = split[0].length();
for (int i = 1; i < split.length; i++) {
SplitFont splitFont = new SplitFont();
String text = split[i];
String cornerLabel = text.substring(0, text.indexOf("</span>"));
splitFont.setStartIndex(index);
splitFont.setEndIndex(index + cornerLabel.length());
splitFontList.add(splitFont);
text = text.replaceAll("</span>", "");
index = index + text.length();
}
}
@ApiOperation(value = "|SarFileSplitItemsEO|导入")
@PostMapping(value = "/importSplitItemsZip")
public ResponseMessage<SarFileSplitItemsEO> importSplitItemsZip(@RequestParam(value = "file", required = false) MultipartFile file,
@@ -0,0 +1,9 @@
package com.adc.da.slrs.standardSplit.entity;
import lombok.Data;
@Data
public class SplitFont {
Integer startIndex;
Integer endIndex;
}
@@ -20,6 +20,7 @@ import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
@@ -240,7 +241,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
if(CollectionUtils.isNotEmpty(imageBundleList)) {
addItermsConditionsImage(messageList.get(messageList.size()-1),itemValList, p,imageBundleList);
} else {
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList, p.getText());
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList, p,0);
}
}
}
@@ -265,7 +266,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
if(CollectionUtils.isNotEmpty(imageBundleList)) {
addItermsConditionsImage(messageList.get(messageList.size()-1),itemValList, p,imageBundleList);
} else {
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList, p.getText());
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList, p,0);
}
}
} else if (messageNumber >= 3) {
@@ -287,7 +288,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i),treeList,generalCatalogueId,sarFileSplitInfoEO ,treeListDisplay++,itemName);
treeList.add(sarFileSplitMenuEO) ;
message.setMenuId(sarFileSplitMenuEO.getId());
addItermsConditionsText(message,itemValList,paragraphString.substring(nowStart.get(i).length()));
addItermsConditionsText(message,itemValList,p,nowStart.get(i).length());
messageList.add(message);
nowStart = getNewNowStart(nowStart.get(i));
menuCanAdd = true;
@@ -310,7 +311,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(),"附录",itemName,clauseContent);
// 增加一条数据,需要在数结构中加一条数据
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList("附录",treeList,generalCatalogueId,sarFileSplitInfoEO ,treeListDisplay++,"");
addItermsConditionsText(message,itemValList,paragraphString);
addItermsConditionsText(message,itemValList,p,0);
treeList.add(sarFileSplitMenuEO) ;
message.setMenuId(sarFileSplitMenuEO.getId());
messageList.add(message);
@@ -320,7 +321,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
}
} else {
if (!p.getText().equals("") ){
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList,p.getText());
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList,p,0);
}
List<String> imageBundleList = readImageInParagraph((XWPFParagraph)p);
if(CollectionUtils.isNotEmpty(imageBundleList)) {
@@ -517,9 +518,31 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
}
// 像每个条款中依次插入每一段的内容
private void addItermsConditionsText(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, String p) {
message.getItemsCondi().add(p);
message.setItermsConditions(message.getItermsConditions() + "<p>" + p + "<p>");
private void addItermsConditionsText(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFParagraph p,Integer length) {
StringBuffer buffer = new StringBuffer();
for (XWPFRun xwrun : p.getRuns()) {
VerticalAlign subscript = xwrun.getSubscript();
String smalltext = xwrun.getText(0);
if (ObjectUtils.isNotEmpty(smalltext)) {
switch (subscript) {
case BASELINE:
buffer.append(smalltext);
break;
case SUBSCRIPT:
buffer.append("<span class=sub>" + smalltext + "</span>");
break;
case SUPERSCRIPT:
buffer.append("<span class=sup>" + smalltext + "</span>");
break;
}
}
}
String text = buffer.toString();
if (length > 0) {
text = text.substring(length);
}
message.getItemsCondi().add(text);
message.setItermsConditions(message.getItermsConditions() + "<p>" + text + "<p>");
// 判断message中是否引用到其他标准
// String testString = p;
// Pattern ptest = Pattern.compile("[A-Z]{1,}/{0,1}[A-Z]{1,}\\s{0,1}[0-9]\\d*\\.?\\d*");
@@ -542,7 +565,7 @@ 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(), text, message.getItemsCondi().size(), null));
}
private SarFileSplitMenuEO getTreeList(String name, List<SarFileSplitMenuEO> treeList, String generalCatalogueId, SarFileSplitInfoEO sarFileSplitInfoEO, Long treeListDisplay, String itemName) {
@@ -5,6 +5,7 @@ import com.adc.da.slrs.zlTree.entity.ZlTree;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Arrays;
import java.util.List;
/**
@@ -51,4 +52,6 @@ public interface IZlTreeService extends IService<ZlTree> {
* @return
*/
ZlTree queryTree(String treeId);
void subordinateTreeNodes(List<String> treeIds,String parentTreeId);
}
@@ -154,4 +154,23 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
}
return null;
}
/**
* 根据树的父节点查询所有子节点id
*
* @param parentTreeId
* @return
*/
@Override
public void subordinateTreeNodes(List<String> treeIds, String parentTreeId) {
treeIds.add(parentTreeId);
QueryWrapper<ZlTree> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("p_id", parentTreeId);
List<ZlTree> list = list(queryWrapper);
if (ObjectUtils.isNotEmpty(list)) {
for (ZlTree zlTree : list) {
subordinateTreeNodes(treeIds,zlTree.getId());
}
}
}
}
@@ -38,9 +38,6 @@
<if test="flieM.id != null and flieM.id != ''">
and fm.id=#{flieM.id}
</if>
<if test="flieM.dataType != null and flieM.dataType != ''">
AND fm.data_type like concat('%',#{flieM.dataType},'%')
</if>
<if test="flieM.dataTitle != null and flieM.dataTitle != ''">
AND fm.data_title like concat('%',#{flieM.dataTitle},'%')
</if>
@@ -482,7 +482,9 @@
)
where 1=1
<trim suffixOverrides="," >
<if test="QCDW != null and QCDW != ''" >
and SAR_BUSS_STAND_ATTR_INFO.QCDW like concat(concat('%',#{QCDW}),'%')
</if>
<if test="putTime!=null">
and put_time=#{putTime}
</if>
@@ -649,7 +651,9 @@
and (SAR_BUSSIONESS_STAND.STAND_CODE = #{standCode}
or REPLACE( SAR_BUSSIONESS_STAND.STAND_CODE,' ','') = REPLACE( #{standCode},' ',''))
</if>
<if test="QCDW != null and QCDW != ''" >
and SAR_BUSS_STAND_ATTR_INFO.QCDW like concat(concat('%',#{QCDW}),'%')
</if>
<!--<if test="menuId != null and menuId =='nomenu' and menuAllChildrenIdList != null and menuAllChildrenIdList.size()>0 and sarMsType != null and sarMsType == 'filterSarMsMenu'" >-->
<!--and SAR_BUSS_STAND_MENU.MENU_ID IS NULL-->
@@ -155,7 +155,7 @@
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} )
WHERE ts_position_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>
@@ -177,7 +177,7 @@
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} )
WHERE ts_position_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>