|
@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.mixsmart.utils.ListUtils;
|
|
|
+import com.mixsmart.utils.RegexUtils;
|
|
|
import com.spire.xls.*;
|
|
|
import com.spire.xls.CellRange;
|
|
|
import com.spire.xls.Workbook;
|
|
@@ -93,6 +94,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
+import java.util.regex.Matcher;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -718,6 +720,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
//施工资料填报
|
|
|
String pkids = "";
|
|
|
+ StringBuilder log =new StringBuilder("异常:");
|
|
|
try {
|
|
|
for (TableInfo tableInfo : tableInfoList) {
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
@@ -768,6 +771,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
transactionManager1.commit(transactionStatus);
|
|
|
} catch (Exception e) {
|
|
|
transactionManager1.rollback(transactionStatus);
|
|
|
+ log.append(e.getMessage()).append("@@");
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@@ -794,10 +798,29 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
e.printStackTrace();
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
+ if(log.length()>5){
|
|
|
+ return R.fail(reason(log.toString()));
|
|
|
+ }
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
+ public String reason(String log){
|
|
|
+ /*字段过短提示*/
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String[] part= log.split("@@");
|
|
|
+ for(String p:part){
|
|
|
+ Matcher m = RegexUtils.matcher("(m_\\d{14}_\\d{19})\\((.+)\\)VALUES\\(([^)]+)\\).+column'(key_\\d{0,2})'",p.replaceAll("[\\n\\s]*",""));
|
|
|
+ if(m.find()){
|
|
|
+ List<Map<String,Object>> result=this.jdbcTemplate.queryForList("select CONCAT(a.tab_ch_name,'&',b.e_name) tf from m_table_info a join m_wbs_form_element b on b.f_id=a.id where a.tab_en_name='"+m.group(1)+"' and b.e_key='"+m.group(4)+"'");
|
|
|
+ if(result.size()>0){
|
|
|
+ sb.append("【").append(result.get(0).values().stream().map(String::valueOf).collect(Collectors.joining(","))).append("】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sb.append("数据库字段太短,请联系管理员").toString();
|
|
|
+ }
|
|
|
+
|
|
|
// 获取用户
|
|
|
@Override
|
|
|
public Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException {
|