|
@@ -685,7 +685,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public TransactionStatus beginTransaction(DataSourceTransactionManager transactionManager){
|
|
|
|
|
|
+ public TransactionStatus beginTransaction(DataSourceTransactionManager transactionManager) {
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();//事务定义类
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();//事务定义类
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
|
TransactionStatus status = transactionManager.getTransaction(def);// 返回事务对象
|
|
TransactionStatus status = transactionManager.getTransaction(def);// 返回事务对象
|
|
@@ -747,7 +747,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
jdbcTemplate.execute(delSql);
|
|
jdbcTemplate.execute(delSql);
|
|
jdbcTemplate.execute(sqlInfo);
|
|
jdbcTemplate.execute(sqlInfo);
|
|
transactionManager1.commit(transactionStatus);
|
|
transactionManager1.commit(transactionStatus);
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
transactionManager1.rollback(transactionStatus);
|
|
transactionManager1.rollback(transactionStatus);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@@ -946,7 +946,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
for (String key : mysqlData.keySet()) {
|
|
for (String key : mysqlData.keySet()) {
|
|
String tabVal = mysqlData.get(key) + "";
|
|
String tabVal = mysqlData.get(key) + "";
|
|
// 时间段处理
|
|
// 时间段处理
|
|
- if (StringUtils.isNotEmpty(tabVal) && tabVal.indexOf("null")<0) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(tabVal) && tabVal.indexOf("null") < 0) {
|
|
if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
|
|
if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
|
|
String[] tabData = tabVal.split("_\\^_");
|
|
String[] tabData = tabVal.split("_\\^_");
|
|
|
|
|
|
@@ -1031,7 +1031,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
public R getBussPdfInfo(Long pkeyId) throws Exception {
|
|
public R getBussPdfInfo(Long pkeyId) throws Exception {
|
|
|
|
|
|
//String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
//String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
- String file_path = "/Users/hongchuangyanfa/Desktop/";//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
|
|
+ String file_path = "C:\\Users\\泓创开发\\Desktop";//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
@@ -1072,27 +1072,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
int all = sheet.getRow(0).getLastCellNum();
|
|
int all = sheet.getRow(0).getLastCellNum();
|
|
int mergedCellCnt = sheet.getNumMergedRegions();
|
|
int mergedCellCnt = sheet.getNumMergedRegions();
|
|
- List<Map<String,Integer>> titleList = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < mergedCellCnt-1; i++) {
|
|
|
|
|
|
+ List<Map<String, Integer>> titleList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < mergedCellCnt - 1; i++) {
|
|
CellRangeAddress mergedCell = sheet.getMergedRegion(i);
|
|
CellRangeAddress mergedCell = sheet.getMergedRegion(i);
|
|
- int xx =mergedCell.getNumberOfCells();
|
|
|
|
- if(xx==all){
|
|
|
|
|
|
+ int xx = mergedCell.getNumberOfCells();
|
|
|
|
+ if (xx == all) {
|
|
int fisRow = mergedCell.getFirstRow();
|
|
int fisRow = mergedCell.getFirstRow();
|
|
int firsrCol = mergedCell.getFirstColumn();
|
|
int firsrCol = mergedCell.getFirstColumn();
|
|
Cell cell = sheet.getRow(fisRow).getCell(firsrCol);
|
|
Cell cell = sheet.getRow(fisRow).getCell(firsrCol);
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
Font fontAt = workbook.getFontAt(fontIndex);
|
|
Font fontAt = workbook.getFontAt(fontIndex);
|
|
short fontHeightInPoints = fontAt.getFontHeightInPoints();
|
|
short fontHeightInPoints = fontAt.getFontHeightInPoints();
|
|
- if(fontHeightInPoints>=14){
|
|
|
|
- Map<String,Integer> titleMap = new HashMap<>();
|
|
|
|
- titleMap.put("index",i);
|
|
|
|
- titleMap.put("x",firsrCol);
|
|
|
|
- titleMap.put("y",fisRow);
|
|
|
|
|
|
+ if (fontHeightInPoints >= 14) {
|
|
|
|
+ Map<String, Integer> titleMap = new HashMap<>();
|
|
|
|
+ titleMap.put("index", i);
|
|
|
|
+ titleMap.put("x", firsrCol);
|
|
|
|
+ titleMap.put("y", fisRow);
|
|
String data = cell.getStringCellValue();
|
|
String data = cell.getStringCellValue();
|
|
- if(StringUtils.isNotEmpty(data)){
|
|
|
|
- titleMap.put("val",2);
|
|
|
|
- }else{
|
|
|
|
- titleMap.put("val",1);
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(data)) {
|
|
|
|
+ titleMap.put("val", 2);
|
|
|
|
+ } else {
|
|
|
|
+ titleMap.put("val", 1);
|
|
}
|
|
}
|
|
titleList.add(titleMap);
|
|
titleList.add(titleMap);
|
|
}
|
|
}
|
|
@@ -1101,18 +1101,18 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
//添加标题
|
|
//添加标题
|
|
System.out.println(titleList.size());
|
|
System.out.println(titleList.size());
|
|
- if(titleList!=null){
|
|
|
|
- if(titleList.size()==1){
|
|
|
|
- Map<String,Integer> titData = titleList.get(0);
|
|
|
|
- if(titData.get("val")==1){
|
|
|
|
|
|
+ if (titleList != null) {
|
|
|
|
+ if (titleList.size() == 1) {
|
|
|
|
+ Map<String, Integer> titData = titleList.get(0);
|
|
|
|
+ if (titData.get("val") == 1) {
|
|
Cell cell = sheet.getRow(titData.get("y")).getCell(titData.get("x"));
|
|
Cell cell = sheet.getRow(titData.get("y")).getCell(titData.get("x"));
|
|
cell.setCellValue(projectInfo.getProjectName());
|
|
cell.setCellValue(projectInfo.getProjectName());
|
|
}
|
|
}
|
|
- }else if(titleList.size()>=2){
|
|
|
|
- for(int i=0;i<titleList.size();i++){
|
|
|
|
- Map<String,Integer> titData = titleList.get(i);
|
|
|
|
- if(titData.get("val")==2){
|
|
|
|
- Map<String,Integer> titData2 = titleList.get(i-1);
|
|
|
|
|
|
+ } else if (titleList.size() >= 2) {
|
|
|
|
+ for (int i = 0; i < titleList.size(); i++) {
|
|
|
|
+ Map<String, Integer> titData = titleList.get(i);
|
|
|
|
+ if (titData.get("val") == 2) {
|
|
|
|
+ Map<String, Integer> titData2 = titleList.get(i - 1);
|
|
Cell cell = sheet.getRow(titData2.get("y")).getCell(titData2.get("x"));
|
|
Cell cell = sheet.getRow(titData2.get("y")).getCell(titData2.get("x"));
|
|
cell.setCellValue(projectInfo.getProjectName());
|
|
cell.setCellValue(projectInfo.getProjectName());
|
|
}
|
|
}
|
|
@@ -1185,7 +1185,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
byte[] bytes = IOUtils.toByteArray(imageIn);
|
|
byte[] bytes = IOUtils.toByteArray(imageIn);
|
|
// 这里根据实际需求选择图片类型
|
|
// 这里根据实际需求选择图片类型
|
|
- int pictureIdx = workbook.addPicture(bytes,6);
|
|
|
|
|
|
+ int pictureIdx = workbook.addPicture(bytes, 6);
|
|
|
|
|
|
CreationHelper helper = workbook.getCreationHelper();
|
|
CreationHelper helper = workbook.getCreationHelper();
|
|
ClientAnchor anchor = helper.createClientAnchor();
|
|
ClientAnchor anchor = helper.createClientAnchor();
|
|
@@ -1198,19 +1198,19 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
// 插入图片
|
|
// 插入图片
|
|
Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
- pict.resize(1,1);
|
|
|
|
- FileUtils.imageOrientation(sheet, anchor, new DataVO(x1-1, y1-1) );
|
|
|
|
|
|
+ pict.resize(1, 1);
|
|
|
|
+ FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
|
|
|
|
|
|
- } else if(myData.equals("1") && data.html().indexOf("hc-form-checkbox-group")>=0){
|
|
|
|
- Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
|
|
- String exceVal = cell.getStringCellValue().replaceAll(" ","");
|
|
|
|
|
|
+ } else if (myData.equals("1") && data.html().indexOf("hc-form-checkbox-group") >= 0) {
|
|
|
|
+ Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
|
|
+ String exceVal = cell.getStringCellValue().replaceAll(" ", "");
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
Font fontAt = workbook.getFontAt(fontIndex);
|
|
Font fontAt = workbook.getFontAt(fontIndex);
|
|
fontAt.setFontName("EUDC");
|
|
fontAt.setFontName("EUDC");
|
|
- cell.setCellValue(exceVal.replace("□","\u2611"));
|
|
|
|
- }else {
|
|
|
|
- Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
|
|
- cell.setCellValue(myData);
|
|
|
|
|
|
+ cell.setCellValue(exceVal.replace("□", "\u2611"));
|
|
|
|
+ } else {
|
|
|
|
+ Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
|
|
+ cell.setCellValue(myData);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1237,7 +1237,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
|
|
|
- Cell cell = sheet.getRow(y1-1).getCell(x1-1);
|
|
|
|
|
|
+ Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
|
|
cell.setCellValue(e.getId() + "");
|
|
cell.setCellValue(e.getId() + "");
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
short fontIndex = cell.getCellStyle().getFontIndex();
|
|
Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
Font oldfontAt = workbook.getFontAt(fontIndex);
|
|
@@ -1254,7 +1254,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // wb.saveToFile(excelPath, ExcelVersion.Version2010);
|
|
|
|
|
|
+ // wb.saveToFile(excelPath, ExcelVersion.Version2010);
|
|
//输出流
|
|
//输出流
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
workbook.write(outputStream);
|
|
workbook.write(outputStream);
|
|
@@ -1312,8 +1312,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
|
|
public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
|
|
- //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
- String file_path = "/Users/hongchuangyanfa/Desktop/" ;//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
+ //String file_path = "/Users/hongchuangyanfa/Desktop/";//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
// 获取有权限的节点信息
|
|
// 获取有权限的节点信息
|
|
List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
|
|
List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
|
|
List<String> data = new ArrayList<>();
|
|
List<String> data = new ArrayList<>();
|
|
@@ -1341,15 +1341,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
FileUtils.mergePdfPublicMethods(data, listPdf);
|
|
FileUtils.mergePdfPublicMethods(data, listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
|
|
|
|
|
|
+ //获取当前填报节点sort
|
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
|
|
+
|
|
// 合并pdf集合
|
|
// 合并pdf集合
|
|
- String sql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
|
|
|
|
|
|
+ String sql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "' ,sort = " + (ObjectUtil.isNotEmpty(wbsTreeContract) ? wbsTreeContract.getSort() : 0) + " where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
|
|
jdbcTemplate.execute(sql);
|
|
jdbcTemplate.execute(sql);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 试验 获取填报信息
|
|
* 试验 获取填报信息
|
|
*/
|
|
*/
|