|
@@ -51,6 +51,7 @@ import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.manager.wrapper.ExcelTabWrapper;
|
|
|
import org.springblade.resource.feign.IOSSClient;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
@@ -97,6 +98,8 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
@@ -290,6 +293,9 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(tree);
|
|
|
}
|
|
|
}
|
|
|
+ if(wbsType==2){
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return R.fail(200, "未查询到信息");
|
|
|
}
|
|
@@ -403,9 +409,7 @@ public class ExcelTabController extends BladeController {
|
|
|
File file_out = ResourceUtil.getFile(thmlUrl);
|
|
|
FileUtil.copy(file_in,file_out);
|
|
|
updateWrapper.set("html_url",thmlUrl);
|
|
|
- wbsTreePrivateService.update(updateWrapper);
|
|
|
- //关联项目下所有的合同段
|
|
|
- wbsTreeContractService.updateAllNodeTabById(aPrivate);
|
|
|
+
|
|
|
|
|
|
|
|
|
// 匹配关联
|
|
@@ -427,32 +431,38 @@ public class ExcelTabController extends BladeController {
|
|
|
Element element = tds.get(j);
|
|
|
if(element.html().indexOf("el-input")>=0){
|
|
|
String titleName = element.attr("title");
|
|
|
- double maxScore = 0.6;
|
|
|
- String lastName = "";
|
|
|
- String attrInfo = "";
|
|
|
+ double maxScore = 0.48;
|
|
|
+ String lastName = "警告";
|
|
|
+ String attrInfo = "key"+"__"+i+"_"+j;;
|
|
|
|
|
|
for(WbsFormElement elementInfo : elementList){
|
|
|
String ysName = elementInfo.getEName().replaceAll("[^\u4E00-\u9FA5_]", "");
|
|
|
if(titleName.equals(ysName)){
|
|
|
lastName = elementInfo.getEName();
|
|
|
- attrInfo = elementInfo.getEKey()+"="+i+"_"+j;
|
|
|
+ attrInfo = elementInfo.getEKey()+"__"+i+"_"+j;
|
|
|
break;
|
|
|
}else{
|
|
|
if(MathUtil.sim(titleName,ysName) > maxScore){
|
|
|
- attrInfo = elementInfo.getEKey()+"="+i+"_"+j;
|
|
|
+ attrInfo = elementInfo.getEKey()+"__"+i+"_"+j;
|
|
|
lastName = ysName ;
|
|
|
maxScore = MathUtil.sim(titleName,ysName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String oncklickText = "'"+lastName +"',"+i+","+j;
|
|
|
- element.children().get(0).attr("placeholder",lastName).attr("@focus","getInformation("+oncklickText+")").attr("keyName",attrInfo).attr("weighing",maxScore+"");//.attr("v-model","formData."+attrInfo);
|
|
|
+ element.children().get(0).attr("placeholder",lastName).attr("@focus","getInformation("+oncklickText+")")
|
|
|
+ .attr("weighing",maxScore+"").attr("id",attrInfo).attr("keyName",attrInfo).attr("v-model","formData."+attrInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
File writefile = new File(thmlUrl);
|
|
|
FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ wbsTreePrivateService.update(updateWrapper);
|
|
|
+ //关联项目下所有的合同段
|
|
|
+ aPrivate.setHtmlUrl(thmlUrl);
|
|
|
+ wbsTreeContractService.updateAllNodeTabById(aPrivate);
|
|
|
+
|
|
|
return R.success("关联成功");
|
|
|
}
|
|
|
|
|
@@ -462,7 +472,7 @@ public class ExcelTabController extends BladeController {
|
|
|
*/
|
|
|
@GetMapping("/get-excel-html_buss")
|
|
|
@ApiOperationSupport(order = 16)
|
|
|
- @ApiOperation(value = "清表生成html", notes = "清表生成html")
|
|
|
+ @ApiOperation(value = "用户端生成html", notes = "用户端生成html")
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
@@ -479,12 +489,12 @@ public class ExcelTabController extends BladeController {
|
|
|
File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
FileInputStream fileInputStream = new FileInputStream(file1);
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ htmlString = htmlString.replaceAll("placeholder","placeholderxx");
|
|
|
// 解析 style
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
|
|
|
|
|
|
-
|
|
|
doc.select("Col").remove();
|
|
|
fileInputStream.close();
|
|
|
return R.data(table+"");
|
|
@@ -501,10 +511,10 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
|
- public R getExcelHtml(Long pkeyId) throws IOException {
|
|
|
+ public R getExcelHtml(Long pkeyId) throws IOException, InterruptedException {
|
|
|
|
|
|
+ Thread.sleep(200);
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(pkeyId);
|
|
|
-
|
|
|
if(wbsTreePrivate ==null ){
|
|
|
return R.fail("该数据下无此节点!");
|
|
|
}
|
|
@@ -531,8 +541,79 @@ public class ExcelTabController extends BladeController {
|
|
|
@PostMapping("/save_buss_data")
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
- public R<String> savaDataInfo1(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) {
|
|
|
- System.out.println("123456");
|
|
|
+ public R<String> saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) {
|
|
|
+ //
|
|
|
+ String contractId = dataInfo.getString("contractId");
|
|
|
+ String pkeyId = dataInfo.getString("pkeyId");
|
|
|
+ String projectId = dataInfo.getString("projectId");
|
|
|
+ dataInfo.remove("contractId");
|
|
|
+ dataInfo.remove("pkeyId");
|
|
|
+ dataInfo.remove("projectId");
|
|
|
+
|
|
|
+ // 去掉
|
|
|
+ Map<String,String> dataMap = new HashMap<>();
|
|
|
+ for(String k:dataInfo.keySet()){
|
|
|
+ String key = k.split("__")[0];
|
|
|
+ if(dataMap.containsKey(key)){
|
|
|
+ dataMap.put(key,dataMap.get(key)+","+k);
|
|
|
+ }else{
|
|
|
+ dataMap.put(key,k);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,String> dataMap2 = new HashMap<>();
|
|
|
+ dataMap2.put("pkeyId",pkeyId);
|
|
|
+ for(String k:dataMap.keySet()){
|
|
|
+ if(dataMap.get(k).indexOf(",")>=0){
|
|
|
+ String [] ziduan= dataMap.get(k).split(",");
|
|
|
+ String temp = "";
|
|
|
+ for(int i = 0; i < ziduan.length - 1; i++) {
|
|
|
+ for (int j = 0; j < ziduan.length - i - 1; j++) {
|
|
|
+ Integer tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
|
|
|
+ Integer td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ Integer tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
|
|
|
+ Integer td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ if (tr > tr_1 && td==td_1 ) { //纵向排序
|
|
|
+ temp = ziduan[j];
|
|
|
+ ziduan[j] = ziduan[j + 1];
|
|
|
+ ziduan[j + 1] = temp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String lastStr = dataInfo.getString(ziduan[0]);
|
|
|
+ for (int i=1 ;i<ziduan.length;i++){
|
|
|
+ lastStr+=","+dataInfo.getString(ziduan[i]);
|
|
|
+ }
|
|
|
+ dataMap2.put(k,lastStr);
|
|
|
+ }else{
|
|
|
+ dataMap2.put(k,dataInfo.getString(dataMap.get(k)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+
|
|
|
+ String tabName = wbsTreeContract.getInitTableName();
|
|
|
+
|
|
|
+ String sqlInfo = "INSERT INTO "+tabName+" ( ";
|
|
|
+ String keyStr = "";
|
|
|
+ String valStr = "";
|
|
|
+ for (String keys : dataMap2.keySet()){
|
|
|
+ keyStr += keys+",";
|
|
|
+ valStr += "'"+dataMap2.get(keys)+"',";
|
|
|
+ }
|
|
|
+
|
|
|
+ keyStr=keyStr.substring(0,keyStr.lastIndexOf(","));
|
|
|
+ valStr=valStr.substring(0,valStr.lastIndexOf(","));
|
|
|
+
|
|
|
+ sqlInfo = sqlInfo + keyStr+") VALUES (" +valStr +")";
|
|
|
+
|
|
|
+ System.out.println(sqlInfo);
|
|
|
+ jdbcTemplate.execute(sqlInfo);
|
|
|
+
|
|
|
|
|
|
return R.success("1");
|
|
|
}
|
|
@@ -559,7 +640,11 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
//解析
|
|
|
Element table = doc.select("table").first();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Elements trs = table.select("tr");
|
|
|
+ Element tableinfo = trs.get(0).parent().parent().attr("style","border-collapse: collapse;");
|
|
|
|
|
|
// 获取总行列数
|
|
|
int maxCol = doc.select("Col").size();
|
|
@@ -594,7 +679,7 @@ public class ExcelTabController extends BladeController {
|
|
|
if(StringUtils.isNotEmpty(keyId)){
|
|
|
String classInfo = styleMap.get(keyId);
|
|
|
data.removeAttr("class");
|
|
|
- data.attr("style",styleMap.get(keyId).replaceAll("break-word","inherit"));
|
|
|
+ //data.attr("style",styleMap.get(keyId).replaceAll("break-word","inherit"));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -734,7 +819,7 @@ public class ExcelTabController extends BladeController {
|
|
|
ExctabCell exctabCell = new ExctabCell();
|
|
|
if(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0){
|
|
|
//data.empty().append("<input type='time' style='width:100%;height:100%' placeholder=''> </input>");
|
|
|
- data.empty().append("<el-date-picker style='width:100%;height:100%' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" type='date' format='YYYY年MM月DD日' placeholder='请选择时间'> </el-date-picker>");
|
|
|
+ data.empty().append("<el-date-picker style='width:100%;height:100%' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" type='date' format='YYYY年MM月DD日' placeholder='请选择时间'> </el-date-picker>");
|
|
|
exctabCell.setExctabId(excelId);
|
|
|
exctabCell.setTextInfo("签字时间");
|
|
|
exctabCell.setIsDeleted(0);
|
|
@@ -744,26 +829,26 @@ public class ExcelTabController extends BladeController {
|
|
|
String parm = i+","+j+","+x1+","+x2+","+y1+","+y2+",$event";
|
|
|
if(index_state){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}else{
|
|
|
if(j==0 ){
|
|
|
if(colspan ==maxCol && i>=1 && i<=2){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
Element bforData = tds.get(j-1);
|
|
|
if(!bforData.text().isEmpty()){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -860,4 +945,35 @@ public class ExcelTabController extends BladeController {
|
|
|
return styleMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 清表生成html
|
|
|
+ */
|
|
|
+ @GetMapping("/get-excel-html-col")
|
|
|
+ @ApiOperationSupport(order = 15)
|
|
|
+ @ApiOperation(value = "元素识别html", notes = "元素识别html")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "id", value = "id", required = true)
|
|
|
+ })
|
|
|
+ public R getExcelHtmlByCol(Long id) throws IOException, InterruptedException {
|
|
|
+
|
|
|
+ Thread.sleep(200);
|
|
|
+ ExcelTab detail = excelTabService.getById(id);
|
|
|
+ if(detail ==null ){
|
|
|
+ return R.fail("该数据下无此节点!");
|
|
|
+ }
|
|
|
+ if(detail.getHtmlUrl()==null){
|
|
|
+ return R.fail("请上传清表!");
|
|
|
+ }
|
|
|
+
|
|
|
+ File file1 = ResourceUtil.getFile(detail.getHtmlUrl());
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(file1);
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ // 解析 style
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ doc.select("Col").remove();
|
|
|
+ fileInputStream.close();
|
|
|
+ return R.data(table+"");
|
|
|
+ }
|
|
|
+
|
|
|
}
|