update 更改模块名称
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
public class BasePage{
|
||||
private Integer page = 1;
|
||||
private Integer pageSize = 10;
|
||||
private Integer startIndex;
|
||||
private Integer endIndex;
|
||||
private String orderBy;
|
||||
private String order;
|
||||
private String q;
|
||||
private Pager pager = new Pager();
|
||||
|
||||
public BasePage() {
|
||||
}
|
||||
|
||||
public Pager getPager() {
|
||||
this.pager.setPageId(this.getPage());
|
||||
this.pager.setPageSize(this.getPageSize());
|
||||
String orderField = "";
|
||||
if (this.orderBy != null && this.orderBy.trim().length() > 0) {
|
||||
orderField = this.orderBy;
|
||||
}
|
||||
|
||||
if (orderField.trim().length() > 0 && this.order != null && this.order.trim().length() > 0) {
|
||||
orderField = orderField + " " + this.order;
|
||||
}
|
||||
|
||||
this.pager.setOrderField(orderField);
|
||||
return this.pager;
|
||||
}
|
||||
|
||||
public void setPager(Pager pager) {
|
||||
this.pager = pager;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
return this.page;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return this.pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getOrderBy() {
|
||||
return this.orderBy;
|
||||
}
|
||||
|
||||
public void setOrderBy(String orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public String getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
public void setOrder(String order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public String getQ() {
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public void setQ(String q) {
|
||||
this.q = q;
|
||||
}
|
||||
|
||||
public Integer getStartIndex() {
|
||||
return this.startIndex;
|
||||
}
|
||||
|
||||
public void setStartIndex(Integer startIndex) {
|
||||
this.startIndex = (this.page - 1) * this.pageSize + 1;
|
||||
}
|
||||
|
||||
public Integer getEndIndex() {
|
||||
return this.endIndex;
|
||||
}
|
||||
|
||||
public void setEndIndex(Integer endIndex) {
|
||||
this.endIndex = this.page * this.pageSize;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/26 10:10
|
||||
*/
|
||||
public class ConvertHtml2Excel {
|
||||
|
||||
/**
|
||||
* html表格转excel
|
||||
*/
|
||||
public static HSSFWorkbook table2Excel(String tableHtml,HSSFWorkbook wb,String sheetName) throws Exception {
|
||||
// HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet(sheetName);
|
||||
List<Integer> moneyCols =new ArrayList<>();
|
||||
moneyCols.add(1);
|
||||
int headEndRow = 1;
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs = new ArrayList<CrossRangeCellMeta>();
|
||||
int rowIndex = 0;
|
||||
try {
|
||||
Document data = DocumentHelper.parseText(tableHtml);
|
||||
HSSFCellStyle contentStyle = getContentStyle(wb);
|
||||
// 生成表头
|
||||
Element thead = data.getRootElement().element("thead");
|
||||
HSSFCellStyle titleStyle = getTitleStyle(wb);
|
||||
int ls = 0;//列数
|
||||
if (thead != null) {
|
||||
List<Element> trLs = thead.elements("tr");
|
||||
for (Element trEle : trLs) {
|
||||
HSSFCellStyle style = rowIndex<=headEndRow?titleStyle:contentStyle;
|
||||
style.setWrapText(true);
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
if(ls<thLs.size()) {
|
||||
ls = thLs.size();
|
||||
}
|
||||
int cellIndex = makeRowCell(thLs, rowIndex, row, 0, style, crossRowEleMetaLs, true,moneyCols);
|
||||
List<Element> tdLs = trEle.elements("td");
|
||||
if(ls<ls+tdLs.size()) {
|
||||
ls = ls + tdLs.size();
|
||||
}
|
||||
makeRowCell(tdLs, rowIndex, row, cellIndex, style, crossRowEleMetaLs, true,moneyCols);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
// 生成表体
|
||||
Element tbody = data.getRootElement().element("tbody");
|
||||
if (tbody != null) {
|
||||
List<Element> trBody = tbody.elements("tr");
|
||||
for (Element trEle : trBody) {
|
||||
HSSFCellStyle style = rowIndex<=headEndRow?titleStyle:contentStyle;
|
||||
style.setWrapText(true);
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
if(ls<thLs.size()) {
|
||||
ls = thLs.size();
|
||||
}
|
||||
int cellIndex = makeRowCell(thLs, rowIndex, row, 0, style, crossRowEleMetaLs, false,moneyCols);
|
||||
List<Element> tdLs = trEle.elements("td");
|
||||
if(ls<ls+tdLs.size()) {
|
||||
ls = ls + tdLs.size();
|
||||
}
|
||||
makeRowCell(tdLs, rowIndex, row, cellIndex, style, crossRowEleMetaLs, false,moneyCols);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 生成表体
|
||||
Element tfoot = data.getRootElement().element("tfoot");
|
||||
if (tfoot != null) {
|
||||
List<Element> trFoot = tfoot.elements("tr");
|
||||
for (Element trEle : trFoot) {
|
||||
HSSFCellStyle style = rowIndex<=headEndRow?titleStyle:contentStyle;
|
||||
style.setWrapText(true);
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
if(ls<thLs.size()) {
|
||||
ls = thLs.size();
|
||||
}
|
||||
int cellIndex = makeRowCell(thLs, rowIndex, row, 0, style, crossRowEleMetaLs, false,moneyCols);
|
||||
List<Element> tdLs = trEle.elements("td");
|
||||
if(ls<ls+tdLs.size()) {
|
||||
ls = ls + tdLs.size();
|
||||
}
|
||||
makeRowCell(tdLs, rowIndex, row, cellIndex, style, crossRowEleMetaLs, false,moneyCols);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 合并表头
|
||||
for (CrossRangeCellMeta crcm : crossRowEleMetaLs) {
|
||||
sheet.addMergedRegion(new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()));
|
||||
HSSFCellStyle mergeStyle;
|
||||
if (crcm.isInHead()) {
|
||||
mergeStyle = titleStyle;
|
||||
} else {
|
||||
mergeStyle = contentStyle;
|
||||
}
|
||||
mergeStyle.setWrapText(true);
|
||||
setRegionStyle(sheet, new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()), mergeStyle);
|
||||
}
|
||||
for (int i = 0; i < ls; i++) {
|
||||
sheet.autoSizeColumn(i, true);//设置列宽
|
||||
sheet.setColumnWidth(i,30*256);
|
||||
// sheet.setColumnWidth(i,sheet.getColumnWidth(i)*15/10);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产行内容
|
||||
*
|
||||
* @return 最后一列的cell index
|
||||
*/
|
||||
/**
|
||||
* @param tdLs th或者td集合
|
||||
* @param rowIndex 行号
|
||||
* @param row POI行对象
|
||||
* @param startCellIndex
|
||||
* @param cellStyle 样式
|
||||
* @param crossRowEleMetaLs 跨行元数据集合
|
||||
* @return
|
||||
*/
|
||||
private static int makeRowCell(List<Element> tdLs, int rowIndex, HSSFRow row, int startCellIndex, HSSFCellStyle cellStyle,
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs, boolean inHead, List<Integer> moneyCols) {
|
||||
int i = startCellIndex;
|
||||
for (int eleIndex = 0; eleIndex < tdLs.size(); i++, eleIndex++) {
|
||||
int captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
while (captureCellSize > 0) {
|
||||
for (int j = 0; j < captureCellSize; j++) {// 当前行跨列处理(补单元格)
|
||||
row.createCell(i);
|
||||
i++;
|
||||
}
|
||||
captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
}
|
||||
Element thEle = tdLs.get(eleIndex);
|
||||
String val = thEle.getText();
|
||||
if (MyStringUtils.isEmpty(val)) {
|
||||
Element e = thEle.element("a");
|
||||
if (e != null) {
|
||||
val = e.getText();
|
||||
}
|
||||
}
|
||||
HSSFCell c = row.createCell(i);
|
||||
if (NumberUtils.isNumber(val)) {
|
||||
if (moneyCols != null && moneyCols.contains(i)) {
|
||||
c.setCellType(CellType.STRING);
|
||||
c.setCellValue(val);
|
||||
} else {
|
||||
c.setCellValue(Double.parseDouble(val));
|
||||
c.setCellType(CellType.NUMERIC);
|
||||
}
|
||||
|
||||
} else {
|
||||
c.setCellType(CellType.STRING);
|
||||
c.setCellValue(new HSSFRichTextString(val));
|
||||
}
|
||||
int rowSpan = NumberUtils.toInt(thEle.attributeValue("rowspan"), 1);
|
||||
int colSpan = NumberUtils.toInt(thEle.attributeValue("colspan"), 1);
|
||||
c.setCellStyle(cellStyle);
|
||||
if (rowSpan > 1 || colSpan > 1) { // 存在跨行或跨列
|
||||
crossRowEleMetaLs.add(new CrossRangeCellMeta(rowIndex, i, rowSpan, colSpan, inHead));
|
||||
}
|
||||
if (colSpan > 1) {// 当前行跨列处理(补单元格)
|
||||
for (int j = 1; j < colSpan; j++) {
|
||||
i++;
|
||||
row.createCell(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置合并单元格的边框样式
|
||||
*
|
||||
* @param sheet
|
||||
* @param region
|
||||
* @param cs
|
||||
*/
|
||||
public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress region, HSSFCellStyle cs) {
|
||||
for (int i = region.getFirstRow(); i <= region.getLastRow(); i++) {
|
||||
Row row = CellUtil.getRow(i, sheet);
|
||||
for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) {
|
||||
Cell cell = CellUtil.getCell(row, (short) j);
|
||||
cell.setCellStyle(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得因rowSpan占据的单元格
|
||||
*
|
||||
* @param rowIndex 行号
|
||||
* @param colIndex 列号
|
||||
* @param crossRowEleMetaLs 跨行列元数据
|
||||
* @return 当前行在某列需要占据单元格
|
||||
*/
|
||||
private static int getCaptureCellSize(int rowIndex, int colIndex, List<CrossRangeCellMeta> crossRowEleMetaLs) {
|
||||
int captureCellSize = 0;
|
||||
for (CrossRangeCellMeta crossRangeCellMeta : crossRowEleMetaLs) {
|
||||
if (crossRangeCellMeta.getFirstRow() < rowIndex && crossRangeCellMeta.getLastRow() >= rowIndex) {
|
||||
if (crossRangeCellMeta.getFirstCol() <= colIndex && crossRangeCellMeta.getLastCol() >= colIndex) {
|
||||
captureCellSize = crossRangeCellMeta.getLastCol() - colIndex + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return captureCellSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得标题样式
|
||||
*
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getTitleStyle(HSSFWorkbook workbook) {
|
||||
short titlebackgroundcolor = HSSFColor.HSSFColorPredefined.GREY_25_PERCENT.getIndex();
|
||||
short fontSize = 11;
|
||||
String fontName = "宋体";
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
style.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
style.setBorderTop(BorderStyle.THIN);//上边框
|
||||
style.setBorderRight(BorderStyle.THIN);//右边框
|
||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
style.setFillForegroundColor(titlebackgroundcolor);// 背景色
|
||||
style.setWrapText(true);
|
||||
HSSFFont font = workbook.createFont();
|
||||
// font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
// font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
style.setFont(font);
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得内容样式
|
||||
*
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getContentStyle(HSSFWorkbook wb) {
|
||||
short fontSize = 11;
|
||||
// String fontName = "宋体";
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
HSSFFont font = wb.createFont();
|
||||
// font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
return style;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String cnt = "\n";
|
||||
List<Integer> c =new ArrayList<>();
|
||||
c.add(1);
|
||||
String tableHtml = "<table><tbody><tr><td colspan='2'>11111111</td><td rowspan='3'>3333333333</td><td>444444444</td></tr><tr><td>5555555</td><td>66666</td><td></td></tr><tr><td></td><td>324234</td><td></td></tr></tbody></table>";
|
||||
tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
// HSSFWorkbook hssfWorkbook = ConvertHtml2Excel.table2Excel(tableHtml,c,1);
|
||||
// hssfWorkbook.write(FileUtils.openOutputStream(new File("D:\\test\\test1.xls")));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
/**
|
||||
* @Description: table转excel 跨行元素元数据
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/26 10:14
|
||||
*/
|
||||
public class CrossRangeCellMeta {
|
||||
|
||||
public CrossRangeCellMeta(int firstRowIndex, int firstColIndex, int rowSpan, int colSpan, boolean inHead) {
|
||||
super();
|
||||
this.firstRowIndex = firstRowIndex;
|
||||
this.firstColIndex = firstColIndex;
|
||||
this.rowSpan = rowSpan;
|
||||
this.colSpan = colSpan;
|
||||
this.inHead = inHead;
|
||||
}
|
||||
|
||||
private int firstRowIndex;
|
||||
private int firstColIndex;
|
||||
private int rowSpan;// 跨越行数
|
||||
private int colSpan;// 跨越列数
|
||||
private boolean inHead;
|
||||
|
||||
public boolean isInHead() {
|
||||
return inHead;
|
||||
}
|
||||
|
||||
public CrossRangeCellMeta setInHead(boolean inHead) {
|
||||
this.inHead = inHead;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getFirstRow() {
|
||||
return firstRowIndex;
|
||||
}
|
||||
|
||||
public int getLastRow() {
|
||||
return firstRowIndex + rowSpan - 1;
|
||||
}
|
||||
|
||||
public int getFirstCol() {
|
||||
return firstColIndex;
|
||||
}
|
||||
|
||||
public int getLastCol() {
|
||||
return firstColIndex + colSpan - 1;
|
||||
}
|
||||
|
||||
public int getColSpan() {
|
||||
return colSpan;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
|
||||
import com.xkcoding.http.util.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
public class FileUnZip {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FileUnZip.class);
|
||||
|
||||
/**
|
||||
* 解压zip文件
|
||||
*
|
||||
* @param sourceFile,待解压的zip文件; toFolder,解压后的存放路径
|
||||
* @throws Exception
|
||||
* @author gaoyan
|
||||
**/
|
||||
public static String unZipFiles(String sourceFile, String descDir) throws IOException {
|
||||
File zipFile = new File(sourceFile);
|
||||
|
||||
File pathFile = new File(descDir);
|
||||
if (!pathFile.exists()) {
|
||||
pathFile.mkdirs();
|
||||
}
|
||||
ZipFile zip = new ZipFile(zipFile,"gbk");
|
||||
String orgMkdirs = "";
|
||||
int count = 0;
|
||||
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements(); ) {
|
||||
count ++;
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
String zipEntryName = entry.getName();
|
||||
String outPath = (descDir + "/" + zipEntryName).replaceAll("\\*", "/");
|
||||
if(count == 1){
|
||||
orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||
}
|
||||
//判断路径是否存在,不存在则创建文件路径
|
||||
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||
if (!file.exists()) {
|
||||
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||
file.mkdirs();
|
||||
}else{
|
||||
// orgMkdirs = outPath.substring(0, outPath.lastIndexOf('/'));
|
||||
}
|
||||
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
|
||||
if (new File(outPath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
//输出文件路径信息
|
||||
// InputStream in = null;
|
||||
// OutputStream out = null;
|
||||
try(InputStream in =zip.getInputStream(entry);
|
||||
OutputStream out =new FileOutputStream(outPath)){
|
||||
byte[] buf1 = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf1)) > 0) {
|
||||
out.write(buf1, 0, len);
|
||||
}
|
||||
}catch(IOException e){
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
zip.close();
|
||||
return orgMkdirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压zip文件
|
||||
* 解决解压文件下有多个文件夹时,读不到orgMkdirs问题
|
||||
* @param sourceFile,待解压的zip文件; descDir,解压后的存放路径
|
||||
* @throws Exception
|
||||
* @author gaoyan
|
||||
**/
|
||||
public static String unZipFiles2(String sourceFile, String descDir) throws IOException {
|
||||
File zipFile = new File(sourceFile);
|
||||
|
||||
File pathFile = new File(descDir);
|
||||
if (!pathFile.exists()) {
|
||||
pathFile.mkdirs();
|
||||
}
|
||||
ZipFile zip = new ZipFile(zipFile,"gbk");
|
||||
String orgMkdirsLast = "";
|
||||
for (Enumeration entries = zip.getEntries(); entries.hasMoreElements(); ) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
String zipEntryName = entry.getName();
|
||||
String outPath = (descDir + "/" + zipEntryName).replaceAll("\\*", "/");
|
||||
orgMkdirsLast = zipEntryName.substring(0, zipEntryName.indexOf('/'));
|
||||
//判断路径是否存在,不存在则创建文件路径
|
||||
File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
//判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
|
||||
if (new File(outPath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
//输出文件路径信息
|
||||
// InputStream in = null;
|
||||
// OutputStream out = null;
|
||||
try(InputStream in =zip.getInputStream(entry);
|
||||
OutputStream out =new FileOutputStream(outPath)){
|
||||
byte[] buf1 = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf1)) > 0) {
|
||||
out.write(buf1, 0, len);
|
||||
}
|
||||
}catch(IOException e){
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
zip.close();
|
||||
String orgMkdirs = descDir + "/" + orgMkdirsLast;
|
||||
return orgMkdirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归删除文件及文件夹
|
||||
*
|
||||
* @throws Exception
|
||||
* @author gaoyan
|
||||
* toFolder,解压后的存放路径
|
||||
**/
|
||||
public static boolean deleteDir(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDir(new File(dir, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else if(dir.isFile()){
|
||||
return dir.delete();
|
||||
}
|
||||
// 目录此时为空,可以删除
|
||||
return dir.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取一个目录下所有的Excel文件
|
||||
* gaoyan
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
public static List<File> readExcelFile(String path) {
|
||||
File file = new File(path);
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
// 对文件进行过滤,只读取Excel文件
|
||||
if (fi.getName().contains(".xls") || fi.getName().contains(".xlsx")) {
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件名称读取固定目录下文件
|
||||
* 适用范围:filename内容 dir/file
|
||||
* gaoyan
|
||||
* @param filename
|
||||
*/
|
||||
public static List<File> readFileByFilenameDataList(String path,
|
||||
String filename,
|
||||
String cut,
|
||||
String errorMsg,
|
||||
List<String> msgList,
|
||||
String nameCn,
|
||||
String nameEn,
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO) {
|
||||
//法规清单列表数据导入的时候,交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx
|
||||
filename = projectLawsInventoryEO.getSerialNumber()+"/"+filename;
|
||||
String filenameOne = "";
|
||||
String filenameTwo = "";
|
||||
if(filename.contains("/")){
|
||||
filenameOne = filename.split("/")[0];
|
||||
filenameTwo = filename.split("/")[1];
|
||||
}
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(path)){
|
||||
File file = new File(path);
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
if(fi.isDirectory()){
|
||||
File[] filesTemp = fi.listFiles();
|
||||
for (File fileTemp : filesTemp) {
|
||||
// 对文件进行过滤
|
||||
if (fileTemp.getName().equals(filenameTwo) && fi.getName().equals(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fileTemp);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// 对文件进行过滤
|
||||
if (fi.getName().equals(filenameTwo) && fi.getPath().contains(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(resultlist.size() == 0){
|
||||
String name = "";
|
||||
if(filename.contains("/")){
|
||||
name = filenameTwo;
|
||||
}else{
|
||||
name = filename;
|
||||
}
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
errorMsg += nameCn + name + "格式不正确或者压缩包中没有" + name + "文件,请参考模板下载中的说明";
|
||||
}else{
|
||||
errorMsg += nameEn + name + " Incorrect format or not present in compressed package " + name + " file please refer to the description in template download;";
|
||||
}
|
||||
if(msgList != null){
|
||||
msgList.add(errorMsg);
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
/**
|
||||
* 根据文件名称读取固定目录下文件
|
||||
* 适用范围:filename内容 dir/file
|
||||
* gaoyan
|
||||
* @param filename
|
||||
*/
|
||||
public static List<File> readFileByFilename(String path,
|
||||
String filename,
|
||||
String cut,
|
||||
String errorMsg,
|
||||
List<String> msgList,
|
||||
String nameCn,
|
||||
String nameEn) {
|
||||
String filenameOne = "";
|
||||
String filenameTwo = "";
|
||||
if(filename.contains("/")){
|
||||
String[] strs = filename.split("/");
|
||||
if(strs.length >= 2){
|
||||
filenameOne = strs[0];
|
||||
filenameTwo = strs[1];
|
||||
}
|
||||
}
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(path)){
|
||||
File file = new File(path);
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
if(fi.isDirectory()){
|
||||
File[] filesTemp = fi.listFiles();
|
||||
for (File fileTemp : filesTemp) {
|
||||
// 对文件进行过滤
|
||||
if (fileTemp.getName().equals(filenameTwo) && fi.getName().equals(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fileTemp);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// 对文件进行过滤
|
||||
if (fi.getName().equals(filenameTwo) && fi.getPath().contains(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(resultlist.size() == 0){
|
||||
String name = "";
|
||||
if(filename.contains("/")){
|
||||
name = filenameTwo;
|
||||
}else{
|
||||
name = filename;
|
||||
}
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
errorMsg += nameCn + name + "格式不正确或者压缩包中没有" + name + "文件,请参考模板下载中的说明";
|
||||
}else{
|
||||
errorMsg += nameEn + name + " Incorrect format or not present in compressed package " + name + " file please refer to the description in template download;";
|
||||
}
|
||||
if(msgList != null){
|
||||
msgList.add(errorMsg);
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件名称读取固定目录下文件
|
||||
* 适用范围:filename内容 dir/file; file
|
||||
* @param path
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
public static List<File> readFileByFilename(String path,String filename) {
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(path)){
|
||||
File file = new File(path);
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
// 对文件进行过滤
|
||||
if (fi.getName().equals(filename)) {
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
/**
|
||||
*@Description: 删除某个文件
|
||||
*@Param: [file]
|
||||
*@return: void
|
||||
*@Author: duyunbao
|
||||
*@date: 2019/5/23 20:31
|
||||
*/
|
||||
public static void delete(File file) {
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.isFile() || file.list() == null) {
|
||||
file.delete();
|
||||
logger.info("删除了" + file.getName());
|
||||
} else {
|
||||
File[] files = file.listFiles();
|
||||
for (File a : files) {
|
||||
delete(a);
|
||||
}
|
||||
file.delete();
|
||||
logger.info("删除了" + file.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public static List<File> readImpExcelFile(String path) {
|
||||
File file = new File(path);
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
// 对文件进行过滤,只读取Excel文件
|
||||
String name = fi.getName();
|
||||
// "导入模板".equals(fi.getName()) || "导入模板.xlsx".equals(fi.getName())
|
||||
if (name != null &&( fi.getName().contains(".xls") || fi.getName().contains(".xlsx") )){
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 11:14 2022/3/2
|
||||
*/
|
||||
public class Pager {
|
||||
private int pageId = 1;
|
||||
private int rowCount = 0;
|
||||
private int pageSize = 10;
|
||||
private int pageCount = 0;
|
||||
private int pageOffset = 0;
|
||||
private int pageTail = 0;
|
||||
private String orderField;
|
||||
private boolean orderDirection = true;
|
||||
private boolean pageEnabled = true;
|
||||
private int length = 6;
|
||||
private int startIndex = 0;
|
||||
private int endIndex = 0;
|
||||
private int[] indexs;
|
||||
|
||||
public Pager() {
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
public void setLength(int length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public int[] getIndexs() {
|
||||
int len = this.getEndIndex() - this.getStartIndex() + 1;
|
||||
this.indexs = new int[len];
|
||||
|
||||
for(int i = 0; i < len; ++i) {
|
||||
this.indexs[i] = this.getStartIndex() + i;
|
||||
}
|
||||
|
||||
return this.indexs;
|
||||
}
|
||||
|
||||
public void setIndexs(int[] indexs) {
|
||||
this.indexs = indexs;
|
||||
}
|
||||
|
||||
public int getStartIndex() {
|
||||
this.startIndex = (this.pageId - 1) * this.pageSize + 1;
|
||||
return this.startIndex;
|
||||
}
|
||||
|
||||
public void setStartIndex(int startIndex) {
|
||||
System.out.println("startIndx:" + this.pageId + ":" + this.pageSize);
|
||||
this.startIndex = (this.pageId - 1) * this.pageSize + 1;
|
||||
}
|
||||
|
||||
public int getEndIndex() {
|
||||
this.endIndex = this.pageId * this.pageSize;
|
||||
return this.endIndex;
|
||||
}
|
||||
|
||||
public void setEndIndex(int endIndex) {
|
||||
this.endIndex = this.pageId * this.pageSize;
|
||||
}
|
||||
|
||||
protected void doPage() {
|
||||
this.pageCount = this.rowCount / this.pageSize + 1;
|
||||
if (this.rowCount % this.pageSize == 0 && this.pageCount > 1) {
|
||||
--this.pageCount;
|
||||
}
|
||||
|
||||
this.pageOffset = (this.pageId - 1) * this.pageSize;
|
||||
this.pageTail = this.pageOffset + this.pageSize;
|
||||
if (this.pageOffset + this.pageSize > this.rowCount) {
|
||||
this.pageTail = this.rowCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getOrderCondition() {
|
||||
String condition = "";
|
||||
if (this.orderField != null && this.orderField.length() != 0) {
|
||||
condition = " order by " + this.orderField + (this.orderDirection ? " " : " desc ");
|
||||
}
|
||||
|
||||
return condition;
|
||||
}
|
||||
|
||||
public String getMysqlQueryCondition() {
|
||||
String condition = "";
|
||||
if (this.pageEnabled) {
|
||||
}
|
||||
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void setOrderDirection(boolean orderDirection) {
|
||||
this.orderDirection = orderDirection;
|
||||
}
|
||||
|
||||
public boolean isOrderDirection() {
|
||||
return this.orderDirection;
|
||||
}
|
||||
|
||||
public void setOrderField(String orderField) {
|
||||
this.orderField = orderField;
|
||||
}
|
||||
|
||||
public String getOrderField() {
|
||||
return this.orderField;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
return this.pageCount;
|
||||
}
|
||||
|
||||
public void setPageId(int pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
|
||||
public int getPageId() {
|
||||
return this.pageId;
|
||||
}
|
||||
|
||||
public void setPageOffset(int pageOffset) {
|
||||
this.pageOffset = pageOffset;
|
||||
}
|
||||
|
||||
public int getPageOffset() {
|
||||
return this.pageOffset;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return this.pageSize;
|
||||
}
|
||||
|
||||
public void setPageTail(int pageTail) {
|
||||
this.pageTail = pageTail;
|
||||
}
|
||||
|
||||
public int getPageTail() {
|
||||
return this.pageTail;
|
||||
}
|
||||
|
||||
public void setRowCount(int rowCount) {
|
||||
this.rowCount = rowCount;
|
||||
this.doPage();
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.rowCount;
|
||||
}
|
||||
|
||||
public boolean isPageEnabled() {
|
||||
return this.pageEnabled;
|
||||
}
|
||||
|
||||
public void setPageEnabled(boolean pageEnabled) {
|
||||
this.pageEnabled = pageEnabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import com.jero.modules.split.util.WDWUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* @des : excel信息读取
|
||||
* @author: duyunbao
|
||||
* @email: 1114808306@qq.com
|
||||
* @date 2017/10/27 17:06
|
||||
**/
|
||||
public class ReadExcel {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ReadExcel.class);
|
||||
|
||||
/**
|
||||
* 总行数
|
||||
*/
|
||||
private int totalRows = 0;
|
||||
/**
|
||||
* 总条数
|
||||
*/
|
||||
private int totalCells = 0;
|
||||
/**
|
||||
* 错误信息接收器
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
public ReadExcel() {
|
||||
// 不做操作
|
||||
}
|
||||
|
||||
public int getTotalRows() {
|
||||
return totalRows;
|
||||
}
|
||||
|
||||
public int getTotalCells() {
|
||||
return totalCells;
|
||||
}
|
||||
|
||||
public String getErrorInfo() {//获取错误信息
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: validateExcel
|
||||
* @des : 验证excel格式
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 17:07
|
||||
**/
|
||||
public boolean validateExcel(String filePath) {
|
||||
if (filePath == null || !(WDWUtil.isExcel2003(filePath) || WDWUtil.isExcel2007(filePath))) {
|
||||
errorMsg = "文件名不是excel格式";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: getExcelInfo
|
||||
* @des : 读EXCEL文件,获取信息集合
|
||||
* @author: duyunbao
|
||||
* @param: [fileName, Mfile]
|
||||
* @return: org.apache.poi.ss.usermodel.Workbook
|
||||
* @date: 2017/10/27 17:08
|
||||
**/
|
||||
public Workbook getExcelInfo(String fileName, MultipartFile Mfile) {
|
||||
Workbook wb = null;
|
||||
//把spring文件上传的MultipartFile转换成CommonsMultipartFile类型
|
||||
CommonsMultipartFile cf = (CommonsMultipartFile) Mfile; //获取本地存储路径
|
||||
//初始化输入流
|
||||
InputStream is = null;
|
||||
try {
|
||||
//根据文件名判断文件是2003版本还是2007版本
|
||||
boolean isExcel2003 = true;
|
||||
if (WDWUtil.isExcel2007(fileName)) {
|
||||
isExcel2003 = false;
|
||||
}
|
||||
is = cf.getInputStream();
|
||||
//根据excel里面的内容读取客户信息
|
||||
wb = getExcelInfo(is, isExcel2003, wb);
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
is = null;
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wb;
|
||||
}
|
||||
|
||||
/***
|
||||
* @method_name: getExcelInfo
|
||||
* @des : 判断excel版本
|
||||
* @author: duyunbao
|
||||
* @param: [is, isExcel2003, wb]
|
||||
* @return: org.apache.poi.ss.usermodel.Workbook
|
||||
* @date: 2017/10/27 17:08
|
||||
**/
|
||||
private Workbook getExcelInfo(InputStream is, boolean isExcel2003, Workbook wb) {
|
||||
Workbook workbook =wb;
|
||||
try {
|
||||
/** 根据版本选择创建Workbook的方式 */
|
||||
//当excel是2003时
|
||||
if (isExcel2003) {
|
||||
workbook = new HSSFWorkbook(is);
|
||||
} else {//当excel是2007时
|
||||
workbook = new XSSFWorkbook(is);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sheet的名称
|
||||
* @MethodName:getSheetName
|
||||
* @author: 马晓晨
|
||||
* @email: 747052172@qq.com
|
||||
* @date 2017年11月24日 上午9:49:22
|
||||
* @version V1.0
|
||||
* @param filename
|
||||
* @param file
|
||||
* @param sheetIndex
|
||||
* @return
|
||||
*/
|
||||
public String getSheetName(String filename, MultipartFile file, Integer sheetIndex) {
|
||||
Workbook wb = getExcelInfo(filename, file);
|
||||
return wb.getSheetName(sheetIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Title: encodeFileName
|
||||
* @Description: 导出文件转换文件名称编码
|
||||
* @param @param fileNames
|
||||
* @param @param request
|
||||
* @param @return 设定文件
|
||||
* @return String 返回类型
|
||||
* @throws
|
||||
*/
|
||||
public static String encodeFileName(String fileNames ,HttpServletRequest request) {
|
||||
try {
|
||||
String agent = request.getHeader("User-Agent");
|
||||
if (agent.contains("Firefox")) {
|
||||
fileNames = new String(fileNames.getBytes("UTF-8"), "ISO8859-1"); // firefox浏览器
|
||||
} else {
|
||||
fileNames = URLEncoder.encode(fileNames, "utf-8");
|
||||
//谷歌中空格变为+问题
|
||||
fileNames = fileNames.replaceAll("\\+","%20");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return fileNames ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/5/11 10:29
|
||||
*/
|
||||
@Data
|
||||
public class SplitTableInfo {
|
||||
private String tableName;
|
||||
|
||||
private String tableHtml;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/1/9 18:59
|
||||
*/
|
||||
@Data
|
||||
public class UploadFileInfo {
|
||||
private String id;
|
||||
private String filePath;
|
||||
private String name;
|
||||
}
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
package com.jero.modules.split.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.lanswitch.service.ILanguageSwitchService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.service.IFileSplitItemsEOService;
|
||||
import com.jero.modules.split.service.impl.FileSplitItemsEOServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 17:59 2022/3/27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/split/sarFileSplitItems")
|
||||
@Api(tags = "文档拆分条款信息")
|
||||
public class FileSplitItemsEOController extends JeroController<SarFileSplitItemsEO, IFileSplitItemsEOService> {
|
||||
@Autowired
|
||||
private FileSplitItemsEOServiceImpl fileSplitItemsEOService;
|
||||
|
||||
@Autowired
|
||||
private ILanguageSwitchService languageSwitchService;
|
||||
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
|
||||
@Value(value="${jero.uploadType}")
|
||||
private String uploadType;
|
||||
|
||||
|
||||
@AutoLog(value = "分页查询")
|
||||
@ApiOperation(value = "分页查询")
|
||||
@PostMapping("/getSplitItemsByPage")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<IPage> page(@RequestBody Map<String, Object> parameter) throws Exception {
|
||||
IPage infoPage = fileSplitItemsEOService.getInfoPage(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
@AutoLog(value = "根据id查询")
|
||||
@ApiOperation(value = "根据id查询")
|
||||
@GetMapping("/getSplitItemsById")
|
||||
@RequiresPermissions("split:sarFileSplitItems:update")
|
||||
public Result<?> getSplitItemsById(String id){
|
||||
Map<String, Object> item = fileSplitItemsEOService.getInfoById(id);
|
||||
return Result.OK(item);
|
||||
}
|
||||
|
||||
@AutoLog(value = "新增")
|
||||
@ApiOperation(value = "新增")
|
||||
@PostMapping("/addSplitItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:add")
|
||||
public Result<?> addSplitItems(@RequestBody Map<String, Object> parameter) {
|
||||
List<SarFileSplitItemsValEO> itemValEOList = (List<SarFileSplitItemsValEO>) parameter.get("itemValEOList");
|
||||
if (CollectionUtils.isNotEmpty(itemValEOList)) {
|
||||
List<SarFileSplitItemsValEO> valEOList = new ArrayList<>();
|
||||
for (Object object : itemValEOList) {
|
||||
String jsonStr = JSON.toJSONString(object);
|
||||
SarFileSplitItemsValEO itemValEO = JSONObject.parseObject(jsonStr, SarFileSplitItemsValEO.class);
|
||||
valEOList.add(itemValEO);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(valEOList)) {
|
||||
List<SarFileSplitItemsValEO> itemValEOListNew = new ArrayList<>();
|
||||
for (SarFileSplitItemsValEO itemsValEO : valEOList) {
|
||||
itemsValEO.setItemContent(StringEscapeUtils.unescapeHtml4(itemsValEO.getItemContent()));
|
||||
itemValEOListNew.add(itemsValEO);
|
||||
}
|
||||
parameter.put("itemValEOList", itemValEOListNew);
|
||||
}
|
||||
}
|
||||
int resultCount = fileSplitItemsEOService.addItemContent(parameter);
|
||||
if (resultCount > 0) {
|
||||
return Result.OK("新增成功", parameter);
|
||||
} else {
|
||||
return Result.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@AutoLog(value = "编辑")
|
||||
@ApiOperation(value = "编辑")
|
||||
@PostMapping("/updateSplitItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:update")
|
||||
public Result<?> updateSplitItems(@RequestBody Map<String, Object> parameter) {
|
||||
List<SarFileSplitItemsValEO> itemValEOList = (List<SarFileSplitItemsValEO>) parameter.get("itemValEOList");
|
||||
if (CollectionUtils.isNotEmpty(itemValEOList)) {
|
||||
List<SarFileSplitItemsValEO> valEOList = new ArrayList<>();
|
||||
for (Object object : itemValEOList) {
|
||||
String jsonStr = JSON.toJSONString(object);
|
||||
SarFileSplitItemsValEO itemValEO = JSONObject.parseObject(jsonStr, SarFileSplitItemsValEO.class);
|
||||
valEOList.add(itemValEO);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(valEOList)) {
|
||||
List<SarFileSplitItemsValEO> itemValEOListNew = new ArrayList<>();
|
||||
for (SarFileSplitItemsValEO itemsValEO : valEOList) {
|
||||
itemsValEO.setItemContent(StringEscapeUtils.unescapeHtml4(itemsValEO.getItemContent()));
|
||||
itemValEOListNew.add(itemsValEO);
|
||||
}
|
||||
parameter.put("itemValEOList", itemValEOListNew);
|
||||
}
|
||||
}
|
||||
int resultCount = fileSplitItemsEOService.updateItemContent(parameter);
|
||||
if (resultCount > 0) {
|
||||
return Result.OK("修改成功",parameter);
|
||||
} else {
|
||||
return Result.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@AutoLog(value = "批量删除")
|
||||
@ApiOperation(value = "批量删除")
|
||||
@PostMapping("/batchDeleteItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:delete")
|
||||
public Result batchDeleteItems(String ids) {
|
||||
if (StringUtils.isNotEmpty(ids)) {
|
||||
int result = fileSplitItemsEOService.batchDeleteItems(ids);
|
||||
if (result > 0) {
|
||||
return Result.OK("删除成功",null);
|
||||
} else {
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
} else {
|
||||
return Result.error("请选择要删除的数据");
|
||||
}
|
||||
}
|
||||
|
||||
@AutoLog(value = "批量设置表单中英文切换")
|
||||
@ApiOperation(value="批量设置表单中英文切换", notes="批量设置表单中英文切换")
|
||||
@GetMapping(value = "/getBatchSetForm")
|
||||
public Result<List<Map<String, Object>>> getBatchSetForm(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = fileSplitItemsEOService.getBatchSetForm(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分条款信息-判断包含子节点")
|
||||
@ApiOperation(value = "文档拆分条款信息-判断包含子节点")
|
||||
@GetMapping("/judgeContainChilds")
|
||||
public Result<Map<String, Object>> judgeContainChilds(String ids) {
|
||||
Map<String, Object> result = fileSplitItemsEOService.judgeContainChilds(ids);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分条款信息-复制")
|
||||
@ApiOperation(value = "文档拆分条款信息-复制")
|
||||
@GetMapping("/batchCopyItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:copy")
|
||||
public Result<?> batchCopyItems(@RequestParam(value = "ids",required = false) String ids,
|
||||
@RequestParam(value = "menuids",required = false) String menuIds,
|
||||
@RequestParam(value = "infoIds",required = false) String infoIds) {
|
||||
int result = fileSplitItemsEOService.batchCopyItems(ids,menuIds,infoIds);
|
||||
return Result.OK("复制成功", result);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分条款信息-批量合并")
|
||||
@ApiOperation(value = "文档拆分条款信息-批量合并")
|
||||
@GetMapping("/batchMergeItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:merge")
|
||||
public Result<Map<String, Object>> batchMergeItems(String ids) {
|
||||
Map<String, Object> result = fileSplitItemsEOService.batchMergeItems(ids);
|
||||
return Result.OK("合并成功", result);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分条款信息-批量设置")
|
||||
@ApiOperation(value = "文档拆分条款信息-批量设置")
|
||||
@PostMapping("/batchSet")
|
||||
@RequiresPermissions("split:sarFileSplitItems:set")
|
||||
public Result<?> batchSet(@RequestBody Map<String, Object> parameter) {
|
||||
int result = fileSplitItemsEOService.batchSet(parameter); // ids, technology_territory, function_territory, information_category
|
||||
return Result.OK("设置成功", result);
|
||||
}
|
||||
|
||||
@AutoLog(value = "模板下载")
|
||||
@ApiOperation(value = "模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
@RequiresPermissions("split:sarFileSplitItems:template")
|
||||
public void exportTemplate(@RequestParam(name = "cut") String cut, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
fileSplitItemsEOService.exportTemplate(cut,response,request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款信息-导出")
|
||||
@GetMapping(value = "/exportSplitInfoZip")
|
||||
@RequiresPermissions("split:sarFileSplitItems:export")
|
||||
public void exportSplitInfoZip(@RequestParam(value = "cut") String cut,
|
||||
@RequestParam(value = "idList", required = false) String idList,
|
||||
@RequestParam(value = "exportName", required = false) String exportName,
|
||||
@RequestParam(value = "parameter") String parameter,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> parameterMap = JSONObject.parseObject(parameter);
|
||||
fileSplitItemsEOService.exportSplitInfo(cut, idList, parameterMap, exportName, response, request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款信息-导入拆分结果")
|
||||
@PostMapping(value = "/importSplitResult")
|
||||
@RequiresPermissions("split:sarFileSplitItems:importSplitResult")
|
||||
public Result<?> importSplitResult(String splitFileId,
|
||||
String cut,
|
||||
SarFileSplitInfoEO splitInfoEO) throws IOException {
|
||||
return fileSplitItemsEOService.importSplitResult(splitFileId, cut,splitInfoEO);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分条款信息-导入")
|
||||
@ApiOperation(value = "文档拆分条款信息-导入")
|
||||
@PostMapping(value = "/importSplitItems")
|
||||
@RequiresPermissions("split:sarFileSplitItems:import")
|
||||
public Result<?> importSplitItems(MultipartFile file,
|
||||
@RequestParam(value = "cut") String cut,
|
||||
@RequestParam(value = "menuId") String menuId,
|
||||
@RequestParam(value = "infoId") String infoId) throws Exception {
|
||||
return fileSplitItemsEOService.importSplitItems(file, cut, menuId, infoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表头中英文切换")
|
||||
@ApiOperation(value="表头中英文切换", notes="表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = fileSplitItemsEOService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "查询条件中英文切换")
|
||||
@ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = languageSwitchService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单中英文切换")
|
||||
@ApiOperation(value="表单中英文切换", notes="表单中英文切换")
|
||||
@GetMapping(value = "/getForm")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<List<Map<String, Object>>> getForm(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = languageSwitchService.getForm(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传统一方法
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="图片上传", notes="图片上传")
|
||||
@PostMapping(value = "/upload")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<?> upload(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(value = "state",required = false) String state,
|
||||
@RequestParam(value = "cut",required = false) String cut) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
String bizPath = request.getParameter("biz");
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
if (oConvertUtils.isEmpty(bizPath)) {
|
||||
bizPath = "";
|
||||
// if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
|
||||
// //未指定目录,则用阿里云默认目录 upload
|
||||
// bizPath = "upload";
|
||||
// } else {
|
||||
// bizPath = "";
|
||||
// }
|
||||
}
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(file, bizPath,state,cut);
|
||||
if (oConvertUtils.isNotEmpty(oSSFile)) {
|
||||
result.setResult(oSSFile);
|
||||
result.setSuccess(true);
|
||||
} else {
|
||||
if("cut".equals(LanguageEnum.CN.getValue())){
|
||||
result.setMessage("上传失败!");
|
||||
}else{
|
||||
result.setMessage("fail to upload!");
|
||||
}
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
package com.jero.modules.split.controller;
|
||||
|
||||
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.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.lanswitch.service.ILanguageSwitchService;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.page.SarFileSplitInfoEOPage;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档拆分表")
|
||||
@RestController
|
||||
@RequestMapping("/split/sarFileSplitInfo")
|
||||
@Slf4j
|
||||
public class SarFileSplitInfoController extends JeroController<SarFileSplitInfoEO, ISarFileSplitInfoService> {
|
||||
@Autowired
|
||||
private ISarFileSplitInfoService sarFileSplitInfoService;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
@Autowired
|
||||
private ILanguageSwitchService languageSwitchService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param sarFileSplitInfoEOPage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-分页列表查询Y")
|
||||
@ApiOperation(value="文档拆分表-分页列表查询", notes="文档拆分表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:page")
|
||||
public Result<?> queryPageList(SarFileSplitInfoEOPage sarFileSplitInfoEOPage) {
|
||||
QueryWrapper<SarFileSplitInfoEO> queryWrapper = new QueryWrapper<>();
|
||||
if(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getSerialNumber())){
|
||||
sarFileSplitInfoEOPage.setSerialNumber(sarFileSplitInfoEOPage.getSerialNumber().replace("%","\\%"));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getTitle())){
|
||||
sarFileSplitInfoEOPage.setTitle(sarFileSplitInfoEOPage.getTitle().replace("%","\\%"));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getFileId())){//判断是不是以及传回文档库
|
||||
queryWrapper.lambda().isNotNull(SarFileSplitInfoEO::getFileId);
|
||||
}
|
||||
if(StringUtils.isNotBlank(sarFileSplitInfoEOPage.getOrderByField())){
|
||||
sarFileSplitInfoEOPage.setOrderByField(LineHumpUtil.humpToLine2(sarFileSplitInfoEOPage.getOrderByField()));
|
||||
}
|
||||
|
||||
queryWrapper.lambda().like(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getSerialNumber()), SarFileSplitInfoEO::getSerialNumber, sarFileSplitInfoEOPage.getSerialNumber())
|
||||
.like(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getTitle()) && LanguageEnum.CN.getValue().equals(sarFileSplitInfoEOPage.getCut()), SarFileSplitInfoEO::getTitle, sarFileSplitInfoEOPage.getTitle())
|
||||
.like(StringUtils.isNotEmpty(sarFileSplitInfoEOPage.getTitle()) && LanguageEnum.EN.getValue().equals(sarFileSplitInfoEOPage.getCut()), SarFileSplitInfoEO::getTitleEn, sarFileSplitInfoEOPage.getTitle());
|
||||
|
||||
queryWrapper.orderBy(StringUtils.isNotBlank(sarFileSplitInfoEOPage.getOrderByField()), "1".equals(sarFileSplitInfoEOPage.getOrderBy())?true:false, sarFileSplitInfoEOPage.getOrderByField())
|
||||
.orderBy(StringUtils.isBlank(sarFileSplitInfoEOPage.getOrderByField()), false, "create_time");
|
||||
Page<SarFileSplitInfoEO> page = new Page<SarFileSplitInfoEO>(sarFileSplitInfoEOPage.getPageNo(), sarFileSplitInfoEOPage.getPageSize());
|
||||
IPage<SarFileSplitInfoEO> pageList = sarFileSplitInfoService.page(page, queryWrapper);
|
||||
List<SarFileSplitInfoEO> rows = pageList.getRecords();
|
||||
sarFileSplitInfoService.dataProcessing(sarFileSplitInfoEOPage.getCut(), rows);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-列表查询")
|
||||
@ApiOperation(value="文档拆分表-列表查询", notes="文档拆分表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileSplitInfoEO>> queryList() {
|
||||
List<SarFileSplitInfoEO> list = sarFileSplitInfoService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档拆分表-回传至文档库")
|
||||
@ApiOperation(value="文档拆分表-回传至文档库", notes="文档拆分表-回传至文档库")
|
||||
@GetMapping(value = "/bindToDocumentLibrary")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:bind")
|
||||
public Result<?> bindToDocumentLibrary(String id, String connectId, String fileName) {
|
||||
// 设置fileId
|
||||
boolean bindState = sarFileSplitInfoService.bindToDocumentLibrary(id, connectId, fileName);
|
||||
if(bindState){
|
||||
return Result.OK("回传成功");
|
||||
} else {
|
||||
return Result.error("文档库不存在当前文档,回传失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-添加")
|
||||
@ApiOperation(value="文档拆分表-添加", notes="文档拆分表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
sarFileSplitInfoService.add(sarFileSplitInfoEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-编辑")
|
||||
@ApiOperation(value="文档拆分表-编辑", notes="文档拆分表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
sarFileSplitInfoService.editById(sarFileSplitInfoEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-通过id删除Y")
|
||||
@ApiOperation(value="文档拆分表-通过id删除", notes="文档拆分表-通过id删除")
|
||||
@GetMapping(value = "/delete")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sarFileSplitInfoService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-批量删除Y")
|
||||
@ApiOperation(value="文档拆分表-批量删除", notes="文档拆分表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sarFileSplitInfoService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档拆分表-通过id查询")
|
||||
@ApiOperation(value="文档拆分表-通过id查询", notes="文档拆分表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SarFileSplitInfoEO sarFileSplitInfoEO = sarFileSplitInfoService.queryById(id);
|
||||
if(sarFileSplitInfoEO ==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileSplitInfoEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分已入库文本
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "拆分已入库文本-分页查询")
|
||||
@ApiOperation(value="拆分已入库文本-分页查询", notes="拆分已入库文本-分页查询")
|
||||
@PostMapping(value = "/splitFilePageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitFile")
|
||||
public Result<IPage<Map<String,Object>>> splitFilePageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "导入拆分结果-分页查询")
|
||||
@ApiOperation(value="导入拆分结果-分页查询", notes="导入拆分结果-分页查询")
|
||||
@PostMapping(value = "/splitResultPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitResult")
|
||||
public Result<IPage<Map<String,Object>>> splitResultPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileSplitInfoEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
return super.exportXls(request, sarFileSplitInfoEO, SarFileSplitInfoEO.class, "文档拆分表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileSplitInfoEO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表头中英文切换")
|
||||
@ApiOperation(value="表头中英文切换", notes="表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:page")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = sarFileSplitInfoService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "查询条件中英文切换")
|
||||
@ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:page")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = languageSwitchService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package com.jero.modules.split.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.page.SarFileSplitItemsValEOPage;
|
||||
import com.jero.modules.split.service.ISarFileSplitItemsValEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/split/sarFileSplitItemsVal")
|
||||
@Api(tags = "文档拆分条目信息")
|
||||
public class SarFileSplitItemsValEOController extends JeroController<SarFileSplitItemsValEO, ISarFileSplitItemsValEOService> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SarFileSplitItemsValEOController.class);
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitItemsValEOService sarFileSplitItemsValEOService;
|
||||
|
||||
// @ApiOperation(value = "|SarFileSplitItemsValEO|分页查询")
|
||||
// @GetMapping("/page")
|
||||
// @RequiresPermissions("lawss:sarFileSplitItemsVal:page")
|
||||
// public Result<IPage<SarFileSplitItemsValEO>> page(SarFileSplitItemsValEOPage page) throws Exception {
|
||||
// List<SarFileSplitItemsValEO> rows = sarFileSplitItemsValEOService.queryByPage(page);
|
||||
// IPage<SarFileSplitItemsValEO> pageList = null;
|
||||
// pageList.setRecords(rows);
|
||||
// pageList.setCurrent(page.getPage());
|
||||
// pageList.setSize(page.getPageSize());
|
||||
// pageList.setTotal(sarFileSplitItemsValEOService.queryByCount(page));
|
||||
// return Result.OK(pageList);
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "文档拆分条目信息-查询Y")
|
||||
@GetMapping("/getItemsValList")
|
||||
@RequiresPermissions("split:sarFileSplitItems:update")
|
||||
public Result<List<SarFileSplitItemsValEO>> list(SarFileSplitItemsValEOPage page) throws Exception {
|
||||
page.setOrderBy("DISPLAY_SEQ,ID");
|
||||
List<SarFileSplitItemsValEO> getList = sarFileSplitItemsValEOService.queryByList(page);
|
||||
if (getList != null && !getList.isEmpty()) {
|
||||
for (SarFileSplitItemsValEO sarFileSplitItemsValEO : getList) {
|
||||
String imgPath = sarFileSplitItemsValEO.getItemContent();
|
||||
if ("IMG".equals(sarFileSplitItemsValEO.getType()) && StringUtils.isNotEmpty(imgPath)) {
|
||||
String imgName = imgPath.substring(imgPath.lastIndexOf("/")+1, imgPath.length());
|
||||
// String imgName = imgPath.substring(imgPath.lastIndexOf("/")+1, imgPath.lastIndexOf("’"));
|
||||
sarFileSplitItemsValEO.setImgName(imgName);
|
||||
}
|
||||
/*else if ("TABLE".equals(sarFileSplitItemsValEO.getType())) {
|
||||
SarFileSplitItemsTableEOPage tablePage = new SarFileSplitItemsTableEOPage();
|
||||
tablePage.setItemsValId(sarFileSplitItemsValEO.getId());
|
||||
List<SarFileSplitItemsTableEO> tableList = sarFileSplitItemsTableEOService.queryByList(tablePage);
|
||||
List<SarFileSplitItemsTableEO> tableListRow = sarFileSplitItemsTableEOService.queryByRowNum(tablePage);
|
||||
sarFileSplitItemsValEO.setTableList(tableList);
|
||||
if (tableListRow != null && !tableListRow.isEmpty()) {
|
||||
List<List<SarFileSplitItemsTableEO>> getTableList = new ArrayList<>();
|
||||
for (int i=1; i <= tableListRow.size();i++) {
|
||||
List<SarFileSplitItemsTableEO> rowList = new ArrayList<>();
|
||||
for (int j=0; j < tableList.size();j++) {
|
||||
if (tableList.get(j).getRowNum() == i) {
|
||||
rowList.add(tableList.get(j));
|
||||
}
|
||||
}
|
||||
getTableList.add(rowList);
|
||||
}
|
||||
sarFileSplitItemsValEO.setTableListShow(getTableList);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return Result.OK(getList);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "|SarFileSplitItemsValEO|详情")
|
||||
// @GetMapping("/{id}")
|
||||
// @RequiresPermissions("lawss:sarFileSplitItemsVal:get")
|
||||
// public Result<SarFileSplitItemsValEO> find(@PathVariable String id) throws Exception {
|
||||
// return Result.OK(sarFileSplitItemsValEOService.selectByPrimaryKey(id));
|
||||
// }
|
||||
//
|
||||
// @ApiOperation(value = "|SarFileSplitItemsValEO|新增")
|
||||
// @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
// @RequiresPermissions("lawss:sarFileSplitItemsVal:save")
|
||||
// public Result<SarFileSplitItemsValEO> create(@RequestBody SarFileSplitItemsValEO sarFileSplitItemsValEO) throws Exception {
|
||||
// sarFileSplitItemsValEOService.insertSelective(sarFileSplitItemsValEO);
|
||||
// return Result.OK(sarFileSplitItemsValEO);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation(value = "|SarFileSplitItemsValEO|修改")
|
||||
// @PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
// @RequiresPermissions("lawss:sarFileSplitItemsVal:update")
|
||||
// public Result<SarFileSplitItemsValEO> update(@RequestBody SarFileSplitItemsValEO sarFileSplitItemsValEO) throws Exception {
|
||||
// sarFileSplitItemsValEOService.updateByPrimaryKeySelective(sarFileSplitItemsValEO);
|
||||
// return Result.OK(sarFileSplitItemsValEO);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation(value = "|SarFileSplitItemsValEO|删除")
|
||||
// @PostMapping("/{id}")
|
||||
// @RequiresPermissions("lawss:sarFileSplitItemsVal:delete")
|
||||
// public Result delete(@PathVariable String id) throws Exception {
|
||||
// sarFileSplitItemsValEOService.deleteByPrimaryKey(id);
|
||||
// logger.info("delete from SAR_FILE_SPLIT_ITEMS_VAL where id = {}", id);
|
||||
// return Result.OK();
|
||||
// }
|
||||
|
||||
// @ApiOperation(value = "文档拆分条目信息-根据目录查询")
|
||||
// @GetMapping("/getSplitItemsByMenu")
|
||||
//// @RequiresPermissions("lawss:sarFileSplitItems:page")
|
||||
// public Result<List<SarFileSplitItemsValEO>> getSplitItemsByMenu(String menuId, String infoId) throws Exception {
|
||||
// List<SarFileSplitItemsValEO> getList = sarFileSplitItemsValEOService.getSplitItemsByMenu(menuId,infoId);
|
||||
// return Result.OK(getList);
|
||||
// }
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.jero.modules.split.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
|
||||
import com.jero.modules.split.service.IFileSplitItemsEOService;
|
||||
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/split/sarFileSplitMenu")
|
||||
@Api(tags = "文档拆分条款目录")
|
||||
public class SarFileSplitMenuEOController extends JeroController<SarFileSplitMenuEO, ISarFileSplitMenuEOService> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SarFileSplitMenuEOController.class);
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||
|
||||
@Autowired
|
||||
private IFileSplitItemsEOService fileSplitItemsEOService;
|
||||
|
||||
// @ApiOperation(value = "文档拆分条款目录-分页查询")
|
||||
// @GetMapping("/page")
|
||||
// @RequiresPermissions("lawss:sarFileSplitMenu:page")
|
||||
// public Result<IPage<SarFileSplitMenuEO>> page(SarFileSplitMenuEOPage page) throws Exception {
|
||||
// List<SarFileSplitMenuEO> rows = sarFileSplitMenuEOService.queryByPage(page);
|
||||
// IPage<SarFileSplitMenuEO> pageList = null;
|
||||
// pageList.setRecords(rows);
|
||||
// pageList.setCurrent(page.getPage());
|
||||
// pageList.setSize(page.getPageSize());
|
||||
// pageList.setTotal(sarFileSplitMenuEOService.queryByCount(page));
|
||||
// return Result.OK(pageList);
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "文档拆分条款目录-查询Y")
|
||||
@GetMapping("/getSplitMenusByInfoId")
|
||||
@RequiresPermissions("split:sarFileSplitItems:page")
|
||||
public Result<List<SarFileSplitMenuEO>> list(SarFileSplitMenuEOPage page) throws Exception {
|
||||
page.setValidFlag("0");
|
||||
// page.setOrderBy("regexp_replace(replace('.'||NAME, '.', '.00000000'), '0+([^\\.]{8})', '\\1')");
|
||||
page.setOrderBy("display_seq asc");
|
||||
List<SarFileSplitMenuEO> getList = sarFileSplitMenuEOService.queryByList(page);
|
||||
return Result.OK(getList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款目录-新增Y")
|
||||
@PostMapping("/addMenu")
|
||||
@RequiresPermissions("split:sarFileSplitMenu:add")
|
||||
public Result<SarFileSplitMenuEO> create(@RequestBody SarFileSplitMenuEO sarFileSplitMenuEO) throws Exception {
|
||||
sarFileSplitMenuEOService.addMenu(sarFileSplitMenuEO);
|
||||
return Result.OK("新增成功",sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款目录-修改Y")
|
||||
@PostMapping("/updateMenu")
|
||||
@RequiresPermissions("split:sarFileSplitMenu:update")
|
||||
public Result<SarFileSplitMenuEO> update(@RequestBody SarFileSplitMenuEO sarFileSplitMenuEO) throws Exception {
|
||||
sarFileSplitMenuEOService.updateByPrimaryKeySelective(sarFileSplitMenuEO);
|
||||
return Result.OK("修改成功",sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款目录-删除Y")
|
||||
@GetMapping("/deleteMenu")
|
||||
@RequiresPermissions("split:sarFileSplitMenu:delete")
|
||||
public Result delete(@RequestParam(name="id") String id) throws Exception {
|
||||
sarFileSplitMenuEOService.deleteMenu(id);
|
||||
return Result.OK("删除成功",null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文档拆分条款目录-向上或向下移动")
|
||||
@PostMapping("/moveUpOrDown")
|
||||
public Result moveUpOrDown(@RequestBody JSONObject json) throws Exception {
|
||||
return this.sarFileSplitMenuEOService.moveUpOrDown(json);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.split.dto;
|
||||
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsTableEO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/14 10:06
|
||||
*/
|
||||
@Data
|
||||
public class FileSpiltValTableExportDto {
|
||||
|
||||
private String tableName;
|
||||
|
||||
private List<List<SarFileSplitItemsTableEO>> tableEOList;
|
||||
|
||||
private String tableHtCon;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.jero.modules.split.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/13 9:48
|
||||
*/
|
||||
@Data
|
||||
public class FileSplitItemsExportDto {
|
||||
private String id;
|
||||
|
||||
private String itemsNum;
|
||||
|
||||
private String itemsName;
|
||||
|
||||
private String itermsConditions;
|
||||
|
||||
private String type;
|
||||
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
// private Date newcarPutTime;
|
||||
// @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
// private Date productPutTime;
|
||||
private String functionTerritory;
|
||||
// private String applyArctic;
|
||||
// private String referenceStand;
|
||||
private String technologyTerritory;
|
||||
// private String relevanceFile;
|
||||
private String informationCategory;
|
||||
private List<FileSplitValExportDto> itemValContent;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.split.dto;
|
||||
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsTableEO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/14 9:18
|
||||
*/
|
||||
@Data
|
||||
public class FileSplitValExportDto {
|
||||
|
||||
private String valType;
|
||||
|
||||
private String valContent;
|
||||
|
||||
private List<SarFileSplitItemsTableEO> tableEOList;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.jero.modules.split.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/14 15:58
|
||||
*/
|
||||
@Data
|
||||
public class FileSplitValImgExportDto {
|
||||
|
||||
private String imgName;
|
||||
|
||||
private String imgPath;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.jero.modules.split.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/5/9 14:40
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsImportDto {
|
||||
@Excel(name = "条款号", orderNum = "1")
|
||||
private String itemsNum;
|
||||
|
||||
@Excel(name = "条款名称", orderNum = "1")
|
||||
private String itemsName;
|
||||
|
||||
@Excel(name = "条款内容", orderNum = "1")
|
||||
private String itermsConditions;
|
||||
|
||||
// @Excel(name = "新车型实施日期", orderNum = "1")
|
||||
// private Date newcarPutTime;
|
||||
//
|
||||
// @Excel(name = "在产车实施日期", orderNum = "1")
|
||||
// private Date productPutTime;
|
||||
|
||||
@Excel(name = "功能领域", orderNum = "1")
|
||||
private String functionTerritory;
|
||||
|
||||
// @Excel(name = "适用车型", orderNum = "1")
|
||||
// private String applyArctic;
|
||||
//
|
||||
// @Excel(name = "引用标准", orderNum = "1")
|
||||
// private String referenceStand;
|
||||
|
||||
@Excel(name = "技术领域", orderNum = "1")
|
||||
private String technologyTerritory;
|
||||
|
||||
@Excel(name = "信息类别", orderNum = "1")
|
||||
private String informationCategory;
|
||||
|
||||
// @Excel(name = "关联文件", orderNum = "1")
|
||||
// private String relevanceFile;
|
||||
//
|
||||
// private String relevanceFileName;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_split_info")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_split_info对象", description="文档拆分表")
|
||||
public class SarFileSplitInfoEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**拆分时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "拆分时间")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**编号*/
|
||||
@Excel(name = "编号", width = 15)
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**标题*/
|
||||
@Excel(name = "标题", width = 15)
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**英文标题*/
|
||||
@Excel(name = "英文标题", width = 15)
|
||||
@ApiModelProperty(value = "英文标题")
|
||||
private String titleEn;
|
||||
|
||||
/**文本状态*/
|
||||
@Excel(name = "文本状态", width = 15, dicCode = "file_type")
|
||||
// @Dict(dicCode = "file_type")
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String fileType;
|
||||
|
||||
/**文件名称*/
|
||||
@Excel(name = "文件名称", width = 15)
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
/**拆分结果*/
|
||||
@Excel(name = "拆分结果", width = 15, dicCode = "split_result")
|
||||
// @Dict(dicCode = "split_result")
|
||||
@ApiModelProperty(value = "拆分结果")
|
||||
private String splitResult;
|
||||
|
||||
/**文件id*/
|
||||
@Excel(name = "文件id", width = 15)
|
||||
@ApiModelProperty(value = "文件id")
|
||||
private String fileId;
|
||||
|
||||
/**文档库关联id*/
|
||||
@Excel(name = "文档库关联id", width = 15)
|
||||
@ApiModelProperty(value = "文档库关联id")
|
||||
private String connectId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String flag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private int startNumber;
|
||||
@TableField(exist = false)
|
||||
private int stopNumber;
|
||||
@TableField(exist = false)
|
||||
private String fileGroup;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
@TableField(exist = false)
|
||||
private String documentId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS SarFileSplitItemsEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String infoId;
|
||||
private String itemsNum;
|
||||
private String itemsName;
|
||||
private String itermsConditions;
|
||||
private String menuId;
|
||||
private String informationCategory; // 信息类别
|
||||
private String technologyTerritory; // 技术领域
|
||||
private Integer validFlag;
|
||||
private String creationUser;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
private String modifyUser;
|
||||
private String[] infoIdList;
|
||||
private String[] idList;
|
||||
private List<SarFileSplitItemsValEO> itemValEOList;
|
||||
// 前台删除的VAL表条目内容ID
|
||||
private String delItemIds;
|
||||
private String sMenuId;
|
||||
|
||||
List<String> itemsCondi;
|
||||
private String zhan3Shi4Shun4Xu4;// 展示顺序字段
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_TABLE SarFileSplitItemsTableEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-17 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsTableEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String itemsValId;
|
||||
private String itemsId;
|
||||
private Integer rowNum;
|
||||
private Integer colNum;
|
||||
private String content;
|
||||
private Integer validFlag;
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
private String modifyUser;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.modules.split.common.UploadFileInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_VAL SarFileSplitItemsValEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-07 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsValEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String type;
|
||||
private String itemId;
|
||||
private String itemContent;
|
||||
private Integer validFlag;
|
||||
private String creationUser;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
private String modifyUser;
|
||||
private Integer displaySeq;
|
||||
private String[] idList;
|
||||
private List<UploadFileInfo> defaultFileList;
|
||||
private String imgName;
|
||||
private Integer indexItem;
|
||||
private List<SarFileSplitItemsTableEO> tableList;
|
||||
private List<List<SarFileSplitItemsTableEO>> tableListShow;
|
||||
private int rowCount;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_MENU SarFileSplitMenuEOEntity<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitMenuEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String infoId;
|
||||
private String name;
|
||||
private String pId;
|
||||
private Long displaySeq;
|
||||
private Integer validFlag;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
private String remarks;
|
||||
private String creationUser;
|
||||
private String modifyUser;
|
||||
private String itemName;
|
||||
private String[] infoIdList;
|
||||
|
||||
private Long displaySeqStart;
|
||||
private Long displaySeqEnd;
|
||||
private Long childrenCount;
|
||||
|
||||
private List<SarFileSplitMenuEO> children = new ArrayList<>();
|
||||
|
||||
// 向上移动标识
|
||||
private boolean moveUpFlag;
|
||||
// 向下移动标识
|
||||
private boolean moveDownFlag;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标准拆分,存储树形结构实体。
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitMenuTreeModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id;
|
||||
private String parendId;
|
||||
private String itemNum;
|
||||
private String itemName;
|
||||
private String itermsConditions;
|
||||
private String name;
|
||||
|
||||
private List<SarFileSplitMenuTreeModel> children = new ArrayList<>();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.split.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SarFileSplitMenuTreeNode {
|
||||
private String id;
|
||||
private String name;
|
||||
private String parentId;
|
||||
private String parentName;
|
||||
private Long orderNum;
|
||||
private String itemName;
|
||||
private String itemId;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.jero.modules.split.enums;
|
||||
|
||||
/**
|
||||
* 标准库参数类型枚举设置
|
||||
* @author gaoyan
|
||||
* date 2018/09/03
|
||||
*/
|
||||
public enum SplitFilePragraTypeEnum {
|
||||
|
||||
TEXT("TEXT","文字"),IMG("IMG","图片"),TABLE("TABLE","表格");
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private SplitFilePragraTypeEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jero.modules.split.enums;
|
||||
|
||||
/**
|
||||
* 标准文件类型枚举设置
|
||||
* @author gaoyan
|
||||
* date 2018/09/03
|
||||
*/
|
||||
public enum SplitFileTypeTypeEnum {
|
||||
|
||||
GSO("GSO","GSO"),
|
||||
KMVSS_TABLE("KMVSS_Table","KMVSS_Table"),
|
||||
KMVSS_ARTICLE("KMVSS_Article","KMVSS_Article"),
|
||||
US("CFR","美国"),
|
||||
EU("UNECE","欧洲"),
|
||||
/**
|
||||
* Japan Attachment
|
||||
*/
|
||||
JPN_ATTACHMENT("JPN_Attachment","Japan Attachment"),
|
||||
|
||||
JPN_ARTICLE("JPN_Article","Japan Article"),
|
||||
GB("GB","中国"),
|
||||
GBT("GBT","中国");
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private SplitFileTypeTypeEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public static SplitFileTypeTypeEnum getEnumByValue(String value){
|
||||
SplitFileTypeTypeEnum[] values = values();
|
||||
|
||||
for (SplitFileTypeTypeEnum splitFileTypeTypeEnum : values) {
|
||||
if(splitFileTypeTypeEnum.value.equals(value)){
|
||||
return splitFileTypeTypeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.jero.modules.split.enums;
|
||||
|
||||
/**
|
||||
* 资源库文件分类枚举设置
|
||||
* @author gaoyan
|
||||
* date 2018/09/03
|
||||
*/
|
||||
public enum StandFileClassifyEnum {
|
||||
|
||||
STAND_FILE("STAND_FILE","标准文本/法规文件"),STAND_MODIFY_FILE("STAND_MODIFY_FILE","标准译文"),
|
||||
DRAFT_FILE("DRAFT_FILE","草案文件"),OPINION_FILE("OPINION_FILE","解读报告"),
|
||||
SENT_SCREEN_FILE("SENT_SCREEN_FILE","送审稿"), REPORT_FILE("REPORT_FILE","报批稿"),
|
||||
RELEVANCE_FILE("RELEVANCE_FILE","关联文件"),LAWS_FILE("LAWS_FILE","法规文件"),
|
||||
RELEVANT_FILE("RELEVANT_FILE","相关附件")
|
||||
;
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private StandFileClassifyEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
|
||||
public static StandFileClassifyEnum getLableByValue(String value){
|
||||
StandFileClassifyEnum[] values = values();
|
||||
for (StandFileClassifyEnum standFileClassifyEnum : values) {
|
||||
if(standFileClassifyEnum.getValue().equals(value)){
|
||||
return standFileClassifyEnum ;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.jero.modules.split.enums;
|
||||
|
||||
/**
|
||||
* 标准库参数类型枚举设置
|
||||
* @author gaoyan
|
||||
* date 2018/09/03
|
||||
*/
|
||||
public enum UseModuleEnum {
|
||||
|
||||
SOURCE_FILE("SOURCE_FILE","源文件"),WEB_FILE("WEB_FILE","PC预览文件"),MOBLE_FILE("MOBLE_FILE","手机预览文件");
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
private UseModuleEnum(String value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.jero.modules.split.enums;
|
||||
|
||||
public enum ValueStateEnum {
|
||||
|
||||
VALUE_TRUE(0,"TRUE"),VALUE_FALSE(1,"FALSE");
|
||||
|
||||
private int value;
|
||||
private String lable;
|
||||
|
||||
|
||||
private ValueStateEnum(int value, String lable) {
|
||||
this.value = value;
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.jero.modules.split.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description: 文档拆分条款表
|
||||
* @Date: Created in 9:40 2022/3/24
|
||||
*/
|
||||
@Mapper
|
||||
public interface FileSplitItemsEOMapper extends BaseMapper<SarFileSplitItemsEO> {
|
||||
|
||||
int insertInfo(@Param("insertField") String insertField,
|
||||
@Param("insertValue") String insertValue);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
IPage getInfoPage(@Param("page") IPage page,
|
||||
@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitItemsEO> getInfoList(@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
/**
|
||||
* 根据条件查询总数
|
||||
* @param
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
Integer getInfoCount(@Param("condition") String condition);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> selectByPrimaryKey(String value);
|
||||
|
||||
int deleteByPrimaryKey(String value);
|
||||
|
||||
List<Map<String, Object>> queryByItemsIds(@Param("idList") List<String> idList);
|
||||
|
||||
List<Map<String, Object>> queryItemByIds(@Param("idList") List<String> idList);
|
||||
|
||||
List<Map<String, Object>> queryItemsByMenuId(@Param("menuId") String menuId);
|
||||
|
||||
int deleteByItemsIdList(@Param("idList") List<String> idList);
|
||||
|
||||
List<Map<String, Object>> queryByOrdersForExport(@Param("field") String field,
|
||||
@Param("idList")List<String> idList,
|
||||
@Param("condition") String condition);
|
||||
|
||||
int deleteByMenuIds(@Param("idList") List<String> idList);
|
||||
|
||||
int insertForeach(List<SarFileSplitItemsEO> list);
|
||||
|
||||
List<SarFileSplitItemsEO> selectByInfoId(String value);
|
||||
|
||||
void updateSarFileSplitItemsInfo(@Param("sarFileSplitItemsEO") SarFileSplitItemsEO sarFileSplitItemsEO);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.split.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileSplitInfoMapper extends BaseMapper<SarFileSplitInfoEO> {
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.jero.modules.split.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.page.SarFileSplitItemsValEOPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_VAL SarFileSplitItemsValEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-07 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface SarFileSplitItemsValEOMapper extends BaseMapper<SarFileSplitItemsValEO> {
|
||||
|
||||
int deleteByIds(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int deleteByitemId(String id);
|
||||
|
||||
int insertForeach(List<SarFileSplitItemsValEO> list);
|
||||
|
||||
int updateForeach(@Param("list") List<SarFileSplitItemsValEO> list);
|
||||
|
||||
int updateForeach2(@Param("list") List<SarFileSplitItemsValEO> list);
|
||||
|
||||
int deleteValByInfoIds(@Param("idList") List<String> idList);
|
||||
|
||||
int deleteValByitemIds(@Param("idList") List<String> idList);
|
||||
|
||||
int deleteValByMenuIds(@Param("idList") List<String> idList);
|
||||
|
||||
List<SarFileSplitItemsValEO> queryItemsValByMenuId(@Param("idList") List<String> idList);
|
||||
|
||||
|
||||
int insert(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int insertSelective(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int updateByPrimaryKey(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int updateByPrimaryKeySelective(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
SarFileSplitItemsValEO selectByPrimaryKey(String value);
|
||||
|
||||
int deleteByPrimaryKey(String value);
|
||||
|
||||
List<SarFileSplitItemsValEO> queryByList(SarFileSplitItemsValEOPage page);
|
||||
|
||||
int queryByCount(SarFileSplitItemsValEOPage page);
|
||||
|
||||
List<SarFileSplitItemsValEO> queryByPage(SarFileSplitItemsValEOPage page);
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.jero.modules.split.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_MENU SarFileSplitMenuEODao<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface SarFileSplitMenuEOMapper extends BaseMapper<SarFileSplitMenuEO> {
|
||||
|
||||
int insertForeach(List<SarFileSplitMenuEO> list);
|
||||
|
||||
int deleteByIds(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateDisplaySeqAdd(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateDisplaySeqCut(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByPidExcpetSelf(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int deleteByPId(@Param("idList") List<String> idList);
|
||||
|
||||
int getMaxDisplayByid(@Param("id") String id);
|
||||
|
||||
int getMaxDisplayByidNextLevel(@Param("id") String id);
|
||||
|
||||
int getChildrenCountByParentId(@Param("id") String id);
|
||||
|
||||
int updateChildrenDisplaySeqByIDAdd(SarFileSplitMenuEO childrenUpdateEO);
|
||||
|
||||
int updateChildrenDisplaySeqByIDCut(SarFileSplitMenuEO childrenUpdateEO);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有的子节点包括父节点
|
||||
* @param sarFileSplitMenuEO
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitMenuEO> queryAllChildrenByid(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int deleteByIdList(@Param("idList") List<String> idList);
|
||||
|
||||
SarFileSplitMenuEO selectGeneral(@Param("infoId") String infoId);
|
||||
|
||||
int insert(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int insertSelective(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateByPrimaryKey(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateByPrimaryKeySelective(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
SarFileSplitMenuEO selectByPrimaryKey(String value);
|
||||
|
||||
int deleteByPrimaryKey(String value);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByList(SarFileSplitMenuEOPage page);
|
||||
|
||||
int queryByCount(SarFileSplitMenuEOPage page);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByPage(SarFileSplitMenuEOPage page);
|
||||
|
||||
List<SarFileSplitMenuEO> selectBatchIds(@Param("idList") List<String> idList);
|
||||
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.split.mapper.FileSplitItemsEOMapper">
|
||||
|
||||
<!--新增-->
|
||||
<insert id="insertInfo">
|
||||
insert into sar_file_split_items(${insertField})
|
||||
values (${insertValue})
|
||||
</insert>
|
||||
|
||||
<!--分页-->
|
||||
<select id="getInfoPage" resultType="java.util.LinkedHashMap">
|
||||
select ${field}
|
||||
from sar_file_split_items left join SAR_FILE_SPLIT_MENU on SAR_FILE_SPLIT_ITEMS.MENU_ID = SAR_FILE_SPLIT_MENU.id
|
||||
${condition}
|
||||
</select>
|
||||
|
||||
<!--列表-->
|
||||
<select id="getInfoList" resultType="com.jero.modules.split.entity.SarFileSplitItemsEO">
|
||||
select ${field}
|
||||
from sar_file_split_items
|
||||
${condition}
|
||||
</select>
|
||||
|
||||
<!--列表-->
|
||||
<select id="getInfoCount" resultType="integer">
|
||||
select count(1)
|
||||
from sar_file_split_items
|
||||
${condition}
|
||||
</select>
|
||||
|
||||
<!--根据id查询-->
|
||||
<select id="selectByPrimaryKey" resultType="java.util.LinkedHashMap">
|
||||
select *
|
||||
from sar_file_split_items
|
||||
where id = #{value}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from sar_file_split_items
|
||||
where id = #{value}
|
||||
</delete>
|
||||
|
||||
<!-- 通过menuid 查询目录下所有的条目 -->
|
||||
<select id="queryItemsByMenuId" resultType="java.util.LinkedHashMap" parameterType="java.lang.String">
|
||||
select SAR_FILE_SPLIT_ITEMS.* from SAR_FILE_SPLIT_ITEMS
|
||||
left join SAR_FILE_SPLIT_MENU on SAR_FILE_SPLIT_ITEMS.MENU_ID = SAR_FILE_SPLIT_MENU.id
|
||||
where SAR_FILE_SPLIT_ITEMS.menu_id in (
|
||||
SELECT m.id
|
||||
FROM SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{menuId})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND m.valid_flag = '0'
|
||||
)
|
||||
order by SAR_FILE_SPLIT_MENU.display_seq asc
|
||||
</select>
|
||||
|
||||
<select id="queryByItemsIds" resultType="java.util.LinkedHashMap" parameterType="java.util.List">
|
||||
select menu_id from SAR_FILE_SPLIT_ITEMS
|
||||
where id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
group by menu_id
|
||||
</select>
|
||||
|
||||
<select id="queryItemByIds" resultType="java.util.LinkedHashMap" parameterType="java.util.List">
|
||||
select SAR_FILE_SPLIT_ITEMS.* from SAR_FILE_SPLIT_ITEMS
|
||||
left join SAR_FILE_SPLIT_MENU on SAR_FILE_SPLIT_ITEMS.MENU_ID = SAR_FILE_SPLIT_MENU.id
|
||||
where SAR_FILE_SPLIT_ITEMS.id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by SAR_FILE_SPLIT_MENU.display_seq ASC
|
||||
</select>
|
||||
|
||||
<!--group by SAR_FILE_SPLIT_ITEMS.menu_id-->
|
||||
|
||||
<delete id="deleteByItemsIdList" parameterType="java.util.List">
|
||||
delete from SAR_FILE_SPLIT_ITEMS
|
||||
where id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryByOrdersForExport" resultType="java.util.LinkedHashMap">
|
||||
select sar_file_split_items.id,${field}
|
||||
from sar_file_split_items
|
||||
left join SAR_FILE_SPLIT_MENU on sar_file_split_items.MENU_ID = SAR_FILE_SPLIT_MENU.id
|
||||
${condition}
|
||||
<if test="idList != null">
|
||||
and sar_file_split_items.id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
order by SAR_FILE_SPLIT_MENU.display_seq ASC
|
||||
</select>
|
||||
|
||||
<delete id="deleteByMenuIds" parameterType="java.util.List">
|
||||
delete from sar_file_split_items
|
||||
where menu_id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入接口 -->
|
||||
<insert id="insertForeach" parameterType="java.util.List">
|
||||
|
||||
insert into sar_file_split_items
|
||||
(id, info_id, items_num, items_name, menu_id,
|
||||
creation_user, creation_time, modify_time,
|
||||
modify_user, iterms_conditions,zhan3_shi4_shun4_xu4)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">(
|
||||
#{item.id, jdbcType=VARCHAR}, #{item.infoId, jdbcType=VARCHAR}, #{item.itemsNum, jdbcType=VARCHAR},
|
||||
#{item.itemsName, jdbcType=VARCHAR},
|
||||
#{item.menuId, jdbcType=VARCHAR},
|
||||
#{item.creationUser, jdbcType=VARCHAR},
|
||||
#{item.creationTime, jdbcType=TIMESTAMP}, #{item.modifyTime, jdbcType=TIMESTAMP},
|
||||
#{item.modifyUser, jdbcType=VARCHAR}, #{item.itermsConditions, jdbcType=CLOB},#{item.zhan3Shi4Shun4Xu4, jdbcType=VARCHAR}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--根据infoid查询-->
|
||||
<select id="selectByInfoId" resultType="com.jero.modules.split.entity.SarFileSplitItemsEO">
|
||||
select *
|
||||
from sar_file_split_items
|
||||
where info_id = #{value}
|
||||
</select>
|
||||
|
||||
<update id="updateSarFileSplitItemsInfo" parameterType="java.util.List">
|
||||
update sar_file_split_items
|
||||
<set >
|
||||
<if test="sarFileSplitItemsEO.zhan3Shi4Shun4Xu4 != null" >
|
||||
zhan3_shi4_shun4_xu4 = #{sarFileSplitItemsEO.zhan3Shi4Shun4Xu4},
|
||||
</if>
|
||||
modify_user = #{sarFileSplitItemsEO.modifyUser, jdbcType=VARCHAR},
|
||||
modify_time = #{sarFileSplitItemsEO.modifyTime, jdbcType=TIMESTAMP}
|
||||
</set>
|
||||
where id = #{sarFileSplitItemsEO.id, jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.split.mapper.SarFileSplitInfoMapper">
|
||||
<resultMap id="SarFileSplitInfoResultMap" type="com.jero.modules.split.entity.SarFileSplitInfoEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="serial_number" property="serialNumber" />
|
||||
<result column="title" property="title" />
|
||||
<result column="title_en" property="titleEn" />
|
||||
<result column="file_type" property="fileType" />
|
||||
<result column="file_name" property="fileName" />
|
||||
<result column="split_result" property="splitResult" />
|
||||
<result column="file_id" property="fileId" />
|
||||
<result column="connect_id" property="connectId" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.split.mapper.SarFileSplitItemsValEOMapper" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.jero.modules.split.entity.SarFileSplitItemsValEO" >
|
||||
<id column="id" property="id" />
|
||||
<result column="type" property="type" />
|
||||
<result column="item_id" property="itemId" />
|
||||
<result column="item_content" property="itemContent" />
|
||||
<result column="valid_flag" property="validFlag" />
|
||||
<result column="creation_user" property="creationUser" />
|
||||
<result column="creation_time" property="creationTime" />
|
||||
<result column="modify_time" property="modifyTime" />
|
||||
<result column="modify_user" property="modifyUser" />
|
||||
<result column="display_seq" property="displaySeq" />
|
||||
<result column="img_name" property="imgName" />
|
||||
<result column="index_item" property="indexItem" />
|
||||
</resultMap>
|
||||
|
||||
<!-- SAR_FILE_SPLIT_ITEMS_VAL table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
id, type, item_id, item_content, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
<if test="type != null" >
|
||||
and type ${typeOperator} #{type}
|
||||
</if>
|
||||
<if test="itemId != null" >
|
||||
and item_id ${itemIdOperator} #{itemId}
|
||||
</if>
|
||||
<if test="itemContent != null" >
|
||||
and item_content ${itemContentOperator} #{itemContent}
|
||||
</if>
|
||||
<if test="validFlag != null" >
|
||||
and valid_flag ${validFlagOperator} #{validFlag}
|
||||
</if>
|
||||
<if test="creationUser != null" >
|
||||
and creation_user ${creationUserOperator} #{creationUser}
|
||||
</if>
|
||||
<if test="creationTime != null" >
|
||||
and creation_time ${creationTimeOperator} #{creationTime}
|
||||
</if>
|
||||
<if test="creationTime1 != null" >
|
||||
and creation_time >= #{creationTime1}
|
||||
</if>
|
||||
<if test="creationTime2 != null" >
|
||||
and creation_time <= #{creationTime2}
|
||||
</if>
|
||||
<if test="modifyTime != null" >
|
||||
and modify_time ${modifyTimeOperator} #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyTime1 != null" >
|
||||
and modify_time >= #{modifyTime1}
|
||||
</if>
|
||||
<if test="modifyTime2 != null" >
|
||||
and modify_time <= #{modifyTime2}
|
||||
</if>
|
||||
<if test="modifyUser != null" >
|
||||
and modify_user ${modifyUserOperator} #{modifyUser}
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
and display_seq ${displaySeqOperator} #{displaySeq}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.jero.modules.split.entity.SarFileSplitItemsValEO" >
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
SELECT SEQ_SAR_FILE_SPLIT_ITEMS_VAL.NEXTVAL FROM DUAL
|
||||
</selectKey> -->
|
||||
insert into SAR_FILE_SPLIT_ITEMS_VAL(<include refid="Base_Column_List" />)
|
||||
values (#{id, jdbcType=VARCHAR}, #{type, jdbcType=VARCHAR}, #{itemId, jdbcType=VARCHAR}, #{itemContent, jdbcType=CLOB}, #{validFlag, jdbcType=INTEGER}, #{creationUser, jdbcType=VARCHAR}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP}, #{modifyUser, jdbcType=VARCHAR}, #{displaySeq, jdbcType=INTEGER})
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.jero.modules.split.entity.SarFileSplitItemsValEO" >
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
SELECT SEQ_SAR_FILE_SPLIT_ITEMS_VAL.NEXTVAL FROM DUAL
|
||||
</selectKey> -->
|
||||
insert into SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="type != null" >type,</if>
|
||||
<if test="itemId != null" >item_id,</if>
|
||||
<if test="itemContent != null" >item_content,</if>
|
||||
<if test="validFlag != null" >valid_flag,</if>
|
||||
<if test="creationUser != null" >creation_user,</if>
|
||||
<if test="creationTime != null" >creation_time,</if>
|
||||
<if test="modifyTime != null" >modify_time,</if>
|
||||
<if test="modifyUser != null" >modify_user,</if>
|
||||
<if test="displaySeq != null" >display_seq,</if>
|
||||
<if test="imgName != null" >img_name,</if>
|
||||
<if test="indexItem != null" >index_item,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
||||
<if test="type != null" >#{type, jdbcType=VARCHAR},</if>
|
||||
<if test="itemId != null" >#{itemId, jdbcType=VARCHAR},</if>
|
||||
<if test="itemContent != null" >#{itemContent, jdbcType=CLOB},</if>
|
||||
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
||||
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
||||
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
||||
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
||||
<if test="modifyUser != null" >#{modifyUser, jdbcType=VARCHAR},</if>
|
||||
<if test="displaySeq != null" >#{displaySeq, jdbcType=INTEGER},</if>
|
||||
<if test="imgName != null" >#{imgName, jdbcType=VARCHAR},</if>
|
||||
<if test="indexItem != null" >#{indexItem, jdbcType=INTEGER},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.jero.modules.split.entity.SarFileSplitItemsValEO" >
|
||||
update SAR_FILE_SPLIT_ITEMS_VAL
|
||||
set type = #{type},
|
||||
item_id = #{itemId},
|
||||
item_content = #{itemContent},
|
||||
valid_flag = #{validFlag},
|
||||
creation_user = #{creationUser},
|
||||
creation_time = #{creationTime},
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser},
|
||||
display_seq = #{displaySeq}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.jero.modules.split.entity.SarFileSplitItemsValEO" >
|
||||
update SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<set >
|
||||
<if test="type != null" >
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="itemId != null" >
|
||||
item_id = #{itemId},
|
||||
</if>
|
||||
<if test="itemContent != null" >
|
||||
item_content = #{itemContent},
|
||||
</if>
|
||||
<if test="validFlag != null" >
|
||||
valid_flag = #{validFlag},
|
||||
</if>
|
||||
<if test="creationUser != null" >
|
||||
creation_user = #{creationUser},
|
||||
</if>
|
||||
<if test="creationTime != null" >
|
||||
creation_time = #{creationTime},
|
||||
</if>
|
||||
<if test="modifyTime != null" >
|
||||
modify_time = #{modifyTime},
|
||||
</if>
|
||||
<if test="modifyUser != null" >
|
||||
modify_user = #{modifyUser},
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
display_seq = #{displaySeq},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 SAR_FILE_SPLIT_ITEMS_VAL -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where id = #{value}
|
||||
|
||||
</delete>
|
||||
|
||||
<!-- SAR_FILE_SPLIT_ITEMS_VAL 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select count(1) from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询SAR_FILE_SPLIT_ITEMS_VAL列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select <include refid="Base_Column_List" /> from
|
||||
(select tmp_tb.* , rownum rn from
|
||||
(select <include refid="Base_Column_List" /> from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
) tmp_tb where rownum <= ${pager.endIndex})
|
||||
where rn >= ${pager.startIndex}
|
||||
</select>
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select <include refid="Base_Column_List"/> from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds" parameterType="com.jero.modules.split.entity.SarFileSplitItemsValEO">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByitemId" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where item_id = #{value}
|
||||
</delete>
|
||||
|
||||
|
||||
<!-- 批量插入接口 -->
|
||||
<insert id="insertForeach" parameterType="java.util.List">
|
||||
insert into SAR_FILE_SPLIT_ITEMS_VAL
|
||||
(id, type, item_id, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq, img_name, item_content, index_item)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">(
|
||||
#{item.id, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
|
||||
#{item.itemId, jdbcType=VARCHAR},
|
||||
#{item.validFlag, jdbcType=INTEGER}, #{item.creationUser, jdbcType=VARCHAR},
|
||||
#{item.creationTime, jdbcType=TIMESTAMP}, #{item.modifyTime, jdbcType=TIMESTAMP},
|
||||
#{item.modifyUser, jdbcType=VARCHAR}, #{item.displaySeq, jdbcType=INTEGER},
|
||||
#{item.imgName, jdbcType=INTEGER},
|
||||
#{item.itemContent, jdbcType=CLOB},
|
||||
#{item.indexItem, jdbcType=INTEGER})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteValByInfoIds" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where EXISTS (
|
||||
select 1 from SAR_FILE_SPLIT_ITEMS
|
||||
where SAR_FILE_SPLIT_ITEMS_VAL.ITEM_ID=SAR_FILE_SPLIT_ITEMS.id
|
||||
and SAR_FILE_SPLIT_ITEMS.INFO_ID in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<delete id="deleteValByitemIds" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where ITEM_ID in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateForeach" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" separator=";">
|
||||
update SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<set >
|
||||
item_content = #{item.itemContent, jdbcType=VARCHAR},
|
||||
modify_time = #{item.modifyTime, jdbcType=TIMESTAMP},
|
||||
modify_user = #{item.modifyUser, jdbcType=VARCHAR},
|
||||
display_seq = #{item.displaySeq, jdbcType=INTEGER},
|
||||
index_item = #{item.indexItem, jdbcType=INTEGER},
|
||||
</set>
|
||||
where id = #{item.id, jdbcType=VARCHAR}
|
||||
</foreach>;
|
||||
</update>
|
||||
|
||||
<update id="updateForeach2" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" separator=";">
|
||||
update SAR_FILE_SPLIT_ITEMS_VAL
|
||||
<set >
|
||||
item_id = #{item.itemId, jdbcType=VARCHAR},
|
||||
item_content = #{item.itemContent, jdbcType=VARCHAR},
|
||||
modify_time = #{item.modifyTime, jdbcType=TIMESTAMP},
|
||||
modify_user = #{item.modifyUser, jdbcType=VARCHAR},
|
||||
display_seq = #{item.displaySeq, jdbcType=INTEGER},
|
||||
</set>
|
||||
where id = #{item.id, jdbcType=VARCHAR}
|
||||
</foreach>;
|
||||
</update>
|
||||
|
||||
<delete id="deleteValByMenuIds" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where EXISTS (
|
||||
select 1 from SAR_FILE_SPLIT_ITEMS
|
||||
where SAR_FILE_SPLIT_ITEMS_VAL.ITEM_ID=SAR_FILE_SPLIT_ITEMS.id
|
||||
and SAR_FILE_SPLIT_ITEMS.MENU_ID in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<!-- 通过menuid 查询目录下所有的条目 -->
|
||||
<select id="queryItemsValByMenuId" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List"/> from SAR_FILE_SPLIT_ITEMS_VAL
|
||||
where valid_flag = '0' and ITEM_ID in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.split.mapper.SarFileSplitMenuEOMapper" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
<id column="id" property="id" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="parent_id" property="pId" />
|
||||
<result column="display_seq" property="displaySeq" />
|
||||
<result column="valid_flag" property="validFlag" />
|
||||
<result column="creation_time" property="creationTime" />
|
||||
<result column="modify_time" property="modifyTime" />
|
||||
<result column="remarks" property="remarks" />
|
||||
<result column="creation_user" property="creationUser" />
|
||||
<result column="modify_user" property="modifyUser" />
|
||||
<result column="item_name" property="itemName" />
|
||||
</resultMap>
|
||||
|
||||
<!-- SAR_FILE_SPLIT_MENU table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
id, info_id, name, parent_id, display_seq, valid_flag, creation_time, modify_time, remarks, creation_user, modify_user,item_name
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
<if test="infoId != null" >
|
||||
and info_id ${infoIdOperator} #{infoId}
|
||||
</if>
|
||||
<if test="name != null" >
|
||||
and name ${nameOperator} #{name}
|
||||
</if>
|
||||
<if test="pId != null" >
|
||||
and parent_id ${pIdOperator} #{pId}
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
and display_seq ${displaySeqOperator} #{displaySeq}
|
||||
</if>
|
||||
<if test="validFlag != null" >
|
||||
and valid_flag ${validFlagOperator} #{validFlag}
|
||||
</if>
|
||||
<if test="creationTime != null" >
|
||||
and creation_time ${creationTimeOperator} #{creationTime}
|
||||
</if>
|
||||
<if test="creationTime1 != null" >
|
||||
and creation_time >= #{creationTime1}
|
||||
</if>
|
||||
<if test="creationTime2 != null" >
|
||||
and creation_time <= #{creationTime2}
|
||||
</if>
|
||||
<if test="modifyTime != null" >
|
||||
and modify_time ${modifyTimeOperator} #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyTime1 != null" >
|
||||
and modify_time >= #{modifyTime1}
|
||||
</if>
|
||||
<if test="modifyTime2 != null" >
|
||||
and modify_time <= #{modifyTime2}
|
||||
</if>
|
||||
<if test="remarks != null" >
|
||||
and remarks ${remarksOperator} #{remarks}
|
||||
</if>
|
||||
<if test="creationUser != null" >
|
||||
and creation_user ${creationUserOperator} #{creationUser}
|
||||
</if>
|
||||
<if test="modifyUser != null" >
|
||||
and modify_user ${modifyUserOperator} #{modifyUser}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
SELECT SEQ_SAR_FILE_SPLIT_MENU.NEXTVAL FROM DUAL
|
||||
</selectKey> -->
|
||||
insert into SAR_FILE_SPLIT_MENU(<include refid="Base_Column_List" />)
|
||||
values (#{id, jdbcType=VARCHAR}, #{infoId, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{pId, jdbcType=VARCHAR}, #{displaySeq, jdbcType=VARCHAR}, #{validFlag, jdbcType=INTEGER}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP}, #{remarks, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{modifyUser, jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
SELECT SEQ_SAR_FILE_SPLIT_MENU.NEXTVAL FROM DUAL
|
||||
</selectKey> -->
|
||||
insert into SAR_FILE_SPLIT_MENU
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="infoId != null" >info_id,</if>
|
||||
<if test="name != null" >name,</if>
|
||||
<if test="pId != null" >parent_id,</if>
|
||||
<if test="displaySeq != null" >display_seq,</if>
|
||||
<if test="validFlag != null" >valid_flag,</if>
|
||||
<if test="creationTime != null" >creation_time,</if>
|
||||
<if test="modifyTime != null" >modify_time,</if>
|
||||
<if test="remarks != null" >remarks,</if>
|
||||
<if test="creationUser != null" >creation_user,</if>
|
||||
<if test="modifyUser != null" >modify_user,</if>
|
||||
<if test="itemName != null" >item_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
||||
<if test="infoId != null" >#{infoId, jdbcType=VARCHAR},</if>
|
||||
<if test="name != null" >#{name, jdbcType=VARCHAR},</if>
|
||||
<if test="pId != null" >#{pId, jdbcType=VARCHAR},</if>
|
||||
<if test="displaySeq != null" >#{displaySeq, jdbcType=VARCHAR},</if>
|
||||
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
||||
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
||||
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
||||
<if test="remarks != null" >#{remarks, jdbcType=VARCHAR},</if>
|
||||
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
||||
<if test="modifyUser != null" >#{modifyUser, jdbcType=VARCHAR},</if>
|
||||
<if test="itemName != null" >#{itemName, jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set info_id = #{infoId},
|
||||
name = #{name},
|
||||
parent_id = #{pId},
|
||||
display_seq = #{displaySeq},
|
||||
valid_flag = #{validFlag},
|
||||
creation_time = #{creationTime},
|
||||
modify_time = #{modifyTime},
|
||||
remarks = #{remarks},
|
||||
creation_user = #{creationUser},
|
||||
modify_user = #{modifyUser}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
<set >
|
||||
<if test="infoId != null" >
|
||||
info_id = #{infoId},
|
||||
</if>
|
||||
<if test="name != null" >
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="pId != null" >
|
||||
parent_id = #{pId},
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
display_seq = #{displaySeq},
|
||||
</if>
|
||||
<if test="validFlag != null" >
|
||||
valid_flag = #{validFlag},
|
||||
</if>
|
||||
<if test="creationTime != null" >
|
||||
creation_time = #{creationTime},
|
||||
</if>
|
||||
<if test="modifyTime != null" >
|
||||
modify_time = #{modifyTime},
|
||||
</if>
|
||||
<if test="remarks != null" >
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="creationUser != null" >
|
||||
creation_user = #{creationUser},
|
||||
</if>
|
||||
<if test="modifyUser != null" >
|
||||
modify_user = #{modifyUser},
|
||||
</if>
|
||||
<if test="itemName != null" >
|
||||
item_name = #{itemName},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 SAR_FILE_SPLIT_MENU -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
from SAR_FILE_SPLIT_MENU
|
||||
where id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_MENU
|
||||
where id = #{value}
|
||||
|
||||
</delete>
|
||||
|
||||
<!-- SAR_FILE_SPLIT_MENU 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select count(1) from SAR_FILE_SPLIT_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询SAR_FILE_SPLIT_MENU列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select tmp_tb.* from
|
||||
(select <include refid="Base_Column_List" /> from SAR_FILE_SPLIT_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
) tmp_tb limit ${pager.startIndex-1}, ${pager.endIndex}
|
||||
</select>
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.jero.modules.split.common.BasePage">
|
||||
select <include refid="Base_Column_List"/> from SAR_FILE_SPLIT_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 批量插入接口 -->
|
||||
<insert id="insertForeach" parameterType="java.util.List">
|
||||
insert into SAR_FILE_SPLIT_MENU(<include refid="Base_Column_List" />)values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
( #{item.id, jdbcType=VARCHAR},
|
||||
#{item.infoId, jdbcType=VARCHAR},
|
||||
#{item.name, jdbcType=VARCHAR},
|
||||
#{item.pId, jdbcType=VARCHAR},
|
||||
#{item.displaySeq, jdbcType=VARCHAR},
|
||||
#{item.validFlag, jdbcType=INTEGER},
|
||||
#{item.creationTime, jdbcType=TIMESTAMP},
|
||||
#{item.modifyTime, jdbcType=TIMESTAMP}, #{item.remarks, jdbcType=VARCHAR},
|
||||
#{item.creationUser, jdbcType=VARCHAR}, #{item.modifyUser, jdbcType=VARCHAR} ,
|
||||
#{item.itemName, jdbcType=VARCHAR}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByIds" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
delete from SAR_FILE_SPLIT_MENU
|
||||
where info_id in
|
||||
<foreach collection="infoIdList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<update id="updateDisplaySeqAdd" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set display_seq = display_seq+#{childrenCount},
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where display_seq >= #{displaySeqStart} and display_seq < #{displaySeqEnd} and valid_flag = 0 and info_id = #{infoId}
|
||||
</update>
|
||||
|
||||
<update id="updateDisplaySeqCut" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set display_seq = display_seq-#{childrenCount},
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where display_seq <= #{displaySeqEnd} and display_seq > #{displaySeqStart} and valid_flag = 0 and info_id = #{infoId}
|
||||
</update>
|
||||
|
||||
<select id="queryByPidExcpetSelf" resultMap="BaseResultMap" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
select m.*
|
||||
from SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
AND id != #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPId" parameterType="java.util.List">
|
||||
delete from SAR_FILE_SPLIT_MENU where id in
|
||||
<foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
<select id="getMaxDisplayByid" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
SELECT max(m.DISPLAY_SEQ)
|
||||
FROM SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="getMaxDisplayByidNextLevel" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT max(SAR_FILE_SPLIT_MENU.DISPLAY_SEQ) FROM
|
||||
SAR_FILE_SPLIT_MENU where parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getChildrenCountByParentId" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
SELECT count(*)
|
||||
FROM SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
</select>
|
||||
|
||||
<update id="updateChildrenDisplaySeqByIDAdd" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set display_seq = display_seq + #{childrenCount},
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where id in (
|
||||
SELECT m.id
|
||||
FROM SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
)
|
||||
</update>
|
||||
|
||||
<update id="updateChildrenDisplaySeqByIDCut" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set display_seq = display_seq - #{childrenCount},
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where id in (
|
||||
SELECT m.id
|
||||
FROM SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
)
|
||||
</update>
|
||||
|
||||
<select id="queryAllChildrenByid" resultMap="BaseResultMap" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
select m.*
|
||||
from SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIdList" parameterType="java.util.List">
|
||||
delete from SAR_FILE_SPLIT_MENU
|
||||
where id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectBatchIds" resultMap="BaseResultMap" parameterType="java.util.List">
|
||||
select * from SAR_FILE_SPLIT_MENU
|
||||
where id in
|
||||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectGeneral" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select * from SAR_FILE_SPLIT_MENU
|
||||
where info_id = #{infoId} and parent_id is null
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.jero.modules.split.page;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_INFO SarFileSplitInfoEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitInfoEOPage {
|
||||
/**主键*/
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
|
||||
/**拆分时间*/
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
private String sysOrgCode;
|
||||
|
||||
/**编号*/
|
||||
private String serialNumber;
|
||||
|
||||
/**标题*/
|
||||
private String title;
|
||||
|
||||
/**文本状态*/
|
||||
private String fileType;
|
||||
|
||||
/**文件名称*/
|
||||
private String fileName;
|
||||
|
||||
/**拆分结果*/
|
||||
private String splitResult;
|
||||
|
||||
/**文件id*/
|
||||
private String fileId;
|
||||
|
||||
//分页
|
||||
private Integer pageNo;
|
||||
private Integer pageSize;
|
||||
|
||||
//排序
|
||||
private String orderBy;
|
||||
private String orderByField;
|
||||
|
||||
private String cut;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.jero.modules.split.page;
|
||||
|
||||
import com.jero.modules.split.common.BasePage;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS SarFileSplitItemsEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String infoId;
|
||||
private String infoIdOperator = "=";
|
||||
private String itemsNum;
|
||||
private String itemsNumOperator = "=";
|
||||
private String itemsName;
|
||||
private String itemsNameOperator = "=";
|
||||
private String itermsConditions;
|
||||
private String itermsConditionsOperator = "=";
|
||||
private String newcarPutTime;
|
||||
private String newcarPutTime1;
|
||||
private String newcarPutTime2;
|
||||
private String newcarPutTimeOperator = "=";
|
||||
private String productPutTime;
|
||||
private String productPutTime1;
|
||||
private String productPutTime2;
|
||||
private String productPutTimeOperator = "=";
|
||||
private String menuId;
|
||||
private String menuIdOperator = "=";
|
||||
private String functionTerritory;
|
||||
private String functionTerritoryOperator = "=";
|
||||
private String applyArctic;
|
||||
private String applyArcticOperator = "=";
|
||||
private String referenceStand;
|
||||
private String referenceStandOperator = "=";
|
||||
private String informationCategory;
|
||||
private String informationCategoryOperator = "=";
|
||||
private String relevanceFile;
|
||||
private String relevanceFileOperator = "=";
|
||||
private String technologyTerritory;
|
||||
private String technologyTerritoryOperator = "=";
|
||||
private String validFlag;
|
||||
private String validFlagOperator = "=";
|
||||
private String creationUser;
|
||||
private String creationUserOperator = "=";
|
||||
private String creationTime;
|
||||
private String creationTime1;
|
||||
private String creationTime2;
|
||||
private String creationTimeOperator = "=";
|
||||
private String modifyTime;
|
||||
private String modifyTime1;
|
||||
private String modifyTime2;
|
||||
private String modifyTimeOperator = "=";
|
||||
private String modifyUser;
|
||||
private String modifyUserOperator = "=";
|
||||
private String sMenuId;
|
||||
private List<String> idList;
|
||||
private List<String> menuIdList;
|
||||
|
||||
private int tableIndex = 1;
|
||||
private int imgIndex = 1;
|
||||
|
||||
private List<SarFileSplitItemsValEO> targetItemValEOList;
|
||||
private String targetMenuId;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.jero.modules.split.page;
|
||||
|
||||
import com.jero.modules.split.common.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_TABLE SarFileSplitItemsTableEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-17 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsTableEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String itemsValId;
|
||||
private String itemsValIdOperator = "=";
|
||||
private String itemsId;
|
||||
private String itemsIdOperator = "=";
|
||||
private String rowNum;
|
||||
private String rowNumOperator = "=";
|
||||
private String colNum;
|
||||
private String colNumOperator = "=";
|
||||
private String content;
|
||||
private String contentOperator = "=";
|
||||
private String validFlag;
|
||||
private String validFlagOperator = "=";
|
||||
private String creationTime;
|
||||
private String creationTime1;
|
||||
private String creationTime2;
|
||||
private String creationTimeOperator = "=";
|
||||
private String modifyTime;
|
||||
private String modifyTime1;
|
||||
private String modifyTime2;
|
||||
private String modifyTimeOperator = "=";
|
||||
private String modifyUser;
|
||||
private String modifyUserOperator = "=";
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.jero.modules.split.page;
|
||||
|
||||
import com.jero.modules.split.common.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_VAL SarFileSplitItemsValEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-07 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsValEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String type;
|
||||
private String typeOperator = "=";
|
||||
private String itemId;
|
||||
private String itemIdOperator = "=";
|
||||
private String itemContent;
|
||||
private String itemContentOperator = "=";
|
||||
private String validFlag;
|
||||
private String validFlagOperator = "=";
|
||||
private String creationUser;
|
||||
private String creationUserOperator = "=";
|
||||
private String creationTime;
|
||||
private String creationTime1;
|
||||
private String creationTime2;
|
||||
private String creationTimeOperator = "=";
|
||||
private String modifyTime;
|
||||
private String modifyTime1;
|
||||
private String modifyTime2;
|
||||
private String modifyTimeOperator = "=";
|
||||
private String modifyUser;
|
||||
private String modifyUserOperator = "=";
|
||||
private String displaySeq;
|
||||
private String displaySeqOperator = "=";
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.jero.modules.split.page;
|
||||
|
||||
import com.jero.modules.split.common.BasePage;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_MENU SarFileSplitMenuEOPage<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitMenuEOPage extends BasePage {
|
||||
|
||||
private String id;
|
||||
private String idOperator = "=";
|
||||
private String infoId;
|
||||
private String infoIdOperator = "=";
|
||||
private String name;
|
||||
private String nameOperator = "=";
|
||||
private String pId;
|
||||
private String pIdOperator = "=";
|
||||
private String displaySeq;
|
||||
private String displaySeqOperator = "=";
|
||||
private String validFlag;
|
||||
private String validFlagOperator = "=";
|
||||
private String creationTime;
|
||||
private String creationTime1;
|
||||
private String creationTime2;
|
||||
private String creationTimeOperator = "=";
|
||||
private String modifyTime;
|
||||
private String modifyTime1;
|
||||
private String modifyTime2;
|
||||
private String modifyTimeOperator = "=";
|
||||
private String remarks;
|
||||
private String remarksOperator = "=";
|
||||
private String creationUser;
|
||||
private String creationUserOperator = "=";
|
||||
private String modifyUser;
|
||||
private String modifyUserOperator = "=";
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.jero.modules.split.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.split.common.SplitTableInfo;
|
||||
import com.jero.modules.split.dto.FileSpiltValTableExportDto;
|
||||
import com.jero.modules.split.dto.FileSplitValExportDto;
|
||||
import com.jero.modules.split.dto.FileSplitValImgExportDto;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.page.SarFileSplitItemsEOPage;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 20:39 2022/3/27
|
||||
*/
|
||||
public interface IFileSplitItemsEOService extends IService<SarFileSplitItemsEO> {
|
||||
int addItemContent(Map<String, Object> parameter);
|
||||
|
||||
int updateItemContent(Map<String, Object> parameter);
|
||||
|
||||
int insertInfo(Map<String, Object> parameter, String id, String type);
|
||||
|
||||
IPage getInfoPage(Map<String, Object> parameter);
|
||||
|
||||
int batchDeleteItems(String ids);
|
||||
|
||||
List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
|
||||
Map<String,Object> judgeContainChilds(String ids);
|
||||
|
||||
int batchCopyItems(String ids,String menuIds,String infoId);
|
||||
|
||||
Map<String,Object> selectByPrimaryKey(String id);
|
||||
|
||||
Map<String,Object> getInfoById(String id);
|
||||
|
||||
Map<String,Object> batchMergeItems(String ids);
|
||||
|
||||
int batchSet(Map<String,Object> parameter);
|
||||
|
||||
Result<?> importSplitItemsData(List<Map<String, Object>> list, String menuId, String filepath, String infoId, String cut, List<SplitTableInfo> getSheetTableList);
|
||||
|
||||
Result<?> importSplitItems(MultipartFile file, String cut, String menuId, String infoId) throws IOException;
|
||||
|
||||
Result<?> importSplitResult(String splitFileId, String cut, SarFileSplitInfoEO sarFileSplitInfoEO) throws IOException;
|
||||
|
||||
void exportTemplate(String cut, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
List<Map<String, Object>> getBatchSetForm(String flag, String cut);
|
||||
|
||||
Map<String, Object> filterMap(Map<String, Object> map);
|
||||
|
||||
List<Map<String, Object>> queryByOrdersForExport(String cut, String field, List<String> idList, Map<String, Object> parameter);
|
||||
|
||||
void downLoadImgList(List<FileSplitValImgExportDto> allImgList,String fileNowPath) throws IOException;
|
||||
|
||||
void downLoadFileList(List<OSSFile> allRelevFileList, String fileNowPath) throws IOException;
|
||||
|
||||
void exportSplitInfo(String cut, String idList, Map<String, Object> parameter,String exportName, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
List<FileSplitValExportDto> combineItemValInfo(List<SarFileSplitItemsValEO> getValList,
|
||||
List<FileSpiltValTableExportDto> allTableList,
|
||||
List<FileSplitValImgExportDto> allImgList,
|
||||
SarFileSplitItemsEOPage page);
|
||||
|
||||
String[] getWorkbookTitleForExport(String cut);
|
||||
|
||||
int deleteByMenuIds(List<String> idList);
|
||||
String getFieldForExport();
|
||||
|
||||
int insertForeach(List<SarFileSplitItemsEO> messageList); // 拆分已入库文件专用
|
||||
|
||||
List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
List<SarFileSplitItemsEO> selectByInfoId(String infoId);
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.jero.modules.split.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileSplitInfoService extends IService<SarFileSplitInfoEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileSplitInfoEO sarFileSplitInfoEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileSplitInfoEO sarFileSplitInfoEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileSplitInfoEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitInfoEO> queryList();
|
||||
|
||||
List<SarFileSplitInfoEO> queryByFileId(String fileId);
|
||||
|
||||
boolean bindToDocumentLibrary(String id, String connectId, String fileName);
|
||||
|
||||
void dataProcessing(String cut, List<SarFileSplitInfoEO> sarFileSplitInfoEOList);
|
||||
|
||||
List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
void batchUpdateByDocumentSerialNumber(String oldSerialNumber,String newSerialNumber,String newTitle,String newTitleEn);
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.jero.modules.split.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.page.SarFileSplitItemsValEOPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_VAL SarFileSplitItemsValEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-07 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface ISarFileSplitItemsValEOService extends IService<SarFileSplitItemsValEO> {
|
||||
|
||||
int insert(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int insertSelective(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int updateByPrimaryKey(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
int updateByPrimaryKeySelective(SarFileSplitItemsValEO sarFileSplitItemsValEO);
|
||||
|
||||
SarFileSplitItemsValEO selectByPrimaryKey(String value);
|
||||
|
||||
int deleteByPrimaryKey(String value);
|
||||
|
||||
List<SarFileSplitItemsValEO> queryByList(SarFileSplitItemsValEOPage page);
|
||||
|
||||
int queryByCount(SarFileSplitItemsValEOPage page);
|
||||
|
||||
List<SarFileSplitItemsValEO> queryByPage(SarFileSplitItemsValEOPage page);
|
||||
|
||||
int insertForeach(List<SarFileSplitItemsValEO> itemValList);
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.jero.modules.split.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_MENU SarFileSplitMenuEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
public interface ISarFileSplitMenuEOService extends IService<SarFileSplitMenuEO> {
|
||||
|
||||
// 通过ID查询该结点及结点下所有的节点排序的最大值
|
||||
int getMaxDisplayByid(String menuID) ;
|
||||
|
||||
int addMenu(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有的子节点包括父节点
|
||||
* @param sarFileSplitMenuEO
|
||||
* @return
|
||||
*/
|
||||
List<SarFileSplitMenuEO> queryAllChildrenById(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
void deleteMenu(String id);
|
||||
|
||||
int insert(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int insertSelective(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateByPrimaryKey(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int updateByPrimaryKeySelective(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
SarFileSplitMenuEO selectByPrimaryKey(String value);
|
||||
|
||||
int deleteByPrimaryKey(String value);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByList(SarFileSplitMenuEOPage page);
|
||||
|
||||
int queryByCount(SarFileSplitMenuEOPage page);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByPage(SarFileSplitMenuEOPage page);
|
||||
|
||||
|
||||
List<SarFileSplitMenuEO> queryByInfoId(String infoId);
|
||||
|
||||
Result moveUpOrDown(JSONObject json);
|
||||
}
|
||||
+2782
File diff suppressed because it is too large
Load Diff
+3740
File diff suppressed because it is too large
Load Diff
+1873
File diff suppressed because it is too large
Load Diff
+396
@@ -0,0 +1,396 @@
|
||||
package com.jero.modules.split.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.ModuleEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.enums.SplitFileTypeTypeEnum;
|
||||
import com.jero.modules.split.mapper.SarFileSplitInfoMapper;
|
||||
import com.jero.modules.split.mapper.SarFileSplitMenuEOMapper;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.ISysDictItemService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 文档拆分表
|
||||
* @Author: wcj
|
||||
* @Date: 2022-03-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMapper, SarFileSplitInfoEO> implements ISarFileSplitInfoService {
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitMenuEOMapper sarFileSplitMenuEOMapper;
|
||||
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictItemService sysDictItemService;
|
||||
@Autowired
|
||||
private FileSpiltService fileSpiltService;
|
||||
@Autowired
|
||||
private FileSplitPdfService fileSplitPdfService;
|
||||
@Autowired
|
||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
Date now = new Date();
|
||||
//保存拆分数据
|
||||
String infoId = UUID.randomUUID().toString().replace("-", "");
|
||||
sarFileSplitInfoEO.setId(infoId);
|
||||
sarFileSplitInfoEO.setSplitResult("成功"); // TODO 这块之后可能不会用到
|
||||
sarFileSplitInfoEO.setCreateTime(now);
|
||||
sarFileSplitInfoEO.setUpdateTime(now);
|
||||
save(sarFileSplitInfoEO);
|
||||
|
||||
SplitFileTypeTypeEnum enumByValue = SplitFileTypeTypeEnum.getEnumByValue(sarFileSplitInfoEO.getFileGroup());
|
||||
String fileSuffix = "docx";
|
||||
if (StringUtils.isNotEmpty(sarFileSplitInfoEO.getFileName())) {
|
||||
String fileName = sarFileSplitInfoEO.getFileName();
|
||||
fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
}
|
||||
int result = 0;
|
||||
switch (enumByValue){
|
||||
case GB:
|
||||
case GBT:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileCHN(sarFileSplitInfoEO,enumByValue);
|
||||
} else if("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileCHN(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case EU:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileEU(sarFileSplitInfoEO, enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileEU(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case US:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileUSA(sarFileSplitInfoEO,enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileUSA(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case GSO:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileGSO(sarFileSplitInfoEO, enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileGSO(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case JPN_ATTACHMENT:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileJapanOne(sarFileSplitInfoEO,enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileJapanOne(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case JPN_ARTICLE:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case KMVSS_ARTICLE:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
case KMVSS_TABLE:
|
||||
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSpiltService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||
result = fileSplitPdfService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if(result == -1){
|
||||
if(LanguageEnum.CN.getValue().equals(sarFileSplitInfoEO.getCut())) {
|
||||
throw new JeroBootException("文档格式错误,请检查文档内容!");
|
||||
}else{
|
||||
throw new JeroBootException("The document format is wrong. Please check the document content!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fileSpiltService.fileCHN(sarFileSplitInfoEO);
|
||||
// fileSpiltService.fileEU(sarFileSplitInfoEO);
|
||||
// fileSpiltService.fileUSA(sarFileSplitInfoEO);
|
||||
|
||||
// 添加条款总目录 TODO 这块之后可能不会用到
|
||||
// SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
// sarFileSplitMenuEO.setName("总目录");
|
||||
// sarFileSplitMenuEO.setInfoId(infoId);
|
||||
// sarFileSplitMenuEO.setDisplaySeq(1L);
|
||||
// sarFileSplitMenuEO.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
// sarFileSplitMenuEO.setValidFlag(0);
|
||||
// sarFileSplitMenuEO.setCreationTime(new Date());
|
||||
// sarFileSplitMenuEO.setModifyTime(new Date());
|
||||
// sarFileSplitMenuEOMapper.insertSelective(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileSplitInfoEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
Date now = new Date();
|
||||
sarFileSplitInfoEO.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileSplitInfoEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
// 删除条款和目录
|
||||
SarFileSplitMenuEO menu = sarFileSplitMenuEOMapper.selectGeneral(id);
|
||||
if(ObjectUtil.isNotEmpty(menu)) {
|
||||
sarFileSplitMenuEOService.deleteMenu(menu.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
for(String id : ids){
|
||||
// 删除条款和目录
|
||||
SarFileSplitMenuEO menu = sarFileSplitMenuEOMapper.selectGeneral(id);
|
||||
if(ObjectUtil.isNotEmpty(menu)) {
|
||||
sarFileSplitMenuEOService.deleteMenu(menu.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileSplitInfoEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileSplitInfoEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitInfoEO> queryByFileId(String fileId) {
|
||||
LambdaQueryWrapper<SarFileSplitInfoEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileSplitInfoEO::getFileId, fileId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bindToDocumentLibrary(String id, String connectId, String fileName) {
|
||||
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(connectId);
|
||||
List<OSSFile> fileOfSplit = ossFileList.stream().filter(e->fileName.equals(e.getFileName())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(fileOfSplit)) {
|
||||
String fileId = fileOfSplit.get(0).getId();
|
||||
SarFileSplitInfoEO infoEO = new SarFileSplitInfoEO();
|
||||
infoEO.setId(id);
|
||||
infoEO.setFileId(fileId);
|
||||
this.updateById(infoEO);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataProcessing(String cut, List<SarFileSplitInfoEO> sarFileSplitInfoEOList) {
|
||||
// 查询文档拆分表中类型是下拉选的字段
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT.getValue());
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是 且 有数据字典编码)
|
||||
fieldList = fieldList.stream()
|
||||
.filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))
|
||||
&& StringUtils.isNotBlank(e.getDictField()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 根据切换语言 查询下拉选字段的下拉值
|
||||
List<SysDictItem> dictItemListAll = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
// 查询数据字典值
|
||||
List<SysDictItem> dictItemList = sysDictItemService.selectItemsByDictCode(onlCgformField.getDictField());
|
||||
if(CollectionUtil.isNotEmpty(dictItemList)) {
|
||||
dictItemListAll.addAll(dictItemList);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理数据中所有下拉字典值
|
||||
for (SarFileSplitInfoEO splitInfoEO : sarFileSplitInfoEOList){
|
||||
String fileType = null;
|
||||
OnlCgformField fileTypeField = onlCgformFieldService.queryById(splitInfoEO.getFileType());
|
||||
if (ObjectUtil.isNotEmpty(fileTypeField)) {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
fileType = fileTypeField.getDbFieldTxt();
|
||||
} else {
|
||||
fileType = fileTypeField.getDbFieldEnName();
|
||||
}
|
||||
}
|
||||
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
Map<String, String> cnMap = dictItemListAll.stream()
|
||||
.filter(e-> e.getItemValue().equals(splitInfoEO.getSplitResult()))
|
||||
.collect(Collectors.toMap(SysDictItem::getItemValue, SysDictItem::getItemText)); // 优化
|
||||
splitInfoEO.setSplitResult(cnMap.get(splitInfoEO.getSplitResult()));
|
||||
} else {
|
||||
Map<String, String> enMap = dictItemListAll.stream()
|
||||
.filter(e-> e.getItemValue().equals(splitInfoEO.getSplitResult()))
|
||||
.collect(Collectors.toMap(SysDictItem::getItemValue, SysDictItem::getEnName)); // 优化
|
||||
splitInfoEO.setSplitResult(enMap.get(splitInfoEO.getSplitResult()));
|
||||
}
|
||||
splitInfoEO.setFileType(fileType);
|
||||
// 处理文档库id字段 根据编号和标题查询
|
||||
List<Map<String, Object>> bussDocumentLibraryEOList = bussDocumentLibraryEOService.getListBySerialNumber(splitInfoEO.getSerialNumber());
|
||||
if (CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)) {
|
||||
splitInfoEO.setDocumentId(bussDocumentLibraryEOList.get(0).get("id").toString());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(splitInfoEO.getFileId())) {
|
||||
splitInfoEO.setFlag("1");
|
||||
}else{
|
||||
splitInfoEO.setFlag("0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(FieldTypeEnum.TEXT_LINK.getValue().equals(onlCgformField.getFieldShowType())){
|
||||
map.put("urlClick","true");
|
||||
}
|
||||
if("file_name".equals(onlCgformField.getDbFieldName())
|
||||
|| "serial_number".equals(onlCgformField.getDbFieldName())
|
||||
|| "title".equals(onlCgformField.getDbFieldName())){
|
||||
//跳转详情的标识
|
||||
map.put("click","true");
|
||||
}
|
||||
//日期添加排序标识
|
||||
if ("create_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
if ("update_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
|
||||
if(LanguageEnum.CN.getValue().equals(cut) && "title_en".equals(onlCgformField.getDbFieldName())) {
|
||||
continue;
|
||||
}
|
||||
if(LanguageEnum.EN.getValue().equals(cut) && "title".equals(onlCgformField.getDbFieldName())) {
|
||||
continue;
|
||||
}
|
||||
String dbFieldName = onlCgformField.getDbFieldName();
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName));
|
||||
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
}else{
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdateByDocumentSerialNumber(String oldSerialNumber,String newSerialNumber,String newTitle,String newTitleEn) {
|
||||
LambdaQueryWrapper<SarFileSplitInfoEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SarFileSplitInfoEO::getSerialNumber, oldSerialNumber);
|
||||
List<SarFileSplitInfoEO> fileSplitInfoEOList = list(lambdaQueryWrapper);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(fileSplitInfoEOList)) {
|
||||
List<SarFileSplitInfoEO> updateEOList = new ArrayList<>();
|
||||
fileSplitInfoEOList.forEach(ocrRecordEO ->{
|
||||
SarFileSplitInfoEO updateEO = new SarFileSplitInfoEO();
|
||||
updateEO.setId(ocrRecordEO.getId());
|
||||
updateEO.setSerialNumber(newSerialNumber);
|
||||
updateEO.setTitle(newTitle);
|
||||
updateEO.setTitleEn(newTitleEn);
|
||||
|
||||
updateEOList.add(updateEO);
|
||||
});
|
||||
|
||||
updateBatchById(updateEOList);
|
||||
}
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.jero.modules.split.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.mapper.SarFileSplitItemsValEOMapper;
|
||||
import com.jero.modules.split.page.SarFileSplitItemsValEOPage;
|
||||
import com.jero.modules.split.service.ISarFileSplitItemsValEOService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_ITEMS_VAL SarFileSplitItemsValEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-07 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Service("sarFileSplitItemsValEOService")
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class SarFileSplitItemsValEOServiceImpl extends ServiceImpl<SarFileSplitItemsValEOMapper, SarFileSplitItemsValEO> implements ISarFileSplitItemsValEOService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SarFileSplitItemsValEOServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitItemsValEOMapper dao;
|
||||
|
||||
@Override
|
||||
public int insert(SarFileSplitItemsValEO sarFileSplitItemsValEO) {
|
||||
return dao.insert(sarFileSplitItemsValEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(SarFileSplitItemsValEO sarFileSplitItemsValEO) {
|
||||
return dao.insertSelective(sarFileSplitItemsValEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(SarFileSplitItemsValEO sarFileSplitItemsValEO) {
|
||||
return dao.updateByPrimaryKey(sarFileSplitItemsValEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(SarFileSplitItemsValEO sarFileSplitItemsValEO) {
|
||||
return dao.updateByPrimaryKeySelective(sarFileSplitItemsValEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarFileSplitItemsValEO selectByPrimaryKey(String value) {
|
||||
return dao.selectByPrimaryKey(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(String value) {
|
||||
return dao.deleteByPrimaryKey(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitItemsValEO> queryByList(SarFileSplitItemsValEOPage page) {
|
||||
return dao.queryByList(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryByCount(SarFileSplitItemsValEOPage page) {
|
||||
return dao.queryByCount(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitItemsValEO> queryByPage(SarFileSplitItemsValEOPage page) {
|
||||
return dao.queryByPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertForeach(List<SarFileSplitItemsValEO> itemValList) {
|
||||
// 解决一次批量插入太多 PacketTooBigException 异常
|
||||
int total = itemValList.size();
|
||||
int count = 0;
|
||||
int pageSum = 1;
|
||||
if(total > 100) {
|
||||
pageSum = total / 100; // 总页数
|
||||
if ((total % 100) > 0) {
|
||||
pageSum += 1;
|
||||
}
|
||||
}
|
||||
List<SarFileSplitItemsValEO> subList = new ArrayList<>();
|
||||
for(int i = 0; i < pageSum; i++) {
|
||||
int j = i*100+100;
|
||||
if (i == pageSum -1) {
|
||||
j = total;
|
||||
}
|
||||
subList = itemValList.subList(i*100, j);
|
||||
count += dao.insertForeach(subList);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
package com.jero.modules.split.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.mapper.SarFileSplitItemsValEOMapper;
|
||||
import com.jero.modules.split.mapper.SarFileSplitMenuEOMapper;
|
||||
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
|
||||
import com.jero.modules.split.service.IFileSplitItemsEOService;
|
||||
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <br>
|
||||
* <b>功能:</b>SAR_FILE_SPLIT_MENU SarFileSplitMenuEOService<br>
|
||||
* <b>作者:</b>code generator<br>
|
||||
* <b>日期:</b> 2020-01-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Service("sarFileSplitMenuEOService")
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class SarFileSplitMenuEOServiceImpl extends ServiceImpl<SarFileSplitMenuEOMapper, SarFileSplitMenuEO> implements ISarFileSplitMenuEOService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SarFileSplitMenuEOServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitMenuEOMapper dao;
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitItemsValEOMapper sarFileSplitItemsValEOMapper;
|
||||
|
||||
@Autowired
|
||||
private IFileSplitItemsEOService fileSplitItemsEOService;
|
||||
|
||||
// 通过ID查询该结点及结点下所有的节点排序的最大值
|
||||
public int getMaxDisplayByid(String menuID) {
|
||||
return dao.getMaxDisplayByid(menuID);
|
||||
}
|
||||
|
||||
public int addMenu(SarFileSplitMenuEO sarFileSplitMenuEO){
|
||||
sarFileSplitMenuEO.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
sarFileSplitMenuEO.setValidFlag(0);
|
||||
sarFileSplitMenuEO.setCreationTime(new Date());
|
||||
sarFileSplitMenuEO.setModifyTime(new Date());
|
||||
int count = dao.insertSelective(sarFileSplitMenuEO);
|
||||
// 新增对应条款
|
||||
Map<String, Object> parameter = new HashMap<>();
|
||||
if (StringUtils.isNotEmpty(sarFileSplitMenuEO.getName())) {
|
||||
parameter.put("items_num", sarFileSplitMenuEO.getName());
|
||||
}
|
||||
parameter.put("items_name", sarFileSplitMenuEO.getItemName());
|
||||
parameter.put("info_id", sarFileSplitMenuEO.getInfoId());
|
||||
parameter.put("menu_id", sarFileSplitMenuEO.getId());
|
||||
String itemId = UUID.randomUUID().toString().replace("-", "");
|
||||
fileSplitItemsEOService.insertInfo(parameter, itemId,"add");
|
||||
// 之后的所有节点序号增加
|
||||
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||
// page.setPId(sarFileSplitMenuEO.getPId());
|
||||
page.setInfoId(sarFileSplitMenuEO.getInfoId());
|
||||
page.setValidFlag("0");
|
||||
page.setOrderBy("display_seq asc");
|
||||
List<SarFileSplitMenuEO> getList = dao.queryByList(page);
|
||||
if (getList != null && !getList.isEmpty()) {
|
||||
for(SarFileSplitMenuEO menu : getList){
|
||||
Long olgSeq = menu.getDisplaySeq();
|
||||
if (olgSeq >= sarFileSplitMenuEO.getDisplaySeq() && !menu.getId().equals(sarFileSplitMenuEO.getId())) {
|
||||
menu.setDisplaySeq(olgSeq + 1);
|
||||
dao.updateByPrimaryKeySelective(menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<SarFileSplitMenuEO> queryAllChildrenById(SarFileSplitMenuEO sarMenuEO) {
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = dao.selectByPrimaryKey(sarMenuEO.getId());
|
||||
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||
page.setInfoId(sarFileSplitMenuEO.getInfoId());
|
||||
List<SarFileSplitMenuEO> listAll = dao.queryByList(page); // 查询所有目录
|
||||
|
||||
List<SarFileSplitMenuEO> result = new ArrayList<>();
|
||||
// 递归查询 指定父节点下的所有子节点,包括父节点
|
||||
if (CollectionUtil.isNotEmpty(listAll)) {
|
||||
result.add(sarFileSplitMenuEO); // 加上父节点
|
||||
recursion(listAll, result, sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void recursion(List<SarFileSplitMenuEO> listAll, List<SarFileSplitMenuEO> result, SarFileSplitMenuEO father) {
|
||||
List<SarFileSplitMenuEO> childern = listAll.stream().filter(e-> father.getId().equals(e.getPId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(childern)) {
|
||||
result.addAll(childern);
|
||||
for(SarFileSplitMenuEO menuEO : childern) {
|
||||
recursion(listAll, result, menuEO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteMenu(String id){
|
||||
List<String> menuIds = new ArrayList<>();
|
||||
SarFileSplitMenuEO sarMenuEO = new SarFileSplitMenuEO();
|
||||
sarMenuEO.setId(id);
|
||||
// 查询当前节点及所有子节点
|
||||
// List<SarFileSplitMenuEO> list = dao.queryAllChildrenByid(sarMenuEO);
|
||||
List<SarFileSplitMenuEO> list = queryAllChildrenById(sarMenuEO);
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for(SarFileSplitMenuEO menu : list){
|
||||
menuIds.add(menu.getId());
|
||||
}
|
||||
}
|
||||
// 删除节点及子节点
|
||||
dao.deleteByPId(menuIds);
|
||||
// 删除条款
|
||||
sarFileSplitItemsValEOMapper.deleteValByMenuIds(menuIds);
|
||||
fileSplitItemsEOService.deleteByMenuIds(menuIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(SarFileSplitMenuEO sarFileSplitMenuEO) {
|
||||
return dao.insert(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(SarFileSplitMenuEO sarFileSplitMenuEO) {
|
||||
return dao.insertSelective(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(SarFileSplitMenuEO sarFileSplitMenuEO) {
|
||||
return dao.updateByPrimaryKey(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(SarFileSplitMenuEO sarFileSplitMenuEO) {
|
||||
return dao.updateByPrimaryKeySelective(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarFileSplitMenuEO selectByPrimaryKey(String value) {
|
||||
return dao.selectByPrimaryKey(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(String value) {
|
||||
return dao.deleteByPrimaryKey(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitMenuEO> queryByList(SarFileSplitMenuEOPage page) {
|
||||
List<SarFileSplitMenuEO> result = dao.queryByList(page);
|
||||
|
||||
// 处理数据是否可以上下移动标识
|
||||
for (SarFileSplitMenuEO sarFileSplitMenuEO : result) {
|
||||
// 如果数据的同级别 该数据是第一条数据,不能向上移动, 该数据是最后一条数据 不能向下移动, 如果该级别只有这一条数据,不可向上或向下移动
|
||||
boolean moveUpFlag = false;
|
||||
boolean moveDownFlag = false;
|
||||
Long displaySeq = sarFileSplitMenuEO.getDisplaySeq();
|
||||
for (SarFileSplitMenuEO fileSplitMenuEO : result) {
|
||||
if(StringUtils.equals(sarFileSplitMenuEO.getPId(),fileSplitMenuEO.getPId())){
|
||||
if(displaySeq > fileSplitMenuEO.getDisplaySeq()){
|
||||
moveUpFlag = true;
|
||||
}else if(displaySeq < fileSplitMenuEO.getDisplaySeq()){
|
||||
moveDownFlag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileSplitMenuEO.setMoveUpFlag(moveUpFlag);
|
||||
sarFileSplitMenuEO.setMoveDownFlag(moveDownFlag);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryByCount(SarFileSplitMenuEOPage page) {
|
||||
return dao.queryByCount(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitMenuEO> queryByPage(SarFileSplitMenuEOPage page) {
|
||||
return dao.queryByPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitMenuEO> queryByInfoId(String infoId) {
|
||||
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||
page.setInfoId(infoId);
|
||||
return dao.queryByList(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result moveUpOrDown(JSONObject json) {
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = JSONObject.parseObject(JSONObject.toJSONString(json.get("SarFileSplitMenu")), SarFileSplitMenuEO.class);
|
||||
String pId = sarFileSplitMenuEO.getPId();
|
||||
Long displaySeq = sarFileSplitMenuEO.getDisplaySeq();
|
||||
String moveFlag = json.getString("moveFlag");
|
||||
String infoId = json.getString("infoId");
|
||||
|
||||
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||
page.setInfoId(infoId);
|
||||
page.setValidFlag("0");
|
||||
List<SarFileSplitMenuEO> updateList = new ArrayList<>();
|
||||
if(StringUtils.equals(moveFlag,"up")){
|
||||
page.setOrderBy("display_seq desc");
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOList = this.queryByList(page);
|
||||
if(displaySeq != 0){
|
||||
// 计算后的当前数据排序号
|
||||
Long displaySeqAfter = displaySeq - 1;
|
||||
|
||||
for (SarFileSplitMenuEO fileSplitMenuEO : sarFileSplitMenuEOList) {
|
||||
if(StringUtils.equals(fileSplitMenuEO.getPId(),pId)){
|
||||
if(displaySeq > fileSplitMenuEO.getDisplaySeq()){
|
||||
fileSplitMenuEO.setDisplaySeq(fileSplitMenuEO.getDisplaySeq() + 1);
|
||||
updateList.add(fileSplitMenuEO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(updateList)){
|
||||
this.baseMapper.updateByPrimaryKeySelective(updateList.get(0));
|
||||
}
|
||||
|
||||
sarFileSplitMenuEO.setDisplaySeq(displaySeqAfter);
|
||||
this.baseMapper.updateByPrimaryKeySelective(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
}else if(StringUtils.equals(moveFlag,"down")){
|
||||
page.setOrderBy("display_seq asc");
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOList = this.queryByList(page);
|
||||
|
||||
// 计算后的当前数据排序号
|
||||
Long displaySeqAfter = displaySeq + 1;
|
||||
|
||||
for (SarFileSplitMenuEO fileSplitMenuEO : sarFileSplitMenuEOList) {
|
||||
if(StringUtils.equals(fileSplitMenuEO.getPId(),pId)){
|
||||
if(displaySeq < fileSplitMenuEO.getDisplaySeq()){
|
||||
fileSplitMenuEO.setDisplaySeq(fileSplitMenuEO.getDisplaySeq() - 1);
|
||||
updateList.add(fileSplitMenuEO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(updateList)){
|
||||
this.baseMapper.updateByPrimaryKeySelective(updateList.get(0));
|
||||
}
|
||||
|
||||
sarFileSplitMenuEO.setDisplaySeq(displaySeqAfter);
|
||||
this.baseMapper.updateByPrimaryKeySelective(sarFileSplitMenuEO);
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.jero.modules.split.util;/**
|
||||
* Created by Administrator on 2018/12/20 16:42
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author Administrator
|
||||
* @Description TODO
|
||||
* Date 2018/12/20 16:42
|
||||
* @Param
|
||||
* @return
|
||||
**/
|
||||
public class ExcelUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExcelUtil.class);
|
||||
/**
|
||||
*
|
||||
* @param filePath 需要读取的文件路径
|
||||
* @param column 指定需要获取的列数,例如第一列 1
|
||||
* @param startRow 指定从第几行开始读取数据
|
||||
* @param endRow 指定结束行
|
||||
* @return 返回读取列数据的set
|
||||
*/
|
||||
public static List<String> getColumnSet(String fileOrginName, MultipartFile file, int column, int startRow , int endRow) throws IOException {
|
||||
Workbook wb = readExcel(fileOrginName,file.getInputStream()); //文件
|
||||
Sheet sheet = wb.getSheetAt(0); //sheet
|
||||
int rownum = sheet.getPhysicalNumberOfRows(); //行数
|
||||
Row row = null;
|
||||
List<String> result = new ArrayList<>();
|
||||
String cellData = null;
|
||||
if(wb != null){
|
||||
for (int i=startRow-1; i<=endRow; i++){
|
||||
System.out.println(i);
|
||||
row = sheet.getRow(i);
|
||||
if(row !=null){
|
||||
if(row.getCell(column-1)!=null){//单元格为空,不进入
|
||||
row.getCell(column-1).setCellType(CellType.STRING);//设置单元格类型
|
||||
cellData = row.getCell(column-1).getStringCellValue();
|
||||
result.add(cellData);
|
||||
}else{
|
||||
result.add("");
|
||||
}
|
||||
}else{
|
||||
|
||||
break;
|
||||
}
|
||||
System.out.println(cellData);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filePath 需要读取的文件路径
|
||||
* @param column 指定需要获取的列数,例如第一列 1
|
||||
* @param startRow 指定从第几行开始读取数据
|
||||
* @return 返回读取列数据的set
|
||||
*/
|
||||
public static List<String> getColumnSet(String fileOrginName, MultipartFile file, int column, int startRow) throws IOException {
|
||||
Workbook wb = readExcel(fileOrginName,file.getInputStream()); //文件
|
||||
Sheet sheet = wb.getSheetAt(0); //sheet
|
||||
int rownum = sheet.getPhysicalNumberOfRows(); //行数
|
||||
System.out.println("sumrows " + rownum);
|
||||
|
||||
return getColumnSet(fileOrginName,file, column, startRow , rownum-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//读取excel
|
||||
public static Workbook readExcel(String fileOrginName,InputStream is){
|
||||
Workbook wb = null;
|
||||
String extString = fileOrginName.substring(fileOrginName.lastIndexOf("."));
|
||||
try {
|
||||
if(".xls".equals(extString)){
|
||||
return wb = new HSSFWorkbook(is);
|
||||
}else if(".xlsx".equals(extString)){
|
||||
return wb = new XSSFWorkbook(is);
|
||||
}else{
|
||||
return wb = null;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.error("异常:",e);
|
||||
} catch (IOException e) {
|
||||
logger.error("异常:",e);
|
||||
}
|
||||
return wb;
|
||||
}
|
||||
|
||||
public static Object getCellFormatValue(Cell cell){
|
||||
Object cellValue = null;
|
||||
if(cell!=null){
|
||||
//判断cell类型
|
||||
switch(cell.getCellType()){
|
||||
case NUMERIC:{
|
||||
cell.setCellType(CellType.STRING); //将数值型cell设置为string型
|
||||
cellValue = cell.getStringCellValue();
|
||||
break;
|
||||
}
|
||||
case FORMULA:{
|
||||
//判断cell是否为日期格式
|
||||
if(DateUtil.isCellDateFormatted(cell)){
|
||||
//转换为日期格式YYYY-mm-dd
|
||||
cellValue = cell.getDateCellValue();
|
||||
}else{
|
||||
//数字
|
||||
cellValue = String.valueOf(cell.getNumericCellValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STRING:{
|
||||
cellValue = cell.getRichStringCellValue().getString();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
cellValue = "";
|
||||
}
|
||||
}else{
|
||||
cellValue = "";
|
||||
}
|
||||
return cellValue;
|
||||
}
|
||||
|
||||
public static String validatePattern(String fileName){
|
||||
if(StringUtils.isNotEmpty(fileName)){
|
||||
Boolean isOk = false;
|
||||
if(fileName.lastIndexOf(".docx") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(fileName.lastIndexOf(".pdf") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(fileName.lastIndexOf(".doc") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(fileName.lastIndexOf(".PDF") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(fileName.lastIndexOf(".ppt") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(fileName.lastIndexOf(".pptx") != -1){
|
||||
isOk = true;
|
||||
}
|
||||
if(isOk){
|
||||
//其格式满足条件,无需提示
|
||||
return null;
|
||||
}else {
|
||||
return "请上传pdf、doc、docx、ppt、pptx文件;";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断对象中属性值是否全为空
|
||||
*
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkObjAllFieldsIsNull(Object object) {
|
||||
if (null == object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
|
||||
if (f.get(object) != null && StringUtils.isNotBlank(f.get(object).toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.jero.modules.split.util;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:文件压缩与解压工具类
|
||||
* @Auther: wcj
|
||||
* @Date: 2021/7/31 11:40
|
||||
*/
|
||||
public class FileRarUtils {
|
||||
|
||||
|
||||
/* public static void main(String[] args) {
|
||||
String rarDir = "E:\\DeskTop\\文档库1111111.rar";
|
||||
String outDir = "E:\\DeskTop\\rar";
|
||||
try (InputStream in = new FileInputStream(rarDir)){
|
||||
List<String> list = fileUnRar(in, outDir, System.currentTimeMillis());
|
||||
System.out.println(list);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// ExpertUtils.fileUnRar(inputStream, upLoadPath, nowTime);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 解压压缩包(rar)
|
||||
* @param inputStream
|
||||
* @param upLoadPath
|
||||
* @param nowTime
|
||||
* @return
|
||||
*/
|
||||
public static List<String> fileUnRar(InputStream inputStream, String upLoadPath, long nowTime) {
|
||||
String savePath = upLoadPath + File.separator + nowTime + File.separator + nowTime + ".rar";
|
||||
String ftpUpPath = upLoadPath + File.separator + nowTime + File.separator + "zipUnCompress";
|
||||
|
||||
try {
|
||||
File saveFile = new File(savePath);
|
||||
if (!saveFile.exists()) {
|
||||
saveFile.getParentFile().mkdirs();
|
||||
saveFile.createNewFile();
|
||||
//首次写入获取
|
||||
}
|
||||
try (FileOutputStream fos = new FileOutputStream(saveFile);) {
|
||||
int len;
|
||||
byte[] buffer = new byte[2048];
|
||||
while ((len = inputStream.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException(e);
|
||||
}
|
||||
|
||||
//压缩包解压
|
||||
FileRarUtils.rarUnCompress(savePath,ftpUpPath);
|
||||
List<String> files = new ArrayList<>();
|
||||
|
||||
//获取解压后的所有文件
|
||||
File foundFile = new File(ftpUpPath);
|
||||
fundFile(foundFile, files);
|
||||
|
||||
return files;
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件递归查找
|
||||
*
|
||||
* @param file
|
||||
* @param result
|
||||
* @return
|
||||
*/
|
||||
public static void fundFile(File file, List<String> result) {
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
File[] fs = file.listFiles();
|
||||
for (File f : fs) {
|
||||
//若是目录,则递归打印该目录下的文件
|
||||
if (f.isDirectory()) {
|
||||
fundFile(f, result);
|
||||
} else {
|
||||
String path = f.getPath();
|
||||
//若是文件,直接返回
|
||||
result.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 解压rar文件
|
||||
*
|
||||
* @param rarDir 需要解压的文件
|
||||
* @param outDir 解压后的路径
|
||||
*/
|
||||
public static void rarUnCompress(String rarDir, String outDir) {
|
||||
/*// 第一个参数是需要解压的压缩包路径,第二个参数参考JdkAPI文档的RandomAccessFile
|
||||
//r代表以只读的方式打开文本,也就意味着不能用write来操作文件
|
||||
try (
|
||||
RandomAccessFile randomAccessFile = new RandomAccessFile(rarDir, "r");
|
||||
IInArchive archive = SevenZip.openInArchive(null, // null - autodetect
|
||||
new RandomAccessFileInStream(randomAccessFile));) {
|
||||
|
||||
int[] in = new int[archive.getNumberOfItems()];
|
||||
for (int i = 0; i < in.length; i++) {
|
||||
in[i] = i;
|
||||
}
|
||||
File file = new File(outDir);
|
||||
if (!file.exists()) {
|
||||
//如果不存在,创建
|
||||
file.mkdirs();
|
||||
}
|
||||
archive.extract(in, false, new ExtractCallback(archive, outDir + "/"));
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new JeroBootException("文件没找到",e);
|
||||
} catch (SevenZipException e) {
|
||||
throw new JeroBootException("SevenZip文件异常",e);
|
||||
} catch (IOException e) {
|
||||
throw new JeroBootException("文件解析异常",e);
|
||||
}catch (Exception e){
|
||||
throw new JeroBootException(e);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.jero.modules.split.util;
|
||||
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FileSplitUtils {
|
||||
public static void main(String[] args) {
|
||||
String paragraphString ="1.1 weere wewwe";
|
||||
String s ="1.1";
|
||||
|
||||
System.out.println(getItemName(paragraphString,s));
|
||||
}
|
||||
public static String getItemName(String paragraphString,String subString){
|
||||
String itemName = "";
|
||||
String itemNameAll = paragraphString.substring(subString.length());
|
||||
String[] itemNameArr = itemNameAll.split(" ");
|
||||
if(itemNameArr.length >= 2){
|
||||
int count = 0;
|
||||
for (String itemNameTemp : itemNameArr) {
|
||||
if(MyStringUtils.isEmpty(itemNameTemp)){
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
itemName= itemName + itemNameTemp+" ";
|
||||
if(count >= 2){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// itemName = itemNameArr[0]+" "+itemNameArr[1];
|
||||
}else {
|
||||
for (String itemNameTemp : itemNameArr) {
|
||||
itemName = itemName + itemNameTemp+" ";
|
||||
}
|
||||
}
|
||||
itemName = itemName.trim();
|
||||
return itemName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个英文字母
|
||||
* @param en
|
||||
* @return
|
||||
*/
|
||||
public static String getNextUpEn(String en) {
|
||||
if (en == null || en.equals(""))
|
||||
return "A";
|
||||
char lastE = 'Z';
|
||||
int lastEnglish = (int) lastE;
|
||||
char[] c = en.toCharArray();
|
||||
if (c.length > 1) {
|
||||
return null;
|
||||
} else {
|
||||
int now = (int) c[0];
|
||||
if (now >= lastEnglish)
|
||||
return "A";
|
||||
char uppercase = (char) (now + 1);
|
||||
return String.valueOf(uppercase);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取下一个英文字母
|
||||
* @param en
|
||||
* @return
|
||||
*/
|
||||
public static String getLastEn(String en) {
|
||||
if (en == null || en.equals(""))
|
||||
return "Z";
|
||||
char lastE = 'A';
|
||||
int lastEnglish = (int) lastE;
|
||||
char[] c = en.toCharArray();
|
||||
if (c.length > 1) {
|
||||
return null;
|
||||
} else {
|
||||
int now = (int) c[0];
|
||||
if (now <= lastEnglish)
|
||||
return "A";
|
||||
char uppercase = (char) (now - 1);
|
||||
return String.valueOf(uppercase);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个字符串是否含有数字
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
public static boolean hasDigit(String content) {
|
||||
boolean flag = false;
|
||||
Pattern p = Pattern.compile(".*\\d+.*");
|
||||
Matcher m = p.matcher(content);
|
||||
if (m.matches()) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个字符串是否含有字母
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
public static boolean judgeContainsStr(String content) {
|
||||
boolean flag = false;
|
||||
Pattern p = Pattern.compile(".*[a-zA-Z]+.*");
|
||||
Matcher m = p.matcher(content);
|
||||
if (m.matches()) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,646 @@
|
||||
package com.jero.modules.split.util;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ooxml.POIXMLDocumentPart;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/5/11 10:39
|
||||
*/
|
||||
public class POIReadExcelToHtml {
|
||||
private static Map<String, Object> map[];
|
||||
|
||||
/**
|
||||
* 程序入口方法(将excel文件读取成字符串)
|
||||
* @param isWithStyle 是否需要表格样式 包含 字体 颜色 边框 对齐方式
|
||||
* @return <table>...</table> 字符串
|
||||
*/
|
||||
public static String readExcelToHtml(XSSFWorkbook xWb,int sheetNum,boolean isWithStyle){
|
||||
String htmlExcel = null;
|
||||
htmlExcel = readWorkbook(xWb,sheetNum,isWithStyle);
|
||||
/*try {
|
||||
// Workbook wb = WorkbookFactory.create(is);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
return htmlExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据excel的版本分配不同的读取方法进行处理
|
||||
* @param wb
|
||||
* @param isWithStyle
|
||||
* @return
|
||||
*/
|
||||
private static String readWorkbook(Workbook wb,int sheetNum,boolean isWithStyle){
|
||||
String htmlExcel = "";
|
||||
if (wb instanceof XSSFWorkbook) {
|
||||
XSSFWorkbook xWb = (XSSFWorkbook) wb;
|
||||
htmlExcel = getExcelInfo(xWb,sheetNum, isWithStyle);
|
||||
}else if(wb instanceof HSSFWorkbook){
|
||||
HSSFWorkbook hWb = (HSSFWorkbook) wb;
|
||||
htmlExcel = getExcelInfo(hWb,sheetNum, isWithStyle);
|
||||
}
|
||||
return htmlExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取excel成string
|
||||
* @param wb
|
||||
* @param isWithStyle
|
||||
* @return
|
||||
*/
|
||||
public static String getExcelInfo(Workbook wb,int sheetNum, boolean isWithStyle){
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
Sheet sheet = wb.getSheetAt(sheetNum);//获取第一个Sheet的内容
|
||||
// map等待存储excel图片
|
||||
// Map<String, PictureData> sheetIndexPicMap = getSheetPictrues(0, sheet, wb);
|
||||
//临时保存位置,正式环境根据部署环境存放其他位置
|
||||
// try {
|
||||
// if(sheetIndexPicMap != null)
|
||||
// printImg(sheetIndexPicMap);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
//读取excel拼装html
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
map = getRowSpanColSpanMap(sheet);
|
||||
sb.append("<table style='border-collapse:collapse;width:100%;'>");
|
||||
Row row = null; //兼容
|
||||
Cell cell = null; //兼容
|
||||
|
||||
for (int rowNum = sheet.getFirstRowNum(); rowNum <= lastRowNum; rowNum ++) {
|
||||
if(rowNum > 1000) {
|
||||
break;
|
||||
}
|
||||
row = sheet.getRow(rowNum);
|
||||
|
||||
int lastColNum = POIReadExcelToHtml.getColsOfTable(sheet)[0];
|
||||
int rowHeight = POIReadExcelToHtml.getColsOfTable(sheet)[1];
|
||||
|
||||
if(null != row) {
|
||||
lastColNum = row.getLastCellNum();
|
||||
rowHeight = row.getHeight();
|
||||
}
|
||||
|
||||
if (null == row) {
|
||||
sb.append("<tr><td > </td></tr>");
|
||||
continue;
|
||||
}else if(row.getZeroHeight()){
|
||||
continue;
|
||||
}else if(0 == rowHeight){
|
||||
continue; //针对jxl的隐藏行(此类隐藏行只是把高度设置为0,单getZeroHeight无法识别)
|
||||
}
|
||||
sb.append("<tr>");
|
||||
|
||||
for (int colNum = 0; colNum < lastColNum; colNum ++) {
|
||||
if(sheet.isColumnHidden(colNum)) {
|
||||
continue;
|
||||
}
|
||||
String imageRowNum = "0_" + rowNum + "_" + colNum;
|
||||
String imageHtml = "";
|
||||
cell = row.getCell(colNum);
|
||||
/*if ((sheetIndexPicMap != null && !sheetIndexPicMap.containsKey(imageRowNum) || sheetIndexPicMap == null) && cell == null) { //特殊情况 空白的单元格会返回null+//判断该单元格是否包含图片,为空时也可能包含图片
|
||||
sb.append("<td> </td>");
|
||||
continue;
|
||||
}
|
||||
if(sheetIndexPicMap!=null && sheetIndexPicMap.containsKey(imageRowNum)){
|
||||
//待修改路径
|
||||
String imagePath = "D:\\pic" + imageRowNum + ".jpeg";
|
||||
|
||||
imageHtml = "<img src='" + imagePath + "' style='height:" + rowHeight / 20 + "px;'>";
|
||||
}*/
|
||||
String stringValue = getCellValue(cell);
|
||||
if (map[0].containsKey(rowNum + "," + colNum)) {
|
||||
String pointString = (String)map[0].get(rowNum + "," + colNum);
|
||||
int bottomeRow = Integer.valueOf(pointString.split(",")[0]);
|
||||
int bottomeCol = Integer.valueOf(pointString.split(",")[1]);
|
||||
int rowSpan = bottomeRow - rowNum + 1;
|
||||
int colSpan = bottomeCol - colNum + 1;
|
||||
if(map[2].containsKey(rowNum + "," + colNum)){
|
||||
rowSpan = rowSpan - (Integer)map[2].get(rowNum + "," + colNum);
|
||||
}
|
||||
sb.append("<td rowspan= '" + rowSpan + "' colspan= '"+ colSpan + "' ");
|
||||
if(map.length > 3 && map[3].containsKey(rowNum + "," + colNum)){
|
||||
//此类数据首行被隐藏,value为空,需使用其他方式获取值
|
||||
stringValue = getMergedRegionValue(sheet, rowNum, colNum);
|
||||
}
|
||||
} else if (map[1].containsKey(rowNum + "," + colNum)) {
|
||||
map[1].remove(rowNum + "," + colNum);
|
||||
continue;
|
||||
} else {
|
||||
sb.append("<td ");
|
||||
}
|
||||
|
||||
//判断是否需要样式
|
||||
if(isWithStyle){
|
||||
dealExcelStyle(wb, sheet, cell, sb);//处理单元格样式
|
||||
}
|
||||
|
||||
sb.append(">");
|
||||
// if(sheetIndexPicMap!=null && sheetIndexPicMap.containsKey(imageRowNum)) sb.append(imageHtml);
|
||||
if (stringValue == null || "".equals(stringValue.trim())) {
|
||||
sb.append(" ");
|
||||
} else {
|
||||
// 将ascii码为160的空格转换为html下的空格( )
|
||||
sb.append(stringValue.replace(String.valueOf((char) 160)," "));
|
||||
}
|
||||
sb.append("</td>");
|
||||
}
|
||||
sb.append("</tr>");
|
||||
continue;
|
||||
}
|
||||
sb.append("</table>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分析excel表格,记录合并单元格相关的参数,用于之后html页面元素的合并操作
|
||||
* @param sheet
|
||||
* @return
|
||||
*/
|
||||
private static Map<String, Object>[] getRowSpanColSpanMap(Sheet sheet) {
|
||||
Map<String, String> map0 = new HashMap<String, String>(); //保存合并单元格的对应起始和截止单元格
|
||||
Map<String, String> map1 = new HashMap<String, String>(); //保存被合并的那些单元格
|
||||
Map<String, Integer> map2 = new HashMap<String, Integer>(); //记录被隐藏的单元格个数
|
||||
Map<String, String> map3 = new HashMap<String, String>(); //记录合并了单元格,但是合并的首行被隐藏的情况
|
||||
int mergedNum = sheet.getNumMergedRegions();
|
||||
CellRangeAddress range = null;
|
||||
Row row = null;
|
||||
for (int i = 0; i < mergedNum; i++) {
|
||||
range = sheet.getMergedRegion(i);
|
||||
int topRow = range.getFirstRow();
|
||||
int topCol = range.getFirstColumn();
|
||||
int bottomRow = range.getLastRow();
|
||||
int bottomCol = range.getLastColumn();
|
||||
/**
|
||||
* 此类数据为合并了单元格的数据
|
||||
* 1.处理隐藏(只处理行隐藏,列隐藏poi已经处理)
|
||||
*/
|
||||
if(topRow != bottomRow){
|
||||
int zeroRoleNum = 0;
|
||||
int tempRow = topRow;
|
||||
for(int j = topRow; j <= bottomRow; j ++){
|
||||
row = sheet.getRow(j);
|
||||
if(row.getZeroHeight() || row.getHeight() == 0){
|
||||
if(j == tempRow){
|
||||
//首行就进行隐藏,将rowTop向后移
|
||||
tempRow ++;
|
||||
continue;//由于top下移,后面计算rowSpan时会扣除移走的列,所以不必增加zeroRoleNum;
|
||||
}
|
||||
zeroRoleNum ++;
|
||||
}
|
||||
}
|
||||
if(tempRow != topRow){
|
||||
map3.put(tempRow + "," + topCol,topRow + "," + topCol);
|
||||
topRow = tempRow;
|
||||
}
|
||||
if(zeroRoleNum!=0) {
|
||||
map2.put(topRow + "," + topCol, zeroRoleNum);
|
||||
}
|
||||
}
|
||||
map0.put(topRow + "," + topCol, bottomRow + "," + bottomCol);
|
||||
int tempRow = topRow;
|
||||
while (tempRow <= bottomRow) {
|
||||
int tempCol = topCol;
|
||||
while (tempCol <= bottomCol) {
|
||||
map1.put(tempRow + "," + tempCol, topRow + "," + topCol);
|
||||
tempCol++;
|
||||
}
|
||||
tempRow++;
|
||||
}
|
||||
map1.remove(topRow + "," + topCol);
|
||||
}
|
||||
Map[] map = { map0, map1 ,map2,map3};
|
||||
System.err.println(map0);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取合并单元格的值
|
||||
* @param sheet
|
||||
* @param row
|
||||
* @param column
|
||||
* @return
|
||||
*/
|
||||
public static String getMergedRegionValue(Sheet sheet, int row, int column){
|
||||
int sheetMergeCount = sheet.getNumMergedRegions();
|
||||
for(int i = 0 ; i < sheetMergeCount ; i++){
|
||||
CellRangeAddress ca = sheet.getMergedRegion(i);
|
||||
int firstColumn = ca.getFirstColumn();
|
||||
int lastColumn = ca.getLastColumn();
|
||||
int firstRow = ca.getFirstRow();
|
||||
int lastRow = ca.getLastRow();
|
||||
|
||||
if(row >= firstRow && row <= lastRow){
|
||||
|
||||
if(column >= firstColumn && column <= lastColumn){
|
||||
Row fRow = sheet.getRow(firstRow);
|
||||
Cell fCell = fRow.getCell(firstColumn);
|
||||
|
||||
return getCellValue(fCell) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null ;
|
||||
}
|
||||
/**
|
||||
* 获取表格单元格Cell内容
|
||||
* @param cell
|
||||
* @return
|
||||
*/
|
||||
private static String getCellValue(Cell cell) {
|
||||
String result = new String();
|
||||
CellType cellType = cell.getCellType();
|
||||
if (cellType == CellType.NUMERIC) {// 数字类型
|
||||
if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
|
||||
SimpleDateFormat sdf = null;
|
||||
if (cell.getCellStyle().getDataFormat() == HSSFDataFormat.getBuiltinFormat("h:mm")) {
|
||||
sdf = new SimpleDateFormat("HH:mm");
|
||||
} else {// 日期
|
||||
sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
}
|
||||
Date date = cell.getDateCellValue();
|
||||
result = sdf.format(date);
|
||||
} else if (cell.getCellStyle().getDataFormat() == 58) {
|
||||
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
double value = cell.getNumericCellValue();
|
||||
Date date = DateUtil
|
||||
.getJavaDate(value);
|
||||
result = sdf.format(date);
|
||||
} else {
|
||||
double value = cell.getNumericCellValue();
|
||||
CellStyle style = cell.getCellStyle();
|
||||
DecimalFormat format = new DecimalFormat();
|
||||
String temp = style.getDataFormatString();
|
||||
// 单元格设置成常规
|
||||
if (temp.equals("General")) {
|
||||
format.applyPattern("#");
|
||||
}
|
||||
result = format.format(value);
|
||||
}
|
||||
} else if (cellType == CellType.STRING) {// String类型
|
||||
result = cell.getRichStringCellValue().toString();
|
||||
} else if (cellType == CellType.BLANK) {
|
||||
result = "";
|
||||
} else {
|
||||
result = "";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理表格样式
|
||||
* @param wb
|
||||
* @param sheet
|
||||
* @param cell
|
||||
* @param sb
|
||||
*/
|
||||
private static void dealExcelStyle(Workbook wb, Sheet sheet, Cell cell, StringBuffer sb){
|
||||
CellStyle cellStyle = cell.getCellStyle();
|
||||
if (cellStyle != null) {
|
||||
HorizontalAlignment alignment = cellStyle.getAlignment();
|
||||
sb.append("align='" + convertAlignToHtml(alignment) + "' ");//单元格内容的水平对齐方式
|
||||
VerticalAlignment verticalAlignment = cellStyle.getVerticalAlignment();
|
||||
sb.append("valign='"+ convertVerticalAlignToHtml(verticalAlignment)+ "' ");//单元格中内容的垂直排列方式
|
||||
|
||||
if (wb instanceof XSSFWorkbook) {
|
||||
|
||||
XSSFFont xf = ((XSSFCellStyle) cellStyle).getFont();
|
||||
boolean bold = xf.getBold();
|
||||
sb.append("style='");
|
||||
sb.append("font-weight:" + bold + ";"); // 字体加粗
|
||||
sb.append("font-size: " + xf.getFontHeight() / 2 + "%;"); // 字体大小
|
||||
|
||||
int topRow = cell.getRowIndex(),topColumn = cell.getColumnIndex();
|
||||
if(map[0].containsKey(topRow+","+topColumn)){//该单元格为合并单元格,宽度需要获取所有单元格宽度后合并
|
||||
String value = (String)map[0].get(topRow+","+topColumn);
|
||||
String[] ary = value.split(",");
|
||||
int bottomColumn = Integer.parseInt(ary[1]);
|
||||
if(topColumn!=bottomColumn){//合并列,需要计算相应宽度
|
||||
int columnWidth = 0;
|
||||
for(int i=topColumn;i<=bottomColumn;i++){
|
||||
columnWidth += sheet.getColumnWidth(i);
|
||||
}
|
||||
sb.append("width:" + columnWidth/256*xf.getFontHeight()/20 + "pt;");
|
||||
}else{
|
||||
int columnWidth = sheet.getColumnWidth(cell.getColumnIndex()) ;
|
||||
sb.append("width:" + columnWidth/256*xf.getFontHeight()/20 + "pt;");
|
||||
}
|
||||
}else{
|
||||
int columnWidth = sheet.getColumnWidth(cell.getColumnIndex()) ;
|
||||
sb.append("width:" + columnWidth/256*xf.getFontHeight()/20 + "pt;");
|
||||
}
|
||||
|
||||
XSSFColor xc = xf.getXSSFColor();
|
||||
if (xc != null && !"".equals(xc.toString())) {
|
||||
sb.append("color:#" + xc.getARGBHex().substring(2) + ";"); // 字体颜色
|
||||
}
|
||||
|
||||
XSSFColor bgColor = (XSSFColor) cellStyle.getFillForegroundColorColor();
|
||||
if (bgColor != null && !"".equals(bgColor.toString())) {
|
||||
sb.append("background-color:#" + bgColor.getARGBHex().substring(2) + ";"); // 背景颜色
|
||||
}
|
||||
sb.append("border:solid #000000 1px;");
|
||||
// sb.append(getBorderStyle(0,cellStyle.getBorderTop(), ((XSSFCellStyle) cellStyle).getTopBorderXSSFColor()));
|
||||
// sb.append(getBorderStyle(1,cellStyle.getBorderRight(), ((XSSFCellStyle) cellStyle).getRightBorderXSSFColor()));
|
||||
// sb.append(getBorderStyle(2,cellStyle.getBorderBottom(), ((XSSFCellStyle) cellStyle).getBottomBorderXSSFColor()));
|
||||
// sb.append(getBorderStyle(3,cellStyle.getBorderLeft(), ((XSSFCellStyle) cellStyle).getLeftBorderXSSFColor()));
|
||||
}else if(wb instanceof HSSFWorkbook){
|
||||
HSSFFont hf = ((HSSFCellStyle) cellStyle).getFont(wb);
|
||||
boolean bold = hf.getBold();
|
||||
short fontColor = hf.getColor();
|
||||
sb.append("style='");
|
||||
|
||||
HSSFPalette palette = ((HSSFWorkbook) wb).getCustomPalette(); // 类HSSFPalette用于求的颜色的国际标准形式
|
||||
HSSFColor hc = palette.getColor(fontColor);
|
||||
sb.append("font-weight:" + bold + ";"); // 字体加粗
|
||||
sb.append("font-size: " + hf.getFontHeight() / 2 + "%;"); // 字体大小
|
||||
String fontColorStr = convertToStardColor(hc);
|
||||
if (fontColorStr != null && !"".equals(fontColorStr.trim())) {
|
||||
sb.append("color:" + fontColorStr + ";"); // 字体颜色
|
||||
}
|
||||
|
||||
int topRow = cell.getRowIndex(),topColumn = cell.getColumnIndex();
|
||||
if(map[0].containsKey(topRow + "," + topColumn)){//该单元格为合并单元格,宽度需要获取所有单元格宽度后合并
|
||||
String value = (String)map[0].get(topRow + "," + topColumn);
|
||||
String[] ary = value.split(",");
|
||||
int bottomColumn = Integer.parseInt(ary[1]);
|
||||
if(topColumn != bottomColumn){//合并列,需要计算相应宽度
|
||||
int columnWidth = 0;
|
||||
for(int i = topColumn; i <= bottomColumn; i++){
|
||||
columnWidth += sheet.getColumnWidth(i);
|
||||
}
|
||||
sb.append("width:" + columnWidth / 256 * hf.getFontHeight() / 20 + "pt;");
|
||||
}else{
|
||||
int columnWidth = sheet.getColumnWidth(cell.getColumnIndex()) ;
|
||||
sb.append("width:" + columnWidth / 256 * hf.getFontHeight() / 20 + "pt;");
|
||||
}
|
||||
}else{
|
||||
int columnWidth = sheet.getColumnWidth(cell.getColumnIndex()) ;
|
||||
sb.append("width:" + columnWidth / 256 * hf.getFontHeight() / 20 + "pt;");
|
||||
}
|
||||
|
||||
short bgColor = cellStyle.getFillForegroundColor();
|
||||
hc = palette.getColor(bgColor);
|
||||
String bgColorStr = convertToStardColor(hc);
|
||||
if (bgColorStr != null && !"".equals(bgColorStr.trim())) {
|
||||
sb.append("background-color:" + bgColorStr + ";"); // 背景颜色
|
||||
}
|
||||
sb.append("border:solid #000000 1px;");
|
||||
}
|
||||
sb.append("' ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单元格内容的水平对齐方式
|
||||
* @param alignment
|
||||
* @return
|
||||
*/
|
||||
private static String convertAlignToHtml(HorizontalAlignment alignment) {
|
||||
String align = "left";
|
||||
if (alignment == HorizontalAlignment.LEFT) {
|
||||
align = "left";
|
||||
} else if (alignment == HorizontalAlignment.CENTER) {
|
||||
align = "center";
|
||||
} else if (alignment == HorizontalAlignment.RIGHT) {
|
||||
align = "right";
|
||||
}
|
||||
return align;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单元格中内容的垂直排列方式
|
||||
* @param verticalAlignment
|
||||
* @return
|
||||
*/
|
||||
private static String convertVerticalAlignToHtml(VerticalAlignment verticalAlignment) {
|
||||
String valign = "middle";
|
||||
if (verticalAlignment == VerticalAlignment.BOTTOM) {
|
||||
valign = "bottom";
|
||||
} else if (verticalAlignment == VerticalAlignment.CENTER) {
|
||||
valign = "center";
|
||||
} else if (verticalAlignment == VerticalAlignment.TOP) {
|
||||
valign = "top";
|
||||
}
|
||||
return valign;
|
||||
}
|
||||
|
||||
private static String convertToStardColor(HSSFColor hc) {
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
if (hc != null) {
|
||||
if (HSSFColor.HSSFColorPredefined.AUTOMATIC.getIndex() == hc.getIndex()) {
|
||||
return null;
|
||||
}
|
||||
sb.append("#");
|
||||
for (int i = 0; i < hc.getTriplet().length; i ++) {
|
||||
sb.append(fillWithZero(Integer.toHexString(hc.getTriplet()[i])));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String fillWithZero(String str) {
|
||||
if (str != null && str.length() < 2) {
|
||||
return "0" + str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static String[] bordesr = {"border-top:", "border-right:", "border-bottom:", "border-left:"};
|
||||
static String[] borderStyles = {"solid ", "solid ", "solid ", "solid ", "solid ", "solid ", "solid ", "solid ", "solid ", "solid", "solid", "solid", "solid", "solid"};
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static String getBorderStyle(HSSFPalette palette , int b, short s, short t){
|
||||
if(s == 0) {
|
||||
return bordesr[b] + borderStyles[s] + "#d0d7e5 1px;";
|
||||
}
|
||||
String borderColorStr = convertToStardColor( palette.getColor(t));
|
||||
borderColorStr = borderColorStr == null || borderColorStr.length() < 1 ? "#000000" : borderColorStr;
|
||||
return bordesr[b] + borderStyles[s] + borderColorStr + " 1px;";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static String getBorderStyle(int b, short s, XSSFColor xc){
|
||||
if(s == 0) {
|
||||
return bordesr[b] + borderStyles[s] + "#d0d7e5 1px;";
|
||||
}
|
||||
if (xc != null && ! "".equals(xc)) {
|
||||
String borderColorStr = xc.getARGBHex();//t.getARGBHex();
|
||||
borderColorStr=borderColorStr == null || borderColorStr.length() < 1 ? "#000000" : borderColorStr.substring(2);
|
||||
return bordesr[b] + borderStyles[s]+borderColorStr+" 1px;";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void writeFile(String content, String path) {
|
||||
OutputStream os = null;
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
File file = new File(path);
|
||||
os = new FileOutputStream(file);
|
||||
bw = new BufferedWriter(new OutputStreamWriter(os,"GBK"));
|
||||
bw.write(content);
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
fnfe.printStackTrace();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (null != bw) {
|
||||
bw.close();
|
||||
}
|
||||
if (null != os) {
|
||||
os.close();
|
||||
}
|
||||
} catch (IOException ie) {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取Excel图片公共方法
|
||||
* @param sheetNum 当前sheet编号
|
||||
* @param sheet 当前sheet对象
|
||||
* @param workbook 工作簿对象
|
||||
* @return Map key:图片单元格索引(0_1_1)String,value:图片流PictureData
|
||||
*/
|
||||
public static Map<String, PictureData> getSheetPictrues(int sheetNum, Sheet sheet, Workbook workbook) {
|
||||
if(workbook instanceof HSSFWorkbook){
|
||||
return getSheetPictrues03(sheetNum, (HSSFSheet) sheet, (HSSFWorkbook) workbook);
|
||||
}else if(workbook instanceof XSSFWorkbook){
|
||||
return getSheetPictrues07(sheetNum, (XSSFSheet) sheet, (XSSFWorkbook) workbook);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Excel2003图片
|
||||
* @param sheetNum 当前sheet编号
|
||||
* @param sheet 当前sheet对象
|
||||
* @param workbook 工作簿对象
|
||||
* @return Map key:图片单元格索引(0_1_1)String,value:图片流PictureData
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Map<String, PictureData> getSheetPictrues03(int sheetNum,
|
||||
HSSFSheet sheet, HSSFWorkbook workbook) {
|
||||
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
List<HSSFPictureData> pictures = workbook.getAllPictures();
|
||||
if (pictures.size() != 0) {
|
||||
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
|
||||
HSSFClientAnchor anchor = (HSSFClientAnchor) shape.getAnchor();
|
||||
shape.getLineWidth();
|
||||
if (shape instanceof HSSFPicture) {
|
||||
HSSFPicture pic = (HSSFPicture) shape;
|
||||
int pictureIndex = pic.getPictureIndex() - 1;
|
||||
HSSFPictureData picData = pictures.get(pictureIndex);
|
||||
String picIndex = String.valueOf(sheetNum) + "_"
|
||||
+ String.valueOf(anchor.getRow1()) + "_"
|
||||
+ String.valueOf(anchor.getCol1());
|
||||
sheetIndexPicMap.put(picIndex, picData);
|
||||
}
|
||||
}
|
||||
return sheetIndexPicMap;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Excel2007图片
|
||||
* @param sheetNum 当前sheet编号
|
||||
* @param sheet 当前sheet对象
|
||||
* @param workbook 工作簿对象
|
||||
* @return Map key:图片单元格索引(0_1_1)String,value:图片流PictureData
|
||||
*/
|
||||
private static Map<String, PictureData> getSheetPictrues07(int sheetNum,
|
||||
XSSFSheet sheet, XSSFWorkbook workbook) {
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
|
||||
for (POIXMLDocumentPart dr : sheet.getRelations()) {
|
||||
if (dr instanceof XSSFDrawing) {
|
||||
XSSFDrawing drawing = (XSSFDrawing) dr;
|
||||
List<XSSFShape> shapes = drawing.getShapes();
|
||||
for (XSSFShape shape : shapes) {
|
||||
XSSFPicture pic = (XSSFPicture) shape;
|
||||
XSSFClientAnchor anchor = pic.getPreferredSize();
|
||||
CTMarker ctMarker = anchor.getFrom();
|
||||
String picIndex = String.valueOf(sheetNum) + "_"
|
||||
+ ctMarker.getRow() + "_" + ctMarker.getCol();
|
||||
sheetIndexPicMap.put(picIndex, pic.getPictureData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sheetIndexPicMap;
|
||||
}
|
||||
|
||||
public static void printImg(List<Map<String, PictureData>> sheetList) throws IOException {
|
||||
for (Map<String, PictureData> map : sheetList) {
|
||||
printImg(map);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printImg(Map<String, PictureData> map) throws IOException {
|
||||
Object key[] = map.keySet().toArray();
|
||||
for (int i = 0; i < map.size(); i++) {
|
||||
// 获取图片流
|
||||
PictureData pic = map.get(key[i]);
|
||||
// 获取图片索引
|
||||
String picName = key[i].toString();
|
||||
// 获取图片格式
|
||||
String ext = pic.suggestFileExtension();
|
||||
|
||||
byte[] data = pic.getData();
|
||||
|
||||
FileOutputStream out = new FileOutputStream("D:\\pic" + picName + "." + ext);
|
||||
out.write(data);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static int[] getColsOfTable(Sheet sheet) {
|
||||
int[] data = {0, 0};
|
||||
for (int i = sheet.getFirstRowNum(); i < sheet.getLastRowNum(); i++) {
|
||||
if (null != sheet.getRow(i)) {
|
||||
data[0] = sheet.getRow(i).getLastCellNum();
|
||||
data[1] = sheet.getRow(i).getHeight();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.jero.modules.split.util;
|
||||
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/2/25 16:58
|
||||
*/
|
||||
public class ReadWordTable {
|
||||
|
||||
|
||||
/**
|
||||
* 保存生成HTML时需要被忽略的单元格
|
||||
*/
|
||||
private List<String> omitCellsList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 生成忽略的单元格列表中的格式
|
||||
*
|
||||
* @param row
|
||||
* @param col
|
||||
* @return
|
||||
*/
|
||||
public String generateOmitCellStr(int row, int col) {
|
||||
return row + ":" + col;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前单元格的colspan(列合并)的列数
|
||||
*
|
||||
* @param tcPr 单元格属性
|
||||
* @return
|
||||
*/
|
||||
public int getColspan(CTTcPr tcPr) {
|
||||
// 判断是否存在列合并
|
||||
CTDecimalNumber gridSpan = null;
|
||||
if ((gridSpan = tcPr.getGridSpan()) != null) { // 合并的起始列
|
||||
// 获取合并的列数
|
||||
BigInteger num = gridSpan.getVal();
|
||||
return num.intValue();
|
||||
} else { // 其他被合并的列或正常列
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前单元格的rowspan(行合并)的行数
|
||||
*
|
||||
* @param table 表格
|
||||
* @param row 行值
|
||||
* @param col 列值
|
||||
* @return
|
||||
*/
|
||||
public int getRowspan(XWPFTable table, int row, int col) {
|
||||
|
||||
XWPFTableCell cell = table.getRow(row).getCell(col);
|
||||
// 正常独立单元格
|
||||
if (!isContinueRow(cell) && !isRestartRow(cell)) {
|
||||
return 1;
|
||||
}
|
||||
// 当前单元格的宽度
|
||||
int cellWidth = getCellWidth(table, row, col);
|
||||
// 当前单元格距离左侧边框的距离
|
||||
int leftWidth = getLeftWidth(table, row, col);
|
||||
|
||||
// 用户保存当前单元格行合并的单元格数-1(因为不包含自身)
|
||||
List<Boolean> list = new ArrayList<>();
|
||||
getRowspan(table, row, cellWidth, leftWidth, list);
|
||||
|
||||
return list.size() + 1;
|
||||
}
|
||||
|
||||
private void getRowspan(XWPFTable table, int row, int cellWidth, int leftWidth,
|
||||
List<Boolean> list) {
|
||||
// 已达到最后一行
|
||||
if (row + 1 >= table.getNumberOfRows()) {
|
||||
return;
|
||||
}
|
||||
row = row + 1;
|
||||
int colsNum = table.getRow(row).getTableCells().size();
|
||||
// 因为列合并单元格可能导致行合并的单元格并不在同一列,所以从头遍历列,通过属性、宽度以及距离左边框间距来判断是否是行合并
|
||||
for (int i = 0; i < colsNum; i++) {
|
||||
XWPFTableCell testTable = table.getRow(row).getCell(i);
|
||||
// 是否为合并单元格的中间行(包括结尾行)
|
||||
if (isContinueRow(testTable)) {
|
||||
// 是被上一行单元格合并的单元格
|
||||
if (getCellWidth(table, row, i) == cellWidth
|
||||
&& getLeftWidth(table, row, i) == leftWidth) {
|
||||
list.add(true);
|
||||
// 被合并的单元格在生成html时需要忽略
|
||||
addOmitCell(row, i);
|
||||
// 去下一行继续查找
|
||||
getRowspan(table, row, cellWidth, leftWidth, list);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是合并行的起始行单元格
|
||||
*
|
||||
* @param tableCell
|
||||
* @return
|
||||
*/
|
||||
public boolean isRestartRow(XWPFTableCell tableCell) {
|
||||
CTTcPr tcPr = tableCell.getCTTc().getTcPr();
|
||||
if (tcPr.getVMerge() == null) {
|
||||
return false;
|
||||
}
|
||||
if (tcPr.getVMerge().getVal() == null) {
|
||||
return false;
|
||||
}
|
||||
if (tcPr.getVMerge().getVal().toString().equalsIgnoreCase("restart")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是合并行的中间行单元格(包括结尾的最后一行的单元格)
|
||||
*
|
||||
* @param tableCell
|
||||
* @return
|
||||
*/
|
||||
public boolean isContinueRow(XWPFTableCell tableCell) {
|
||||
CTTcPr tcPr = tableCell.getCTTc().getTcPr();
|
||||
if (tcPr.getVMerge() == null) {
|
||||
return false;
|
||||
}
|
||||
if (tcPr.getVMerge().getVal() == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLeftWidth(XWPFTable table, int row, int col) {
|
||||
int leftWidth = 0;
|
||||
for (int i = 0; i < col; i++) {
|
||||
leftWidth += getCellWidth(table, row, i);
|
||||
}
|
||||
return leftWidth;
|
||||
}
|
||||
|
||||
public int getCellWidth(XWPFTable table, int row, int col) {
|
||||
CTTblWidth tcW = table.getRow(row).getCell(col).getCTTc().getTcPr().getTcW();
|
||||
if(tcW == null){
|
||||
//如果获取不到值,先赋予默认值
|
||||
return 10;
|
||||
}
|
||||
BigInteger width = tcW.getW();
|
||||
return width.intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加忽略的单元格(被行合并的单元格,生成HTML时需要忽略)
|
||||
*
|
||||
* @param row
|
||||
* @param col
|
||||
*/
|
||||
public void addOmitCell(int row, int col) {
|
||||
String omitCellStr = generateOmitCellStr(row, col);
|
||||
omitCellsList.add(omitCellStr);
|
||||
}
|
||||
|
||||
public boolean isOmitCell(int row, int col) {
|
||||
String cellStr = generateOmitCellStr(row, col);
|
||||
return omitCellsList.contains(cellStr);
|
||||
}
|
||||
|
||||
public String readTable(XWPFTable table) throws IOException {
|
||||
// 表格行数
|
||||
int tableRowsSize = table.getRows().size();
|
||||
StringBuilder tableToHtmlStr = new StringBuilder("<table border=\"1\">");
|
||||
|
||||
for (int i = 0; i < tableRowsSize; i++) {
|
||||
tableToHtmlStr.append("<tr>");
|
||||
int tableCellsSize = table.getRow(i).getTableCells().size();
|
||||
for (int j = 0; j < tableCellsSize; j++) {
|
||||
if (isOmitCell(i, j)) {
|
||||
continue;
|
||||
}
|
||||
XWPFTableCell tableCell = table.getRow(i).getCell(j);
|
||||
// 获取单元格的属性
|
||||
CTTcPr tcPr = tableCell.getCTTc().getTcPr();
|
||||
int colspan = getColspan(tcPr);
|
||||
if (colspan > 1) { // 合并的列
|
||||
tableToHtmlStr.append("<td colspan='" + colspan + "'");
|
||||
} else { // 正常列
|
||||
tableToHtmlStr.append("<td");
|
||||
}
|
||||
|
||||
int rowspan = getRowspan(table, i, j);
|
||||
if (rowspan > 1) { // 合并的行
|
||||
tableToHtmlStr.append(" rowspan='" + rowspan + "'>");
|
||||
} else {
|
||||
tableToHtmlStr.append(">");
|
||||
}
|
||||
String text = tableCell.getText();
|
||||
tableToHtmlStr.append(text + "</td>");
|
||||
|
||||
}
|
||||
tableToHtmlStr.append("</tr>");
|
||||
}
|
||||
tableToHtmlStr.append("</table>");
|
||||
|
||||
clearTableInfo();
|
||||
|
||||
return tableToHtmlStr.toString();
|
||||
}
|
||||
|
||||
public void clearTableInfo() {
|
||||
// System.out.println(omitCellsList);
|
||||
omitCellsList.clear();
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// ReadWordTable readWordTable = new com.adc.da.lawss.common.ReadWordTable();
|
||||
//
|
||||
// try (FileInputStream fileInputStream = new FileInputStream("E:\\下载\\table1.docx");
|
||||
// XWPFDocument document = new XWPFDocument(fileInputStream);) {
|
||||
// List<XWPFTable> tables = document.getTables();
|
||||
// for (XWPFTable table : tables) {
|
||||
// System.out.println(readWordTable.readTable(table));
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.jero.modules.split.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @des : excel版本判断类
|
||||
* @author: duyunbao
|
||||
* @email: 1114808306@qq.com
|
||||
* @date 2017/10/27 16:59
|
||||
**/
|
||||
public class WDWUtil {
|
||||
|
||||
/**
|
||||
* @method_name: isExcel2003
|
||||
* @des :是否是2003的excel,返回true是2003
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 16:57
|
||||
**/
|
||||
public static boolean isExcel2003(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xls)$");
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: isExcel2007
|
||||
* @des : 是否是2007的excel,返回true是2007
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 16:57
|
||||
**/
|
||||
public static boolean isExcel2007(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xlsx)$");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断字符串是否是整数
|
||||
* @MethodName:isInteger
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/22 18:00
|
||||
*/
|
||||
public static boolean isNumeric(String str){
|
||||
for (int i = str.length();--i>=0;){
|
||||
if (!Character.isDigit(str.charAt(i))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**方法二:推荐,速度最快
|
||||
* 判断是否为整数
|
||||
* @param str 传入的字符串
|
||||
* @return 是整数返回true,否则返回false
|
||||
*/
|
||||
public static boolean isInteger(String str) {
|
||||
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
|
||||
return pattern.matcher(str).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字母或数字
|
||||
*
|
||||
* @MethodName:isLetterDigitOrChinese
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:26
|
||||
*/
|
||||
public static boolean isLetterOrNumber(String str) {
|
||||
String regex = "^(\\d|[a-zA-Z])+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、()
|
||||
*
|
||||
* @MethodName:isLetterOrChineseOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:53
|
||||
*/
|
||||
public static boolean isLetterOrChineseOrChar1(String str) {
|
||||
String regex = "[^\\a-\\z\\A-\\Z\\u4E00-\\u9FA5\\()\\()]";
|
||||
return str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、数字
|
||||
*
|
||||
* @MethodName:isLetterOrChineseOrNumber
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:56
|
||||
*/
|
||||
public static boolean isLetterOrChineseOrNumber(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z0-9]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、()、-、下划线
|
||||
*
|
||||
* @MethodName:isChineseOrLetterOrUnderlineOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:03
|
||||
*/
|
||||
public static boolean isChineseOrLetterOrUnderlineOrChar1(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z_\\-\\()\\()]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字
|
||||
*
|
||||
* @MethodName:isNumbee
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:09
|
||||
*/
|
||||
public static boolean isNumber(String str) {
|
||||
String regex = "\\D";
|
||||
return str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字、大写字母、-
|
||||
*
|
||||
* @MethodName:isNumberOrLowerLetterOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:41
|
||||
*/
|
||||
public static boolean isNumberOrLowerLetterOrChar1(String str) {
|
||||
String regex = "^[A-Z0-9\\-]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、数字、字母、()、-、下划线
|
||||
*
|
||||
* @MethodName:isChineseOrNumberOrLetterOrUnderlineOrChar
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:45
|
||||
*/
|
||||
public static boolean isChineseOrNumberOrLetterOrUnderlineOrChar(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z0-9_\\-\\()\\()]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 去除整数含有小数点
|
||||
* @MethodName:subStr
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/31 11:19
|
||||
*/
|
||||
public static String subStr(String text) {
|
||||
if (StringUtils.isNotEmpty(text)) {
|
||||
if(text.contains(".0") && text.substring(text.length()-2,text.length()).equals(".0")) {
|
||||
text = text.substring(0,text.length()-2);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user