|
@@ -18,6 +18,7 @@ import com.spire.xls.core.spreadsheet.HTMLOptions;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
|
+import org.apache.commons.codec.Charsets;
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.Jsoup;
|
|
@@ -32,6 +33,7 @@ import org.springblade.common.utils.CommonUtil;
|
|
import org.springblade.common.utils.MathUtil;
|
|
import org.springblade.common.utils.MathUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
+import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
import org.springblade.core.secure.BladeUser;
|
|
import org.springblade.core.secure.BladeUser;
|
|
@@ -41,6 +43,7 @@ import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.manager.bean.TableInfo;
|
|
import org.springblade.manager.bean.TableInfo;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
|
|
+import org.springblade.manager.excel.WbsFormElementBatchExcel;
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
import org.springblade.manager.service.*;
|
|
import org.springblade.manager.service.*;
|
|
import org.springblade.manager.utils.FileUtils;
|
|
import org.springblade.manager.utils.FileUtils;
|
|
@@ -60,10 +63,12 @@ import org.springblade.core.log.exception.ServiceException;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.awt.*;
|
|
import java.awt.*;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
+import java.net.URLEncoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
@@ -124,6 +129,9 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
private final InformationQueryClient informationQueryClient;
|
|
private final InformationQueryClient informationQueryClient;
|
|
|
|
|
|
|
|
+ // 项目信息
|
|
|
|
+ private final IProjectInfoService projectInfoService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 详情
|
|
* 详情
|
|
*/
|
|
*/
|
|
@@ -442,13 +450,16 @@ public class ExcelTabController extends BladeController {
|
|
WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
|
|
WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
|
|
aPrivate.setExcelId(exceTabId);
|
|
aPrivate.setExcelId(exceTabId);
|
|
|
|
|
|
|
|
+ // 获取excel 基本信息
|
|
|
|
+ ExcelTab excelTab = excelTabService.getById(exceTabId);
|
|
|
|
+
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.in("p_key_id", tabId);
|
|
updateWrapper.in("p_key_id", tabId);
|
|
updateWrapper.set("is_link_table", 2);
|
|
updateWrapper.set("is_link_table", 2);
|
|
|
|
+ updateWrapper.set("node_name", excelTab.getName()); //关联清表后 表单名和清表一样
|
|
updateWrapper.set("excel_id", exceTabId);
|
|
updateWrapper.set("excel_id", exceTabId);
|
|
|
|
|
|
- // 获取excel 基本信息
|
|
|
|
- ExcelTab excelTab = excelTabService.getById(exceTabId);
|
|
|
|
|
|
+
|
|
|
|
|
|
// 复制模版htmlURL
|
|
// 复制模版htmlURL
|
|
File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
|
|
File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
|
|
@@ -475,7 +486,7 @@ public class ExcelTabController extends BladeController {
|
|
Elements tds = tr.select("td");
|
|
Elements tds = tr.select("td");
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
Element element = tds.get(j);
|
|
Element element = tds.get(j);
|
|
- if (element.html().indexOf("el-input") >= 0) {
|
|
|
|
|
|
+ if (element.html().indexOf("el-input") >= 0 || element.html().indexOf("el-date-picker") >= 0) {
|
|
|
|
|
|
boolean is_true = false;
|
|
boolean is_true = false;
|
|
String titleName = element.attr("title");
|
|
String titleName = element.attr("title");
|
|
@@ -513,16 +524,16 @@ public class ExcelTabController extends BladeController {
|
|
String regularExpression = "$event" + "," + "'" + RegularExpressionUtil.getRegularExpression(filedType) + "','" + (StringUtils.isNotEmpty(filedType) ? WbsElementUtil.getTypeTips(filedType) : null) + "'," + i + "," + j;
|
|
String regularExpression = "$event" + "," + "'" + RegularExpressionUtil.getRegularExpression(filedType) + "','" + (StringUtils.isNotEmpty(filedType) ? WbsElementUtil.getTypeTips(filedType) : null) + "'," + i + "," + j;
|
|
|
|
|
|
if (is_true) {
|
|
if (is_true) {
|
|
- element.children().get(0).attr("placeholder", lastName).attr("@focus", "getInformation(" + oncklickText + ")")
|
|
|
|
|
|
+ element.children().get(0).attr("placeholder", lastName)
|
|
.attr("weighing", maxScore + "").attr("id", attrInfo).attr("keyName", attrInfo)
|
|
.attr("weighing", maxScore + "").attr("id", attrInfo).attr("keyName", attrInfo)
|
|
.attr("@blur", "getRegularExpression(" + regularExpression + ")")
|
|
.attr("@blur", "getRegularExpression(" + regularExpression + ")")
|
|
.attr("v-model", "formData." + attrInfo);
|
|
.attr("v-model", "formData." + attrInfo);
|
|
} else {
|
|
} else {
|
|
- element.children().get(0).attr("placeholder", lastName).attr("@focus", "getInformation(" + oncklickText + ")")
|
|
|
|
|
|
+ element.children().get(0).attr("placeholder", lastName)
|
|
.attr("weighing", maxScore + "").attr("id", attrInfo).attr("keyName", attrInfo)
|
|
.attr("weighing", maxScore + "").attr("id", attrInfo).attr("keyName", attrInfo)
|
|
.attr("@blur", "getRegularExpression(" + regularExpression + ")");
|
|
.attr("@blur", "getRegularExpression(" + regularExpression + ")");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ element.attr("@click", "getInformation(" + oncklickText + ")");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -576,10 +587,37 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
- // htmlString = htmlString.replaceAll("@focu","@focu212");
|
|
|
|
|
|
+ htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// 解析 style
|
|
// 解析 style
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
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());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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());
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
doc.select("Col").remove();
|
|
doc.select("Col").remove();
|
|
fileInputStream.close();
|
|
fileInputStream.close();
|
|
return R.data(table + "");
|
|
return R.data(table + "");
|
|
@@ -669,43 +707,7 @@ public class ExcelTabController extends BladeController {
|
|
// expailHtmlInfo(thmlUrl,1L);
|
|
// expailHtmlInfo(thmlUrl,1L);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 首件表单获取 html页面
|
|
|
|
- */
|
|
|
|
- @GetMapping("/getDataInfoinfoxxxxx")
|
|
|
|
- @ApiOperationSupport(order = 33)
|
|
|
|
- @ApiOperation(value = "初始化实际", notes = "初始化实际")
|
|
|
|
-
|
|
|
|
- public R getFirstExcelHtml() throws Exception {
|
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
- List<Map<String, Object>> dataInof = jdbcTemplate.queryForList("SELECT * from m_excel_tab where parent_id ='1542056853226622977' and is_deleted=0");
|
|
|
|
- System.out.println(dataInof.size());
|
|
|
|
- for (int i = 0; i < dataInof.size(); i++) {
|
|
|
|
-
|
|
|
|
- String html = dataInof.get(i).get("html_url") + "";
|
|
|
|
- String fileUrl = dataInof.get(i).get("file_url") + "";
|
|
|
|
- Long id = Long.parseLong(dataInof.get(i).get("id") + "");
|
|
|
|
-
|
|
|
|
- String thmlUrl = file_path + id + ".html";
|
|
|
|
- ExcelTab detail = excelTabService.getById(id);
|
|
|
|
- Workbook wb = new Workbook();
|
|
|
|
- InputStream da = CommonUtil.getOSSInputStream(fileUrl);
|
|
|
|
- wb.loadFromMHtml(da);
|
|
|
|
- //获取工作表
|
|
|
|
- Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
|
- sheet.saveToHtml(thmlUrl);
|
|
|
|
-
|
|
|
|
- detail.setHtmlUrl(thmlUrl);
|
|
|
|
- excelTabService.saveOrUpdate(detail);
|
|
|
|
- System.out.println(i);
|
|
|
|
- if (thmlUrl != null) {
|
|
|
|
- this.expailHtmlInfo(thmlUrl, id);
|
|
|
|
- }
|
|
|
|
- da.close();
|
|
|
|
- }
|
|
|
|
|
|
|
|
- return R.data("");
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
// 上传解析 html
|
|
// 上传解析 html
|
|
@@ -1863,65 +1865,80 @@ public class ExcelTabController extends BladeController {
|
|
})
|
|
})
|
|
public R<List<Map<String, Object>>> copyTheLogBusinessData(@RequestParam String theLogId, @RequestParam String nodePrimaryKeyId, @RequestParam String currentTime, @RequestParam String contractId) {
|
|
public R<List<Map<String, Object>>> copyTheLogBusinessData(@RequestParam String theLogId, @RequestParam String nodePrimaryKeyId, @RequestParam String currentTime, @RequestParam String contractId) {
|
|
if (StringUtils.isNotEmpty(theLogId) && StringUtils.isNotEmpty(currentTime)) {
|
|
if (StringUtils.isNotEmpty(theLogId) && StringUtils.isNotEmpty(currentTime)) {
|
|
- //获取目标的数据
|
|
|
|
- JSONObject targetJson = this.contractLogClient.queryContractLogById(theLogId);
|
|
|
|
- if (targetJson == null) {
|
|
|
|
- return R.fail("目标日期下未找到当前用户填报的数据,请重新选择");
|
|
|
|
- }
|
|
|
|
- //查询是否存在关联工序的数据
|
|
|
|
- List<JSONObject> wbsJsonList = this.contractLogClient.queryContractLogWbsByTheLogId(targetJson.getString("id"));
|
|
|
|
-
|
|
|
|
- //获取目标数据所在数据表
|
|
|
|
- WbsTreePrivate table = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, targetJson.getString("tableId")));
|
|
|
|
-
|
|
|
|
- //获取目标数据
|
|
|
|
- String queryTargetDataSql = "SELECT * FROM " + table.getInitTableName() + " WHERE group_id = " + targetJson.getString("dataId");
|
|
|
|
- List<Map<String, Object>> targetDatas = this.jdbcTemplate.queryForList(queryTargetDataSql);
|
|
|
|
|
|
|
|
//检查当前日期下是否存在数据
|
|
//检查当前日期下是否存在数据
|
|
JSONObject currentJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, currentTime, contractId);
|
|
JSONObject currentJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, currentTime, contractId);
|
|
String businessId = SnowFlakeUtil.getId().toString();
|
|
String businessId = SnowFlakeUtil.getId().toString();
|
|
boolean isNew = true;
|
|
boolean isNew = true;
|
|
if (currentJson != null) {
|
|
if (currentJson != null) {
|
|
- //有记录,需要删除掉原本记录填写的数据
|
|
|
|
- String removeOldSql = "DELETE FROM " + table.getInitTableName() + " WHERE group_id = " + currentJson.getString("dataId");
|
|
|
|
- this.jdbcTemplate.execute(removeOldSql);
|
|
|
|
-
|
|
|
|
- //删除掉原本关联的工序节点
|
|
|
|
- this.contractLogClient.removeContractLogWbsByTheLogId(currentJson.getString("id"));
|
|
|
|
-
|
|
|
|
//使用原本的数据ID
|
|
//使用原本的数据ID
|
|
businessId = currentJson.getString("dataId");
|
|
businessId = currentJson.getString("dataId");
|
|
isNew = false;
|
|
isNew = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
//新增的SQL集合
|
|
//新增的SQL集合
|
|
List<String> insertSqlList = new ArrayList<>();
|
|
List<String> insertSqlList = new ArrayList<>();
|
|
|
|
+ //关联集合
|
|
|
|
+ List<JSONObject> logWbsList = new ArrayList<>();
|
|
|
|
+ //记录第一组
|
|
|
|
+ List<JSONObject> oneGroupLogWbsList = new ArrayList<>();
|
|
|
|
|
|
- //只需要替换group_id和id即可
|
|
|
|
- for (Map<String, Object> dataMap : targetDatas) {
|
|
|
|
- StringBuilder insertSql = new StringBuilder("INSERT INTO " + table.getInitTableName()), keySql = new StringBuilder(), valueSql = new StringBuilder();
|
|
|
|
- for (Map.Entry<String, Object> mapEntry : dataMap.entrySet()) {
|
|
|
|
- String key = mapEntry.getKey();
|
|
|
|
- Object value = mapEntry.getValue();
|
|
|
|
-
|
|
|
|
- if ("id".equals(key)) {
|
|
|
|
- value = SnowFlakeUtil.getId();
|
|
|
|
- } else if ("group_id".equals(key)) {
|
|
|
|
- value = businessId;
|
|
|
|
- }
|
|
|
|
- //设置参数
|
|
|
|
- keySql.append(",").append(key);
|
|
|
|
- if (value != null && StringUtils.isNotEmpty(String.valueOf(value))) {
|
|
|
|
- valueSql.append(",").append("'").append(value).append("'");
|
|
|
|
- } else {
|
|
|
|
- valueSql.append(",").append(value);
|
|
|
|
|
|
+ List<JSONObject> targetJsonList = this.contractLogClient.queryContractLogByIds(Func.toStrList(theLogId));
|
|
|
|
+ if (targetJsonList == null || targetJsonList.size() <= 0) {
|
|
|
|
+ return R.fail("目标日期下未找到当前用户填报的数据,请重新选择");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(JSONObject targetJson : targetJsonList){
|
|
|
|
+
|
|
|
|
+ //获取目标数据所在数据表
|
|
|
|
+ WbsTreePrivate table = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, targetJson.getString("tableId")));
|
|
|
|
+
|
|
|
|
+ //获取目标数据
|
|
|
|
+ String queryTargetDataSql = "SELECT * FROM " + table.getInitTableName() + " WHERE group_id = " + targetJson.getString("dataId");
|
|
|
|
+ List<Map<String, Object>> targetDatas = this.jdbcTemplate.queryForList(queryTargetDataSql);
|
|
|
|
+
|
|
|
|
+ //只需要替换group_id和id即可
|
|
|
|
+ for (Map<String, Object> dataMap : targetDatas) {
|
|
|
|
+ StringBuilder insertSql = new StringBuilder("INSERT INTO " + table.getInitTableName()), keySql = new StringBuilder(), valueSql = new StringBuilder();
|
|
|
|
+ for (Map.Entry<String, Object> mapEntry : dataMap.entrySet()) {
|
|
|
|
+ String key = mapEntry.getKey();
|
|
|
|
+ Object value = mapEntry.getValue();
|
|
|
|
+
|
|
|
|
+ if ("id".equals(key)) {
|
|
|
|
+ //查询是否有关联记录
|
|
|
|
+ //查询是否存在关联工序的数据
|
|
|
|
+ List<JSONObject> wbsJsonList = this.contractLogClient.queryContractLogWbsByBusinessId(value.toString());
|
|
|
|
+ //重置业务ID
|
|
|
|
+ value = SnowFlakeUtil.getId();
|
|
|
|
+ if(wbsJsonList != null && wbsJsonList.size() > 0){
|
|
|
|
+ if(oneGroupLogWbsList.size() == 0){
|
|
|
|
+ oneGroupLogWbsList.addAll(wbsJsonList);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ wbsJsonList = new ArrayList<>(oneGroupLogWbsList);
|
|
|
|
+ }
|
|
|
|
+ for(JSONObject json : wbsJsonList){
|
|
|
|
+ json.put("businessId", value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ logWbsList.addAll(wbsJsonList);
|
|
|
|
+ } else if ("group_id".equals(key)) {
|
|
|
|
+ value = businessId;
|
|
|
|
+ }
|
|
|
|
+ //设置参数
|
|
|
|
+ keySql.append(",").append(key);
|
|
|
|
+ if (value != null && StringUtils.isNotEmpty(String.valueOf(value))) {
|
|
|
|
+ valueSql.append(",").append("'").append(value).append("'");
|
|
|
|
+ } else {
|
|
|
|
+ valueSql.append(",").append(value);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- //组装SQL
|
|
|
|
- insertSql.append(" (").append(keySql.toString().substring(1)).append(") ");
|
|
|
|
- insertSql.append(" VALUES(").append(valueSql.toString().substring(1)).append(")");
|
|
|
|
|
|
+ //组装SQL
|
|
|
|
+ insertSql.append(" (").append(keySql.toString().substring(1)).append(") ");
|
|
|
|
+ insertSql.append(" VALUES(").append(valueSql.toString().substring(1)).append(")");
|
|
|
|
|
|
- insertSqlList.add(insertSql.toString());
|
|
|
|
|
|
+ insertSqlList.add(insertSql.toString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (insertSqlList.size() > 0) {
|
|
if (insertSqlList.size() > 0) {
|
|
@@ -1933,13 +1950,13 @@ public class ExcelTabController extends BladeController {
|
|
//处理数据
|
|
//处理数据
|
|
this.contractLogClient.saveContractLog(new SaveContractLogVO(
|
|
this.contractLogClient.saveContractLog(new SaveContractLogVO(
|
|
Long.parseLong(businessId),
|
|
Long.parseLong(businessId),
|
|
- targetJson.getString("projectId"),
|
|
|
|
- targetJson.getString("contractId"),
|
|
|
|
- Long.parseLong(targetJson.getString("wbsNodeId")),
|
|
|
|
- Long.parseLong(targetJson.getString("tableId")),
|
|
|
|
- Integer.parseInt(targetJson.getString("wbsNodeType")),
|
|
|
|
|
|
+ targetJsonList.get(0).getString("projectId"),
|
|
|
|
+ targetJsonList.get(0).getString("contractId"),
|
|
|
|
+ Long.parseLong(targetJsonList.get(0).getString("wbsNodeId")),
|
|
|
|
+ Long.parseLong(targetJsonList.get(0).getString("tableId")),
|
|
|
|
+ Integer.parseInt(targetJsonList.get(0).getString("wbsNodeType")),
|
|
currentTime,
|
|
currentTime,
|
|
- wbsJsonList
|
|
|
|
|
|
+ logWbsList
|
|
));
|
|
));
|
|
|
|
|
|
//返回当前的新数据
|
|
//返回当前的新数据
|
|
@@ -2260,4 +2277,51 @@ public class ExcelTabController extends BladeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * excel 模版下载
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/down-Excel-file")
|
|
|
|
+ @ApiOperationSupport(order = 31)
|
|
|
|
+ @ApiOperation(value = "下载excel数据")
|
|
|
|
+ @ApiImplicitParam(name = "fileId", value = "fileId")
|
|
|
|
+ public void downExcelFile(HttpServletResponse response,String fileId) throws Exception {
|
|
|
|
+ ExcelTab excelTab = excelTabService.getById(fileId);
|
|
|
|
+
|
|
|
|
+ String fileName = URLEncoder.encode(excelTab.getName(), Charsets.UTF_8.name());
|
|
|
|
+
|
|
|
|
+ InputStream redio = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
|
|
|
|
+ byte[] buffer = IoUtil.readToByteArray(redio);
|
|
|
|
+
|
|
|
|
+ OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
|
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
|
+ toClient.write(buffer);
|
|
|
|
+ toClient.flush();
|
|
|
|
+ toClient.close();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 首件表单获取 html页面
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getDataInfoinfoxxxxx")
|
|
|
|
+ @ApiOperationSupport(order = 100)
|
|
|
|
+ @ApiOperation(value = "初始化实际", notes = "初始化实际")
|
|
|
|
+
|
|
|
|
+ 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 ";
|
|
|
|
+ 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));
|
|
|
|
+ System.out.println(i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data("");
|
|
|
|
+ }
|
|
}
|
|
}
|