Commit 8521b38d by manxiaoqiang

app排序

parent f0b8cd7f
......@@ -27,8 +27,8 @@
<file leaf-file-name="ContractController.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506">
<caret line="111" column="91" lean-forward="true" selection-start-line="111" selection-start-column="91" selection-end-line="111" selection-end-column="91" />
<state relative-caret-position="368">
<caret line="104" column="47" lean-forward="true" selection-start-line="104" selection-start-column="47" selection-end-line="104" selection-end-column="47" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......@@ -1443,14 +1443,7 @@
<workItem from="1517189406074" duration="8333000" />
<workItem from="1517275427548" duration="11524000" />
<workItem from="1517361892578" duration="19237000" />
<workItem from="1517447750893" duration="616000" />
</task>
<task id="LOCAL-00024" summary="pom">
<created>1515054597133</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1515054597133</updated>
<workItem from="1517447750893" duration="1793000" />
</task>
<task id="LOCAL-00025" summary="pom">
<created>1515061487894</created>
......@@ -1788,11 +1781,18 @@
<option name="project" value="LOCAL" />
<updated>1517399760213</updated>
</task>
<option name="localTasksCounter" value="73" />
<task id="LOCAL-00073" summary="app排序">
<created>1517452222290</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1517452222291</updated>
</task>
<option name="localTasksCounter" value="74" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="317663000" />
<option name="totallyTimeSpent" value="318840000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
......@@ -2426,8 +2426,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506">
<caret line="111" column="91" lean-forward="true" selection-start-line="111" selection-start-column="91" selection-end-line="111" selection-end-column="91" />
<state relative-caret-position="368">
<caret line="104" column="47" lean-forward="true" selection-start-line="104" selection-start-column="47" selection-end-line="104" selection-end-column="47" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......
......@@ -32,7 +32,9 @@ import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by mxq on 17/12/21.
......@@ -58,7 +60,11 @@ public class ContractController {
public ResponseEntity<byte[]> export(@PathVariable String platform, @RequestParam String startDate
, @RequestParam String endDate, HttpServletRequest request, HttpServletResponse response) {
List<Contract> contractList = service.findAll(startDate, endDate, platform);
Map<String, String> map = new HashMap<>();
map.put("wait", "未执行");
map.put("executing", "执行中");
map.put("end", "已结束");
map.put("cancel", "作废");
byte[] content = new byte[0];
StringBuilder sb = new StringBuilder();
......@@ -67,7 +73,7 @@ public class ContractController {
for (Contract c : contractList){
sb.append(c.getDs()).append(",").append(c.getContractCode()).append(",").append(c.getEmail()).append(",").append(c.getCustomerBody()).append(",").append(c.getSaleName()).append(",")
.append(c.getStartDate()).append(",").append(c.getEndDate()).append(",").append(c.getPriceLevelName()).append(",").append(c.getMoney()).append(",").append(c.getPayMoney()).append(",")
.append(c.getStatus()).append(",").append("\r\n");
.append(map.get(c.getStatus())).append("\r\n");
}
}
InputStream in = new ByteArrayInputStream(sb.toString().getBytes());
......@@ -79,7 +85,8 @@ public class ContractController {
HttpHeaders headers = new HttpHeaders();
response.setHeader("filename", "contract.txt");
response.setHeader("content-disposition", "attachment; filename=contract.txt");
response.setHeader("Content-Type", "application/octet-stream;charset=UTF-8");
response.setHeader("Content-Type","text/csv");
response.setContentType("APPLICATION/OCTET-STREAM");
//返回文件字符串
return new ResponseEntity<byte[]>(content, headers, HttpStatus.CREATED);
......@@ -90,14 +97,16 @@ public class ContractController {
public ResponseEntity<byte[]> exportPay( @RequestParam String startDate, @RequestParam String endDate,
HttpServletRequest request, HttpServletResponse response) {
List<ContractMoney> moneyList = service.findPay(startDate, endDate);
Map<String, String> map = new HashMap<>();
map.put("pay", "收款");
map.put("invoice", "收票");
byte[] content = new byte[0];
StringBuilder sb = new StringBuilder();
sb.append("合同编号 ,客户账号 ,签约方 ,事项 ,金额 ,日期 ,修改人 \r\n");
if(ValidateUtil.isValid(moneyList)){
for (ContractMoney c : moneyList){
sb.append(c.getContractCode()).append(",").append(c.getEmail()).append(",").append(c.getCompany()).append(",").append(c.getType()).append(",")
sb.append(c.getContractCode()).append(",").append(c.getEmail()).append(",").append(c.getCompany()).append(",").append(map.get(c.getType())).append(",")
.append(c.getMoney()).append(",").append(c.getDs()).append(",").append(c.getCreateName()).append("\r\n");
}
}
......
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