Commit 18f5a84e authored by 竹天卫's avatar 竹天卫

导出委托单示例

parent 98189e15
......@@ -3,18 +3,23 @@ package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.ReportDetailVo;
import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.EntrustVo;
import cn.wise.sc.cement.business.service.IEntrustService;
import cn.wise.sc.cement.business.util.WordUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -26,6 +31,7 @@ import java.util.Map;
* @since 2020-08-24
*/
@Api(tags="委托管理")
@Slf4j
@RestController
@RequestMapping("/business/entrust")
public class EntrustController {
......@@ -107,6 +113,27 @@ public class EntrustController {
return BaseResponse.errorMsg("失败!");
}
@GetMapping("/export/{entrustId}")
@ApiOperation("导出委托单")
public void getReportDetail(@PathVariable("entrustId") Integer entrustId,
HttpServletResponse response) {
// ReportDetailVo rts = iEntrustService.getReportDetail(entrustId);
EntrustVo entrustVo = entrustService.getDtail(entrustId).getData();
Map<String, Object> beanParams = new HashMap<>(7);
beanParams.put("clientName", entrustVo.getClientName());
beanParams.put("entrustCode", entrustVo.getEntrustCode());
beanParams.put("userName", entrustVo.getUserName());
beanParams.put("userPhone", entrustVo.getUserPhone());
beanParams.put("userFax", entrustVo.getUserFax());
beanParams.put("projectName", entrustVo.getProjectName());
beanParams.put("sampleNum", entrustVo.getSampleNum());
WordUtil.writeWordReport(entrustVo.getProjectName() + "(委托单)", "entrust.ftl",
beanParams, response);
}
@ApiOperation(value = "获取样品表里最大的本所编号")
@GetMapping("/getMaxCementCode")
public BaseResponse getMaxCementCode(){
......
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>12650</WindowHeight>
<WindowWidth>22260</WindowWidth>
<WindowTopX>32767</WindowTopX>
<WindowTopY>32767</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
<Style ss:ID="s64">
<Font ss:FontName="等线" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="8" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="52" ss:DefaultRowHeight="14">
<Column ss:AutoFitWidth="0" ss:Width="116.5"/>
<Column ss:AutoFitWidth="0" ss:Width="117"/>
<Row>
<Cell ss:MergeAcross="1" ss:StyleID="s63"><Data ss:Type="String">中国水泥发展中心物化检测所检测委托单</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托单位</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${clientName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托编号</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${entrustCode}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">委托人</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">电话</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userPhone}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">传真</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${userFax}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">项目名称</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${projectName}</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">样品数量</Data></Cell>
<Cell ss:StyleID="s64"><Data ss:Type="String">${sampleNum}</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>9</ActiveRow>
<ActiveCol>4</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment