Commit 3f0008b70b7a28d19a5e31ceff273f8d7e86faaa

Authored by 陈杰
1 parent 261c4e04
Exists in master

1

src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
... ... @@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
17 17 import org.springframework.web.bind.annotation.RequestMethod;
18 18 import org.springframework.web.bind.annotation.RestController;
19 19  
20   -import javax.imageio.ImageIO;
21   -import javax.servlet.ServletOutputStream;
22 20 import javax.servlet.http.HttpServletResponse;
23   -import java.awt.image.BufferedImage;
24 21 import java.io.*;
25 22 import java.net.HttpURLConnection;
26 23 import java.net.URL;
... ... @@ -95,22 +92,27 @@ public class ReportVoluntaryController {
95 92 @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST)
96 93 @ApiOperation(value = "生成预支付订单并返回详情")
97 94 public JSONObject GetAddOrderDetail(@RequestBody Order order) {
98   - JSONObject object = new JSONObject();
99   - object.put("account",order.getAccount());
100   - object.put("expert_id",0);
101   - object.put("paymoney",order.getPaymoney());
102   - object.put("payway",2);
103   - object.put("product_detail","升学汇产品-代理商");
104   - object.put("product_id",order.getProduct_id());
105   - object.put("product_name",order.getProduct_name());
106   - object.put("type",order.getProduct_id());
107   - object.put("user_name",order.getUser_name());
108   - object.put("buycount",0);
109   - object.put("score_id",0);
110   - object.put("channelId",order.getChannelId());
111   - object.put("agentId",order.getAgentId());
112   - object.put("address",order.getAddress());
113   - return HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString());
  95 + try{
  96 + JSONObject object = new JSONObject();
  97 + object.put("account",order.getAccount());
  98 + object.put("expert_id",0);
  99 + object.put("paymoney",order.getPaymoney());
  100 + object.put("payway",2);
  101 + object.put("product_detail","升学汇产品-代理商");
  102 + object.put("product_id",order.getProduct_id());
  103 + object.put("product_name",order.getProduct_name());
  104 + object.put("type",order.getProduct_id());
  105 + object.put("user_name",order.getUser_name());
  106 + object.put("buycount",0);
  107 + object.put("score_id",0);
  108 + object.put("channelId",order.getChannelId());
  109 + object.put("agentId",order.getAgentId());
  110 + object.put("address",order.getAddress());
  111 + return HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString());
  112 + }catch (Exception e){
  113 + e.printStackTrace();
  114 + }
  115 + return null ;
114 116 }
115 117  
116 118 @RequestMapping(value = "WxPay",method = RequestMethod.POST)
... ... @@ -151,14 +153,13 @@ public class ReportVoluntaryController {
151 153 Channel channel = channelService.getDetail(channelId);
152 154 if(StringUtils.isBlank(channel.getReportRoutineUrl())){
153 155 createRoutine(channelId);
154   - String url = "https://market.myjxt.com:51315/smallRoutine/"+channelId+".png" ;
  156 + String url = "D:\\report\\img\\smallRoutine\\"+channelId+".png" ;
155 157 channel.setReportRoutineUrl(url);
156 158 channelService.updateRoutine(channelId,url);
157 159 }
158 160 try{
159   - String fileUrl = channel.getReportRoutineUrl().replace("https://market.myjxt.com:51315/smallRoutine/","c:\\report\\img\\smallRoutine\\");
160   - response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(channel.getName()+"动态码.jpg", "utf-8"));
161   - InputStream in = new FileInputStream(fileUrl);
  161 + response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(channel.getName()+"动态码.png", "utf-8"));
  162 + InputStream in = new FileInputStream(channel.getReportRoutineUrl());
162 163 OutputStream out = response.getOutputStream();
163 164 byte [] by = new byte[1024];
164 165 int i = 0;
... ... @@ -197,7 +198,7 @@ public class ReportVoluntaryController {
197 198 printWriter.flush();
198 199 //开始获取数据
199 200 BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());
200   - OutputStream os = new FileOutputStream(new File("C:\report\img\smallRoutine\"+channelId+".png"));
  201 + OutputStream os = new FileOutputStream(new File("D:\report\img\smallRoutine\"+channelId+".png"));
201 202 int len;
202 203 byte[] arr = new byte[1024];
203 204 while ((len = bis.read(arr)) != -1)
... ...
src/main/java/com/sincere/wechatbusiness/model/Channel.java
... ... @@ -31,8 +31,18 @@ public class Channel {
31 31 //小程序 动态码
32 32 private String reportRoutineUrl ;
33 33  
  34 + private int register ;
  35 +
34 36 private List<ChannelProduct> channelProductList;
35 37  
  38 + public int getRegister() {
  39 + return register;
  40 + }
  41 +
  42 + public void setRegister(int register) {
  43 + this.register = register;
  44 + }
  45 +
36 46 public String getReportRoutineUrl() {
37 47 return reportRoutineUrl;
38 48 }
... ...