|
@@ -8,11 +8,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.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
-import com.itextpdf.html2pdf.ConverterProperties;
|
|
|
-import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
|
|
|
-import com.itextpdf.io.font.FontProgram;
|
|
|
-import com.itextpdf.io.font.FontProgramFactory;
|
|
|
-import com.itextpdf.layout.font.FontProvider;
|
|
|
+
|
|
|
import com.spire.xls.*;
|
|
|
import com.spire.xls.core.spreadsheet.HTMLOptions;
|
|
|
import io.swagger.annotations.*;
|
|
@@ -387,16 +383,14 @@ public class ExcelTabController extends BladeController {
|
|
|
String ancestors = parent.getAlias() + StringPool.COMMA + excelTab.getParentId();
|
|
|
excelTab.setAlias(ancestors);
|
|
|
}
|
|
|
- excelTabService.saveOrUpdate(excelTab);
|
|
|
// 关联清表信息计算
|
|
|
-
|
|
|
List<ExcelTabWbsTypeVO> linkDataInfo = wbsExclTabParmVO.getLinkDataInfo();
|
|
|
-
|
|
|
if (linkDataInfo != null && linkDataInfo.size() >= 1) {
|
|
|
// 判断是否上传excle
|
|
|
if ((excelTab.getFileUrl() != null || excelTab.getFileUrl() != "") && excelTab.getFileType() != 3) {
|
|
|
return R.fail("请上传清表!");
|
|
|
}
|
|
|
+ excelTabService.saveOrUpdate(excelTab);
|
|
|
for (ExcelTabWbsTypeVO info : linkDataInfo) {
|
|
|
String[] pk_id = info.getLinkIds().split(",");
|
|
|
for (String pkInfo : pk_id) {
|
|
@@ -411,10 +405,11 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
updateWrapper.set("is_link_table", Integer.parseInt(pk_type[1]));
|
|
|
updateWrapper.set("excel_id", excelTab.getId());
|
|
|
-
|
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ excelTabService.saveOrUpdate(excelTab);
|
|
|
}
|
|
|
|
|
|
return R.success("添加成功!");
|
|
@@ -460,7 +455,6 @@ public class ExcelTabController extends BladeController {
|
|
|
updateWrapper.set("excel_id", exceTabId);
|
|
|
|
|
|
|
|
|
-
|
|
|
// 复制模版htmlURL
|
|
|
File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
|
|
|
String filecode = SnowFlakeUtil.getId() + "";
|
|
@@ -589,33 +583,59 @@ public class ExcelTabController extends BladeController {
|
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // 解析 style
|
|
|
+ // 远程搜索配置
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
+ int maxCol = doc.select("Col").size();
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements hc = doc.select("hc-form-select-search");
|
|
|
- if(hc.size()>=1){
|
|
|
- for(int i =0;i<hc.size();i++){
|
|
|
- Element datax = hc.get(i);
|
|
|
- datax.removeAttr("pkeyId");
|
|
|
- datax.removeAttr("contractId");
|
|
|
- datax.attr("pkeyId",pkeyId+"");
|
|
|
- datax.attr("contractId",wbsTreeContract.getContractId());
|
|
|
- }
|
|
|
+ if (hc.size() >= 1) {
|
|
|
+ for (int i = 0; i < hc.size(); i++) {
|
|
|
+ Element datax = hc.get(i);
|
|
|
+ datax.removeAttr("pkeyId");
|
|
|
+ datax.removeAttr("contractId");
|
|
|
+ datax.attr("pkeyId", pkeyId + "");
|
|
|
+ datax.attr("contractId", wbsTreeContract.getContractId());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
+ // 标题解决
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
// 添加标题显示
|
|
|
- Elements dwtitle = doc.getElementsByAttributeValueMatching("style","18.0pt");
|
|
|
- if(dwtitle.size()==1){
|
|
|
-
|
|
|
- }else if(dwtitle.size()>=2){
|
|
|
- for (int i = 0;i<dwtitle.size();i++){
|
|
|
- Element dw = dwtitle.get(i);
|
|
|
- if(StringUtils.isEmpty(dw.text())){
|
|
|
- dw.text(projectInfo.getProjectName());
|
|
|
- };
|
|
|
+ // Elements dwtitle = doc.getElementsByAttributeValueMatching("style", "18.0pt");
|
|
|
+ Elements trs = table.select("tr");
|
|
|
+ for (int i = 0; i < 6; i++) {
|
|
|
+ Element tr = trs.get(i);
|
|
|
+ Elements tds = tr.select("td");
|
|
|
+ for (int j = 0; j < tds.size(); j++) {
|
|
|
+ Element data = tds.get(j);
|
|
|
+ int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
+ String style = data.attr("style");
|
|
|
+ if(style.indexOf("font-size")>=0){
|
|
|
+ int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:")+10,style.indexOf(".0pt")));
|
|
|
+ if (StringUtils.isNotEmpty(data.text()) && fontsize>=12) {
|
|
|
+ trs.get(i-1).select("td").get(0).text(projectInfo.getProjectName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取公式颜色
|
|
|
+
|
|
|
+ String tabName = wbsTreeContract.getInitTableName();
|
|
|
+ // 字段查询 获取公式字段
|
|
|
+ String colkeys = "SELECT e_key from m_wbs_tree a ,m_wbs_form_element b WHERE a.init_table_name = '" + tabName + "' and a.id=b.f_id and b.id in(SELECT element_id from m_formula c where c.is_deleted=0) ";
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(colkeys);
|
|
|
+
|
|
|
+ if (maps != null) {
|
|
|
+ for (Map<String, Object> keys : maps) {
|
|
|
+ String key = keys.get("e_key") + "__";
|
|
|
+ Elements gscolor = doc.select("el-input[keyname~=^" + key + "]");
|
|
|
+ for (Element element : gscolor) {
|
|
|
+ System.out.println(element.parent());
|
|
|
+ element.parent().attr("gscolor", "11");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
doc.select("Col").remove();
|
|
@@ -656,60 +676,6 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 首件表单获取 html页面
|
|
|
- */
|
|
|
- @GetMapping("/get-first-excel-html")
|
|
|
- @ApiOperationSupport(order = 15)
|
|
|
- @ApiOperation(value = "首件表单获取html页面", notes = "首件表单获取html页面")
|
|
|
- @ApiImplicitParams(value = {
|
|
|
- @ApiImplicitParam(name = "projectId", value = "projectId", required = true)
|
|
|
- })
|
|
|
- public R getFirstExcelHtml(Long projectId) throws IOException, InterruptedException {
|
|
|
-
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
- .eq(WbsTreeContract::getProjectId, projectId).eq(WbsTreeContract::getTableType, "111"));
|
|
|
- if (wbsTreeContract == null) {
|
|
|
- return R.fail("该数据下无此节点!");
|
|
|
- }
|
|
|
- if (wbsTreeContract.getHtmlUrl() == null) {
|
|
|
- return R.fail("请上传清表!");
|
|
|
- }
|
|
|
-
|
|
|
- File file1 = ResourceUtil.getFile(wbsTreeContract.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();
|
|
|
- JSONObject reData = new JSONObject();
|
|
|
- reData.put("id", wbsTreeContract.getPKeyId());
|
|
|
- reData.put("data", table);
|
|
|
- return R.data(table + "");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static void main11(String[] args) throws Exception {
|
|
|
-
|
|
|
- String thmlUrl = "/Users/hongchuangyanfa/Desktop/1574226461517152256.html";
|
|
|
-
|
|
|
- String osUrl = "https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220926/255f87504cd9f4ba61d888d044d1342c.xlsx";
|
|
|
- InputStream redio = CommonUtil.getOSSInputStream(osUrl);
|
|
|
- Workbook wb = new Workbook();
|
|
|
- wb.loadFromMHtml(redio);
|
|
|
- //获取工作表
|
|
|
- Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
-
|
|
|
- sheet.saveToHtml(thmlUrl);
|
|
|
-
|
|
|
- // expailHtmlInfo(thmlUrl,1L);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// 上传解析 html
|
|
|
public void expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
|
|
|
|
|
@@ -980,7 +946,6 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (inputText != null && inputText != "" && inputText.indexOf("_") >= 0) {
|
|
|
inputText = inputText.substring(0, inputText.lastIndexOf("_"));
|
|
|
}
|
|
@@ -1274,7 +1239,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
|
- public R copeBussTab(Long pkeyId) throws FileNotFoundException {
|
|
|
+ public R copeBussTab(Long pkeyId){
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
|
|
@@ -1306,34 +1271,43 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
|
|
|
String tabName = wbsTreeContract.getInitTableName();
|
|
|
+
|
|
|
+ // 字段查询 并去掉公式字段
|
|
|
+
|
|
|
+ String colkeys = "SELECT GROUP_CONCAT(e_key) as colkeys from m_wbs_tree a ,m_wbs_form_element b WHERE a.init_table_name = '" + tabName + "' and a.id=b.f_id and b.id not in(SELECT element_id from m_formula c where c.is_deleted=0) ";
|
|
|
+ Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(colkeys);
|
|
|
+ colkeys = stringObjectMap.get("colkeys") + "";
|
|
|
// 复制表数据
|
|
|
- String querySql = "select * from " + tabName + " where p_key_id=" + pkeyId;
|
|
|
- Map<String, Object> dataMap2 = jdbcTemplate.queryForMap(querySql);
|
|
|
+ String querySql = "select " + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
|
|
|
+ List<Map<String, Object>> dataList = jdbcTemplate.queryForList(querySql);
|
|
|
+ if (dataList != null && dataList.size()>=1) {
|
|
|
+ Map<String, Object> dataMap2 = dataList.get(0);
|
|
|
|
|
|
- dataMap2.remove("p_key_id");
|
|
|
- dataMap2.remove("id");
|
|
|
+ dataMap2.remove("p_key_id");
|
|
|
+ dataMap2.remove("id");
|
|
|
|
|
|
- // sql 组装
|
|
|
- String sqlInfo = "";
|
|
|
+ // sql 组装
|
|
|
+ String sqlInfo = "";
|
|
|
|
|
|
- sqlInfo = "INSERT INTO " + tabName + " ( ";
|
|
|
+ sqlInfo = "INSERT INTO " + tabName + " ( ";
|
|
|
|
|
|
- String keyStr = "id,p_key_id,";
|
|
|
- String valStr = SnowFlakeUtil.getId() + "," + wbsTreeContract.getPKeyId() + ",";
|
|
|
+ String keyStr = "id,p_key_id,";
|
|
|
+ String valStr = SnowFlakeUtil.getId() + "," + wbsTreeContract.getPKeyId() + ",";
|
|
|
|
|
|
- for (String keys : dataMap2.keySet()) {
|
|
|
- if (!(dataMap2.get(keys) + "").equals("null")) {
|
|
|
- keyStr += keys + ",";
|
|
|
- valStr += "'" + dataMap2.get(keys) + "',";
|
|
|
+ for (String keys : dataMap2.keySet()) {
|
|
|
+ if (!(dataMap2.get(keys) + "").equals("null")) {
|
|
|
+ keyStr += keys + ",";
|
|
|
+ valStr += "'" + dataMap2.get(keys) + "',";
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
|
|
|
- valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
+ keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
|
|
|
+ valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
|
|
|
- sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
|
|
|
+ sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
|
|
|
|
|
|
- //huangjn 保存成功后调用生成资料查询列表数据
|
|
|
- jdbcTemplate.execute(sqlInfo);
|
|
|
+ //huangjn 保存成功后调用生成资料查询列表数据
|
|
|
+ jdbcTemplate.execute(sqlInfo);
|
|
|
+ }
|
|
|
wbsTreeContractService.save(wbsTreeContract);
|
|
|
return R.data("成功");
|
|
|
}
|
|
@@ -1357,7 +1331,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParam(name = "classify", value = "classify", required = true),
|
|
|
@ApiImplicitParam(name = "projectId", value = "projectId", required = true)
|
|
|
})
|
|
|
- public R addBussFile(@RequestParam("file") MultipartFile file, Long pkeyId,String nodeId, String contractId,String projectId,String classify) {
|
|
|
+ public R addBussFile(@RequestParam("file") MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify) {
|
|
|
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
|
@@ -1403,7 +1377,7 @@ public class ExcelTabController extends BladeController {
|
|
|
wbsTreeContractService.update(updateWrapper);
|
|
|
// 合并后
|
|
|
|
|
|
- excelTabService.getBussPdfs(nodeId,classify,contractId,projectId);
|
|
|
+ excelTabService.getBussPdfs(nodeId, classify, contractId, projectId);
|
|
|
|
|
|
return R.data(tableFile.getId());
|
|
|
}
|
|
@@ -1438,7 +1412,7 @@ public class ExcelTabController extends BladeController {
|
|
|
String sql = "select pdf_url, e_visa_pdf_url from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
|
|
|
Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(sql);
|
|
|
Object pdfUrl = stringObjectMap.get("pdf_url");
|
|
|
- if(stringObjectMap.get("e_visa_pdf_url") != null){
|
|
|
+ if (stringObjectMap.get("e_visa_pdf_url") != null) {
|
|
|
//优先使用电签的PDF
|
|
|
pdfUrl = stringObjectMap.get("e_visa_pdf_url");
|
|
|
}
|
|
@@ -1459,26 +1433,6 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.status(this.excelTabService.removeBussTabInfoById(pkeyid));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 设置BaseFont
|
|
|
- *
|
|
|
- * @param fontPath 字体路径
|
|
|
- * @return
|
|
|
- */
|
|
|
- private static ConverterProperties creatBaseFont(String fontPath) {
|
|
|
- ConverterProperties properties = new ConverterProperties();
|
|
|
- FontProvider fontProvider = new DefaultFontProvider();
|
|
|
- FontProgram fontProgram;
|
|
|
- try {
|
|
|
- fontProgram = FontProgramFactory.createFont(fontPath);
|
|
|
- fontProvider.addFont(fontProgram);
|
|
|
- properties.setFontProvider(fontProvider);
|
|
|
- } catch (IOException e) {
|
|
|
- System.out.println("creat base font erro");
|
|
|
- }
|
|
|
- return properties;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@PostMapping("/save_buss_data")
|
|
|
@ApiOperationSupport(order = 13)
|
|
@@ -1498,7 +1452,7 @@ public class ExcelTabController extends BladeController {
|
|
|
String classify = tableInfo1.getString("classify");
|
|
|
List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
|
|
|
try {
|
|
|
- this.excelTabService.formulaFillData(tableInfoList,Long.parseLong(nodeid));
|
|
|
+ this.excelTabService.formulaFillData(tableInfoList, Long.parseLong(nodeid));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1800,6 +1754,13 @@ public class ExcelTabController extends BladeController {
|
|
|
//数据结果
|
|
|
Map<String, Object> reData = new HashMap<>();
|
|
|
|
|
|
+ String id = mysqlData.get("id")+"" ;
|
|
|
+ String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where business_id ='"+id+"'";
|
|
|
+ List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
|
|
|
+ if(businessDat!=null){
|
|
|
+ reData.put("linkTabIds",businessDat);
|
|
|
+ }
|
|
|
+
|
|
|
for (String key : mysqlData.keySet()) {
|
|
|
String tabVal = mysqlData.get(key) + "";
|
|
|
// 时间段处理
|
|
@@ -1842,13 +1803,11 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
// 移除Id 和 p_key_id
|
|
|
-// reData.remove("id");
|
|
|
reData.remove("p_key_id");
|
|
|
reData.remove("classify");
|
|
|
reData.remove("contractId");
|
|
|
reData.remove("pkeyId");
|
|
|
reData.remove("projectId");
|
|
|
-
|
|
|
resultMapList.add(reData);
|
|
|
}
|
|
|
}
|
|
@@ -1894,7 +1853,7 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.fail("目标日期下未找到当前用户填报的数据,请重新选择");
|
|
|
}
|
|
|
|
|
|
- for(JSONObject targetJson : targetJsonList){
|
|
|
+ for (JSONObject targetJson : targetJsonList) {
|
|
|
|
|
|
//获取目标数据所在数据表
|
|
|
WbsTreePrivate table = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, targetJson.getString("tableId")));
|
|
@@ -1916,14 +1875,14 @@ public class ExcelTabController extends BladeController {
|
|
|
List<JSONObject> wbsJsonList = this.contractLogClient.queryContractLogWbsByBusinessId(value.toString());
|
|
|
//重置业务ID
|
|
|
value = SnowFlakeUtil.getId();
|
|
|
- if(wbsJsonList != null && wbsJsonList.size() > 0){
|
|
|
- if(oneGroupLogWbsList.size() == 0){
|
|
|
+ if (wbsJsonList != null && wbsJsonList.size() > 0) {
|
|
|
+ if (oneGroupLogWbsList.size() == 0) {
|
|
|
oneGroupLogWbsList.addAll(wbsJsonList);
|
|
|
}
|
|
|
} else {
|
|
|
wbsJsonList = new ArrayList<>(oneGroupLogWbsList);
|
|
|
}
|
|
|
- for(JSONObject json : wbsJsonList){
|
|
|
+ for (JSONObject json : wbsJsonList) {
|
|
|
json.put("businessId", value);
|
|
|
}
|
|
|
|
|
@@ -2054,6 +2013,206 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(300, null, "未找到对应的业务数据");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 预览首件PDF
|
|
|
+ */
|
|
|
+ @GetMapping("/get-first-pdf-info")
|
|
|
+ @ApiOperationSupport(order = 28)
|
|
|
+ @ApiOperation(value = "获取首件填报记录")
|
|
|
+ @ApiImplicitParam(name = "firstId", value = "首件列表ID")
|
|
|
+ public R<String> getFirstPdfInfo(String firstId) {
|
|
|
+ if (StringUtils.isNotEmpty(firstId)) {
|
|
|
+ //PDF路径集合
|
|
|
+ List<String> pdfUrls = new ArrayList<>();
|
|
|
+
|
|
|
+ //获取配置的路径
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ //获取数据
|
|
|
+ JSONObject firstJson = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
|
|
|
+ if (firstJson != null) {
|
|
|
+ if (StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) || StringUtils.isNotEmpty(firstJson.getString("pdfUrl"))) {
|
|
|
+ pdfUrls.add(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) ? firstJson.getString("eVisaPdfUrl") : firstJson.getString("pdfUrl"));
|
|
|
+ } else {
|
|
|
+ //没有生成拼接的记录,生成
|
|
|
+ //获取html
|
|
|
+ WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, firstJson.getString("tableId")));
|
|
|
+
|
|
|
+ if (tableNode == null) {
|
|
|
+ return R.fail("该数据下无此节点!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(tableNode.getHtmlUrl())) {
|
|
|
+ return R.fail("请关联清表!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取清表信息
|
|
|
+ ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
|
|
|
+ if (excelTab == null) {
|
|
|
+ return R.fail("失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> businessDataMapList = this.getFirstBusinessData(firstId).getData();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //处理数据
|
|
|
+ for (Map<String, Object> dataMap : businessDataMapList) {
|
|
|
+ // 获取excel流 和 html流
|
|
|
+ Workbook wb = new Workbook();
|
|
|
+ wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
+ //获取工作表
|
|
|
+ Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
+
|
|
|
+ // 数据不为空 &&
|
|
|
+ if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
|
|
|
+ File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
|
|
|
+ if (htmlFile.exists()) {
|
|
|
+ String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ Elements trs = table.select("tr");
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(dataMap)) {
|
|
|
+ for (String val : dataMap.keySet()) {
|
|
|
+ if (val.indexOf("__") >= 0) {
|
|
|
+ String DataVal[] = val.split("__");
|
|
|
+ String[] xy = DataVal[1].split("_");
|
|
|
+ Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
|
|
|
+
|
|
|
+ if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
|
|
|
+ int x1, y1;
|
|
|
+
|
|
|
+ if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
+ y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
|
+ } else {
|
|
|
+ x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
+ y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
+ }
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
+ }
|
|
|
+ String myData = dataMap.get(val) + "";
|
|
|
+ if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
|
+ if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
+ myData = myData.replace("[", "").replace("]", "");
|
|
|
+ String[] dataVal = myData.split(",");
|
|
|
+ String Start_dataStr[] = dataVal[0].split("T")[0].split("-");
|
|
|
+ String StartDate = StringUtil.format("{}年{}月{}日", new Object[]{Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1});
|
|
|
+
|
|
|
+ String end_dataStr[] = dataVal[1].split("T")[0].split("-");
|
|
|
+ String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1});
|
|
|
+
|
|
|
+ if (StartDate.equals(endDate)) {
|
|
|
+ myData = StartDate;
|
|
|
+ } else {
|
|
|
+ myData = StartDate + "-" + endDate;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String dataStr[] = myData.split("T")[0].split("-");
|
|
|
+ myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
|
|
|
+ Element element = trs.get(y1).select("td").get(x1);
|
|
|
+ String styles[] = element.attr("style").split(";");
|
|
|
+ int Height = 0;
|
|
|
+ for (String sty : styles) {
|
|
|
+ if (sty.indexOf("height:") >= 0) {
|
|
|
+ Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
+ ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
|
+ pic.setHeight(Height);
|
|
|
+ sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+ cellRange.setText(myData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组装电签设置
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("type", 2);
|
|
|
+ queryWrapper.eq("tab_id", tableNode.getPKeyId());
|
|
|
+
|
|
|
+ final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
+ textdictInfos.forEach(e -> {
|
|
|
+ String key = e.getColKey();
|
|
|
+ String keys[] = key.split("__");
|
|
|
+ String[] trtd = keys[1].split("_");
|
|
|
+ Element data = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
|
|
|
+ int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
+ }
|
|
|
+ int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
+
|
|
|
+ final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+
|
|
|
+ cellRange.setText(e.getId() + "");
|
|
|
+ cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Long fileName = SnowFlakeUtil.getId();
|
|
|
+ String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
|
|
|
+
|
|
|
+ sheet.saveToPdf(onePdfPath);
|
|
|
+
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
|
|
|
+
|
|
|
+ pdfUrls.add(bladeFile.getLink());
|
|
|
+
|
|
|
+ wb.dispose();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pdfUrls.size() > 0) {
|
|
|
+ try {
|
|
|
+ //关联的数据
|
|
|
+ if (StringUtils.isNotEmpty(firstJson.getString("linkMergePdfUrl"))) {
|
|
|
+ pdfUrls.add(firstJson.getString("linkMergePdfUrl"));
|
|
|
+ }
|
|
|
+ //总结报告,暂时无
|
|
|
+
|
|
|
+ //上传
|
|
|
+ String mergePdfPath = file_path + "/pdf//" + firstId + ".pdf";
|
|
|
+ File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
|
|
|
+ if (oldMergePdf.exists()) {
|
|
|
+ oldMergePdf.delete();
|
|
|
+ }
|
|
|
+ //合并
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
|
|
|
+ //上传
|
|
|
+ BladeFile mergeFile = this.newIOSSClient.uploadFile(firstId + '-' + new Date().getTime() + ".pdf", mergePdfPath);
|
|
|
+
|
|
|
+ //返回
|
|
|
+ return R.data(mergeFile.getLink());
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/save_log_first_buss_data")
|
|
|
@ApiOperationSupport(order = 29)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
@@ -2067,14 +2226,14 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
|
|
|
try {
|
|
|
- this.excelTabService.formulaFillData(tableInfoList,null);
|
|
|
+ this.excelTabService.formulaFillData(tableInfoList, null);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
// 保存数据到数据库
|
|
|
String isFirst = tableInfoList.get(0).getIsFirst();
|
|
|
- if(StringUtils.isNotEmpty(isFirst)){
|
|
|
+ if (StringUtils.isNotEmpty(isFirst)) {
|
|
|
//保存首件
|
|
|
return R.data(this.excelTabService.saveOrUpdateFirst(tableInfoList));
|
|
|
} else {
|
|
@@ -2091,7 +2250,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperationSupport(order = 31)
|
|
|
@ApiOperation(value = "下载excel数据")
|
|
|
@ApiImplicitParam(name = "fileId", value = "fileId")
|
|
|
- public void downExcelFile(HttpServletResponse response,String fileId) throws Exception {
|
|
|
+ public void downExcelFile(HttpServletResponse response, String fileId) throws Exception {
|
|
|
ExcelTab excelTab = excelTabService.getById(fileId);
|
|
|
|
|
|
String fileName = URLEncoder.encode(excelTab.getName(), Charsets.UTF_8.name());
|
|
@@ -2118,16 +2277,252 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
public R getFirstExcelHtml() throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String sql ="SELECT n.p_key_id,excelId from (SELECT p_key_id,(SELECT id from m_excel_tab x where x.alias like '%1542045893564796930%' and x.name =m.full_name) as excelId from m_wbs_tree_private m where m.project_id = '1578599210897772545' and m.type='2' and m.p_key_id!='1578599432939634723' ) n where excelId is not null ";
|
|
|
+ String sql = "SELECT * from m_excel_tab x where x.alias like '%1579401528622919682%' and parent_id in ('1582212216210829314','1582211923960115201') and is_deleted=0 and file_type=3 ";
|
|
|
List<Map<String, Object>> dataInof = jdbcTemplate.queryForList(sql);
|
|
|
System.out.println(dataInof.size());
|
|
|
for (int i = 0; i < dataInof.size(); i++) {
|
|
|
- String p_key_id = dataInof.get(i).get("p_key_id") + "";
|
|
|
- Long excelId = Long.parseLong(dataInof.get(i).get("excelId") + "");
|
|
|
- this.saveLinkeTab(excelId, Long.valueOf(p_key_id));
|
|
|
+ String file_url = dataInof.get(i).get("file_url") + "";
|
|
|
+ Long p_key_id = Long.parseLong(dataInof.get(i).get("id") + "");
|
|
|
+ String html_url = dataInof.get(i).get("html_url") + "";
|
|
|
+
|
|
|
+ ExcelTab detail = excelTabService.getById(p_key_id);
|
|
|
+ // 解析excel
|
|
|
+ Workbook wb = new Workbook();
|
|
|
+ wb.loadFromMHtml(CommonUtil.getOSSInputStream(file_url));
|
|
|
+ //
|
|
|
+ HTMLOptions options = new HTMLOptions();
|
|
|
+ options.setImageEmbedded(true);
|
|
|
+ //获取工作表
|
|
|
+ Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
+ Thread.sleep(100);
|
|
|
+ sheet.saveToHtml(html_url, options);
|
|
|
+ Thread.sleep(100);
|
|
|
+ this.expailHtmlInfo(html_url, p_key_id);
|
|
|
+ Thread.sleep(100);
|
|
|
+ EexpaileInfo(html_url, p_key_id);
|
|
|
System.out.println(i);
|
|
|
}
|
|
|
|
|
|
return R.data("");
|
|
|
}
|
|
|
+
|
|
|
+ // 水利水电
|
|
|
+ public void EexpaileInfo(String htmlUrl, long pk_id) throws FileNotFoundException {
|
|
|
+ // String html_url = "/Users/hongchuangyanfa/Desktop/1582973587797573632.html";
|
|
|
+ String htmlString = IoUtil.readToString(new FileInputStream(htmlUrl));
|
|
|
+ // 样式集合
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ //解析
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ Elements trs = table.select("tr");
|
|
|
+ List<ExctabCell> colTitle = new ArrayList<>();
|
|
|
+ int sgY = 0;
|
|
|
+ int sgY_st = 0;
|
|
|
+ int jlY = 0;
|
|
|
+
|
|
|
+ String titt = "";
|
|
|
+ String first = "";
|
|
|
+ String end = "";
|
|
|
+ for (int i = 6; i <= trs.size() - 1; i++) {
|
|
|
+ Element tr = trs.get(i);
|
|
|
+ Elements tds = tr.select("td");
|
|
|
+ if (tds.size() >= 1) {
|
|
|
+ String titName = tds.get(0).text().replaceAll(" ", "");
|
|
|
+ if (titName.equals("施工单位自评意见")) {
|
|
|
+ sgY = i + Integer.parseInt(tds.get(0).attr("rowspan"));
|
|
|
+ titt = "施工单位自评意见";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (titName.equals("监理单位复核意见")) {
|
|
|
+ sgY = i + Integer.parseInt(tds.get(0).attr("rowspan"));
|
|
|
+ titt = "监理单位复核意见";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sgY >= 1 && i < sgY - 1) {
|
|
|
+ for (int j = 0; j < tds.size(); j++) {
|
|
|
+ String tdStr = "";
|
|
|
+ String trTitleName = "";
|
|
|
+ Element element = tds.get(j);
|
|
|
+
|
|
|
+ first += element.text();
|
|
|
+
|
|
|
+ // 中间计算方式
|
|
|
+ if (element.html().indexOf("el-input") >= 0) {
|
|
|
+ // 获取开始的标题
|
|
|
+ ExctabCell exctabCell = new ExctabCell();
|
|
|
+ exctabCell.setExctabId(pk_id);
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+
|
|
|
+ exctabCell.setCreateTime(new Date());
|
|
|
+ exctabCell.setTextElementType(99);
|
|
|
+
|
|
|
+ for (int k = i; k < sgY; k++) {
|
|
|
+ Element atr = trs.get(k);
|
|
|
+ Elements atds = atr.select("td");
|
|
|
+ int m = 0;
|
|
|
+ if (k == i) {
|
|
|
+ m = j + 1;
|
|
|
+ } else {
|
|
|
+ m = 0;
|
|
|
+ }
|
|
|
+ for (int l = m; l < atds.size(); l++) {
|
|
|
+ Element element1 = atds.get(l);
|
|
|
+ if (element1.html().indexOf("el-input") >= 0) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ end = end + element1.text();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ tdStr = first + end;
|
|
|
+
|
|
|
+ if (first.indexOf("检验点") >= 0 && first.indexOf("合格率均不小于") >= 0 && end.indexOf("%") >= 0) {
|
|
|
+ trTitleName = titt + "_合格率";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (first.indexOf("不合格点的质量") >= 0 && end.indexOf("有关规范或设计要求") >= 0) {
|
|
|
+ trTitleName = titt + "_是否符合有关规范或设计要求的限值";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (first.indexOf("各项报验资料") >= 0 && end.indexOf("的要求") >= 0 && end.indexOf("SL") >= 0) {
|
|
|
+ if (end.indexOf("。") >= 0) {
|
|
|
+ end = end.substring(0, end.indexOf("。"));
|
|
|
+ }
|
|
|
+ trTitleName = titt + "_报验资料是否满足" + end;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (first.indexOf("质量等级评定为") >= 0 && end.indexOf("。") >= 0) {
|
|
|
+ if (first.indexOf("。") >= 0) {
|
|
|
+ first = first.substring(first.indexOf("。") + 1, first.length());
|
|
|
+ }
|
|
|
+ trTitleName = titt + "_" + first.substring(0, first.length() - 2);
|
|
|
+ }
|
|
|
+ // 2
|
|
|
+ if (first.indexOf("合格") >= 0 && first.indexOf("其中优良") >= 0 && end.indexOf("%") >= 0) {
|
|
|
+ trTitleName = titt + "_" + first.substring(first.indexOf("其中优良") + 2, first.indexOf("占") + 1) + "比";
|
|
|
+ }
|
|
|
+ if (first.indexOf("主要工序达到") >= 0 && end.indexOf("等级") >= 0) {
|
|
|
+ trTitleName = titt + "工序等级";
|
|
|
+ }
|
|
|
+ // 3
|
|
|
+ if (first.indexOf("单元工程") >= 0 && end.indexOf("要求") >= 0 && first.indexOf("符合") >= 0) {
|
|
|
+ trTitleName = titt + "_设计要求";
|
|
|
+ }
|
|
|
+ if (end.indexOf("100%合格") >= 0) {
|
|
|
+ trTitleName = titt + "_合格数量";
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println(i + "," + j + "=" + trTitleName);
|
|
|
+ first = "";
|
|
|
+ end = "";
|
|
|
+ exctabCell.setTextInfo(trTitleName);
|
|
|
+ exctabCell.setXys(i + "_" + j);
|
|
|
+ exctabCellService.save(exctabCell);
|
|
|
+ }
|
|
|
+ element.removeAttr("title");
|
|
|
+ element.attr("title", trTitleName);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((sgY >= 1 && i == sgY - 1) || (jlY >= 1 && i == jlY - 1)) {
|
|
|
+
|
|
|
+
|
|
|
+ if (tds.get(0).html().indexOf("el-input") >= 0) {
|
|
|
+
|
|
|
+ ExctabCell exctabCell = new ExctabCell();
|
|
|
+ exctabCell.setExctabId(pk_id);
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+ exctabCell.setCreateTime(new Date());
|
|
|
+ exctabCell.setTextElementType(99);
|
|
|
+ tds.get(0).removeAttr("title");
|
|
|
+ if (titt.indexOf("施工") >= 0) {
|
|
|
+ exctabCell.setTextInfo("施工单位合同章");
|
|
|
+ tds.get(0).attr("title", "施工单位合同章");
|
|
|
+ }
|
|
|
+ if (titt.indexOf("监理") >= 0) {
|
|
|
+ exctabCell.setTextInfo("监理单位合同章");
|
|
|
+ tds.get(0).attr("title", "监理单位合同章");
|
|
|
+ }
|
|
|
+ exctabCell.setXys(i + "_" + 0);
|
|
|
+ exctabCellService.save(exctabCell);
|
|
|
+ }
|
|
|
+ if (tds.get(1).html().indexOf("el-input") >= 0) {
|
|
|
+ ExctabCell exctabCell = new ExctabCell();
|
|
|
+ exctabCell.setExctabId(pk_id);
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+
|
|
|
+ exctabCell.setCreateTime(new Date());
|
|
|
+ exctabCell.setTextElementType(99);
|
|
|
+ tds.get(1).removeAttr("title");
|
|
|
+
|
|
|
+ if (titt.indexOf("施工") >= 0) {
|
|
|
+ tds.get(1).attr("title", "施工单位个人签字");
|
|
|
+ exctabCell.setTextInfo("施工单位个人签字");
|
|
|
+ }
|
|
|
+ if (titt.indexOf("监理") >= 0) {
|
|
|
+ tds.get(1).attr("title", "监理单位个人签字");
|
|
|
+ exctabCell.setTextInfo("监理单位个人签字");
|
|
|
+ }
|
|
|
+ exctabCell.setXys(i + "_" + 1);
|
|
|
+ exctabCellService.save(exctabCell);
|
|
|
+ }
|
|
|
+ if (tds.get(2).html().indexOf("el-date-picker") >= 0) {
|
|
|
+ ExctabCell exctabCell = new ExctabCell();
|
|
|
+ exctabCell.setExctabId(pk_id);
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+
|
|
|
+ exctabCell.setCreateTime(new Date());
|
|
|
+ exctabCell.setTextElementType(99);
|
|
|
+ tds.get(2).removeAttr("title");
|
|
|
+ if (titt.indexOf("施工") >= 0) {
|
|
|
+ tds.get(2).attr("title", "日期施工单位");
|
|
|
+ exctabCell.setTextInfo("日期施工单位");
|
|
|
+ }
|
|
|
+ if (titt.indexOf("监理") >= 0) {
|
|
|
+ tds.get(2).attr("title", "日期监理单位");
|
|
|
+ exctabCell.setTextInfo("日期监理单位");
|
|
|
+ }
|
|
|
+ exctabCell.setXys(i + "_" + 2);
|
|
|
+ exctabCellService.save(exctabCell);
|
|
|
+ }
|
|
|
+
|
|
|
+ titt = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ File writefile = new File(htmlUrl);
|
|
|
+ FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ System.out.println("完成");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 表单填写 图片添加 并压缩
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @SneakyThrows
|
|
|
+ @PostMapping("/add-buss-imginfo")
|
|
|
+ @ApiOperationSupport(order = 32)
|
|
|
+ @ApiOperation(value = "表单填写图片上传", notes = "表单填写图片上传")
|
|
|
+ public R addBussFile(@RequestParam MultipartFile file) {
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ BladeFile bladeFile = new BladeFile();
|
|
|
+ if (file.getSize() >= 1024) {
|
|
|
+ String filecode = SnowFlakeUtil.getId() + "";
|
|
|
+ String imgUrl = file_path + "/pdf/" + filecode + ".jpg";
|
|
|
+ FileUtils.CompressImage(imgUrl, file.getInputStream());
|
|
|
+ bladeFile = this.newIOSSClient.uploadFile(file.getOriginalFilename(), imgUrl);
|
|
|
+ File imgFile = ResourceUtil.getFile(imgUrl);
|
|
|
+ imgFile.delete();
|
|
|
+ } else {
|
|
|
+ bladeFile = this.newIOSSClient.uploadFileByInputStream(file);
|
|
|
+ }
|
|
|
+ return R.data(bladeFile);
|
|
|
+ }
|
|
|
+
|
|
|
}
|