Commit 8521b38d by manxiaoqiang

app排序

parent f0b8cd7f
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
<file leaf-file-name="ContractController.java" pinned="false" current-in-tab="true"> <file leaf-file-name="ContractController.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java"> <entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506"> <state relative-caret-position="368">
<caret line="111" column="91" lean-forward="true" selection-start-line="111" selection-start-column="91" selection-end-line="111" selection-end-column="91" /> <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> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
...@@ -1443,14 +1443,7 @@ ...@@ -1443,14 +1443,7 @@
<workItem from="1517189406074" duration="8333000" /> <workItem from="1517189406074" duration="8333000" />
<workItem from="1517275427548" duration="11524000" /> <workItem from="1517275427548" duration="11524000" />
<workItem from="1517361892578" duration="19237000" /> <workItem from="1517361892578" duration="19237000" />
<workItem from="1517447750893" duration="616000" /> <workItem from="1517447750893" duration="1793000" />
</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>
</task> </task>
<task id="LOCAL-00025" summary="pom"> <task id="LOCAL-00025" summary="pom">
<created>1515061487894</created> <created>1515061487894</created>
...@@ -1788,11 +1781,18 @@ ...@@ -1788,11 +1781,18 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1517399760213</updated> <updated>1517399760213</updated>
</task> </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 /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="317663000" /> <option name="totallyTimeSpent" value="318840000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" /> <frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
...@@ -2426,8 +2426,8 @@ ...@@ -2426,8 +2426,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java"> <entry file="file://$PROJECT_DIR$/src/main/java/common/controller/ContractController.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="506"> <state relative-caret-position="368">
<caret line="111" column="91" lean-forward="true" selection-start-line="111" selection-start-column="91" selection-end-line="111" selection-end-column="91" /> <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> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
......
...@@ -32,7 +32,9 @@ import java.net.URLConnection; ...@@ -32,7 +32,9 @@ import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by mxq on 17/12/21. * Created by mxq on 17/12/21.
...@@ -58,7 +60,11 @@ public class ContractController { ...@@ -58,7 +60,11 @@ public class ContractController {
public ResponseEntity<byte[]> export(@PathVariable String platform, @RequestParam String startDate public ResponseEntity<byte[]> export(@PathVariable String platform, @RequestParam String startDate
, @RequestParam String endDate, HttpServletRequest request, HttpServletResponse response) { , @RequestParam String endDate, HttpServletRequest request, HttpServletResponse response) {
List<Contract> contractList = service.findAll(startDate, endDate, platform); 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]; byte[] content = new byte[0];
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -67,7 +73,7 @@ public class ContractController { ...@@ -67,7 +73,7 @@ public class ContractController {
for (Contract c : contractList){ 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(",") 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.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()); InputStream in = new ByteArrayInputStream(sb.toString().getBytes());
...@@ -79,7 +85,8 @@ public class ContractController { ...@@ -79,7 +85,8 @@ public class ContractController {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
response.setHeader("filename", "contract.txt"); response.setHeader("filename", "contract.txt");
response.setHeader("content-disposition", "attachment; 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); return new ResponseEntity<byte[]>(content, headers, HttpStatus.CREATED);
...@@ -90,14 +97,16 @@ public class ContractController { ...@@ -90,14 +97,16 @@ public class ContractController {
public ResponseEntity<byte[]> exportPay( @RequestParam String startDate, @RequestParam String endDate, public ResponseEntity<byte[]> exportPay( @RequestParam String startDate, @RequestParam String endDate,
HttpServletRequest request, HttpServletResponse response) { HttpServletRequest request, HttpServletResponse response) {
List<ContractMoney> moneyList = service.findPay(startDate, endDate); List<ContractMoney> moneyList = service.findPay(startDate, endDate);
Map<String, String> map = new HashMap<>();
map.put("pay", "收款");
map.put("invoice", "收票");
byte[] content = new byte[0]; byte[] content = new byte[0];
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("合同编号 ,客户账号 ,签约方 ,事项 ,金额 ,日期 ,修改人 \r\n"); sb.append("合同编号 ,客户账号 ,签约方 ,事项 ,金额 ,日期 ,修改人 \r\n");
if(ValidateUtil.isValid(moneyList)){ if(ValidateUtil.isValid(moneyList)){
for (ContractMoney c : 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"); .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