Commit 3f0008b70b7a28d19a5e31ceff273f8d7e86faaa
1 parent
261c4e04
Exists in
master
1
Showing
2 changed files
with
35 additions
and
24 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
@@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
17 | import org.springframework.web.bind.annotation.RequestMethod; | 17 | import org.springframework.web.bind.annotation.RequestMethod; |
18 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
19 | 19 | ||
20 | -import javax.imageio.ImageIO; | ||
21 | -import javax.servlet.ServletOutputStream; | ||
22 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
23 | -import java.awt.image.BufferedImage; | ||
24 | import java.io.*; | 21 | import java.io.*; |
25 | import java.net.HttpURLConnection; | 22 | import java.net.HttpURLConnection; |
26 | import java.net.URL; | 23 | import java.net.URL; |
@@ -95,22 +92,27 @@ public class ReportVoluntaryController { | @@ -95,22 +92,27 @@ public class ReportVoluntaryController { | ||
95 | @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) | 92 | @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) |
96 | @ApiOperation(value = "生成预支付订单并返回详情") | 93 | @ApiOperation(value = "生成预支付订单并返回详情") |
97 | public JSONObject GetAddOrderDetail(@RequestBody Order order) { | 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 | @RequestMapping(value = "WxPay",method = RequestMethod.POST) | 118 | @RequestMapping(value = "WxPay",method = RequestMethod.POST) |
@@ -151,14 +153,13 @@ public class ReportVoluntaryController { | @@ -151,14 +153,13 @@ public class ReportVoluntaryController { | ||
151 | Channel channel = channelService.getDetail(channelId); | 153 | Channel channel = channelService.getDetail(channelId); |
152 | if(StringUtils.isBlank(channel.getReportRoutineUrl())){ | 154 | if(StringUtils.isBlank(channel.getReportRoutineUrl())){ |
153 | createRoutine(channelId); | 155 | createRoutine(channelId); |
154 | - String url = "https://market.myjxt.com:51315/smallRoutine/"+channelId+".png" ; | 156 | + String url = "D:\\report\\img\\smallRoutine\\"+channelId+".png" ; |
155 | channel.setReportRoutineUrl(url); | 157 | channel.setReportRoutineUrl(url); |
156 | channelService.updateRoutine(channelId,url); | 158 | channelService.updateRoutine(channelId,url); |
157 | } | 159 | } |
158 | try{ | 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 | OutputStream out = response.getOutputStream(); | 163 | OutputStream out = response.getOutputStream(); |
163 | byte [] by = new byte[1024]; | 164 | byte [] by = new byte[1024]; |
164 | int i = 0; | 165 | int i = 0; |
@@ -197,7 +198,7 @@ public class ReportVoluntaryController { | @@ -197,7 +198,7 @@ public class ReportVoluntaryController { | ||
197 | printWriter.flush(); | 198 | printWriter.flush(); |
198 | //开始获取数据 | 199 | //开始获取数据 |
199 | BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream()); | 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 | int len; | 202 | int len; |
202 | byte[] arr = new byte[1024]; | 203 | byte[] arr = new byte[1024]; |
203 | while ((len = bis.read(arr)) != -1) | 204 | while ((len = bis.read(arr)) != -1) |
src/main/java/com/sincere/wechatbusiness/model/Channel.java
@@ -31,8 +31,18 @@ public class Channel { | @@ -31,8 +31,18 @@ public class Channel { | ||
31 | //小程序 动态码 | 31 | //小程序 动态码 |
32 | private String reportRoutineUrl ; | 32 | private String reportRoutineUrl ; |
33 | 33 | ||
34 | + private int register ; | ||
35 | + | ||
34 | private List<ChannelProduct> channelProductList; | 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 | public String getReportRoutineUrl() { | 46 | public String getReportRoutineUrl() { |
37 | return reportRoutineUrl; | 47 | return reportRoutineUrl; |
38 | } | 48 | } |