|
@@ -82,9 +82,6 @@ import org.springframework.transaction.TransactionDefinition;
|
|
|
import org.springframework.transaction.TransactionStatus;
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
|
-import javax.imageio.ImageIO;
|
|
|
-import java.awt.Color;
|
|
|
-import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
import java.net.URL;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -593,44 +590,29 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
//
|
|
|
- List<WbsTreeContract> lastList = new ArrayList<>();
|
|
|
+ Map<Long,String> lastList = new HashMap<>();
|
|
|
List<WbsTreeContract> collect = wbsTreeContractList.stream().filter(wbsTreeContract -> "0".equals(wbsTreeContract.getParentId().toString())).collect(Collectors.toList());
|
|
|
|
|
|
this.dataInfo(collect,lastList,Data);
|
|
|
|
|
|
if(lastList!=null && lastList.size()>=1){
|
|
|
- for(WbsTreeContract data : lastList){
|
|
|
- UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.eq("p_key_id", data.getPKeyId() + "");
|
|
|
- updateWrapper.set("ancestors", data.getAncestors());
|
|
|
- wbsTreeContractService.getBaseMapper().update(data,updateWrapper);
|
|
|
+ int index = 0;
|
|
|
+ StringBuffer sb =new StringBuffer();
|
|
|
+ for(Long data : lastList.keySet()){
|
|
|
+ sb.append(" update m_wbs_tree_contract set ancestors='"+lastList.get(data)+"' where p_key_id="+data+";");
|
|
|
+ index = index+1;
|
|
|
+ System.out.println(index);
|
|
|
+ if(index>=1000){
|
|
|
+ jdbcTemplate.execute(sb.toString());
|
|
|
+ sb = new StringBuffer();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return R.data("成功");
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void dataInfo(List<WbsTreeContract> collect,List<WbsTreeContract> lastList,Map<String , List<WbsTreeContract> > Data){
|
|
|
-
|
|
|
- /*List<WbsTreeContract> redata = new ArrayList<>();
|
|
|
- if (collect!=null && collect.size()==1){
|
|
|
- // 主节点
|
|
|
- for(WbsTreeContract fu:collect){
|
|
|
- String dataId = fu.getId()+"";
|
|
|
- List<WbsTreeContract> er = Data.get(dataId);
|
|
|
- redata.add(fu);
|
|
|
- if(er!=null && er.size()>=1){
|
|
|
- for(WbsTreeContract erData : er){
|
|
|
- erData.setAncestors(fu.getAncestors()+","+erData.getParentId());
|
|
|
- lastList.add(erData);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(redata!=null && redata.size()>=1){
|
|
|
- this.dataInfo(redata,lastList,Data);
|
|
|
- }*/
|
|
|
-
|
|
|
+ public void dataInfo(List<WbsTreeContract> collect,Map<Long ,String > lastList,Map<String , List<WbsTreeContract> > Data){
|
|
|
|
|
|
Queue<WbsTreeContract> queue = new LinkedList<>();
|
|
|
//将第一层级的目录全部入列
|
|
@@ -642,8 +624,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<WbsTreeContract> er = Data.get(dataId);
|
|
|
if(er!=null && er.size()>=1){
|
|
|
for(WbsTreeContract erData : er){
|
|
|
- erData.setAncestors(tree.getAncestors()+","+erData.getParentId());
|
|
|
- lastList.add(erData);
|
|
|
+ String Ancestors="";
|
|
|
+ if(lastList.containsKey(tree.getPKeyId())){
|
|
|
+ Ancestors = lastList.get(tree.getPKeyId());
|
|
|
+ }else{
|
|
|
+ Ancestors = tree.getAncestors();
|
|
|
+ }
|
|
|
+ lastList.put(erData.getPKeyId(),Ancestors+","+erData.getParentId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -885,7 +872,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//保存操作记录
|
|
|
this.operationLogClient.saveUserOperationLog(1, "资料填报", "工序填报页面", json);
|
|
|
// 更新redis
|
|
|
- informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId()+"",wbsTreeContractByP.getParentId()+"",wbsTreeContractByP.getContractId(),"","1");
|
|
|
+ informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getContractId(), "", "1");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return R.fail("操作失败");
|
|
@@ -904,12 +891,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
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()) {
|
|
|
- if(p.contains("Data too long for column")){
|
|
|
+ if (p.contains("Data too long for column")) {
|
|
|
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("数据库字段太短】");
|
|
|
}
|
|
|
- }else if(p.contains("Unknown column")){
|
|
|
+ } else if (p.contains("Unknown column")) {
|
|
|
sb.append("【").append(m.group(1)).append(":").append(m.group(4)).append("关联错误】");
|
|
|
}
|
|
|
|
|
@@ -2000,16 +1987,47 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<Map<String, Object>> bussDataInfoTrial = this.getBussDataInfoTrial(id, pkeyId, Long.parseLong(contractId));
|
|
|
Map<String, Object> DataInfo = bussDataInfoTrial.stream().findAny().orElse(null);
|
|
|
|
|
|
- //获取excel流 和 html流
|
|
|
- Workbook wb = new Workbook();
|
|
|
- wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
- //获取工作表
|
|
|
- Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
-
|
|
|
- //页码
|
|
|
- PageSetup pageSetup = sheet.getPageSetup();
|
|
|
+ org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ sheet.setForceFormulaRecalculation(true);
|
|
|
+ Header header = sheet.getHeader();
|
|
|
+ //页眉
|
|
|
if (pageNumber != 0 && pageNumberCount != 0) {
|
|
|
- pageSetup.setRightHeader("第" + pageNumber + "页,共" + pageNumberCount + "页");
|
|
|
+ header.setRight("第" + pageNumber + "页,共" + pageNumberCount + "页");
|
|
|
+ }
|
|
|
+
|
|
|
+ //标题Title
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreePrivate.getProjectId());
|
|
|
+ int all = sheet.getRow(0).getLastCellNum();
|
|
|
+ int mergedCellCnt = sheet.getNumMergedRegions();
|
|
|
+ for (int i = 0; i < mergedCellCnt - 1; i++) {
|
|
|
+ CellRangeAddress mergedCell = sheet.getMergedRegion(i);
|
|
|
+ int xx = mergedCell.getNumberOfCells();
|
|
|
+ if (xx <= all) {
|
|
|
+ int fisRow = mergedCell.getFirstRow();
|
|
|
+ int firstCol = mergedCell.getFirstColumn();
|
|
|
+ Cell cell = sheet.getRow(fisRow).getCell(firstCol);
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font oldFontAt = workbook.getFontAt(fontIndex);
|
|
|
+ Font redFont = workbook.createFont();
|
|
|
+ redFont.setFontHeightInPoints(oldFontAt.getFontHeightInPoints());//设置字体大小
|
|
|
+ redFont.setFontName(oldFontAt.getFontName());//设置字体
|
|
|
+ CellStyle newStyle = workbook.createCellStyle();//创建单元格样式
|
|
|
+ newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+ short fontHeightInPoints = redFont.getFontHeightInPoints();
|
|
|
+ if (fontHeightInPoints >= 14 && StringUtils.isEmpty(cell.getStringCellValue()) && fisRow <= 8) {
|
|
|
+ String title = projectInfo.getProjectName();
|
|
|
+ if (title.length() >= 30) {
|
|
|
+ sheet.getRow(fisRow).setHeight((short) 900);
|
|
|
+ newStyle.setWrapText(true);
|
|
|
+ }
|
|
|
+ redFont.setBold(true);
|
|
|
+ newStyle.setFont(redFont);
|
|
|
+ cell.setCellStyle(newStyle);
|
|
|
+ cell.setCellValue(title);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//数据不为空
|
|
@@ -2020,134 +2038,173 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements trs = table.select("tr");
|
|
|
- Elements cols = table.select("col");
|
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
|
- for (String val : DataInfo.keySet()) {
|
|
|
+ for (String val : Objects.requireNonNull(DataInfo).keySet()) {
|
|
|
if (val.contains("__")) {
|
|
|
String[] DataVal = val.split("__");
|
|
|
String[] xy = DataVal[1].split("_");
|
|
|
+ if (Integer.parseInt(xy[0]) < trs.size()) {
|
|
|
+ Element ytzData = trs.get(Integer.parseInt(xy[0]));
|
|
|
+ if (ytzData != null) {
|
|
|
+ Elements tdsx = ytzData.select("td");
|
|
|
+ if (Integer.parseInt(xy[1]) < tdsx.size()) {
|
|
|
+ Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
|
|
|
+ if (data != null) {
|
|
|
+ if (data.html().contains("x1") && data.html().contains("y1")) {
|
|
|
+ int x1 = 0;
|
|
|
+ int x2 = 0;
|
|
|
+ int y1 = 0;
|
|
|
+ int y2 = 0;
|
|
|
+ if (data.html().contains("el-tooltip")) {
|
|
|
+ x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
+ x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
|
|
|
+ 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 = DataInfo.get(val) + "";
|
|
|
+ if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
+ sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
|
|
|
+ SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ if (myData.contains(",") && myData.contains("]")) {
|
|
|
|
|
|
- Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
|
|
|
+ myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
|
|
|
+ String[] dataVal = myData.split(",");
|
|
|
|
|
|
- if (data.html().contains("x1") && data.html().contains("y1")) {
|
|
|
- int x1 = 0;
|
|
|
- int y1 = 0;
|
|
|
- if (data.html().contains("el-tooltip")) {
|
|
|
- x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
- y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
|
+ Date Start_dataStr = sdf.parse(dataVal[0]);
|
|
|
+ Date end_dataStr = sdf.parse(dataVal[1]);
|
|
|
+ String StartDate = formatStr.format(Start_dataStr);
|
|
|
+ String endDate = formatStr.format(end_dataStr);
|
|
|
+ if (StartDate.equals(endDate)) {
|
|
|
+ myData = StartDate;
|
|
|
+ } else {
|
|
|
+ myData = StartDate + "-" + endDate;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String[] dataStr = myData.split("T")[0].split("-");
|
|
|
+ myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
|
|
|
+ if (myData.contains("https") && myData.contains("aliyuncs")) {
|
|
|
+ InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
|
+ byte[] bytes = IOUtils.toByteArray(imageIn);
|
|
|
+ // 这里根据实际需求选择图片类型
|
|
|
+ int pictureIdx = workbook.addPicture(bytes, 6);
|
|
|
|
|
|
- } 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 = DataInfo.get(val) + "";
|
|
|
-
|
|
|
- if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
- sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
|
|
|
- SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- if (myData.contains(",") && myData.contains("]")) {
|
|
|
- myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
|
|
|
- String[] dataVal = myData.split(",");
|
|
|
-
|
|
|
- Date Start_dataStr = sdf.parse(dataVal[0]);
|
|
|
- Date end_dataStr = sdf.parse(dataVal[1]);
|
|
|
- String StartDate = formatStr.format(Start_dataStr);
|
|
|
- String endDate = formatStr.format(end_dataStr);
|
|
|
- if (StartDate.equals(endDate)) {
|
|
|
- myData = StartDate;
|
|
|
- } else {
|
|
|
- myData = StartDate + "-" + endDate;
|
|
|
- }
|
|
|
- } else {
|
|
|
- String[] dataStr = myData.split("T")[0].split("-");
|
|
|
- myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ CreationHelper helper = workbook.getCreationHelper();
|
|
|
+ ClientAnchor anchor = helper.createClientAnchor();
|
|
|
+ anchor.setCol1(x1); // param1是列号
|
|
|
+ anchor.setCol2(x2);
|
|
|
+ anchor.setRow1(y1); // param2是行号
|
|
|
+ anchor.setRow2(y2); // param2是行号
|
|
|
+ //
|
|
|
+ Drawing<?> drawing = sheet.createDrawingPatriarch();
|
|
|
+ anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
|
+ // 插入图片
|
|
|
+ Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
|
+ pict.resize(1, 1);
|
|
|
+ FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
|
|
|
|
|
|
- if (myData.contains("https") && myData.contains("aliyuncs")) {
|
|
|
- BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
- int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
- int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
|
|
|
- int picHeight = 0;
|
|
|
- int picWidth = 0;
|
|
|
-
|
|
|
- if (rowspan == 0) {
|
|
|
- String dataInfo = trs.get(y1).attr("height");
|
|
|
- if (StringUtils.isEmpty(dataInfo)) {
|
|
|
- Element firstTd = trs.get(y1 - 1).children().get(0);
|
|
|
- String[] heg = firstTd.attr("style").split(";");
|
|
|
- for (String str : heg) {
|
|
|
- if (str.contains("height:")) {
|
|
|
- picHeight = Integer.parseInt(str.split(":")[1].replaceAll("px", ""));
|
|
|
+ } else if (myData.equals("1") && data.html().contains("hc-form-checkbox-group")) {
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null) {
|
|
|
+ String exceVal = cell.getStringCellValue().replaceAll(" ", "");
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font fontAt = workbook.getFontAt(fontIndex);
|
|
|
+ fontAt.setFontName("EUDC");
|
|
|
+ cell.setCellValue(exceVal.replace("□", "\u2611"));
|
|
|
+ } else {
|
|
|
+ ObjectUtils.isNotEmpty(cell);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null) {
|
|
|
+ cell.setCellValue(myData);
|
|
|
+ } else {
|
|
|
+ ObjectUtils.isNotEmpty(cell);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- picHeight = Integer.parseInt(dataInfo);
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (int i = y1; i <= (y1 + rowspan); i++) { // 跨列处理
|
|
|
- String dataInfo = trs.get(i).attr("height");
|
|
|
- if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
- picHeight += Integer.parseInt(dataInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (colspan >= 1) {
|
|
|
- for (int i = x1 - 1; i < x1 + colspan - 1; i++) {
|
|
|
- String dataInfo = cols.get(i).attr("width").replaceAll("px", "");
|
|
|
- if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
- picWidth += Integer.parseInt(dataInfo);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
|
- pic.setAutoSize(true);
|
|
|
- pic.setWidth(picWidth - 10);
|
|
|
- pic.setHeight(picHeight);
|
|
|
- pic.setLeft(5);
|
|
|
- } else {
|
|
|
- CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
- cellRange.getCellStyle().getExcelFont().setFontName("EUDC");
|
|
|
- cellRange.setText(myData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 组装电签设置
|
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.select("col_key", "id");
|
|
|
- queryWrapper.eq("type", 2);
|
|
|
+ queryWrapper.in("type", 2);
|
|
|
queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
|
|
|
- List<TextdictInfo> textDictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
- if (textDictInfos != null && !textDictInfos.isEmpty()) {
|
|
|
- for (TextdictInfo e : textDictInfos) {
|
|
|
+
|
|
|
+ List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
+ for (TextdictInfo e : textdictInfos) {
|
|
|
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"));
|
|
|
+ String[] trtd = keys[1].split("_");
|
|
|
+ if (Integer.parseInt(trtd[0]) < trs.size()) {
|
|
|
+ Element ytzData = trs.get(Integer.parseInt(trtd[0]));
|
|
|
+ if (ytzData != null) {
|
|
|
+ Elements tdsx = ytzData.select("td");
|
|
|
+ if (Integer.parseInt(trtd[1]) < tdsx.size()) {
|
|
|
+ Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
|
|
|
+ if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ data = data.children().get(0);
|
|
|
+ }
|
|
|
|
|
|
- final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
- cellRange.setText(e.getId() + "");
|
|
|
- cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
+ 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"));
|
|
|
+
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
|
+ if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
|
+
|
|
|
+ Font redFont = workbook.createFont();
|
|
|
+ redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
|
|
|
+ redFont.setFontHeightInPoints(oldfontAt.getFontHeightInPoints());//设置字体大小
|
|
|
+ redFont.setFontName(oldfontAt.getFontName());//设置字体
|
|
|
+
|
|
|
+ CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
|
|
|
+ newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+ newStyle.setFont(redFont);
|
|
|
+ cell.setCellStyle(newStyle);
|
|
|
+ cell.setCellValue(e.getId() + "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- wb.saveToFile(excelPath, ExcelVersion.Version2010);
|
|
|
- FileUtils.excelToPdf(excelPath, pdfPath);
|
|
|
+ //输出流
|
|
|
+ FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
+ workbook.write(outputStream);
|
|
|
+ FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
|
|
|
+
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1).eq(TableFile::getTrialRecordId, id));
|
|
|
if (tableFile1 != null) {
|
|
@@ -2201,7 +2258,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
jdbcTemplate.execute(sql);
|
|
|
|
|
|
- wb.dispose();
|
|
|
return bladeFile2.getLink();
|
|
|
}
|
|
|
|
|
@@ -2271,10 +2327,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String querySql = "select id from u_information_query where classify ='" + classify + "' and wbs_id ='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
List<InformationQuery> query = jdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
if (query.size() > 0) {
|
|
|
- String updateSql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='" + trialProjectName + "' where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
+ String updateSql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='" + (StringUtils.isNotEmpty(trialProjectName) ? trialProjectName : "") + "' where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
jdbcTemplate.execute(updateSql);
|
|
|
} else {
|
|
|
- informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink(), trialProjectName);
|
|
|
+ informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink(), StringUtils.isNotEmpty(trialProjectName) ? trialProjectName : "");
|
|
|
}
|
|
|
|
|
|
return bladeFile.getLink();
|