Commit bbcd213feba6035890116edefcb4e8ac2945dbcb

Authored by 陈杰
1 parent b68eea61
Exists in master

渠道商 动态码

src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
@@ -10,7 +10,6 @@ import com.sincere.wechatbusiness.logs.LogName; @@ -10,7 +10,6 @@ import com.sincere.wechatbusiness.logs.LogName;
10 import com.sincere.wechatbusiness.logs.LoggerUtils; 10 import com.sincere.wechatbusiness.logs.LoggerUtils;
11 import com.sincere.wechatbusiness.model.*; 11 import com.sincere.wechatbusiness.model.*;
12 import com.sincere.wechatbusiness.service.*; 12 import com.sincere.wechatbusiness.service.*;
13 -import com.sincere.wechatbusiness.utils.HttpClientUtils;  
14 import com.sincere.wechatbusiness.utils.Page; 13 import com.sincere.wechatbusiness.utils.Page;
15 import com.sincere.wechatbusiness.utils.TokenUtils; 14 import com.sincere.wechatbusiness.utils.TokenUtils;
16 import io.swagger.annotations.ApiOperation; 15 import io.swagger.annotations.ApiOperation;
@@ -104,7 +103,7 @@ public class ChannelController { @@ -104,7 +103,7 @@ public class ChannelController {
104 } 103 }
105 } 104 }
106 } 105 }
107 - }else if(channel.getTemplateId() == 2){ 106 + }else if(channel.getTemplateId() == 2 || channel.getTemplateId() == 3){
108 List<Banner> banners = bannerService.getList(copyDto.getSourceId()); 107 List<Banner> banners = bannerService.getList(copyDto.getSourceId());
109 List<BannerNext> bannerNexts = bannerService.getBannerNextList(copyDto.getSourceId()); 108 List<BannerNext> bannerNexts = bannerService.getBannerNextList(copyDto.getSourceId());
110 for(Integer channelId : copyDto.getTargetIdList()){ 109 for(Integer channelId : copyDto.getTargetIdList()){
@@ -119,6 +118,15 @@ public class ChannelController { @@ -119,6 +118,15 @@ public class ChannelController {
119 bannerService.copyBannerNext(bannerNext); 118 bannerService.copyBannerNext(bannerNext);
120 } 119 }
121 } 120 }
  121 + }else if(channel.getTemplateId() == 4){
  122 + List<Banner> banners = bannerService.getList(copyDto.getSourceId());
  123 + for(Integer channelId : copyDto.getTargetIdList()){
  124 + bannerService.deleteChannelBanner(channelId);
  125 + for(Banner banner : banners){
  126 + banner.setChannelId(channelId);
  127 + bannerService.copy(banner);
  128 + }
  129 + }
122 } 130 }
123 return new BaseDto(); 131 return new BaseDto();
124 } 132 }
src/main/java/com/sincere/wechatbusiness/controller/CodeController.java
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
1 -//package com.sincere.wechatbusiness.controller;  
2 -//  
3 -//import com.alibaba.fastjson.JSONObject;  
4 -//import com.sincere.wechatbusiness.utils.HttpClientUtils;  
5 -//import org.springframework.web.bind.annotation.RestController;  
6 -//  
7 -//import java.io.*;  
8 -//import java.net.HttpURLConnection;  
9 -//import java.net.URL;  
10 -//  
11 -//@RestController  
12 -//public class CodeController {  
13 -//  
14 -// private static String appId = "wxd055a716238e1bd7";  
15 -// private static String secret = "c6912d34732b65116b8b4e9d5f8a81a5";  
16 -//  
17 -// public static void main(String[] args){  
18 -// String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;  
19 -// JSONObject object = HttpClientUtils.httpGet(url) ;  
20 -// String token = object.get("access_token").toString();  
21 -// try {  
22 -// URL imgUrl = new URL("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+token);  
23 -// HttpURLConnection httpURLConnection = (HttpURLConnection) imgUrl.openConnection();  
24 -// httpURLConnection.setRequestMethod("POST");// 提交模式  
25 -// // conn.setConnectTimeout(10000);//连接超时 单位毫秒  
26 -// // conn.setReadTimeout(2000);//读取超时 单位毫秒  
27 -// // 发送POST请求必须设置如下两行  
28 -// httpURLConnection.setDoOutput(true);  
29 -// httpURLConnection.setDoInput(true);  
30 -// // 获取URLConnection对象对应的输出流  
31 -// PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());  
32 -// // 发送请求参数  
33 -// JSONObject paramJson = new JSONObject();  
34 -// paramJson.put("scene", "channel=2");  
35 -// paramJson.put("page", "pages/index/index");  
36 -// paramJson.put("width", 430);  
37 -// paramJson.put("auto_color", true);  
38 -// printWriter.write(paramJson.toString());  
39 -// // flush输出流的缓冲  
40 -// printWriter.flush();  
41 -// //开始获取数据  
42 -// BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());  
43 -// OutputStream os = new FileOutputStream(new File("C:\\Users\\chen\\Desktop\\abc.png"));  
44 -// int len;  
45 -// byte[] arr = new byte[1024];  
46 -// while ((len = bis.read(arr)) != -1)  
47 -// {  
48 -// os.write(arr, 0, len);  
49 -// os.flush();  
50 -// }  
51 -// os.close();  
52 -// }  
53 -// catch (Exception e)  
54 -// {  
55 -// e.printStackTrace();  
56 -// }  
57 -// }  
58 -//}  
src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
1 package com.sincere.wechatbusiness.controller; 1 package com.sincere.wechatbusiness.controller;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.sincere.wechatbusiness.dto.BaseDto;
  5 +import com.sincere.wechatbusiness.model.Channel;
4 import com.sincere.wechatbusiness.model.Order; 6 import com.sincere.wechatbusiness.model.Order;
5 import com.sincere.wechatbusiness.model.Users; 7 import com.sincere.wechatbusiness.model.Users;
6 import com.sincere.wechatbusiness.model.WxPay; 8 import com.sincere.wechatbusiness.model.WxPay;
  9 +import com.sincere.wechatbusiness.service.ChannelService;
7 import com.sincere.wechatbusiness.utils.HttpClientUtils; 10 import com.sincere.wechatbusiness.utils.HttpClientUtils;
8 import io.swagger.annotations.ApiOperation; 11 import io.swagger.annotations.ApiOperation;
  12 +import org.apache.commons.lang3.StringUtils;
  13 +import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.beans.factory.annotation.Value; 14 import org.springframework.beans.factory.annotation.Value;
10 import org.springframework.web.bind.annotation.RequestBody; 15 import org.springframework.web.bind.annotation.RequestBody;
11 import org.springframework.web.bind.annotation.RequestMapping; 16 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RequestMethod; 17 import org.springframework.web.bind.annotation.RequestMethod;
13 import org.springframework.web.bind.annotation.RestController; 18 import org.springframework.web.bind.annotation.RestController;
14 19
  20 +import java.io.*;
  21 +import java.net.HttpURLConnection;
  22 +import java.net.URL;
  23 +
15 @RestController 24 @RestController
16 @RequestMapping("reportVoluntary") 25 @RequestMapping("reportVoluntary")
17 public class ReportVoluntaryController { 26 public class ReportVoluntaryController {
@@ -19,6 +28,11 @@ public class ReportVoluntaryController { @@ -19,6 +28,11 @@ public class ReportVoluntaryController {
19 @Value("${reportVoluntary}") 28 @Value("${reportVoluntary}")
20 private String domain ; 29 private String domain ;
21 30
  31 + @Autowired
  32 + ChannelService channelService;
  33 +
  34 + private static String appId = "wxd055a716238e1bd7";
  35 + private static String secret = "c6912d34732b65116b8b4e9d5f8a81a5";
22 36
23 @ApiOperation("获取支付成功之后分享列表 coupon_type AI 1 || 专家 2 ") 37 @ApiOperation("获取支付成功之后分享列表 coupon_type AI 1 || 专家 2 ")
24 @RequestMapping(value = "/getShareCouponList" , method = RequestMethod.GET) 38 @RequestMapping(value = "/getShareCouponList" , method = RequestMethod.GET)
@@ -110,4 +124,90 @@ public class ReportVoluntaryController { @@ -110,4 +124,90 @@ public class ReportVoluntaryController {
110 object.put("openid",pay.getOpenid()); 124 object.put("openid",pay.getOpenid());
111 return HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); 125 return HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString());
112 } 126 }
  127 +
  128 +
  129 + @RequestMapping(value = "getData",method = RequestMethod.GET)
  130 + @ApiOperation(value = "type 1 ai 2 expert")
  131 + public JSONObject getData(int type){
  132 + String url = domain+"/data/getData?type="+type ;
  133 + return HttpClientUtils.httpGet(url);
  134 + }
  135 +
  136 + @ApiOperation("获取商品列表 全部列表point传0 好评point传5")
  137 + @RequestMapping(value = "/getEvaluationList" , method = RequestMethod.GET)
  138 + public JSONObject getEvaluationList(int packageId , int point , int page , int pageSize){
  139 + String url = domain+"/h5/order/getEvaluationList?packageId="+packageId+"&point="+point+"&page="+page+"&pageSize="+pageSize ;
  140 + return HttpClientUtils.httpGet(url);
  141 + }
  142 +
  143 + @ApiOperation("获取小程序动态码")
  144 + @RequestMapping(value = "/downloadSmallRoutine" , method = RequestMethod.GET)
  145 + public BaseDto downloadSmallRoutine(int channelId){
  146 + BaseDto result = new BaseDto();
  147 + Channel channel = channelService.getDetail(channelId);
  148 + if(StringUtils.isBlank(channel.getReportRoutineUrl())){
  149 + createRoutine(channelId);
  150 + String prefix = domain.replaceAll("51314","51315");
  151 + String url = prefix+"smallRoutine\\"+channelId+".png" ;
  152 + channel.setReportRoutineUrl(url);
  153 + channelService.updateRoutine(channelId,url);
  154 + }
  155 + result.setData(channel.getReportRoutineUrl());
  156 + return result ;
  157 +
  158 + }
  159 +
  160 + public void createRoutine(int channelId){
  161 + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+secret;
  162 + JSONObject object = HttpClientUtils.httpGet(url) ;
  163 + String token = object.get("access_token").toString();
  164 + try {
  165 + URL imgUrl = new URL("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+token);
  166 + HttpURLConnection httpURLConnection = (HttpURLConnection) imgUrl.openConnection();
  167 + httpURLConnection.setRequestMethod("POST");// 提交模式
  168 + // conn.setConnectTimeout(10000);//连接超时 单位毫秒
  169 + // conn.setReadTimeout(2000);//读取超时 单位毫秒
  170 + // 发送POST请求必须设置如下两行
  171 + httpURLConnection.setDoOutput(true);
  172 + httpURLConnection.setDoInput(true);
  173 + // 获取URLConnection对象对应的输出流
  174 + PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
  175 + // 发送请求参数
  176 + JSONObject paramJson = new JSONObject();
  177 + paramJson.put("scene", "channel="+channelId);
  178 + paramJson.put("page", "pages/index/index");
  179 + paramJson.put("width", 430);
  180 + paramJson.put("auto_color", true);
  181 + printWriter.write(paramJson.toString());
  182 + // flush输出流的缓冲
  183 + printWriter.flush();
  184 + //开始获取数据
  185 + BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());
  186 + OutputStream os = new FileOutputStream(new File("D:\\report\\img\\smallRoutine\\"+channelId+".png"));
  187 + int len;
  188 + byte[] arr = new byte[1024];
  189 + while ((len = bis.read(arr)) != -1)
  190 + {
  191 + os.write(arr, 0, len);
  192 + os.flush();
  193 + }
  194 + os.close();
  195 + }
  196 + catch (Exception e)
  197 + {
  198 + e.printStackTrace();
  199 + }
  200 + }
  201 +
  202 + @ApiOperation("获取渠道商推广的用户")
  203 + @RequestMapping(value = "/getUserList" , method = RequestMethod.GET)
  204 + public JSONObject getUserList(int channelId , int page , int pageSize){
  205 + JSONObject search = new JSONObject();
  206 + search.put("userType",1);
  207 + search.put("page",page);
  208 + search.put("pageSize",pageSize);
  209 + search.put("channelId",channelId);
  210 + String url = domain+"/admin/Voluntary/GetUserList";
  211 + return HttpClientUtils.httpPostJson(url,search.toJSONString());
  212 + }
113 } 213 }
src/main/java/com/sincere/wechatbusiness/controller/TokenController.java
@@ -3,18 +3,16 @@ package com.sincere.wechatbusiness.controller; @@ -3,18 +3,16 @@ package com.sincere.wechatbusiness.controller;
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.sincere.wechatbusiness.mapper.ChannelMapper; 4 import com.sincere.wechatbusiness.mapper.ChannelMapper;
5 import com.sincere.wechatbusiness.model.AccessToken; 5 import com.sincere.wechatbusiness.model.AccessToken;
6 -import com.sincere.wechatbusiness.model.Channel;  
7 import com.sincere.wechatbusiness.model.Token; 6 import com.sincere.wechatbusiness.model.Token;
  7 +import com.sincere.wechatbusiness.service.BannerService;
  8 +import com.sincere.wechatbusiness.service.ChannelProductService;
8 import com.sincere.wechatbusiness.service.ChannelService; 9 import com.sincere.wechatbusiness.service.ChannelService;
9 -import com.sincere.wechatbusiness.utils.HttpClientUtils;  
10 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.RequestMapping; 12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod; 13 import org.springframework.web.bind.annotation.RequestMethod;
14 import org.springframework.web.bind.annotation.RestController; 14 import org.springframework.web.bind.annotation.RestController;
15 15
16 -import java.io.BufferedReader;  
17 -import java.io.FileReader;  
18 import java.io.IOException; 16 import java.io.IOException;
19 import java.io.InputStream; 17 import java.io.InputStream;
20 import java.net.HttpURLConnection; 18 import java.net.HttpURLConnection;
@@ -32,6 +30,12 @@ public class TokenController { @@ -32,6 +30,12 @@ public class TokenController {
32 @Autowired 30 @Autowired
33 ChannelMapper channelMapper; 31 ChannelMapper channelMapper;
34 32
  33 + @Autowired
  34 + ChannelProductService channelProductService ;
  35 +
  36 + @Autowired
  37 + BannerService bannerService ;
  38 +
35 private static String appId = "wx6078ff3f67524996" ; 39 private static String appId = "wx6078ff3f67524996" ;
36 private static String secret = "8a0465b8ad0f000f568f48853e2818c8" ; 40 private static String secret = "8a0465b8ad0f000f568f48853e2818c8" ;
37 41
@@ -99,24 +103,129 @@ public class TokenController { @@ -99,24 +103,129 @@ public class TokenController {
99 return token; 103 return token;
100 } 104 }
101 105
102 - @RequestMapping(value = "test",method = RequestMethod.GET)  
103 - public void test(){  
104 - try {  
105 - FileReader fr = new FileReader("C:\\Users\\chen\\Desktop\\name.txt");  
106 - BufferedReader bf = new BufferedReader(fr);  
107 - String str;  
108 - // 按行读取字符串  
109 - while ((str = bf.readLine()) != null) {  
110 - Channel channel = channelMapper.getByName(str+"团购");  
111 - int pageView = channelService.getPageViewCount(channel.getId(),0,3);  
112 - int register = channelService.getRegisterCount(channel.getId(),0,3);  
113 - int order = channelService.getOrderCount(channel.getId(),0,3);  
114 - System.out.println(str+"---浏览量:" + pageView+";---注册量:"+register+";---订单量:"+order);  
115 - }  
116 - bf.close();  
117 - fr.close();  
118 - } catch (IOException e) {  
119 - e.printStackTrace();  
120 - }  
121 - } 106 +// @RequestMapping(value = "test",method = RequestMethod.GET)
  107 +// public void test(){
  108 +// try {
  109 +// FileReader fr = new FileReader("C:\\Users\\chen\\Desktop\\name.txt");
  110 +// BufferedReader bf = new BufferedReader(fr);
  111 +// String str;
  112 +// // 按行读取字符串
  113 +// while ((str = bf.readLine()) != null) {
  114 +// Channel channel = channelMapper.getByName(str+"团购");
  115 +// int pageView = channelService.getPageViewCount(channel.getId(),0,3);
  116 +// int register = channelService.getRegisterCount(channel.getId(),0,3);
  117 +// int order = channelService.getOrderCount(channel.getId(),0,3);
  118 +// System.out.println(str+"---浏览量:" + pageView+";---注册量:"+register+";---订单量:"+order);
  119 +// }
  120 +// bf.close();
  121 +// fr.close();
  122 +// } catch (IOException e) {
  123 +// e.printStackTrace();
  124 +// }
  125 +// }
  126 +
  127 +// @RequestMapping(value = "test2",method = RequestMethod.GET)
  128 +// public void test2(){
  129 +// try {
  130 +// FileReader fr = new FileReader("C:\\Users\\chen\\Desktop\\company.txt");
  131 +// BufferedReader bf = new BufferedReader(fr);
  132 +// String str;
  133 +// // 按行读取字符串
  134 +// while ((str = bf.readLine()) != null) {
  135 +// String[] msg = str.split(",");
  136 +// Channel channel = new Channel();
  137 +// channel.setName("顺治"+msg[0]);
  138 +// channel.setMobile(msg[1]);
  139 +// channel.setProvince("浙江省");
  140 +// channel.setCity("绍兴市");
  141 +// channel.setTemplateId(4);
  142 +// channel.setState(1);
  143 +// channelService.insert(channel);
  144 +// for(int i = 1 ; i <= 2; i++){
  145 +// ChannelProduct channelProduct = new ChannelProduct();
  146 +// channelProduct.setChannelId(channel.getId());
  147 +// JSONObject jsonObject = HttpClientUtils.httpGet("https://proxy.shunzhi.net:51314/University/getPackageById?id="+i);
  148 +// String data = jsonObject.getString("data");
  149 +// DiscountPackage model= JSON.parseObject(data,new TypeReference<DiscountPackage>(){});
  150 +// channelProduct.setChannelTitle(model.getPackage_name());
  151 +// channelProduct.setChannelImg(model.getPhoto());
  152 +// channelProduct.setChannelRequire(model.getDescribe());
  153 +// channelProduct.setChannelExplain(model.getRequire());
  154 +// channelProduct.setProductId(i);
  155 +// channelProduct.setProductName(model.getPackage_name());
  156 +// channelProduct.setPrice(model.getPrice());
  157 +// channelProduct.setImgUrl(model.getPhoto());
  158 +// if(i == 1){
  159 +// channelProduct.setChannelPrice("199");
  160 +// }else {
  161 +// channelProduct.setChannelPrice("999");
  162 +// }
  163 +// channelProductService.insert(channelProduct);
  164 +// }
  165 +// }
  166 +// bf.close();
  167 +// fr.close();
  168 +// } catch (IOException e) {
  169 +// e.printStackTrace();
  170 +// }
  171 +// }
  172 +
  173 +
  174 +// @RequestMapping(value = "test3",method = RequestMethod.GET)
  175 +// public void test3(){
  176 +// try {
  177 +// FileReader fr = new FileReader("C:\\Users\\chen\\Desktop\\company.txt");
  178 +// BufferedReader bf = new BufferedReader(fr);
  179 +// String str;
  180 +// // 按行读取字符串
  181 +// List<ChannelProduct> list = channelProductService.getList(1472);
  182 +// ChannelProduct aiProduct = new ChannelProduct();
  183 +// ChannelProduct expertProduct = new ChannelProduct();
  184 +// //List<Banner> banners = bannerService.getList(1472);
  185 +// for(ChannelProduct channelProduct : list){
  186 +// if(channelProduct.getProductId() == 1){
  187 +// aiProduct = channelProduct;
  188 +// }
  189 +// if(channelProduct.getProductId() == 2){
  190 +// expertProduct = channelProduct;
  191 +// }
  192 +// }
  193 +// while ((str = bf.readLine()) != null) {
  194 +// String name = str.split(",")[0];
  195 +// Channel channel = channelMapper.getByName("顺治"+name);
  196 +// List<ChannelProduct> products = channelProductService.getList(channel.getId());
  197 +// int ai = 0, expert = 0 ;
  198 +// for(ChannelProduct channelProduct : products){
  199 +// if(channelProduct.getProductId() == 1){
  200 +// ai = channelProduct.getId();
  201 +// channelProduct.setChannelRequire(null);
  202 +// channelProduct.setChannelExplain(aiProduct.getChannelExplain());
  203 +// channelProductService.updateChannelProductMsg(channelProduct);
  204 +// }else {
  205 +// expert = channelProduct.getId();
  206 +// channelProduct.setChannelRequire(null);
  207 +// channelProduct.setChannelExplain(expertProduct.getChannelExplain());
  208 +// channelProductService.updateChannelProductMsg(channelProduct);
  209 +// }
  210 +// }
  211 +//
  212 +//// bannerService.deleteChannelBanner(channel.getId());
  213 +//// for(Banner banner : banners){
  214 +//// if(banner.getLinkUrl().equals("http://market.myjxt.com/wap/index.html#/CommodityDetail?id=1518&productId=1")){
  215 +//// banner.setLinkUrl("http://market.myjxt.com/wap/index.html#/CommodityDetail?id="+ai+"&productId=1");
  216 +//// }else if(banner.getLinkUrl().equals("http://market.myjxt.com/wap/index.html#/CommodityDetail?id=1517&productId=2")){
  217 +//// banner.setLinkUrl("http://market.myjxt.com/wap/index.html#/CommodityDetail?id="+expert+"&productId=2");
  218 +//// }
  219 +//// banner.setChannelId(channel.getId());
  220 +//// bannerService.copy(banner);
  221 +//// }
  222 +// }
  223 +// bf.close();
  224 +// fr.close();
  225 +// } catch (IOException e) {
  226 +// e.printStackTrace();
  227 +// }
  228 +// }
  229 +
  230 +
122 } 231 }
src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
@@ -24,6 +24,8 @@ public interface ChannelMapper { @@ -24,6 +24,8 @@ public interface ChannelMapper {
24 24
25 int deleteChannel(int id); 25 int deleteChannel(int id);
26 26
  27 + int updateRoutine(@Param("id")int id , @Param("reportRoutineUrl")String reportRoutineUrl);
  28 +
27 List<Area> getProvince(); 29 List<Area> getProvince();
28 30
29 List<Area> getCity(String areaCode); 31 List<Area> getCity(String areaCode);
src/main/java/com/sincere/wechatbusiness/model/Channel.java
@@ -28,8 +28,19 @@ public class Channel { @@ -28,8 +28,19 @@ public class Channel {
28 28
29 private String cityCode; 29 private String cityCode;
30 30
  31 + //小程序 动态码
  32 + private String reportRoutineUrl ;
  33 +
31 private List<ChannelProduct> channelProductList; 34 private List<ChannelProduct> channelProductList;
32 35
  36 + public String getReportRoutineUrl() {
  37 + return reportRoutineUrl;
  38 + }
  39 +
  40 + public void setReportRoutineUrl(String reportRoutineUrl) {
  41 + this.reportRoutineUrl = reportRoutineUrl;
  42 + }
  43 +
33 public Integer getId() { 44 public Integer getId() {
34 return id; 45 return id;
35 } 46 }
src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
@@ -2,8 +2,6 @@ package com.sincere.wechatbusiness.service; @@ -2,8 +2,6 @@ package com.sincere.wechatbusiness.service;
2 2
3 import com.sincere.wechatbusiness.model.*; 3 import com.sincere.wechatbusiness.model.*;
4 import com.sincere.wechatbusiness.utils.Page; 4 import com.sincere.wechatbusiness.utils.Page;
5 -import org.apache.ibatis.annotations.Param;  
6 -import org.springframework.web.bind.annotation.RequestParam;  
7 5
8 import java.util.List; 6 import java.util.List;
9 7
@@ -21,6 +19,8 @@ public interface ChannelService { @@ -21,6 +19,8 @@ public interface ChannelService {
21 19
22 int deleteChannel(int id); 20 int deleteChannel(int id);
23 21
  22 + int updateRoutine(int id ,String reportRoutineUrl);
  23 +
24 List<Area> getAreaList(); 24 List<Area> getAreaList();
25 25
26 List<Template> getTemplateList(); 26 List<Template> getTemplateList();
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java
@@ -10,6 +10,7 @@ import java.util.List; @@ -10,6 +10,7 @@ import java.util.List;
10 10
11 @Service 11 @Service
12 public class ChannelProductServiceImpl implements ChannelProductService { 12 public class ChannelProductServiceImpl implements ChannelProductService {
  13 +
13 @Autowired 14 @Autowired
14 ChannelProductMapper channelProductMapper; 15 ChannelProductMapper channelProductMapper;
15 16
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
@@ -46,6 +46,11 @@ public class ChannelServiceImpl implements ChannelService { @@ -46,6 +46,11 @@ public class ChannelServiceImpl implements ChannelService {
46 public int deleteChannel(int id){return channelMapper.deleteChannel(id);} 46 public int deleteChannel(int id){return channelMapper.deleteChannel(id);}
47 47
48 @Override 48 @Override
  49 + public int updateRoutine(int id, String reportRoutineUrl) {
  50 + return channelMapper.updateRoutine(id,reportRoutineUrl);
  51 + }
  52 +
  53 + @Override
49 public List<Area> getAreaList(){ 54 public List<Area> getAreaList(){
50 List<Area> areaList=channelMapper.getProvince(); 55 List<Area> areaList=channelMapper.getProvince();
51 for (Area area:areaList) 56 for (Area area:areaList)
src/main/resources/mapper/ChannelMapper.xml
@@ -14,12 +14,17 @@ @@ -14,12 +14,17 @@
14 <result column="template_name" jdbcType="VARCHAR" property="templateName" /> 14 <result column="template_name" jdbcType="VARCHAR" property="templateName" />
15 <result column="province_code" jdbcType="VARCHAR" property="provinceCode" /> 15 <result column="province_code" jdbcType="VARCHAR" property="provinceCode" />
16 <result column="city_code" jdbcType="VARCHAR" property="cityCode" /> 16 <result column="city_code" jdbcType="VARCHAR" property="cityCode" />
  17 + <result column="report_routine_url" jdbcType="VARCHAR" property="reportRoutineUrl" />
17 </resultMap> 18 </resultMap>
18 19
19 <select id="getByName" parameterType="java.lang.String" resultMap="ChannelMap"> 20 <select id="getByName" parameterType="java.lang.String" resultMap="ChannelMap">
20 select * from channel where name = #{name} and state = 1 21 select * from channel where name = #{name} and state = 1
21 </select> 22 </select>
22 23
  24 + <update id="updateRoutine" >
  25 + update channel set report_routine_url = #{reportRoutineUrl} where id = #{id}
  26 + </update>
  27 +
23 <resultMap id="AreaMap" type="com.sincere.wechatbusiness.model.Area"> 28 <resultMap id="AreaMap" type="com.sincere.wechatbusiness.model.Area">
24 <result column="value" jdbcType="VARCHAR" property="value" /> 29 <result column="value" jdbcType="VARCHAR" property="value" />
25 <result column="label" jdbcType="VARCHAR" property="label" /> 30 <result column="label" jdbcType="VARCHAR" property="label" />
src/main/resources/mapper/ChannelProductMapper.xml
@@ -27,9 +27,11 @@ @@ -27,9 +27,11 @@
27 </select> 27 </select>
28 28
29 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.ChannelProduct"> 29 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
30 - insert into channel_product (channelId,productId,product_name,price,img_url,channel_title,channel_img,channel_require,channel_explain) 30 + insert into channel_product (channelId,productId,product_name,price,img_url,
  31 + channel_title,channel_img,channel_require,channel_explain,channel_price)
31 values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, 32 values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR},
32 - #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{channelTitle},#{channelImg},#{channelRequire},#{channelExplain} 33 + #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{channelTitle},#{channelImg},#{channelRequire},
  34 + #{channelExplain},#{channelPrice}
33 ) 35 )
34 </insert> 36 </insert>
35 37
@@ -42,6 +44,9 @@ @@ -42,6 +44,9 @@
42 <update id="update" parameterType="com.sincere.wechatbusiness.model.ChannelProduct"> 44 <update id="update" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
43 update channel_product 45 update channel_product
44 <trim prefix="set" suffixOverrides=","> 46 <trim prefix="set" suffixOverrides=",">
  47 + <if test="imgUrl!=null and imgUrl!=''">
  48 + img_url=#{imgUrl},
  49 + </if>
45 <if test="channelPrice!=null and channelPrice!=''"> 50 <if test="channelPrice!=null and channelPrice!=''">
46 channel_price=#{channelPrice}, 51 channel_price=#{channelPrice},
47 </if> 52 </if>