版本号批处理导入
This commit is contained in:
parent
7ab63c3b14
commit
3c4ea84c4b
Binary file not shown.
@ -4,6 +4,7 @@ import com.actionsoft.apps.coe.pal.datamigration.aris.web.ArisXmlImportWeb;
|
|||||||
import com.actionsoft.apps.coe.pal.datamigration.position.web.PositionExcelImportWeb;
|
import com.actionsoft.apps.coe.pal.datamigration.position.web.PositionExcelImportWeb;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.util.readtable.ReadTable;
|
import com.actionsoft.apps.coe.pal.datamigration.util.readtable.ReadTable;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.util.readword.ReadWordUtil;
|
import com.actionsoft.apps.coe.pal.datamigration.util.readword.ReadWordUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.web.VersionNoExcelImportWeb;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
|
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||||
@ -216,4 +217,43 @@ public class DataMigrationController {
|
|||||||
return web.downloadPositionExcelImportLog(logId, path);
|
return web.downloadPositionExcelImportLog(logId, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号导入
|
||||||
|
* @param uc
|
||||||
|
* @param wsId
|
||||||
|
* @param groupValue
|
||||||
|
* @param fileValue
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_version_no_import")
|
||||||
|
public String versionNoImport(UserContext uc, String wsId,String groupValue,String fileValue,String fileName) {
|
||||||
|
return new VersionNoExcelImportWeb(uc).versionNoImport(wsId, groupValue, fileValue, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号导入日志查询
|
||||||
|
* @param uc
|
||||||
|
* @param logId
|
||||||
|
* @param path
|
||||||
|
* @param timer
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_query")
|
||||||
|
public String queryVersionNoExcelImportLog(UserContext uc, String logId, String path, String timer) {
|
||||||
|
return new VersionNoExcelImportWeb(uc).queryVersionNoExcelImportLog(logId, path, timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号日志下载
|
||||||
|
* @param uc
|
||||||
|
* @param logId
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_download")
|
||||||
|
public String downloadVersionNoExcelImportLog(UserContext uc, String logId, String path) {
|
||||||
|
return new VersionNoExcelImportWeb(uc).downloadVersionNoExcelImportLog(logId, path);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,9 @@ public class Constant {
|
|||||||
// 建模属性代码--IT系统别名
|
// 建模属性代码--IT系统别名
|
||||||
public static final String METHOD_OTHER_NAME = "otherName";
|
public static final String METHOD_OTHER_NAME = "otherName";
|
||||||
|
|
||||||
|
// 建模属性代码--版本
|
||||||
|
public static final String METHOD_VERSION = "P_versions";
|
||||||
|
|
||||||
// 存放与流程同名的角色模型的文件夹名称
|
// 存放与流程同名的角色模型的文件夹名称
|
||||||
public static final String DEFAULT_FOLDER_NAME = "角色模型";
|
public static final String DEFAULT_FOLDER_NAME = "角色模型";
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.actionsoft.apps.coe.pal.datamigration.plugin;
|
|||||||
|
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.position.constant.PositionConstant;
|
import com.actionsoft.apps.coe.pal.datamigration.position.constant.PositionConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.constant.VersionNoConstant;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
|
import com.actionsoft.apps.coe.pal.datamigration.web.DataMigrationWeb;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.CoeFileProcessor;
|
import com.actionsoft.apps.coe.pal.pal.repository.upfile.CoeFileProcessor;
|
||||||
import com.actionsoft.apps.listener.PluginListener;
|
import com.actionsoft.apps.listener.PluginListener;
|
||||||
@ -24,8 +25,9 @@ public class Plugins implements PluginListener {
|
|||||||
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
|
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
|
||||||
|
|
||||||
list.add(new DCPluginProfile("migration", CoeFileProcessor.class.getName(), "存放数据迁移文件", false, false));
|
list.add(new DCPluginProfile("migration", CoeFileProcessor.class.getName(), "存放数据迁移文件", false, false));
|
||||||
list.add(new DCPluginProfile(ArisConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存在arisXML数据迁移日志", false, false));
|
list.add(new DCPluginProfile(ArisConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存放arisXML数据迁移日志", false, false));
|
||||||
list.add(new DCPluginProfile(PositionConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存在岗位Excel数据导入日志", false, false));
|
list.add(new DCPluginProfile(PositionConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存放岗位Excel数据导入日志", false, false));
|
||||||
|
list.add(new DCPluginProfile(VersionNoConstant.REPOSITORY_NAME, CoeFileProcessor.class.getName(), "存放流程版本号数据导入日志", false, false));
|
||||||
|
|
||||||
// PAL应用扩展点
|
// PAL应用扩展点
|
||||||
Map<String, Object> params0 = new HashMap<String, Object>();
|
Map<String, Object> params0 = new HashMap<String, Object>();
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class PositionExcelImportRun {
|
|||||||
if (!arisNameMap.containsKey(processName)) {
|
if (!arisNameMap.containsKey(processName)) {
|
||||||
// Excel中的流程在PAL中不存在,当作警告处理,全部记录
|
// Excel中的流程在PAL中不存在,当作警告处理,全部记录
|
||||||
LogUtil.appendLog(Constant.LOG_WARNING + "Excel流程" + "[" + processName + "]未在PAL中找到,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel流程" + "[" + processName + "]未在PAL中找到,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
LogUtil.appendLog("[流程未找到]Excel流程" + "[" + processName + "]", matchErrImportFile);
|
LogUtil.appendLog("[流程未找到]Excel流程" + "[" + processName + "]未在PAL中找到,忽略导入", matchErrImportFile);
|
||||||
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class PositionExcelImportWeb extends ActionWeb {
|
|||||||
|
|
||||||
public void initParams () {
|
public void initParams () {
|
||||||
logId = UUIDGener.getUUID();// 记录缓存
|
logId = UUIDGener.getUUID();// 记录缓存
|
||||||
String fileValue = "arisXML-" + new SimpleDateFormat("yyyy-MM-dd-HHmmss").format(new Date()) + "-" + _uc.getUID();
|
String fileValue = PositionConstant.REPOSITORY_NAME + "-" + new SimpleDateFormat("yyyy-MM-dd-HHmmss").format(new Date()) + "-" + _uc.getUID();
|
||||||
// 创建dc目录
|
// 创建dc目录
|
||||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(Constant.APP_ID, PositionConstant.REPOSITORY_NAME);
|
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(Constant.APP_ID, PositionConstant.REPOSITORY_NAME);
|
||||||
DCContext dc = new DCContext(_uc, dcProfile, Constant.APP_ID, PositionConstant.GROUP_VALUE_LOG, fileValue);
|
DCContext dc = new DCContext(_uc, dcProfile, Constant.APP_ID, PositionConstant.GROUP_VALUE_LOG, fileValue);
|
||||||
|
|||||||
@ -0,0 +1,302 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.util;
|
||||||
|
|
||||||
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.hssf.util.HSSFColor;
|
||||||
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.usermodel.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
public class POIUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格title行主要信息样式
|
||||||
|
* @param wb
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static XSSFCellStyle getMainCellStyle(XSSFWorkbook wb) {
|
||||||
|
XSSFCellStyle result = wb.createCellStyle();
|
||||||
|
XSSFFont font = wb.createFont();
|
||||||
|
font.setBold(true);
|
||||||
|
font.setFontHeightInPoints((short)12);
|
||||||
|
result.setFont(font);
|
||||||
|
result.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
result.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
result.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
|
||||||
|
result.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
result.setBorderBottom(BorderStyle.THIN);
|
||||||
|
result.setBorderLeft(BorderStyle.THIN);
|
||||||
|
result.setBorderTop(BorderStyle.THIN);
|
||||||
|
result.setBorderRight(BorderStyle.THIN);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格title行扩展属性信息样式
|
||||||
|
* @param wb
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static XSSFCellStyle getExtendCellStyle(XSSFWorkbook wb) {
|
||||||
|
XSSFCellStyle result = wb.createCellStyle();
|
||||||
|
XSSFFont font = wb.createFont();
|
||||||
|
font.setBold(true);
|
||||||
|
font.setFontHeightInPoints((short)12);
|
||||||
|
result.setFont(font);
|
||||||
|
result.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
result.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
result.setFillForegroundColor((short)51);
|
||||||
|
result.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
result.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
result.setBorderBottom(BorderStyle.THIN);
|
||||||
|
result.setBorderLeft(BorderStyle.THIN);
|
||||||
|
result.setBorderTop(BorderStyle.THIN);
|
||||||
|
result.setBorderRight(BorderStyle.THIN);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格边框样式
|
||||||
|
* @param wb
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static XSSFCellStyle getTableCellStyle(XSSFWorkbook wb) {
|
||||||
|
XSSFCellStyle result = wb.createCellStyle();
|
||||||
|
result.setBorderBottom(BorderStyle.THIN);
|
||||||
|
result.setBorderLeft(BorderStyle.THIN);
|
||||||
|
result.setBorderTop(BorderStyle.THIN);
|
||||||
|
result.setBorderRight(BorderStyle.THIN);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制一个单元格样式到目的单元格样式
|
||||||
|
* @param wb
|
||||||
|
* @param fromStyle
|
||||||
|
* @param toStyle
|
||||||
|
*/
|
||||||
|
public static void copyCellStyle(XSSFWorkbook wb, XSSFCellStyle fromStyle, XSSFCellStyle toStyle) {
|
||||||
|
toStyle.setAlignment(fromStyle.getAlignmentEnum());
|
||||||
|
//边框和边框颜色
|
||||||
|
toStyle.setBorderBottom(fromStyle.getBorderBottomEnum());
|
||||||
|
toStyle.setBorderLeft(fromStyle.getBorderLeftEnum());
|
||||||
|
toStyle.setBorderRight(fromStyle.getBorderRightEnum());
|
||||||
|
toStyle.setBorderTop(fromStyle.getBorderTopEnum());
|
||||||
|
toStyle.setTopBorderColor(fromStyle.getTopBorderColor());
|
||||||
|
toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());
|
||||||
|
toStyle.setRightBorderColor(fromStyle.getRightBorderColor());
|
||||||
|
toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
|
||||||
|
|
||||||
|
//背景和前景
|
||||||
|
toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
|
||||||
|
toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
|
||||||
|
|
||||||
|
toStyle.setDataFormat(fromStyle.getDataFormat());
|
||||||
|
toStyle.setFillPattern(fromStyle.getFillPatternEnum());
|
||||||
|
// toStyle.setFont(fromStyle.getFont(null));
|
||||||
|
toStyle.setHidden(fromStyle.getHidden());
|
||||||
|
toStyle.setIndention(fromStyle.getIndention());//首行缩进
|
||||||
|
toStyle.setLocked(fromStyle.getLocked());
|
||||||
|
toStyle.setRotation(fromStyle.getRotation());//旋转
|
||||||
|
toStyle.setVerticalAlignment(fromStyle.getVerticalAlignmentEnum());
|
||||||
|
toStyle.setWrapText(fromStyle.getWrapText());
|
||||||
|
|
||||||
|
// 字体
|
||||||
|
XSSFFont newFont = wb.createFont();
|
||||||
|
XSSFFont fromFont = fromStyle.getFont();
|
||||||
|
newFont.setBold(fromFont.getBold());
|
||||||
|
newFont.setCharSet(fromFont.getCharSet());
|
||||||
|
newFont.setColor(fromFont.getColor());
|
||||||
|
newFont.setFamily(fromFont.getFamily());
|
||||||
|
newFont.setFontHeight(fromFont.getFontHeight());
|
||||||
|
newFont.setFontHeightInPoints(fromFont.getFontHeightInPoints());
|
||||||
|
newFont.setFontName(fromFont.getFontName());
|
||||||
|
newFont.setItalic(fromFont.getItalic());
|
||||||
|
newFont.setScheme(fromFont.getScheme());
|
||||||
|
newFont.setStrikeout(fromFont.getStrikeout());
|
||||||
|
newFont.setThemeColor(fromFont.getThemeColor());
|
||||||
|
newFont.setTypeOffset(fromFont.getTypeOffset());
|
||||||
|
newFont.setUnderline(fromFont.getUnderline());
|
||||||
|
toStyle.setFont(newFont);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sheet复制
|
||||||
|
* @param fromSheet
|
||||||
|
* @param toSheet
|
||||||
|
* @param copyValueFlag
|
||||||
|
*/
|
||||||
|
public static void copySheet(XSSFWorkbook wb,XSSFSheet fromSheet, XSSFSheet toSheet, boolean copyValueFlag) {
|
||||||
|
//合并区域处理
|
||||||
|
mergerRegion(fromSheet, toSheet);
|
||||||
|
// 设置列宽
|
||||||
|
setColumnWidth(wb, fromSheet, toSheet);
|
||||||
|
for (Iterator rowIt = fromSheet.rowIterator(); rowIt.hasNext();) {
|
||||||
|
XSSFRow tmpRow = (XSSFRow) rowIt.next();
|
||||||
|
XSSFRow newRow = toSheet.createRow(tmpRow.getRowNum());
|
||||||
|
//行复制
|
||||||
|
copyRow(wb,tmpRow,newRow,copyValueFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setColumnWidth(XSSFWorkbook wb, XSSFSheet fromSheet, XSSFSheet toSheet) {
|
||||||
|
int maxColumnIndex = 0;
|
||||||
|
for (Iterator rowIt = fromSheet.rowIterator(); rowIt.hasNext();) {
|
||||||
|
XSSFRow fromRow = (XSSFRow) rowIt.next();
|
||||||
|
int index = 0;
|
||||||
|
for (Iterator cellIt = fromRow.cellIterator(); cellIt.hasNext();) {
|
||||||
|
XSSFCell tmpCell = (XSSFCell) cellIt.next();
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
maxColumnIndex = maxColumnIndex > index ? maxColumnIndex : index;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < maxColumnIndex; i++) {
|
||||||
|
toSheet.setColumnWidth(i, fromSheet.getColumnWidth(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 行复制功能
|
||||||
|
* @param fromRow
|
||||||
|
* @param toRow
|
||||||
|
*/
|
||||||
|
public static void copyRow(XSSFWorkbook wb,XSSFRow fromRow,XSSFRow toRow,boolean copyValueFlag){
|
||||||
|
for (Iterator cellIt = fromRow.cellIterator(); cellIt.hasNext();) {
|
||||||
|
XSSFCell tmpCell = (XSSFCell) cellIt.next();
|
||||||
|
XSSFCell newCell = toRow.createCell(tmpCell.getColumnIndex());
|
||||||
|
copyCell(wb,tmpCell, newCell, copyValueFlag);
|
||||||
|
}
|
||||||
|
toRow.setHeight(fromRow.getHeight());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 复制原有sheet的合并单元格到新创建的sheet
|
||||||
|
*/
|
||||||
|
public static void mergerRegion(XSSFSheet fromSheet, XSSFSheet toSheet) {
|
||||||
|
int sheetMergerCount = fromSheet.getNumMergedRegions();
|
||||||
|
for (int i = 0; i < sheetMergerCount; i++) {
|
||||||
|
CellRangeAddress mergedRegionAt = fromSheet.getMergedRegion(i);
|
||||||
|
toSheet.addMergedRegion(mergedRegionAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 复制单元格
|
||||||
|
*
|
||||||
|
* @param srcCell
|
||||||
|
* @param distCell
|
||||||
|
* @param copyValueFlag
|
||||||
|
* true则连同cell的内容一起复制
|
||||||
|
*/
|
||||||
|
public static void copyCell(XSSFWorkbook wb,XSSFCell srcCell, XSSFCell distCell, boolean copyValueFlag) {
|
||||||
|
XSSFCellStyle newstyle=wb.createCellStyle();
|
||||||
|
copyCellStyle(wb, srcCell.getCellStyle(), newstyle);
|
||||||
|
distCell.setCellType(srcCell.getCellType());
|
||||||
|
// distCell.setEncoding(srcCell.seten.getEncoding());
|
||||||
|
|
||||||
|
//评论
|
||||||
|
if (srcCell.getCellComment() != null) {
|
||||||
|
distCell.setCellComment(srcCell.getCellComment());
|
||||||
|
}
|
||||||
|
// 不同数据类型处理
|
||||||
|
int srcCellType = srcCell.getCellType();
|
||||||
|
distCell.setCellType(srcCellType);
|
||||||
|
if (copyValueFlag) {
|
||||||
|
if (srcCellType == XSSFCell.CELL_TYPE_NUMERIC) {
|
||||||
|
if (HSSFDateUtil.isCellDateFormatted(srcCell)) {
|
||||||
|
distCell.setCellValue(srcCell.getDateCellValue());
|
||||||
|
} else {
|
||||||
|
distCell.setCellValue(srcCell.getNumericCellValue());
|
||||||
|
}
|
||||||
|
} else if (srcCellType == XSSFCell.CELL_TYPE_STRING) {
|
||||||
|
distCell.setCellValue(srcCell.getRichStringCellValue());
|
||||||
|
} else if (srcCellType == XSSFCell.CELL_TYPE_BLANK) {
|
||||||
|
// nothing21
|
||||||
|
} else if (srcCellType == XSSFCell.CELL_TYPE_BOOLEAN) {
|
||||||
|
distCell.setCellValue(srcCell.getBooleanCellValue());
|
||||||
|
} else if (srcCellType == XSSFCell.CELL_TYPE_ERROR) {
|
||||||
|
distCell.setCellErrorValue(srcCell.getErrorCellValue());
|
||||||
|
} else if (srcCellType == XSSFCell.CELL_TYPE_FORMULA) {
|
||||||
|
distCell.setCellFormula(srcCell.getCellFormula());
|
||||||
|
} else { // nothing29
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取单元格各类型值,返回字符串类型
|
||||||
|
public static String getCellValueByCell(Cell cell) {
|
||||||
|
//判断是否为null或空串
|
||||||
|
if (cell == null || cell.toString().trim().equals("")) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String cellValue = "";
|
||||||
|
int cellType = cell.getCellType();
|
||||||
|
// 以下是判断数据的类型
|
||||||
|
switch (cellType) {
|
||||||
|
case Cell.CELL_TYPE_NUMERIC: // 数字
|
||||||
|
|
||||||
|
if (0 == cell.getCellType()) {//判断单元格的类型是否则NUMERIC类型
|
||||||
|
|
||||||
|
if (DateUtil.isCellDateFormatted(cell)) {// 判断是否为日期类型
|
||||||
|
Date date = cell.getDateCellValue();
|
||||||
|
DateFormat formater = new SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm");
|
||||||
|
cellValue = formater.format(date);
|
||||||
|
} else {
|
||||||
|
cellValue = cell.getNumericCellValue() + "";
|
||||||
|
if (!UtilString.isEmpty(cellValue)) {
|
||||||
|
cellValue = cellValue.endsWith(".0") ? cellValue.substring(0, cellValue.lastIndexOf(".0")) : cellValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Cell.CELL_TYPE_STRING: // 字符串
|
||||||
|
cellValue = cell.getStringCellValue();
|
||||||
|
break;
|
||||||
|
case Cell.CELL_TYPE_BOOLEAN: // Boolean
|
||||||
|
cellValue = cell.getBooleanCellValue() + "";
|
||||||
|
break;
|
||||||
|
case Cell.CELL_TYPE_FORMULA: // 公式
|
||||||
|
cellValue = cell.getCellFormula() + "";
|
||||||
|
break;
|
||||||
|
case Cell.CELL_TYPE_BLANK: // 空值
|
||||||
|
cellValue = "";
|
||||||
|
break;
|
||||||
|
// case XSSFCell.CELL_TYPE_ERROR: // 故障
|
||||||
|
// cellValue = "非法字符";
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
cellValue = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return StrUtil.removeAllBlack(cellValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文档数据
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Workbook getWorkbook(File file, String suffix) {
|
||||||
|
Workbook wb = null;
|
||||||
|
try {
|
||||||
|
if("xls".equals(suffix)) {
|
||||||
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
wb = new HSSFWorkbook(fis);
|
||||||
|
} else if ("xlsx".equals(suffix)) {
|
||||||
|
wb = new XSSFWorkbook(file);
|
||||||
|
}
|
||||||
|
} catch (InvalidFormatException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return wb;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -326,6 +326,46 @@ public class ProcessUtil {
|
|||||||
return propValMap;
|
return propValMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有PAL epc模型的流程名称(多版本只查询最新版本)
|
||||||
|
* @param wsId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String, String> getPalRepositoryNameMap(String wsId, String methodId) {
|
||||||
|
Map<String, String> propValMap = new HashMap<>();
|
||||||
|
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||||
|
List<PALRepositoryModel> list = new ArrayList<>();
|
||||||
|
|
||||||
|
// 过滤epc
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
PALRepositoryModel model = iterator.next();
|
||||||
|
if (model.getMethodId().equals(methodId)) {
|
||||||
|
list.add(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 找到最新版本,只匹配最新版本(在日志中添加此明显提示)
|
||||||
|
List<PALRepositoryModel> recentVerList = new ArrayList<>();
|
||||||
|
Map<String, PALRepositoryModel> modelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel model : list) {
|
||||||
|
if (!modelMap.containsKey(model.getVersionId())) {
|
||||||
|
modelMap.put(model.getVersionId(), model);
|
||||||
|
} else {
|
||||||
|
if (modelMap.get(model.getVersionId()).getVersion() < model.getVersion()) {
|
||||||
|
modelMap.put(model.getVersionId(), model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, PALRepositoryModel> entry : modelMap.entrySet()) {
|
||||||
|
recentVerList.add(entry.getValue());
|
||||||
|
}
|
||||||
|
list = recentVerList;
|
||||||
|
|
||||||
|
for (PALRepositoryModel model : list) {
|
||||||
|
propValMap.put(model.getId(), model.getName());
|
||||||
|
}
|
||||||
|
return propValMap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定建模方法模型列表
|
* 获取指定建模方法模型列表
|
||||||
* @param wsId
|
* @param wsId
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.versionNo.constant;
|
||||||
|
|
||||||
|
public class VersionNoConstant {
|
||||||
|
|
||||||
|
public final static String REPOSITORY_NAME = "versionNoExcel";// 岗位Excel文件导入dc根目录
|
||||||
|
|
||||||
|
public final static String GROUP_VALUE_UPFILE = "upfile";// aris xml文件上传根目录,在REPOSITORY_NAME之下
|
||||||
|
|
||||||
|
public final static String GROUP_VALUE_LOG = "log";// aris xml文件导入日志根目录,在REPOSITORY_NAME之下
|
||||||
|
|
||||||
|
public final static String GROUP_VALUE_DOWNLOAD = "download";
|
||||||
|
|
||||||
|
public final static String IMPORT_LOG_FILE_SIMPLE = "simpleImport.log";// 简要日志,展示给前端,体现大致的导入内容和进度
|
||||||
|
public final static String IMPORT_LOG_FILE_FULL = "fullImport.log";// 详细日志,包括全量信息内容
|
||||||
|
public final static String IMPORT_LOG_FILE_WARN = "warnErrImport.log";// 错误&警告日志,单独记录错误&警告日志,同时详细日志中也有记录
|
||||||
|
|
||||||
|
public final static String IMPORT_LOG_FILE_SUCCESS = "successImport.log";// 导入成功日志单独记录,只记录pal流程名称与对应的Aris地址,客户需要
|
||||||
|
|
||||||
|
public final static String IMPORT_LOG_FILE_MATCH_ERR = "matchErrImport.log";// 导入aris流程匹配失败的
|
||||||
|
|
||||||
|
// Excel标标题
|
||||||
|
public final static String TABLE_PROCESS_NAME = "流程名称";
|
||||||
|
public final static String TABLE_PROCESS_VERSION_NO = "版本号";
|
||||||
|
|
||||||
|
public final static String [] EXCEL_TITLE_ROW_ARR = new String [] {TABLE_PROCESS_NAME, TABLE_PROCESS_VERSION_NO};
|
||||||
|
public final static String EXCEL_TITLE_ROW = TABLE_PROCESS_NAME+ "、" +TABLE_PROCESS_VERSION_NO;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.versionNo.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel数据model
|
||||||
|
*/
|
||||||
|
public class VersionNoExcelModel {
|
||||||
|
private String processName;// 流程名称
|
||||||
|
private String processVersionNo;// 版本号
|
||||||
|
|
||||||
|
public String getProcessName() {
|
||||||
|
return processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessName(String processName) {
|
||||||
|
this.processName = processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersionNo() {
|
||||||
|
return processVersionNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersionNo(String processVersionNo) {
|
||||||
|
this.processVersionNo = processVersionNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,337 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.versionNo.web;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.position.model.PalOrgPositionModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.position.model.PalShapeInfoModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.position.model.PositionValidDataModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.util.LogUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.util.StrUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.constant.VersionNoConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.model.VersionNoExcelModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Cache.LogRealTimeCountCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Model.LogRealTimeCountModel;
|
||||||
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
|
import com.actionsoft.bpms.util.UUIDGener;
|
||||||
|
import com.actionsoft.bpms.util.UtilDate;
|
||||||
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import sun.tools.jconsole.inspector.Utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class VersionNoExcelImportRun {
|
||||||
|
|
||||||
|
private final UserContext uc;
|
||||||
|
private final String wsId;
|
||||||
|
private final String logId;
|
||||||
|
private final String logPath;
|
||||||
|
private final File simpleLogFile;
|
||||||
|
private final File fullLogFile;
|
||||||
|
private final File warnLogFile;
|
||||||
|
private final File successLogFile;// 客户特殊需要,记录成功日志
|
||||||
|
private final File matchErrImportFile;// 匹配失败记录
|
||||||
|
private final String filePath;
|
||||||
|
private final String fileName;
|
||||||
|
private final long startTime;
|
||||||
|
|
||||||
|
private long endTime;
|
||||||
|
|
||||||
|
public VersionNoExcelImportRun(UserContext uc, String wsId, String logId, String logPath, File simpleLogFile, File fullLogFile, File warnLogFile, String filePath, String fileName, long startTime) {
|
||||||
|
this.uc = uc;
|
||||||
|
this.wsId = wsId;
|
||||||
|
this.logId = logId;
|
||||||
|
this.logPath = logPath;
|
||||||
|
this.simpleLogFile = simpleLogFile;
|
||||||
|
this.fullLogFile = fullLogFile;
|
||||||
|
this.warnLogFile = warnLogFile;
|
||||||
|
this.filePath = filePath;
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.startTime = startTime;
|
||||||
|
// 单独创建一个成功日志
|
||||||
|
successLogFile = new File(fullLogFile.getParentFile().getPath() + File.separator + ArisConstant.IMPORT_LOG_FILE_SUCCESS);
|
||||||
|
matchErrImportFile = new File(fullLogFile.getParentFile().getPath() + File.separator + ArisConstant.IMPORT_LOG_FILE_MATCH_ERR);
|
||||||
|
try {
|
||||||
|
successLogFile.createNewFile();
|
||||||
|
matchErrImportFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行导入
|
||||||
|
* @param excelModelList
|
||||||
|
* @param arisNameMap
|
||||||
|
*/
|
||||||
|
public void execute(List<VersionNoExcelModel> excelModelList, Map<String, String> arisNameMap) {
|
||||||
|
DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao();
|
||||||
|
try {
|
||||||
|
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||||
|
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
|
||||||
|
int totalCount = LogRealTimeCountCache.getCache().get(logId).getTotalCount();
|
||||||
|
// 以Excel行数据为单位进行导入
|
||||||
|
int importingCount = 0;// 当前导入的第几个
|
||||||
|
for (VersionNoExcelModel row : excelModelList) {
|
||||||
|
importingCount++;
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setImportingCount(importingCount);// 当前记录缓存
|
||||||
|
// 当前正在导入的流程全部日志记录,方便对照
|
||||||
|
LogUtil.appendLog("\n************[执行进度]当前执行第[" + importingCount + "]条,共["+ totalCount +"]条************", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
|
||||||
|
String processName = row.getProcessName();// Excel流程名称
|
||||||
|
String versionNo = row.getProcessVersionNo();// Excel流程版本
|
||||||
|
if (UtilString.isEmpty(processName)) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_NAME + "内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[Excel数据为空]Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_NAME + "内容为空,忽略导入", matchErrImportFile);
|
||||||
|
}
|
||||||
|
if (UtilString.isEmpty(versionNo)) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_VERSION_NO + "内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[Excel数据为空]Excel第[" + importingCount + "]行" + VersionNoConstant.TABLE_PROCESS_VERSION_NO + "内容为空,忽略导入", matchErrImportFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][流程匹配阶段]PAL过程链图与Excel中流程进行匹配************", simpleLogFile, fullLogFile);
|
||||||
|
// 校验pal是否存在该流程
|
||||||
|
if (!arisNameMap.containsKey(processName)) {
|
||||||
|
// Excel中的流程在PAL中不存在,当作警告处理,全部记录
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]未在PAL中找到,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[流程未找到]Excel第[" + importingCount + "]行流程" + "[" + processName + "]未在PAL中找到,忽略导入", matchErrImportFile);
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String palId = arisNameMap.get(processName);// pal流程id
|
||||||
|
PALRepositoryModel model = PALRepositoryCache.getCache().get(palId);
|
||||||
|
// 判断是否有多只流程
|
||||||
|
List<PALRepositoryModel> versionList = PALRepositoryCache.getByVersionId(model.getVersionId());
|
||||||
|
if (versionList.size() > 1) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]存在多版本,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]存在多版本,忽略导入", matchErrImportFile);
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断单只流程版本号是否为1.0
|
||||||
|
double VerNo = model.getVersion();
|
||||||
|
if (!"V1.0".equals(VersionUtil.getVersionStrV(model.getVersion()))) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]版本号不是[V1.0],忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]版本号不是[V1.0],忽略导入", matchErrImportFile);
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 修改版本号
|
||||||
|
double verNo = 1.000;
|
||||||
|
String tmp = versionNo.replace("V", "").replace("v", "");
|
||||||
|
String bigNum = "";
|
||||||
|
String smallNum = "";
|
||||||
|
String [] numArr = tmp.split("\\.");
|
||||||
|
bigNum = numArr[0];
|
||||||
|
if (numArr.length == 2 && UtilString.isNotEmpty(numArr[0]) && UtilString.isNotEmpty(numArr[1])) {
|
||||||
|
smallNum = numArr[1];
|
||||||
|
}
|
||||||
|
// 小数转换成编号字符
|
||||||
|
smallNum = smallNum.length() == 1 ? ("00" + smallNum) : smallNum.length() == 2 ? ("0" + smallNum) : smallNum;
|
||||||
|
tmp = bigNum + "." + smallNum;
|
||||||
|
try {
|
||||||
|
verNo = Double.parseDouble(tmp);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第["+ importingCount + "]行流程" + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[存在多版本]Excel第[" + importingCount + "]行流程" + "[" + processName + "]版本号不是[" + versionNo + "]转换数字类型失败,忽略导入", matchErrImportFile);
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String verNoStr = VersionUtil.getVersionStr(verNo);
|
||||||
|
|
||||||
|
boolean isSuccess = true;
|
||||||
|
// 修改编号
|
||||||
|
int result = repository.updateVerNo(model.getId(), verNo);
|
||||||
|
if (result > 0) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本号更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||||
|
} else {
|
||||||
|
isSuccess = false;
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本号更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PALRepositoryPropertyModel> propertyModelList = propertyDao.getPropertysByPlid(model.getId(), Constant.METHOD_VERSION);
|
||||||
|
if (propertyModelList == null || propertyModelList.size() == 0) {
|
||||||
|
PALRepositoryPropertyModel propertyModel = new PALRepositoryPropertyModel();
|
||||||
|
propertyModel.setId(UUIDGener.getUUID());
|
||||||
|
propertyModel.setPlId(model.getId());
|
||||||
|
propertyModel.setPropertyId(Constant.METHOD_VERSION);
|
||||||
|
propertyModel.setPropertyName("版本");
|
||||||
|
propertyModel.setPropertyValue(verNoStr);
|
||||||
|
propertyModel.setOrderIndex(0);
|
||||||
|
int n = propertyDao.insert(propertyModel);
|
||||||
|
if (n > 0) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||||
|
} else {
|
||||||
|
isSuccess = false;
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (PALRepositoryPropertyModel propertyModel : propertyModelList) {
|
||||||
|
propertyModel.setPropertyValue(verNoStr);
|
||||||
|
int n = propertyDao.update(propertyModel);
|
||||||
|
if (n > 0) {
|
||||||
|
LogUtil.appendLog(Constant.LOG_SUCCESS + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"]", simpleLogFile, fullLogFile);
|
||||||
|
} else {
|
||||||
|
isSuccess = false;
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "Excel第[" + importingCount + "]行流程[" + processName + "]版本文件属性内容更新为["+ verNoStr +"],更新失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSuccess) {
|
||||||
|
// 记录流程导入结束日志
|
||||||
|
LogRealTimeCountCache.getCache().get(logId).setSuccessCount(LogRealTimeCountCache.getCache().get(logId).getSuccessCount() + 1);
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "[更新]Excel第[" + importingCount + "]行流程[" + processName + "]版本号[" + verNoStr + "]", simpleLogFile, fullLogFile, successLogFile);
|
||||||
|
} else {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "[更新]Excel第[" + importingCount + "]行流程[" + processName + "]版本号[" + verNoStr + "]失败", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
Timestamp endDate = new Timestamp(endTime);
|
||||||
|
LogRealTimeCountModel model = LogRealTimeCountCache.getCache().get(logId);
|
||||||
|
String takeTimeText = takeTime(endTime, startTime);
|
||||||
|
String resultMsg = "导入完成,总耗时" + takeTimeText + ",Excel流程总共[" + model.getTotalCount() + "],导入成功[" + model.getSuccessCount() + "]条,导入失败[" + (model.getTotalCount() - model.getSuccessCount()) + "]条";
|
||||||
|
LogUtil.updateLog(logId, endDate, Constant.LOG_RESULT_StATUS_SUCCESS, resultMsg);
|
||||||
|
LogUtil.appendLog("\n" + Constant.LOG_END + resultMsg, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("\n" + "版本号Excel导入 End " + UtilDate.datetimeFormat(endDate), simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog(Constant.END_LOG, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogRealTimeCountCache.getCache().remove(logId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// 记录结束日志
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
Timestamp endDate = new Timestamp(endTime);
|
||||||
|
LogRealTimeCountModel model = LogRealTimeCountCache.getCache().get(logId);
|
||||||
|
String takeTimeText = takeTime(endTime, startTime);
|
||||||
|
String resultMsg = "导入失败,报错信息:" + e.getMessage() + ",总耗时" + takeTimeText + ",导入成功[" + model.getSuccessCount() + "]条,导入失败[" + (model.getTotalCount() - model.getSuccessCount()) + "]条";
|
||||||
|
LogUtil.updateLog(logId, endDate, Constant.LOG_RESULT_StATUS_ERROR, resultMsg);
|
||||||
|
LogUtil.appendLog(Constant.LOG_ERROR + resultMsg, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog(Constant.END_LOG, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogRealTimeCountCache.getCache().remove(logId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询流程对应的活动形状的角色
|
||||||
|
* @param info
|
||||||
|
* @param roleRepositoryMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void queryProcessShapeRole(PalShapeInfoModel info, Map<String, List<JSONObject>> roleRepositoryMap) {
|
||||||
|
// 对应的角色名称查询
|
||||||
|
List<DesignerShapeRelationModel> relationModelList = DesignerShapeRelationCache.getListByAttrId(info.getProcessId(), info.getShapeId(), Constant.METHOD_ROLE);
|
||||||
|
if (relationModelList.size() != 0 && relationModelList.size() > 0) {
|
||||||
|
DesignerShapeRelationModel roleRelation = relationModelList.get(0);
|
||||||
|
String roleRepositoryId = roleRelation.getRelationFileId();
|
||||||
|
String roleShapeId = roleRelation.getRelationShapeId();
|
||||||
|
if (!roleRepositoryMap.containsKey(roleRepositoryId)) {
|
||||||
|
roleRepositoryMap.put(roleRepositoryId, CoeDesignerUtil.getShapeMessageJson5(roleRepositoryId));
|
||||||
|
}
|
||||||
|
List<JSONObject> roleShapeList = roleRepositoryMap.get(roleRepositoryId);
|
||||||
|
if (roleShapeList != null) {
|
||||||
|
for (JSONObject roleShape : roleShapeList) {
|
||||||
|
if (roleShapeId.equals(roleShape.getString("id"))) {
|
||||||
|
info.setRoleRepositoryId(roleRepositoryId);
|
||||||
|
info.setRoleRepositoryName(PALRepositoryCache.getCache().get(roleRepositoryId).getName());
|
||||||
|
info.setRoleShapeId(roleShapeId);
|
||||||
|
info.setRoleShapeName(StrUtil.removeAllBlack(roleShape.getString("text")));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间转换
|
||||||
|
* @param type
|
||||||
|
* @param timeStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Timestamp getTimeStampDate(String type, String timeStr) {
|
||||||
|
timeStr = timeStr.replaceAll(".000;", ";");
|
||||||
|
DateFormat format = new SimpleDateFormat("HH:mm:ss;MM/dd/yyyy");
|
||||||
|
try {
|
||||||
|
Timestamp time = new Timestamp(format.parse(timeStr).getTime());
|
||||||
|
return time;
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "[" + type + "]转换异常,异常信息" + e.getMessage(), simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算使用时间
|
||||||
|
* @param endTime
|
||||||
|
* @param startTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String takeTime(long endTime, long startTime) {
|
||||||
|
long time = endTime - startTime;
|
||||||
|
String timeMsg = "";
|
||||||
|
if (time > 1000 * 60) {
|
||||||
|
timeMsg = "[" + (time / 1000 / 60) + "]分钟";
|
||||||
|
} else if (time > 1000) {
|
||||||
|
timeMsg = "[" + (time / 1000) + "]秒";
|
||||||
|
} else {
|
||||||
|
timeMsg = "[" + time + "]毫秒";
|
||||||
|
}
|
||||||
|
return timeMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验和创建角色模型文件夹
|
||||||
|
* @param coeProcessLevel
|
||||||
|
* @param wsId
|
||||||
|
* @return 已经存在的或新创建的角色模型ID
|
||||||
|
*/
|
||||||
|
private String checkAndCreatePalRoleFolderModel(PALRepository coeProcessLevel, String wsId) {
|
||||||
|
// 组织下创建[角色模型]文件夹
|
||||||
|
List<PALRepositoryModel> defaultModels = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryModelsByWsIdAndMethodId(wsId, "org");
|
||||||
|
defaultModels = defaultModels.stream()
|
||||||
|
.filter(model -> "default".equals(model.getMethodId()))
|
||||||
|
.filter(model -> Constant.DEFAULT_FOLDER_NAME.equals(model.getName())).collect(Collectors.toList());
|
||||||
|
if (defaultModels.size() == 0) {
|
||||||
|
String id = UUIDGener.getUUID();
|
||||||
|
|
||||||
|
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId("org", wsId) + 1;
|
||||||
|
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||||
|
PALRepositoryModelImpl defaultModel = CoeProcessLevelUtil.createPALRepositoryModel(id, UUIDGener.getUUID(), wsId, Constant.DEFAULT_FOLDER_NAME, "", orderIndex, "org", "org", true, 1,
|
||||||
|
id, false, "default", "0", 1, null, null, uc.getUID(), uc.getUID(), nowTime, null, null, null, null,
|
||||||
|
null, null, null, null, null, -1);
|
||||||
|
coeProcessLevel.insert(defaultModel);
|
||||||
|
defaultModels.add(defaultModel);
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "角色模型文件夹创建", simpleLogFile, fullLogFile);
|
||||||
|
return defaultModel.getId();
|
||||||
|
} else {
|
||||||
|
LogUtil.appendLog(Constant.LOG_WARNING + "角色模型文件夹已存在,不再重复创建", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
return defaultModels.get(0).getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,535 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.versionNo.web;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.log.model.LogModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.util.*;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.constant.VersionNoConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.versionNo.model.VersionNoExcelModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Cache.LogRealTimeCountCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Model.LogRealTimeCountModel;
|
||||||
|
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||||
|
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||||
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||||
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
|
import com.actionsoft.bpms.server.fs.DCContext;
|
||||||
|
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||||
|
import com.actionsoft.bpms.util.UUIDGener;
|
||||||
|
import com.actionsoft.bpms.util.UtilDate;
|
||||||
|
import com.actionsoft.bpms.util.UtilFile;
|
||||||
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
|
import com.actionsoft.i18n.I18nRes;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class VersionNoExcelImportWeb extends ActionWeb {
|
||||||
|
|
||||||
|
UserContext _uc;
|
||||||
|
|
||||||
|
public VersionNoExcelImportWeb(UserContext uc) {
|
||||||
|
_uc = uc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String logId;
|
||||||
|
private String logPath;
|
||||||
|
private File simpleLogFile;
|
||||||
|
private File fullLogFile;
|
||||||
|
private File warnLogFile;
|
||||||
|
private String filePath;
|
||||||
|
private String fileName;
|
||||||
|
private final long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
public void initParams () {
|
||||||
|
logId = UUIDGener.getUUID();// 记录缓存
|
||||||
|
String fileValue = VersionNoConstant.REPOSITORY_NAME + "-" + new SimpleDateFormat("yyyy-MM-dd-HHmmss").format(new Date()) + "-" + _uc.getUID();
|
||||||
|
// 创建dc目录
|
||||||
|
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(Constant.APP_ID, VersionNoConstant.REPOSITORY_NAME);
|
||||||
|
DCContext dc = new DCContext(_uc, dcProfile, Constant.APP_ID, VersionNoConstant.GROUP_VALUE_LOG, fileValue);
|
||||||
|
String dirPath = dc.getPath();
|
||||||
|
File dir = new File(dirPath);
|
||||||
|
dir.mkdirs();
|
||||||
|
simpleLogFile = new File(dirPath, VersionNoConstant.IMPORT_LOG_FILE_SIMPLE);
|
||||||
|
try {
|
||||||
|
simpleLogFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
fullLogFile = new File(dirPath, VersionNoConstant.IMPORT_LOG_FILE_FULL);
|
||||||
|
try {
|
||||||
|
fullLogFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
warnLogFile = new File(dirPath, VersionNoConstant.IMPORT_LOG_FILE_WARN);
|
||||||
|
try {
|
||||||
|
warnLogFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
logPath = simpleLogFile.getPath();// 前端实时展示的日志
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建日志记录Model
|
||||||
|
* @param id
|
||||||
|
* @param wsId
|
||||||
|
* @param fileName
|
||||||
|
* @param filePath
|
||||||
|
* @param createDate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void createLogModel(String id, String wsId, String fileName, String filePath, Timestamp createDate) {
|
||||||
|
LogModel model = new LogModel();
|
||||||
|
model.setId(id);
|
||||||
|
model.setWsId(wsId);
|
||||||
|
model.setFileName(fileName);
|
||||||
|
model.setFilePath(filePath);
|
||||||
|
model.setLogPath(logPath);
|
||||||
|
model.setCreateUser(_uc.getUID());
|
||||||
|
model.setCreateUserName(_uc.getUserName());
|
||||||
|
model.setCreateDate(createDate);
|
||||||
|
model.setStartDate(createDate);
|
||||||
|
model.setResultStatus(Constant.LOG_RESULT_StATUS_RUN);
|
||||||
|
model.setMainInfo("导入进行中");
|
||||||
|
// 存储日志db
|
||||||
|
LogUtil.createLog(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入停止时更新日志db状态
|
||||||
|
* @param logFileMsg
|
||||||
|
* @param logDbMsg
|
||||||
|
*/
|
||||||
|
private void updateErrLog(String logFileMsg, String logDbMsg) {
|
||||||
|
// 记录日志
|
||||||
|
LogUtil.appendLog(logFileMsg, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
// 日志表记录导入结果
|
||||||
|
LogUtil.updateLog(logId, new Timestamp(System.currentTimeMillis()), Constant.LOG_RESULT_StATUS_ERROR, logDbMsg);
|
||||||
|
// 清空缓存
|
||||||
|
LogRealTimeCountCache.getCache().remove(logId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入
|
||||||
|
*
|
||||||
|
* @param wsId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String versionNoImport(String wsId, String groupValue, String fileValue, String fileName) {
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
// 初始化一些参数
|
||||||
|
initParams();
|
||||||
|
// 读取dc
|
||||||
|
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(Constant.APP_ID, VersionNoConstant.REPOSITORY_NAME);// repositoryName要调整新的路径
|
||||||
|
DCContext dc = new DCContext(_uc, dcProfile, Constant.APP_ID, groupValue, fileValue, fileName);
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.filePath = dc.getFilePath();
|
||||||
|
Timestamp startDate = new Timestamp(startTime);
|
||||||
|
// 创建日志信息db
|
||||||
|
createLogModel(logId, wsId, fileName, filePath, startDate);
|
||||||
|
ro.put("logId", logId);
|
||||||
|
ro.put("path", logPath);
|
||||||
|
ro.put("resultStatus", LogUtil.queryLog(logId).getResultStatus());
|
||||||
|
|
||||||
|
LogUtil.appendLog("注:该日志文件存储简要日志信息", simpleLogFile);
|
||||||
|
LogUtil.appendLog("注:该日志文件存储详细日志信息", fullLogFile);
|
||||||
|
LogUtil.appendLog("注:该日志文件记录警告、出错日志信息", warnLogFile);
|
||||||
|
|
||||||
|
LogUtil.appendLog("\n[信息]操作人:" + _uc.getUserName() + "<" + _uc.getUID() + ">", simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[信息]操作时间:" + UtilDate.datetimeFormat(startDate), simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[信息]版本号Excel文件:" + fileName, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
LogUtil.appendLog("[信息]版本号Excel文件路径:" + filePath, simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
|
||||||
|
LogUtil.appendLog("\n版本号Excel导入 Begin " + UtilDate.datetimeFormat(startDate), simpleLogFile, fullLogFile, warnLogFile);
|
||||||
|
|
||||||
|
LogUtil.appendLog("\n若流程存在多版本,则忽略该流程的版本号更新;若流程为无多版本但是版本号不是V1.0,则忽略该流程的版本号更新");
|
||||||
|
|
||||||
|
String msg;
|
||||||
|
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验阶段]校验导入文件、属性配置等基础事项************", simpleLogFile, fullLogFile);
|
||||||
|
// 校验资产库是否存在可用
|
||||||
|
boolean isActive = PALRepositoryQueryAPIManager.getInstance().isActiveWorkSpace(wsId);
|
||||||
|
if (!isActive) {
|
||||||
|
msg = Constant.LOG_ERROR + "资产库不存在或已停用," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("资产库不存在或已停用");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "校验资产库存在并可用", simpleLogFile, fullLogFile);
|
||||||
|
|
||||||
|
// 校验文件/形状属性配置是否正常
|
||||||
|
ResponseObject checkRo = checkMethodConfig(wsId);
|
||||||
|
if (checkRo.isErr()) {
|
||||||
|
msg = Constant.LOG_ERROR + checkRo.getMsg() + "," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err(checkRo.getMsg());
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
// 校验文件是否存在
|
||||||
|
File file = new File(dc.getFilePath());
|
||||||
|
if (!file.exists()) {
|
||||||
|
msg = Constant.LOG_ERROR + "上传文件不存在," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("上传文件不存在");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
if (!".xls".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
||||||
|
msg = Constant.LOG_ERROR + "上传文件名称格式不正确," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("上传文件名称格式不正确,请上传xls文件");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "校验上传文件是否为xls格式", simpleLogFile, fullLogFile);
|
||||||
|
|
||||||
|
// 解析Excel
|
||||||
|
Workbook wb = POIUtil.getWorkbook(file, fileName.substring(fileName.lastIndexOf(".") + 1));
|
||||||
|
if (wb == null) {
|
||||||
|
msg = Constant.LOG_ERROR + "获取上传文件失败," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("获取上传文件失败,请重新上传");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "校验上传文件是否存在", simpleLogFile, fullLogFile);
|
||||||
|
|
||||||
|
// 解析xls标题
|
||||||
|
Sheet sheet = wb.getSheetAt(0);
|
||||||
|
List<String> titleList = new LinkedList<String>();
|
||||||
|
Row titleRow = sheet.getRow(0);
|
||||||
|
if (titleRow == null ) {
|
||||||
|
msg = Constant.LOG_ERROR + "上传文件工作表中首行为标题行,不能为空,请调整," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("上传文件工作表中首行为标题行,不能为空,请调整");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
int cellNum = titleRow.getLastCellNum();
|
||||||
|
for (int i = 0; i < cellNum; i++) {
|
||||||
|
Cell cell = titleRow.getCell(i);
|
||||||
|
String title = POIUtil.getCellValueByCell(cell);
|
||||||
|
if (UtilString.isEmpty(title)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
titleList.add(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titleList.size() == 0) {
|
||||||
|
msg = Constant.LOG_ERROR + "上传文件工作表中首行为标题行,不能为空,请调整," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("上传文件工作表中首行为标题行,不能为空,请调整");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
// 校验Excel标题
|
||||||
|
ResponseObject checkTitleRo = checkExcelTitle(titleList);
|
||||||
|
if (!checkTitleRo.isOk()) {
|
||||||
|
msg = Constant.LOG_ERROR + checkTitleRo.getMsg() + "," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err(checkTitleRo.getMsg());
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
// 解析xls内容
|
||||||
|
List<VersionNoExcelModel> excelModelList = getExcelContent(sheet);
|
||||||
|
if (excelModelList.size() == 0) {
|
||||||
|
msg = Constant.LOG_ERROR + "上传文件工作表中内容不能为空," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err("上传文件工作表中内容不能为空");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
// 校验aris流程名称是否重复
|
||||||
|
Map<String, String> palNameMap = ProcessUtil.getPalRepositoryNameMap(wsId, Constant.PROCESS_EPC);// 获取流程以及流程的aris名称
|
||||||
|
ResponseObject checkRepeatPalNameRo = checkRepositoryNameRepeat(palNameMap);
|
||||||
|
if (!checkRepeatPalNameRo.isOk()) {
|
||||||
|
msg = Constant.LOG_ERROR + checkRepeatPalNameRo.getMsg() + "," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
ro.err(checkRepeatPalNameRo.getMsg());
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aris流程名称与PALID反转
|
||||||
|
Map<String, String> arisNameMap2 = new HashMap<>();
|
||||||
|
for (Map.Entry<String, String> entry : palNameMap.entrySet()) {
|
||||||
|
arisNameMap2.put(entry.getValue(), entry.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalCount = excelModelList.size();
|
||||||
|
// 存储缓存,导入计数
|
||||||
|
LogRealTimeCountModel countModel = new LogRealTimeCountModel();
|
||||||
|
countModel.setTotalCount(totalCount);
|
||||||
|
countModel.setSuccessCount(0);
|
||||||
|
countModel.setArisBlankCount(0);
|
||||||
|
countModel.setPalExistsCount(0);
|
||||||
|
countModel.setImportingCount(0);
|
||||||
|
countModel.setMatchFieldCount(0);
|
||||||
|
LogRealTimeCountCache.getCache().put(logId, countModel, true);
|
||||||
|
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验阶段]", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
|
||||||
|
|
||||||
|
LogUtil.appendLog("\n" + Constant.LOG_START + "预计导入[" + fileName + "]" + I18nRes.findValue(CoEConstant.APP_ID, Constant.PROCESS_EPC + ",共[" + totalCount + "]条流程"));
|
||||||
|
// 开始执行导入
|
||||||
|
new Thread(()->{new VersionNoExcelImportRun(_uc, wsId, logId, logPath, simpleLogFile, fullLogFile, warnLogFile, this.filePath, this.fileName, startTime).execute(excelModelList, arisNameMap2);}) .start();
|
||||||
|
|
||||||
|
ro.put("totalCount", totalCount);
|
||||||
|
ro.put("importingCount", LogRealTimeCountCache.getCache().get(logId).getImportingCount());
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验流程名称重复
|
||||||
|
* @param palNameMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ResponseObject checkRepositoryNameRepeat(Map<String, String> palNameMap) {
|
||||||
|
boolean isOk = true;
|
||||||
|
Map<String, List<String>> map = new HashMap<>();
|
||||||
|
for (Map.Entry<String, String> entry : palNameMap.entrySet()) {
|
||||||
|
String palId = entry.getKey();
|
||||||
|
String name = entry.getValue();
|
||||||
|
if (!map.containsKey(name)) {
|
||||||
|
map.put(name, new ArrayList<>());
|
||||||
|
}
|
||||||
|
map.get(name).add(palId);
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
|
||||||
|
List<String> idList = entry.getValue();
|
||||||
|
String name = entry.getKey();
|
||||||
|
if (idList.size() > 1) {
|
||||||
|
isOk = false;
|
||||||
|
List<String> nameList = new ArrayList<>();
|
||||||
|
for (String palId : idList) {
|
||||||
|
PALRepositoryModel model = PALRepositoryCache.getCache().get(palId);
|
||||||
|
nameList.add(model.getName());
|
||||||
|
}
|
||||||
|
LogUtil.appendLog(Constant.LOG_ERROR + "同一PAL流程名称[" + name + "]对应多个PAL流程", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isOk) {
|
||||||
|
return ResponseObject.newErrResponse("存在同一PAL流程名称对应多个PAL流程,详情见日志");
|
||||||
|
}
|
||||||
|
return ResponseObject.newOkResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Excel内容
|
||||||
|
* @param sheet
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<VersionNoExcelModel> getExcelContent(Sheet sheet) {
|
||||||
|
List<VersionNoExcelModel> list = new ArrayList<>();
|
||||||
|
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
VersionNoExcelModel rowModel = new VersionNoExcelModel();
|
||||||
|
// 流程名称
|
||||||
|
Cell cell1 = row.getCell(0);
|
||||||
|
rowModel.setProcessName(POIUtil.getCellValueByCell(cell1));
|
||||||
|
// 活动名称
|
||||||
|
Cell cell2 = row.getCell(1);
|
||||||
|
rowModel.setProcessVersionNo(POIUtil.getCellValueByCell(cell2));
|
||||||
|
list.add(rowModel);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验Excel标题
|
||||||
|
* @param titleList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ResponseObject checkExcelTitle(List<String> titleList) {
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
if (titleList.size() < VersionNoConstant.EXCEL_TITLE_ROW_ARR.length) {
|
||||||
|
ro.err("上传文件工作表中标题行错误,请按照" + VersionNoConstant.EXCEL_TITLE_ROW + "的格式填写,当前Excel列名:" + StringUtils.join(titleList, "、"));
|
||||||
|
return ro;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < VersionNoConstant.EXCEL_TITLE_ROW_ARR.length; i++) {
|
||||||
|
if (!VersionNoConstant.EXCEL_TITLE_ROW_ARR[i].equals(titleList.get(i))) {
|
||||||
|
ro.err("上传文件工作表中标题行错误,请按照" + VersionNoConstant.EXCEL_TITLE_ROW + "的格式填写,若有隐藏列,请移动至最后,当前Excel列名:" + StringUtils.join(titleList, "、"));
|
||||||
|
return ro;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ro;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计EPC流程图个数,用以展示进度
|
||||||
|
* @param modelMap
|
||||||
|
*/
|
||||||
|
// private int countProcessMainInfo(Map<String, ModelModel> modelMap) {
|
||||||
|
// int count = 0;
|
||||||
|
//// for (Map.Entry<String, ModelModel> entry : modelMap.entrySet()) {
|
||||||
|
//// ModelModel model = entry.getValue();
|
||||||
|
//// if ("MT_EEPC".equals(model.getType())) {
|
||||||
|
//// count++;
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
// return count;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验文件/形状属性是否存在
|
||||||
|
* @param wsId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ResponseObject checkMethodConfig(String wsId) {
|
||||||
|
// 校验EPC图的文件属性
|
||||||
|
// 校验Aris地址、Aris流程名称属性
|
||||||
|
ResponseObject checkRo = checkMethodAttrExist(wsId, Constant.PROCESS_EPC, null, Constant.METHOD_VERSION);
|
||||||
|
if (checkRo.isErr()) {
|
||||||
|
return checkRo;
|
||||||
|
}
|
||||||
|
return ResponseObject.newOkResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验属性是否存在
|
||||||
|
* @param methodId
|
||||||
|
* @param shapeName
|
||||||
|
* @param attrs
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ResponseObject checkMethodAttrExist(String wsId, String methodId, String shapeName, String ... attrs) {
|
||||||
|
String methodName = I18nRes.findValue(CoEConstant.APP_ID, methodId);
|
||||||
|
// 形状属性校验
|
||||||
|
if (UtilString.isNotEmpty(shapeName)) {
|
||||||
|
JSONObject shape = ShapeUtil.getProcessShapeDefinitionByName(methodId, shapeName);
|
||||||
|
if (isEmptyJsonOject(shape)) {
|
||||||
|
String msg = Constant.LOG_ERROR + "模型[" + methodName + "]中的形状[" + shapeName + "]不存在," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
return ResponseObject.newErrResponse("模型[" + methodName + "]中的形状[" + shapeName + "]不存在");
|
||||||
|
}
|
||||||
|
String shapeText = shape.getString("text");
|
||||||
|
List<PALMethodAttributeModel> list = CoeDesignerShapeAPIManager.getInstance().getValidAndUseAttributeModels(wsId, methodId, shapeName, methodId);
|
||||||
|
Map<String, PALMethodAttributeModel> attrMap = new HashMap<>();
|
||||||
|
for (PALMethodAttributeModel attrModel : list) {
|
||||||
|
attrMap.put(attrModel.getKey(), attrModel);
|
||||||
|
}
|
||||||
|
List<PALMethodAttributeModel> list2 = CoeDesignerShapeAPIManager.getInstance().getValidAttributeModels(wsId, methodId, shapeName, methodId);
|
||||||
|
Map<String, PALMethodAttributeModel> attrMap2 = new HashMap<>();
|
||||||
|
for (PALMethodAttributeModel attrModel : list2) {
|
||||||
|
attrMap2.put(attrModel.getKey(), attrModel);
|
||||||
|
}
|
||||||
|
for (String attrId : attrs) {
|
||||||
|
String text = attrMap2.containsKey(attrId) ? attrMap2.get(attrId).getNewTitle() : attrId;
|
||||||
|
if (!attrMap.containsKey(attrId)) {
|
||||||
|
String msg = Constant.LOG_ERROR + "[" + methodName + "]中的形状[" + shapeText + "]属性[" + text + "]不存在,请检查相应属性配置," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
return ResponseObject.newErrResponse("[" + methodName + "]中的形状[" + shapeText + "]属性[" + text + "]不存在");
|
||||||
|
}
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "校验[" + methodName + "]中的形状[" + shapeText + "]属性[" + text + "]", simpleLogFile, fullLogFile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 文件属性校验
|
||||||
|
List<PALMethodAttributeModel> list = PALRepositoryAPIManager.getInstance().getValidAndUseAttributeModels(wsId, methodId);
|
||||||
|
Map<String, PALMethodAttributeModel> attrMap = new HashMap<>();
|
||||||
|
for (PALMethodAttributeModel attrModel : list) {
|
||||||
|
attrMap.put(attrModel.getKey(), attrModel);
|
||||||
|
}
|
||||||
|
List<PALMethodAttributeModel> list2 = PALRepositoryAPIManager.getInstance().getValidAttributeModels(wsId, methodId);
|
||||||
|
Map<String, PALMethodAttributeModel> attrMap2 = new HashMap<>();
|
||||||
|
for (PALMethodAttributeModel attrModel : list2) {
|
||||||
|
attrMap2.put(attrModel.getKey(), attrModel);
|
||||||
|
}
|
||||||
|
for (String attrId : attrs) {
|
||||||
|
String text = attrMap2.containsKey(attrId) ? attrMap2.get(attrId).getNewTitle() : attrId;
|
||||||
|
if (!attrMap.containsKey(attrId)) {
|
||||||
|
|
||||||
|
String msg = Constant.LOG_ERROR + "[" + methodName + "]的文件属性[" + text + "]不存在,请检查相应属性配置," + Constant.IMPORT_STOP_MSG;
|
||||||
|
updateErrLog(msg, msg);
|
||||||
|
return ResponseObject.newErrResponse("[" + methodName + "]的文件属性[" + text + "]不存在");
|
||||||
|
}
|
||||||
|
LogUtil.appendLog(Constant.LOG_END + "校验[" + methodName + "]的文件属性[" + text + "]", simpleLogFile, fullLogFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResponseObject.newOkResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验是否为空的对象
|
||||||
|
* @param o
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isEmptyJsonOject(JSONObject o) {
|
||||||
|
return o == null || o.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询导入流程日志
|
||||||
|
* @param logId
|
||||||
|
* @param path
|
||||||
|
* @param timer
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String queryVersionNoExcelImportLog(String logId, String path, String timer) {
|
||||||
|
String content = "";
|
||||||
|
if (new File(path).exists()) {
|
||||||
|
content = LogUtil.getLogContent(new File(path));
|
||||||
|
}
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
ro.put("content", content);
|
||||||
|
ro.put("timer", timer);
|
||||||
|
|
||||||
|
LogRealTimeCountModel countCache = LogRealTimeCountCache.getCache().get(logId);
|
||||||
|
int importingCount = 0;
|
||||||
|
int resultStatus = Constant.LOG_RESULT_StATUS_RUN;
|
||||||
|
if (countCache != null) {
|
||||||
|
importingCount = countCache.getImportingCount();
|
||||||
|
} else {
|
||||||
|
resultStatus = LogUtil.queryLog(logId).getResultStatus();
|
||||||
|
}
|
||||||
|
ro.put("resultStatus", resultStatus);
|
||||||
|
ro.put("importingCount", importingCount);
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载日志
|
||||||
|
* @param logId
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String downloadVersionNoExcelImportLog(String logId, String path) {
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return ResponseObject.newErrResponse("日志文件不存在").toString();
|
||||||
|
}
|
||||||
|
LogModel model = LogUtil.queryLog(logId);
|
||||||
|
String fileName = model.getFileName();
|
||||||
|
// 创建dc目录
|
||||||
|
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(Constant.APP_ID, VersionNoConstant.REPOSITORY_NAME);
|
||||||
|
DCContext dc = new DCContext(_uc, dcProfile, Constant.APP_ID, VersionNoConstant.GROUP_VALUE_DOWNLOAD, file.getParentFile().getName());
|
||||||
|
String dirPath = dc.getPath();
|
||||||
|
File dir = new File(dirPath);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
String targetFileName = fileName.substring(0, fileName.lastIndexOf(".")) + "导入日志.zip";
|
||||||
|
File targetFile = new File(dir.getPath() + File.separator + targetFileName);
|
||||||
|
try {
|
||||||
|
UtilFile.zipCompress(file.getParentFile().getPath(), targetFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return ResponseObject.newErrResponse("压缩日志文件失败,详细信息:" + e.getMessage()).toString();
|
||||||
|
}
|
||||||
|
DCContext dc2 = new DCContext(_uc, dcProfile, Constant.APP_ID, VersionNoConstant.GROUP_VALUE_DOWNLOAD, file.getParentFile().getName(), targetFileName);
|
||||||
|
String url = dc2.getDownloadURL();
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
ro.put("url", url + "&isInline=false");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,8 +22,8 @@
|
|||||||
const production = true;
|
const production = true;
|
||||||
const devUserInfo = {};
|
const devUserInfo = {};
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-4d9d5df5.js"></script>
|
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-2dcbe6a7.js"></script>
|
||||||
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-1286d7e8.css">
|
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-6157276c.css">
|
||||||
</head>
|
</head>
|
||||||
<body style="margin:0;">
|
<body style="margin:0;">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@ -59,4 +59,43 @@
|
|||||||
<param name="fileNames"/>
|
<param name="fileNames"/>
|
||||||
<param name="type"/>
|
<param name="type"/>
|
||||||
</cmd-bean>
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_data_migrate_log_query">
|
||||||
|
<param name="logId"/>
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="timer"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_data_migrate_log_download">
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="logId"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_position_import">
|
||||||
|
<param name="wsId"/>
|
||||||
|
<param name="groupValue"/>
|
||||||
|
<param name="fileValue"/>
|
||||||
|
<param name="fileName"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_position_import_log_query">
|
||||||
|
<param name="logId"/>
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="timer"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_position_import_log_download">
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="logId"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_version_no_import">
|
||||||
|
<param name="wsId"/>
|
||||||
|
<param name="groupValue"/>
|
||||||
|
<param name="fileValue"/>
|
||||||
|
<param name="fileName"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_query">
|
||||||
|
<param name="logId"/>
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="timer"/>
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_download">
|
||||||
|
<param name="path"/>
|
||||||
|
<param name="logId"/>
|
||||||
|
</cmd-bean>
|
||||||
</aws-actions>
|
</aws-actions>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -4437,4 +4437,23 @@ public class PALRepository extends DaoObject<PALRepositoryModel> {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改版本号
|
||||||
|
* @param uuid
|
||||||
|
* @param verNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateVerNo(String uuid, double verNo) {
|
||||||
|
PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) PALRepositoryCache.getCache().get(uuid);
|
||||||
|
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||||
|
String sql = "UPDATE " + PALRepositoryModelImpl.DATABASE_ENTITY + " set " + PALRepositoryModelImpl.FIELD_PL_VER + "=? WHERE " + PALRepositoryModelImpl.FIELD_UUID + "=?";
|
||||||
|
Object[] args = {verNo, uuid };
|
||||||
|
int r = DBSql.update(sql, args);
|
||||||
|
if (r > 0) {
|
||||||
|
plModel.setVersion(verNo);
|
||||||
|
PALRepositoryCache.getCache().put(uuid, plModel);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user