|
|
@@ -1983,6 +1983,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
/*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
|
|
|
dataMap2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
dataMap2=isPartition(wbsTreeContract,tabName,dataMap2);
|
|
|
+ dataConvert(wbsTreeContract, dataMap2);
|
|
|
sqlInfo = buildMTableInsertSql(tabName, dataMap2, SnowFlakeUtil.getId(), null, null).toString();
|
|
|
|
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
@@ -2052,6 +2053,63 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
return R.data(tableInfoList2);
|
|
|
}
|
|
|
+ public void dataConvert(WbsTreeContract wbsTreeContract, LinkedHashMap<String, String> dataMap) {
|
|
|
+ try {
|
|
|
+ // 这里先从旧html表中获取 如果有用旧的html m_wbs_tree_contract_old_html
|
|
|
+ WbsTreeContractOldHtml oldHtml = wbsTreeContractOldHtmlService.getOne(Wrappers.<WbsTreeContractOldHtml>lambdaQuery()
|
|
|
+ .eq(WbsTreeContractOldHtml::getContractFormId, wbsTreeContract.getPKeyId())
|
|
|
+ .eq(WbsTreeContractOldHtml::getIsDeleted, 0)
|
|
|
+ .last("limit 1"));
|
|
|
+ if(oldHtml != null){
|
|
|
+ wbsTreeContract.setHtmlUrl(oldHtml.getOldHtmlUrl());
|
|
|
+ }
|
|
|
+ InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract.getHtmlUrl());
|
|
|
+ String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ if (!dataMap.isEmpty()) {
|
|
|
+ // 处理日期范围框和日期框的问题
|
|
|
+ Elements dateElements = doc.select("el-date-picker");
|
|
|
+ dateElements.forEach(element -> {
|
|
|
+ String dateType = element.attr("type");
|
|
|
+ String keyname = element.attr("keyname");
|
|
|
+ if (StringUtil.isBlank(keyname) || !keyname.contains("__")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String[] split = keyname.split("__");
|
|
|
+ String valStr = dataMap.get(split[0]);
|
|
|
+ if (valStr == null || !valStr.contains("_^_")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String[] split1 = valStr.split("☆");
|
|
|
+ for (String v : split1) {
|
|
|
+ String[] split2 = v.split("_\\^_");
|
|
|
+ // 不是数组格式
|
|
|
+ String newVal = "";
|
|
|
+ if (split2.length >= 2 && split[1].equals(split2[1]) && StringUtil.hasText(split2[0])) {
|
|
|
+ if ("datetimerange".equals(dateType) && !split2[0].trim().startsWith("[")) {
|
|
|
+ if (split2[0].contains(",")) {
|
|
|
+ newVal = "[" + split2[0] + "]";
|
|
|
+ } else {
|
|
|
+ newVal = "[" + split2[0] + "," + split2[0] + "]";
|
|
|
+ }
|
|
|
+ valStr = valStr.replace(v, newVal + "_^_" + split2[1]);
|
|
|
+ dataMap.put(split[0], valStr);
|
|
|
+ } else if (!"datetimerange".equals(dateType) && split2[0].trim().startsWith("[") && split2[0].trim().endsWith("]")) {
|
|
|
+ String[] strings = StringUtils.strip(split2[0], "[]").split(",");
|
|
|
+ if (strings.length > 0) {
|
|
|
+ newVal = strings[strings.length - 1];
|
|
|
+ valStr = valStr.replace(v, newVal + "_^_" + split2[1]);
|
|
|
+ dataMap.put(split[0], valStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
public LinkedHashMap<String ,String> isPartition(WbsTreeContract wbsTreeContract,String tabName,LinkedHashMap<String, String> dataMap2){
|
|
|
//判断是否需要移除编号 当工序 子分项 分项的划分编码有一个不为null就移除编号
|
|
|
String sqlContractInfo="select * from m_contract_info where id="+wbsTreeContract.getContractId();
|