|
@@ -2814,7 +2814,7 @@ public class TaskController extends BladeController {
|
|
|
/*设置表头*/
|
|
|
setTitle(sheet, tile);
|
|
|
/*添加电签*/
|
|
|
- setDQInfo(sheet, rs.getUrl(), tile);
|
|
|
+ setDQInfo(sheet, rs);
|
|
|
//去掉表格虚线
|
|
|
sheet.setPrintGridlines(false);
|
|
|
//设置 整个工作表为一页
|
|
@@ -2900,7 +2900,7 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
|
|
|
// 添加电签信息数据
|
|
|
- public void setDQInfo(Sheet sheet, String htmlUrl, String title) {
|
|
|
+ public void setDQInfoOld(Sheet sheet, String htmlUrl, String title) {
|
|
|
String file_path = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";//CollectionUtils.getSysLocalFileUrl();
|
|
|
// 添加电签关键字Id
|
|
|
String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
@@ -2970,7 +2970,56 @@ public class TaskController extends BladeController {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
+ public void setDQInfo(Sheet sheet, ReportResult rs){
|
|
|
+ /*电签信息已经和坐标一起给出*/
|
|
|
+ /*具体获取方法在 FormulaUtils 里的 public static Map<String,String> getESignMap(Document document)*/
|
|
|
+ Map<String,String> signMap =rs.getESignMap();
|
|
|
+ if(signMap.size()>0) {
|
|
|
+ signMap.forEach((k, dqVal) -> {
|
|
|
+ try {
|
|
|
+ String[] yx = k.split("_");
|
|
|
+ if(yx.length>=2){
|
|
|
+ int y1=Func.toInt(yx[0]);
|
|
|
+ int x1=Func.toInt(yx[1]);
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null && ObjectUtil.isNotEmpty(cell)) {
|
|
|
+ String dataInfo = cell.getStringCellValue();
|
|
|
+ //调用方法设置字体样式到单元格中的指定字符
|
|
|
+ Workbook workbook = cell.getSheet().getWorkbook();
|
|
|
+ CellStyle cellStyle = workbook.createCellStyle();
|
|
|
+ cellStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
+ Font newFont = workbook.createFont();
|
|
|
+ newFont.setFontHeightInPoints(workbook.getFontAt(cell.getCellStyle().getFontIndex()).getFontHeightInPoints());
|
|
|
+ if (dataInfo == null || StringUtil.isEmpty(dataInfo)) {
|
|
|
+ cell.setCellValue(dqVal);
|
|
|
+ newFont.setFontHeightInPoints((short) 1);
|
|
|
+ newFont.setColor(IndexedColors.WHITE.getIndex());
|
|
|
+ cellStyle.setFont(newFont);
|
|
|
+ } else {
|
|
|
+ String lastData = dataInfo + "*" + dqVal;
|
|
|
+ RichTextString richString = new XSSFRichTextString(lastData);
|
|
|
+ richString.clearFormatting();
|
|
|
+ richString.applyFont(0, dataInfo.length(), newFont);
|
|
|
+ newFont.setFontHeightInPoints((short) 1);
|
|
|
+ newFont.setColor(IndexedColors.WHITE.getIndex());
|
|
|
+ richString.applyFont(dataInfo.length(), lastData.length(), newFont);
|
|
|
+ cell.setCellValue(richString);
|
|
|
+ }
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ System.out.println(rs.getName()+"未找到电签配置信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
@Data
|
|
|
class Report {
|
|
|
public final String[] REPORT_TYPE = new String[]{"s_interim_pay_certificate", "s_material_start_statement", "s_material_start_statement"};
|