Commit 962b0bfd02af511780b4bb6977a68d3e240135ba

Authored by louyao
1 parent 634b467b
Exists in master

渠道商移动端

Showing 34 changed files with 1659 additions and 17 deletions   Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
... ... @@ -7,17 +7,19 @@ import com.sincere.wechatbusiness.dto.BaseDto;
7 7 import com.sincere.wechatbusiness.dto.ChannelDto;
8 8 import com.sincere.wechatbusiness.model.*;
9 9 import com.sincere.wechatbusiness.service.*;
  10 +import com.sincere.wechatbusiness.utils.HttpClientUtils;
10 11 import com.sincere.wechatbusiness.utils.Page;
  12 +import com.sincere.wechatbusiness.utils.TokenUtils;
11 13 import io.swagger.annotations.ApiOperation;
12   -import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher;
13 14 import org.springframework.beans.factory.annotation.Autowired;
14 15 import org.springframework.web.bind.annotation.RequestBody;
15 16 import org.springframework.web.bind.annotation.RequestMapping;
16 17 import org.springframework.web.bind.annotation.RequestMethod;
17 18 import org.springframework.web.bind.annotation.RestController;
18 19  
19   -import java.io.BufferedReader;
20   -import java.io.InputStreamReader;
  20 +import java.io.*;
  21 +import java.net.HttpURLConnection;
  22 +import java.net.MalformedURLException;
21 23 import java.net.URL;
22 24 import java.net.URLConnection;
23 25 import java.util.List;
... ... @@ -43,6 +45,12 @@ public class ChannelController {
43 45 @Autowired
44 46 CatalogContentService catalogContentService;
45 47  
  48 + @Autowired
  49 + AgentService agentService;
  50 +
  51 + private String domain="https://mytest.myjxt.com:51314";
  52 +// private String domain="https://proxy.shunzhi.net:51314";
  53 +
46 54 @RequestMapping(value = "GetChannelList",method = RequestMethod.POST)
47 55 @ApiOperation(value = "获取渠道商列表")
48 56 public BaseDto<Page<Channel>> GetChannelList(@RequestBody ChannelDto channelDto){
... ... @@ -58,7 +66,7 @@ public class ChannelController {
58 66 @ApiOperation(value = "获取代理商品列表")
59 67 public BaseDto<List<DiscountPackage>> GetPackageList(){
60 68 BaseDto<List<DiscountPackage>> result=new BaseDto<>();
61   - String r=Get("https://mytest.myjxt.com:51314/University/getPackageList","");
  69 + String r=Get(domain+"/University/getPackageList","");
62 70 JSONObject jsonObject= JSONObject.parseObject(r);
63 71 String data = jsonObject.getString("data");
64 72 List<DiscountPackage> list=JSON.parseObject(data,new TypeReference<List<DiscountPackage>>(){});
... ... @@ -201,7 +209,7 @@ public class ChannelController {
201 209 catalog.setChannelId(channelId);
202 210 catalog.setSort(sort);
203 211 catalog=catalogService.getDetail(catalog);
204   - catalog.setCatalogContentList(catalogContentService.getList(catalog.getId()));
  212 + if(catalog!=null) catalog.setCatalogContentList(catalogContentService.getList(catalog.getId()));
205 213 result.setData(catalog);
206 214 return result;
207 215 }
... ... @@ -241,6 +249,181 @@ public class ChannelController {
241 249 return new BaseDto();
242 250 }
243 251  
  252 + @RequestMapping(value = "GetAgentList",method = RequestMethod.GET)
  253 + @ApiOperation(value = "获取推广代理列表")
  254 + public BaseDto<List<Agent>> GetAgentList(int id){
  255 + BaseDto<List<Agent>> result=new BaseDto<>();
  256 + result.setData(agentService.getList(id));
  257 + return result;
  258 + }
  259 +
  260 + @RequestMapping(value = "AddAgent",method = RequestMethod.POST)
  261 + @ApiOperation(value = "新增推广代理")
  262 + public BaseDto AddAgent(@RequestBody Agent agent){
  263 + agentService.insert(agent);
  264 + return new BaseDto();
  265 + }
  266 +
  267 + @RequestMapping(value = "UpdateAgent",method = RequestMethod.POST)
  268 + @ApiOperation(value = "编辑推广代理")
  269 + public BaseDto UpdateAgent(@RequestBody Agent agent){
  270 + agentService.update(agent);
  271 + return new BaseDto();
  272 + }
  273 +
  274 + @RequestMapping(value = "DeleteAgent",method = RequestMethod.GET)
  275 + @ApiOperation(value = "删除推广代理")
  276 + public BaseDto DeleteAgent(int id){
  277 + agentService.deleteAgent(id);
  278 + return new BaseDto();
  279 + }
  280 +
  281 + @RequestMapping(value = "GetCatalogList",method = RequestMethod.GET)
  282 + @ApiOperation(value = "获取栏目列表")
  283 + public BaseDto<List<Catalog>> GetCatalogList(int id){
  284 + BaseDto<List<Catalog>> result=new BaseDto<>();
  285 + result.setData(catalogService.getList(id));
  286 + return result;
  287 + }
  288 +
  289 + @RequestMapping(value = "GetCatalogContByDate",method = RequestMethod.GET)
  290 + @ApiOperation(value ="根据日期获取栏目内容" )
  291 + public BaseDto<List<CatalogContent>> GetCatalogContByDate(int catalogId,String date){
  292 + BaseDto<List<CatalogContent>> result=new BaseDto<>();
  293 + result.setData(catalogContentService.getListByDate(catalogId,date));
  294 + return result;
  295 + }
  296 +
  297 + @RequestMapping(value = "GetChannelProduct",method = RequestMethod.GET)
  298 + @ApiOperation(value = "获取代理商品详情")
  299 + public BaseDto<ChannelProduct> GetChannelProduct(int id){
  300 + BaseDto<ChannelProduct> result=new BaseDto<>();
  301 + result.setData(channelProductService.getDetail(id));
  302 + return result;
  303 + }
  304 +
  305 + @RequestMapping(value = "GetDiscountPackage",method = RequestMethod.GET)
  306 + @ApiOperation(value = "获取商品详情")
  307 + public BaseDto<DiscountPackage> GetDiscountPackage(int id){
  308 + BaseDto<DiscountPackage> result=new BaseDto<>();
  309 + String r=Get(domain+"/University/getPackageById","id="+id);
  310 + JSONObject jsonObject= JSONObject.parseObject(r);
  311 + String data = jsonObject.getString("data");
  312 + DiscountPackage model=JSON.parseObject(data,new TypeReference<DiscountPackage>(){});
  313 + result.setData(model);
  314 + return result;
  315 + }
  316 +
  317 + @RequestMapping(value = "GetWxSign",method = RequestMethod.GET)
  318 + @ApiOperation(value = "获取微信分享签名")
  319 + public BaseDto<WxSign> GetWxSign(String url){
  320 + BaseDto<WxSign> result=new BaseDto<>();
  321 + String r=Get("http://114.55.30.100:1111/api/UserRegisterApp/GetWxShareSign","url="+url);
  322 + JSONObject jsonObject= JSONObject.parseObject(r);
  323 + String data = jsonObject.getString("result");
  324 + WxSign wxSign=JSON.parseObject(data,new TypeReference<WxSign>(){});
  325 + result.setData(wxSign);
  326 + return result;
  327 + }
  328 +
  329 + @RequestMapping(value = "AddVerificationCode",method = RequestMethod.GET)
  330 + @ApiOperation(value = "获取验证码")
  331 + public BaseDto AddVerificationCode(String mobile){
  332 + Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1");
  333 + return new BaseDto();
  334 + }
  335 +
  336 + @RequestMapping(value = "CheckCodeIsRight",method = RequestMethod.GET)
  337 + @ApiOperation(value = "判断验证码是否正确")
  338 + public BaseDto CheckCodeIsRight(String mobile, String captcha){
  339 + BaseDto result=new BaseDto();
  340 + String r=Get(domain+"/h5/MyVoluntary/CheckCodeIsRight","mobile="+mobile+"&captcha="+captcha);
  341 + JSONObject jsonObject= JSONObject.parseObject(r);
  342 + result.setSuccess(jsonObject.getString("success")=="true"?true:false);
  343 + result.setMessage(jsonObject.getString("message"));
  344 + return result;
  345 + }
  346 +
  347 + @RequestMapping(value = "AdminLogin",method = RequestMethod.GET)
  348 + @ApiOperation(value = "管理员登录")
  349 + public BaseDto<String> AdminLogin(String mobile){
  350 + BaseDto<String> result=new BaseDto();
  351 + Manager manager=channelService.getManagerDetail(mobile);
  352 + if(manager==null){
  353 + result.setSuccess(false);
  354 + result.setMessage("账号不存在!");
  355 + }
  356 + Log log=new Log();
  357 + log.setOperation("账号登录");
  358 + log.setMobile(mobile);
  359 + channelService.insertLog(log);
  360 + result.setData(TokenUtils.buildToken(mobile));
  361 + return result;
  362 + }
  363 +
  364 + @RequestMapping(value = "IsDianXin",method = RequestMethod.GET)
  365 + @ApiOperation(value = "判断是否是电信用户")
  366 + public BaseDto<List<Coupon>> IsDianXin(String mobile,int productId){
  367 + BaseDto<List<Coupon>> result=new BaseDto();
  368 + String r=Get(domain+"/admin/Voluntary/GetAccount","mobile="+mobile);
  369 + JSONObject jsonObject= JSONObject.parseObject(r);
  370 + String data = jsonObject.getString("data");
  371 + if(data==null){
  372 + result.setSuccess(false);
  373 + result.setMessage("非VIP邀请号码");
  374 + }
  375 + else {
  376 + Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1");
  377 + String re=Get(domain+"/University/getMyCouponDetail","mobile="+mobile+"&type="+productId);
  378 + JSONObject jsonObject1= JSONObject.parseObject(re);
  379 + String data1 = jsonObject1.getString("data");
  380 + result.setData(JSON.parseObject(data1,new TypeReference<List<Coupon>>(){}));
  381 + }
  382 + return result;
  383 + }
  384 +
  385 + @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST)
  386 + @ApiOperation(value = "生成预支付订单并返回详情")
  387 + public BaseDto<List<Order>> GetAddOrderDetail(@RequestBody Order order) {
  388 + BaseDto<List<Order>> result=new BaseDto<>();
  389 + JSONObject object = new JSONObject();
  390 + object.put("account",order.getAccount());
  391 + object.put("expert_id",0);
  392 + object.put("paymoney",order.getPaymoney());
  393 + object.put("payway",2);
  394 + object.put("product_detail","升学汇产品-代理商");
  395 + object.put("product_id",order.getProduct_id());
  396 + object.put("product_name",order.getProduct_name());
  397 + object.put("type",order.getProduct_id());
  398 + object.put("user_name",order.getUser_name());
  399 + object.put("buycount",0);
  400 + object.put("score_id",0);
  401 + JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString());
  402 + String data = jsonObject.getString("data");
  403 + result.setData(JSON.parseObject(data,new TypeReference<List<Order>>(){}));
  404 + return result;
  405 + }
  406 +
  407 + @RequestMapping(value = "WxPay",method = RequestMethod.POST)
  408 + @ApiOperation(value = "微信支付")
  409 + public BaseDto<WxResult> WxPay(@RequestBody WxPay pay){
  410 + BaseDto<WxResult> result = new BaseDto();
  411 + JSONObject object = new JSONObject();
  412 + object.put("attach",pay.getAttach());
  413 + object.put("notify_url",domain+"/Payment/WXPayBack");
  414 + object.put("outTradeNo",pay.getOutTradeNo());
  415 + object.put("payType",2);
  416 + object.put("payWay",2);
  417 + object.put("productId",pay.getProductId());
  418 + object.put("subject",pay.getSubject());
  419 + object.put("totalFee",pay.getTotalFee());
  420 + object.put("coupon_num",pay.getCoupon_num());
  421 + JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString());
  422 + String data = jsonObject.getString("data");
  423 + result.setData(JSON.parseObject(data,new TypeReference<WxResult>(){}));
  424 + return result;
  425 + }
  426 +
244 427 public String Get(String url, String param) {
245 428 String result = "";
246 429 BufferedReader in = null;
... ... @@ -285,4 +468,86 @@ public class ChannelController {
285 468 }
286 469 return result;
287 470 }
  471 +
  472 + public String Post(String httpUrl, String param)
  473 + {
  474 + HttpURLConnection connection = null;
  475 + InputStream is = null;
  476 + OutputStream os = null;
  477 + BufferedReader br = null;
  478 + String result = null;
  479 + try {
  480 + URL url = new URL(httpUrl);
  481 + // 通过远程url连接对象打开连接
  482 + connection = (HttpURLConnection) url.openConnection();
  483 + // 设置连接请求方式
  484 + connection.setRequestMethod("POST");
  485 + // 设置连接主机服务器超时时间:15000毫秒
  486 + connection.setConnectTimeout(15000);
  487 + // 设置读取主机服务器返回数据超时时间:60000毫秒
  488 + connection.setReadTimeout(60000);
  489 +
  490 + // 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true
  491 + connection.setDoOutput(true);
  492 + // 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无
  493 + connection.setDoInput(true);
  494 + // 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。
  495 + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  496 +
  497 + // 设置鉴权信息:Authorization: Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0
  498 + connection.setRequestProperty("Authorization", "Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0");
  499 +
  500 + // 通过连接对象获取一个输出流
  501 + os = connection.getOutputStream();
  502 + // 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的
  503 + os.write(param.getBytes());
  504 + // 通过连接对象获取一个输入流,向远程读取
  505 + if (connection.getResponseCode() == 200) {
  506 +
  507 + is = connection.getInputStream();
  508 + // 对输入流对象进行包装:charset根据工作项目组的要求来设置
  509 + br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
  510 +
  511 + StringBuffer sbf = new StringBuffer();
  512 + String temp = null;
  513 + // 循环遍历一行一行读取数据
  514 + while ((temp = br.readLine()) != null) {
  515 + sbf.append(temp);
  516 + sbf.append("\r\n");
  517 + }
  518 + result = sbf.toString();
  519 + }
  520 + } catch (MalformedURLException e) {
  521 + e.printStackTrace();
  522 + } catch (IOException e) {
  523 + e.printStackTrace();
  524 + } finally {
  525 + // 关闭资源
  526 + if (null != br) {
  527 + try {
  528 + br.close();
  529 + } catch (IOException e) {
  530 + e.printStackTrace();
  531 + }
  532 + }
  533 + if (null != os) {
  534 + try {
  535 + os.close();
  536 + } catch (IOException e) {
  537 + e.printStackTrace();
  538 + }
  539 + }
  540 + if (null != is) {
  541 + try {
  542 + is.close();
  543 + } catch (IOException e) {
  544 + e.printStackTrace();
  545 + }
  546 + }
  547 + // 断开与远程地址url的连接
  548 + connection.disconnect();
  549 + }
  550 + return result;
  551 + }
  552 +
288 553 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/AgentMapper.java 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +package com.sincere.wechatbusiness.mapper;
  2 +
  3 +import com.sincere.wechatbusiness.model.Agent;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface AgentMapper {
  8 + List<Agent> getList(int id);
  9 +
  10 + int insert(Agent agent);
  11 +
  12 + int update(Agent agent);
  13 +
  14 + int deleteAgent(int id);
  15 +}
... ...
src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java
1 1 package com.sincere.wechatbusiness.mapper;
2 2  
3 3 import com.sincere.wechatbusiness.model.CatalogContent;
  4 +import org.apache.ibatis.annotations.Param;
4 5  
5 6 import java.util.List;
6 7  
... ... @@ -12,4 +13,6 @@ public interface CatalogContentMapper {
12 13 int update(CatalogContent catalogContent);
13 14  
14 15 int deleteCatalogContent(int id);
  16 +
  17 + List<CatalogContent> getListByDate(@Param("catalogId") int catalogId,@Param("date") String date,@Param("state") int state);
15 18 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java
... ... @@ -2,10 +2,14 @@ package com.sincere.wechatbusiness.mapper;
2 2  
3 3 import com.sincere.wechatbusiness.model.Catalog;
4 4  
  5 +import java.util.List;
  6 +
5 7 public interface CatalogMapper {
6 8 Catalog getDetail(Catalog catalog);
7 9  
8 10 int insert(Catalog catalog);
9 11  
10 12 int update(Catalog catalog);
  13 +
  14 + List<Catalog> getList(int id);
11 15 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
1 1 package com.sincere.wechatbusiness.mapper;
2 2  
3   -import com.sincere.wechatbusiness.model.Area;
4   -import com.sincere.wechatbusiness.model.Channel;
5   -import com.sincere.wechatbusiness.model.Template;
  3 +import com.sincere.wechatbusiness.model.*;
6 4  
7 5 import java.util.List;
8 6  
... ... @@ -26,4 +24,8 @@ public interface ChannelMapper {
26 24 List<Area> getArea(String areaCode);
27 25  
28 26 List<Template> getTemplateList();
  27 +
  28 + Manager getManagerDetail(String mobile);
  29 +
  30 + int insertLog(Log log);
29 31 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java
... ... @@ -12,4 +12,6 @@ public interface ChannelProductMapper {
12 12 int update(ChannelProduct channelProduct);
13 13  
14 14 int deleteChannelProduct(int id);
  15 +
  16 + ChannelProduct getDetail(int id);
15 17 }
... ...
src/main/java/com/sincere/wechatbusiness/model/Agent.java 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Agent {
  6 + private Integer id;
  7 +
  8 + private int channelId;
  9 +
  10 + private String name;
  11 +
  12 + private String mobile;
  13 +
  14 + private Integer state;
  15 +
  16 + private Date createTime;
  17 +
  18 + public Integer getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(Integer id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public int getChannelId() {
  27 + return channelId;
  28 + }
  29 +
  30 + public void setChannelId(int channelId) {
  31 + this.channelId = channelId;
  32 + }
  33 +
  34 + public String getName() {
  35 + return name;
  36 + }
  37 +
  38 + public void setName(String name) {
  39 + this.name = name;
  40 + }
  41 +
  42 + public String getMobile() {
  43 + return mobile;
  44 + }
  45 +
  46 + public void setMobile(String mobile) {
  47 + this.mobile = mobile;
  48 + }
  49 +
  50 + public Integer getState() {
  51 + return state;
  52 + }
  53 +
  54 + public void setState(Integer state) {
  55 + this.state = state;
  56 + }
  57 +
  58 + public Date getCreateTime() {
  59 + return createTime;
  60 + }
  61 +
  62 + public void setCreateTime(Date createTime) {
  63 + this.createTime = createTime;
  64 + }
  65 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/CatalogContent.java
... ... @@ -27,6 +27,8 @@ public class CatalogContent {
27 27  
28 28 private Date createTime;
29 29  
  30 + private Integer isStart;
  31 +
30 32 public Integer getId() {
31 33 return id;
32 34 }
... ... @@ -106,4 +108,12 @@ public class CatalogContent {
106 108 public void setCreateTime(Date createTime) {
107 109 this.createTime = createTime;
108 110 }
  111 +
  112 + public Integer getIsStart() {
  113 + return isStart;
  114 + }
  115 +
  116 + public void setIsStart(Integer isStart) {
  117 + this.isStart = isStart;
  118 + }
109 119 }
... ...
src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java
... ... @@ -7,10 +7,14 @@ public class ChannelProduct {
7 7  
8 8 private Integer channelId;
9 9  
  10 + private Integer productId;
  11 +
10 12 private String productName;
11 13  
12 14 private String price;
13 15  
  16 + private String imgUrl;
  17 +
14 18 private String ChannelPrice;
15 19  
16 20 private String caption;
... ... @@ -35,6 +39,14 @@ public class ChannelProduct {
35 39 this.channelId = channelId;
36 40 }
37 41  
  42 + public Integer getProductId() {
  43 + return productId;
  44 + }
  45 +
  46 + public void setProductId(Integer productId) {
  47 + this.productId = productId;
  48 + }
  49 +
38 50 public String getProductName() {
39 51 return productName;
40 52 }
... ... @@ -51,6 +63,14 @@ public class ChannelProduct {
51 63 this.price = price;
52 64 }
53 65  
  66 + public String getImgUrl() {
  67 + return imgUrl;
  68 + }
  69 +
  70 + public void setImgUrl(String imgUrl) {
  71 + this.imgUrl = imgUrl;
  72 + }
  73 +
54 74 public String getChannelPrice() {
55 75 return ChannelPrice;
56 76 }
... ...
src/main/java/com/sincere/wechatbusiness/model/Coupon.java 0 → 100644
... ... @@ -0,0 +1,224 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import io.swagger.annotations.ApiModel;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  8 +
  9 +import java.util.Date;
  10 +
  11 +@ApiModel
  12 +public class Coupon {
  13 + private Integer id;
  14 + @ApiModelProperty(value = "优惠券编号")
  15 + private String coupon_num;
  16 + @ApiModelProperty(value = "优惠券类型")
  17 + private String type;
  18 + @ApiModelProperty(value = "减免金额")
  19 + private String discount;
  20 + @ApiModelProperty(value = "减免条件")
  21 + private String condition;
  22 + @ApiModelProperty(value = "有效期")
  23 + private String expiry_date;
  24 + @ApiModelProperty(value = "发放类型")
  25 + private Integer sendtype;
  26 + @ApiModelProperty(value = "发放对象号码")
  27 + private String sendmobile;
  28 + @ApiModelProperty(value = "账号项目名称")
  29 + private String itemname;
  30 +
  31 + @DateTimeFormat(pattern = "yyyy-MM-dd")
  32 + @JsonFormat(pattern = "yyyy-MM-dd")
  33 + private Date start_time;
  34 + @DateTimeFormat(pattern = "yyyy-MM-dd")
  35 + @JsonFormat(pattern = "yyyy-MM-dd")
  36 + private Date end_time;
  37 +
  38 + private String remark;
  39 +
  40 + private String state;
  41 + private Date create_time;
  42 +
  43 + @ApiModelProperty(value = "总优惠券数")
  44 + private Integer allcount;
  45 + @ApiModelProperty(value = "实际生成优惠券数")
  46 + private Integer actualcount;
  47 + @ApiModelProperty(value = "已发放优惠券数")
  48 + private Integer sendcount;
  49 + @ApiModelProperty(value = "已兑换优惠券数")
  50 + private Integer exchangecount;
  51 +
  52 + private String url;
  53 +
  54 + private Integer project_id;
  55 +
  56 + @ApiModelProperty(value = "0- 计划数内新增优惠券 1-计划数已经新增完了 再新增优惠券")
  57 + private Integer flog;
  58 +
  59 +
  60 + public Integer getId() {
  61 + return id;
  62 + }
  63 +
  64 + public void setId(Integer id) {
  65 + this.id = id;
  66 + }
  67 +
  68 + public String getCoupon_num() {
  69 + return coupon_num;
  70 + }
  71 +
  72 + public void setCoupon_num(String coupon_num) {
  73 + this.coupon_num = coupon_num;
  74 + }
  75 +
  76 + public String getType() {
  77 + return type;
  78 + }
  79 +
  80 + public void setType(String type) {
  81 + this.type = type;
  82 + }
  83 +
  84 + public String getDiscount() {
  85 + return discount;
  86 + }
  87 +
  88 + public void setDiscount(String discount) {
  89 + this.discount = discount;
  90 + }
  91 +
  92 + public String getCondition() {
  93 + return condition;
  94 + }
  95 +
  96 + public void setCondition(String condition) {
  97 + this.condition = condition;
  98 + }
  99 +
  100 + public String getExpiry_date() {
  101 + return expiry_date;
  102 + }
  103 +
  104 + public void setExpiry_date(String expiry_date) {
  105 + this.expiry_date = expiry_date;
  106 + }
  107 +
  108 + public Integer getSendtype() {
  109 + return sendtype;
  110 + }
  111 +
  112 + public void setSendtype(Integer sendtype) {
  113 + this.sendtype = sendtype;
  114 + }
  115 +
  116 + public String getSendmobile() {
  117 + return sendmobile;
  118 + }
  119 +
  120 + public void setSendmobile(String sendmobile) {
  121 + this.sendmobile = sendmobile;
  122 + }
  123 +
  124 + public String getItemname() {
  125 + return itemname;
  126 + }
  127 +
  128 + public void setItemname(String itemname) {
  129 + this.itemname = itemname;
  130 + }
  131 +
  132 + public Date getStart_time() {
  133 + return start_time;
  134 + }
  135 +
  136 + public void setStart_time(Date start_time) {
  137 + this.start_time = start_time;
  138 + }
  139 +
  140 + public Date getEnd_time() {
  141 + return end_time;
  142 + }
  143 +
  144 + public void setEnd_time(Date end_time) {
  145 + this.end_time = end_time;
  146 + }
  147 +
  148 + public String getRemark() {
  149 + return remark;
  150 + }
  151 +
  152 + public void setRemark(String remark) {
  153 + this.remark = remark;
  154 + }
  155 +
  156 + public String getState() {
  157 + return state;
  158 + }
  159 +
  160 + public void setState(String state) {
  161 + this.state = state;
  162 + }
  163 +
  164 + public Date getCreate_time() { return create_time; }
  165 +
  166 + public void setCreate_time(Date create_time) { this.create_time = create_time; }
  167 +
  168 +
  169 + public Integer getAllcount() {
  170 + return allcount;
  171 + }
  172 +
  173 + public void setAllcount(Integer allcount) {
  174 + this.allcount = allcount;
  175 + }
  176 +
  177 + public Integer getActualcount() {
  178 + return actualcount;
  179 + }
  180 +
  181 + public void setActualcount(Integer actualcount) {
  182 + this.actualcount = actualcount;
  183 + }
  184 +
  185 + public Integer getSendcount() {
  186 + return sendcount;
  187 + }
  188 +
  189 + public void setSendcount(Integer sendcount) {
  190 + this.sendcount = sendcount;
  191 + }
  192 +
  193 + public Integer getExchangecount() {
  194 + return exchangecount;
  195 + }
  196 +
  197 + public void setExchangecount(Integer exchangecount) {
  198 + this.exchangecount = exchangecount;
  199 + }
  200 +
  201 + public String getUrl() {
  202 + return url;
  203 + }
  204 +
  205 + public void setUrl(String url) {
  206 + this.url = url;
  207 + }
  208 +
  209 + public Integer getProject_id() {
  210 + return project_id;
  211 + }
  212 +
  213 + public void setProject_id(Integer project_id) {
  214 + this.project_id = project_id;
  215 + }
  216 +
  217 + public Integer getFlog() {
  218 + return flog;
  219 + }
  220 +
  221 + public void setFlog(Integer flog) {
  222 + this.flog = flog;
  223 + }
  224 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/Log.java 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Log {
  6 + private Integer id;
  7 +
  8 + private String mobile;
  9 +
  10 + private String operation;
  11 +
  12 + private Date createTime;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public String getMobile() {
  23 + return mobile;
  24 + }
  25 +
  26 + public void setMobile(String mobile) {
  27 + this.mobile = mobile;
  28 + }
  29 +
  30 + public String getOperation() {
  31 + return operation;
  32 + }
  33 +
  34 + public void setOperation(String operation) {
  35 + this.operation = operation;
  36 + }
  37 +
  38 + public Date getCreateTime() {
  39 + return createTime;
  40 + }
  41 +
  42 + public void setCreateTime(Date createTime) {
  43 + this.createTime = createTime;
  44 + }
  45 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/Manager.java 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Manager {
  6 + private Integer id;
  7 +
  8 + private String mobile;
  9 +
  10 + private Integer state;
  11 +
  12 + private Date createTime;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public String getMobile() {
  23 + return mobile;
  24 + }
  25 +
  26 + public void setMobile(String mobile) {
  27 + this.mobile = mobile;
  28 + }
  29 +
  30 + public Integer getState() {
  31 + return state;
  32 + }
  33 +
  34 + public void setState(Integer state) {
  35 + this.state = state;
  36 + }
  37 +
  38 + public Date getCreateTime() {
  39 + return createTime;
  40 + }
  41 +
  42 + public void setCreateTime(Date createTime) {
  43 + this.createTime = createTime;
  44 + }
  45 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/Order.java 0 → 100644
... ... @@ -0,0 +1,217 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +
  6 +import java.util.Date;
  7 +
  8 +@ApiModel
  9 +public class Order {
  10 + @ApiModelProperty(value = "主键 , 新增接口不用传")
  11 + private Integer id;
  12 + @ApiModelProperty(value = " 平台流水号")
  13 + private String trade_no;
  14 + @ApiModelProperty(value = " 商户订单号")
  15 + private String orderpaynum;
  16 + @ApiModelProperty(value = " 商品id")
  17 + private Integer product_id;
  18 + @ApiModelProperty(value = " 商品名称")
  19 + private String product_name;
  20 + @ApiModelProperty(value = " 商品详情")
  21 + private String product_detail;
  22 + @ApiModelProperty(value = " 账号")
  23 + private String account;
  24 + @ApiModelProperty(value = " 学生姓名")
  25 + private String user_name;
  26 + @ApiModelProperty(value = " ai填报 使用成绩id")
  27 + private Integer score_id;
  28 + @ApiModelProperty(value = " 支付方式")
  29 + private Integer payway;
  30 + @ApiModelProperty(value = " 支付金额")
  31 + private String paymoney;
  32 + @ApiModelProperty(value = " 支付状态")
  33 + private Integer paystate;
  34 + @ApiModelProperty(value = " 优惠券")
  35 + private String coupon;
  36 + @ApiModelProperty(value = " 优惠券名字")
  37 + private String coupon_name;
  38 + @ApiModelProperty(value = " 实际支付")
  39 + private String actualpay;
  40 + @ApiModelProperty(value = " 订单类型")
  41 + private Integer type;
  42 +
  43 + private Integer expert_id;
  44 + private String address;
  45 +
  46 + @ApiModelProperty(value = " 订购时间")
  47 + private Date intime;
  48 +
  49 + private Integer buycount;
  50 +
  51 + private String discount;
  52 +
  53 +
  54 + public Integer getId() {
  55 + return id;
  56 + }
  57 +
  58 + public void setId(Integer id) {
  59 + this.id = id;
  60 + }
  61 +
  62 + public String getTrade_no() {
  63 + return trade_no;
  64 + }
  65 +
  66 + public void setTrade_no(String trade_no) {
  67 + this.trade_no = trade_no;
  68 + }
  69 +
  70 + public String getOrderpaynum() {
  71 + return orderpaynum;
  72 + }
  73 +
  74 + public void setOrderpaynum(String orderpaynum) {
  75 + this.orderpaynum = orderpaynum;
  76 + }
  77 +
  78 + public Integer getProduct_id() {
  79 + return product_id;
  80 + }
  81 +
  82 + public void setProduct_id(Integer product_id) {
  83 + this.product_id = product_id;
  84 + }
  85 +
  86 + public String getProduct_name() {
  87 + return product_name;
  88 + }
  89 +
  90 + public void setProduct_name(String product_name) {
  91 + this.product_name = product_name;
  92 + }
  93 +
  94 + public String getProduct_detail() {
  95 + return product_detail;
  96 + }
  97 +
  98 + public void setProduct_detail(String product_detail) {
  99 + this.product_detail = product_detail;
  100 + }
  101 +
  102 + public String getAccount() {
  103 + return account;
  104 + }
  105 +
  106 + public void setAccount(String account) {
  107 + this.account = account;
  108 + }
  109 +
  110 + public String getUser_name() {
  111 + return user_name;
  112 + }
  113 +
  114 + public void setUser_name(String user_name) {
  115 + this.user_name = user_name;
  116 + }
  117 +
  118 + public Integer getScore_id() {
  119 + return score_id;
  120 + }
  121 +
  122 + public void setScore_id(Integer score_id) {
  123 + this.score_id = score_id;
  124 + }
  125 +
  126 + public Integer getPayway() {
  127 + return payway;
  128 + }
  129 +
  130 + public void setPayway(Integer payway) {
  131 + this.payway = payway;
  132 + }
  133 +
  134 + public String getPaymoney() {
  135 + return paymoney;
  136 + }
  137 +
  138 + public void setPaymoney(String paymoney) {
  139 + this.paymoney = paymoney;
  140 + }
  141 +
  142 + public Integer getPaystate() {
  143 + return paystate;
  144 + }
  145 +
  146 + public void setPaystate(Integer paystate) {
  147 + this.paystate = paystate;
  148 + }
  149 +
  150 + public String getCoupon() {
  151 + return coupon;
  152 + }
  153 +
  154 + public void setCoupon(String coupon) {
  155 + this.coupon = coupon;
  156 + }
  157 +
  158 + public String getCoupon_name() {
  159 + return coupon_name;
  160 + }
  161 +
  162 + public void setCoupon_name(String coupon_name) {
  163 + this.coupon_name = coupon_name;
  164 + }
  165 +
  166 + public String getActualpay() {
  167 + return actualpay;
  168 + }
  169 +
  170 + public void setActualpay(String actualpay) {
  171 + this.actualpay = actualpay;
  172 + }
  173 +
  174 + public Integer getType() {
  175 + return type;
  176 + }
  177 +
  178 + public void setType(Integer type) {
  179 + this.type = type;
  180 + }
  181 +
  182 + public Integer getExpert_id() {
  183 + return expert_id;
  184 + }
  185 +
  186 + public void setExpert_id(Integer expert_id) {
  187 + this.expert_id = expert_id;
  188 + }
  189 +
  190 + public String getAddress() {
  191 + return address;
  192 + }
  193 +
  194 + public void setAddress(String address) {
  195 + this.address = address;
  196 + }
  197 +
  198 + public Date getIntime() { return intime; }
  199 +
  200 + public void setIntime(Date intime) { this.intime = intime; }
  201 +
  202 + public Integer getBuycount() {
  203 + return buycount;
  204 + }
  205 +
  206 + public void setBuycount(Integer buycount) {
  207 + this.buycount = buycount;
  208 + }
  209 +
  210 + public String getDiscount() {
  211 + return discount;
  212 + }
  213 +
  214 + public void setDiscount(String discount) {
  215 + this.discount = discount;
  216 + }
  217 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/WxPay.java 0 → 100644
... ... @@ -0,0 +1,102 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +public class WxPay {
  4 + private Integer productId ;
  5 + private String subject;
  6 + private String body;
  7 + private String paymoney;
  8 + private String totalFee;
  9 + private String coupon;
  10 + private String outTradeNo;
  11 + private String notify_url;
  12 + private String attach;
  13 + private Integer payType;
  14 + private Integer payWay;
  15 + private String quit_url;
  16 + private String map;
  17 + private String openid;
  18 +
  19 + private String address;
  20 + private Integer expert_id;
  21 + private String coupon_num;
  22 +
  23 + public Integer getProductId() {return productId;}
  24 +
  25 + public void setProductId(Integer productId) {this.productId=productId;}
  26 +
  27 + public String getSubject() {return subject;}
  28 +
  29 + public void setSubject(String subject) {this.subject=subject;}
  30 +
  31 + public String getBody() {return body;}
  32 +
  33 + public void setBody(String body) {this.body=body;}
  34 +
  35 + public String getPaymoney() {return paymoney;}
  36 +
  37 + public void setPaymoney(String paymoney) {this.paymoney=paymoney;}
  38 +
  39 + public String getCoupon() {return coupon;}
  40 +
  41 + public void setCoupon(String coupon) {this.coupon=coupon;}
  42 +
  43 + public String getTotalFee() {return totalFee;}
  44 +
  45 + public void setTotalFee(String totalFee) {this.totalFee=totalFee;}
  46 +
  47 + public String getOutTradeNo() {return outTradeNo;}
  48 +
  49 + public void setOutTradeNo(String outTradeNo) {this.outTradeNo=outTradeNo;}
  50 +
  51 + public String getNotify_url() {return notify_url;}
  52 +
  53 + public void setNotify_url(String notify_url) {this.notify_url=notify_url;}
  54 +
  55 + public String getAttach() {return attach;}
  56 +
  57 + public void setAttach(String attach) {this.attach=attach;}
  58 +
  59 + public Integer getPayType() {return payType;}
  60 +
  61 + public void setPayType(Integer payType) {this.payType=payType;}
  62 +
  63 + public Integer getPayWay() {return payWay;}
  64 +
  65 + public void setPayWay(Integer payWay) {this.payWay=payWay;}
  66 +
  67 + public String getQuit_url() {return quit_url;}
  68 +
  69 + public void setQuit_url(String quit_url) {this.quit_url=quit_url;}
  70 +
  71 + public String getMap() {return map;}
  72 +
  73 + public void setMap(String map) {this.map=map;}
  74 +
  75 + public String getOpenid() {return openid;}
  76 +
  77 + public void setOpenid(String openid) {this.openid=openid;}
  78 +
  79 + public String getAddress() {
  80 + return address;
  81 + }
  82 +
  83 + public void setAddress(String address) {
  84 + this.address = address;
  85 + }
  86 +
  87 + public Integer getExpert_id() {
  88 + return expert_id;
  89 + }
  90 +
  91 + public void setExpert_id(Integer expert_id) {
  92 + this.expert_id = expert_id;
  93 + }
  94 +
  95 + public String getCoupon_num() {
  96 + return coupon_num;
  97 + }
  98 +
  99 + public void setCoupon_num(String coupon_num) {
  100 + this.coupon_num = coupon_num;
  101 + }
  102 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/WxResult.java 0 → 100644
... ... @@ -0,0 +1,83 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +public class WxResult {
  4 + private String prepay_id;
  5 +
  6 + private String appId;
  7 +
  8 + private String timeStamp;
  9 +
  10 + private String nonceStr;
  11 +
  12 + private String paySign;
  13 +
  14 + private String orderNo;
  15 +
  16 + private String totalFee;
  17 +
  18 + private String signType;
  19 +
  20 + public String getPrepay_id() {
  21 + return prepay_id;
  22 + }
  23 +
  24 + public void setPrepay_id(String prepay_id) {
  25 + this.prepay_id = prepay_id;
  26 + }
  27 +
  28 + public String getAppId() {
  29 + return appId;
  30 + }
  31 +
  32 + public void setAppId(String appId) {
  33 + this.appId = appId;
  34 + }
  35 +
  36 + public String getTimeStamp() {
  37 + return timeStamp;
  38 + }
  39 +
  40 + public void setTimeStamp(String timeStamp) {
  41 + this.timeStamp = timeStamp;
  42 + }
  43 +
  44 + public String getNonceStr() {
  45 + return nonceStr;
  46 + }
  47 +
  48 + public void setNonceStr(String nonceStr) {
  49 + this.nonceStr = nonceStr;
  50 + }
  51 +
  52 + public String getPaySign() {
  53 + return paySign;
  54 + }
  55 +
  56 + public void setPaySign(String paySign) {
  57 + this.paySign = paySign;
  58 + }
  59 +
  60 + public String getOrderNo() {
  61 + return orderNo;
  62 + }
  63 +
  64 + public void setOrderNo(String orderNo) {
  65 + this.orderNo = orderNo;
  66 + }
  67 +
  68 + public String getTotalFee() {
  69 + return totalFee;
  70 + }
  71 +
  72 + public void setTotalFee(String totalFee) {
  73 + this.totalFee = totalFee;
  74 + }
  75 +
  76 + public String getSignType() {
  77 + return signType;
  78 + }
  79 +
  80 + public void setSignType(String signType) {
  81 + this.signType = signType;
  82 + }
  83 +}
... ...
src/main/java/com/sincere/wechatbusiness/model/WxSign.java 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +package com.sincere.wechatbusiness.model;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +
  5 +public class WxSign {
  6 + @ApiModelProperty(value = "时间戳")
  7 + private String timestamp;
  8 +
  9 + @ApiModelProperty(value = "随机码")
  10 + private String noncestr;
  11 +
  12 + @ApiModelProperty(value = "签名")
  13 + private String signature;
  14 +
  15 + private String jsapi_ticket;
  16 +
  17 + private String sign_before;
  18 +
  19 + private String basictoken;
  20 +
  21 + public String getTimestamp() {
  22 + return timestamp;
  23 + }
  24 +
  25 + public void setTimestamp(String timestamp) {
  26 + this.timestamp = timestamp;
  27 + }
  28 +
  29 + public String getNoncestr() {
  30 + return noncestr;
  31 + }
  32 +
  33 + public void setNoncestr(String noncestr) {
  34 + this.noncestr = noncestr;
  35 + }
  36 +
  37 + public String getSignature() {
  38 + return signature;
  39 + }
  40 +
  41 + public void setSignature(String signature) {
  42 + this.signature = signature;
  43 + }
  44 +
  45 + public String getJsapi_ticket() {
  46 + return jsapi_ticket;
  47 + }
  48 +
  49 + public void setJsapi_ticket(String jsapi_ticket) {
  50 + this.jsapi_ticket = jsapi_ticket;
  51 + }
  52 +
  53 + public String getSign_before() {
  54 + return sign_before;
  55 + }
  56 +
  57 + public void setSign_before(String sign_before) {
  58 + this.sign_before = sign_before;
  59 + }
  60 +
  61 + public String getBasictoken() {
  62 + return basictoken;
  63 + }
  64 +
  65 + public void setBasictoken(String basictoken) {
  66 + this.basictoken = basictoken;
  67 + }
  68 +}
... ...
src/main/java/com/sincere/wechatbusiness/service/AgentService.java 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +package com.sincere.wechatbusiness.service;
  2 +
  3 +import com.sincere.wechatbusiness.model.Agent;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface AgentService {
  8 + List<Agent> getList(int id);
  9 +
  10 + int insert(Agent agent);
  11 +
  12 + int update(Agent agent);
  13 +
  14 + int deleteAgent(int id);
  15 +}
... ...
src/main/java/com/sincere/wechatbusiness/service/CatalogContentService.java
1 1 package com.sincere.wechatbusiness.service;
2 2  
3 3 import com.sincere.wechatbusiness.model.CatalogContent;
  4 +import org.apache.ibatis.annotations.Param;
4 5  
5 6 import java.util.List;
6 7  
... ... @@ -12,4 +13,6 @@ public interface CatalogContentService {
12 13 int update(CatalogContent catalogContent);
13 14  
14 15 int deleteCatalogContent(int id);
  16 +
  17 + List<CatalogContent> getListByDate(int catalogId,String date);
15 18 }
... ...
src/main/java/com/sincere/wechatbusiness/service/CatalogService.java
... ... @@ -2,10 +2,14 @@ package com.sincere.wechatbusiness.service;
2 2  
3 3 import com.sincere.wechatbusiness.model.Catalog;
4 4  
  5 +import java.util.List;
  6 +
5 7 public interface CatalogService {
6 8 Catalog getDetail(Catalog catalog);
7 9  
8 10 int insert(Catalog catalog);
9 11  
10 12 int update(Catalog catalog);
  13 +
  14 + List<Catalog> getList(int id);
11 15 }
... ...
src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java
... ... @@ -12,4 +12,6 @@ public interface ChannelProductService {
12 12 int update(ChannelProduct channelProduct);
13 13  
14 14 int deleteChannelProduct(int id);
  15 +
  16 + ChannelProduct getDetail(int id);
15 17 }
... ...
src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
1 1 package com.sincere.wechatbusiness.service;
2 2  
3   -import com.sincere.wechatbusiness.model.Area;
4   -import com.sincere.wechatbusiness.model.Channel;
5   -import com.sincere.wechatbusiness.model.Template;
  3 +import com.sincere.wechatbusiness.model.*;
6 4 import com.sincere.wechatbusiness.utils.Page;
7 5  
8 6 import java.util.List;
... ... @@ -21,4 +19,8 @@ public interface ChannelService {
21 19 List<Area> getAreaList();
22 20  
23 21 List<Template> getTemplateList();
  22 +
  23 + Manager getManagerDetail(String mobile);
  24 +
  25 + int insertLog(Log log);
24 26 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/AgentServiceImpl.java 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +package com.sincere.wechatbusiness.service.impl;
  2 +
  3 +import com.sincere.wechatbusiness.mapper.AgentMapper;
  4 +import com.sincere.wechatbusiness.model.Agent;
  5 +import com.sincere.wechatbusiness.service.AgentService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import java.rmi.activation.ActivationGroup;
  10 +import java.util.List;
  11 +
  12 +@Service
  13 +public class AgentServiceImpl implements AgentService {
  14 + @Autowired
  15 + AgentMapper agentMapper;
  16 +
  17 + @Override
  18 + public List<Agent> getList(int id){return agentMapper.getList(id);}
  19 +
  20 + @Override
  21 + public int insert(Agent agent){return agentMapper.insert(agent);}
  22 +
  23 + @Override
  24 + public int update(Agent agent){return agentMapper.update(agent);}
  25 +
  26 + @Override
  27 + public int deleteAgent(int id){return agentMapper.deleteAgent(id);}
  28 +}
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java
... ... @@ -25,4 +25,7 @@ public class CatalogContentServiceImpl implements CatalogContentService {
25 25  
26 26 @Override
27 27 public int deleteCatalogContent(int id){return catalogContentMapper.deleteCatalogContent(id);}
  28 +
  29 + @Override
  30 + public List<CatalogContent> getListByDate(int catalogId,String date){return catalogContentMapper.getListByDate(catalogId,date,1);}
28 31 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java
... ... @@ -6,6 +6,8 @@ import com.sincere.wechatbusiness.service.CatalogService;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.stereotype.Service;
8 8  
  9 +import java.util.List;
  10 +
9 11 @Service
10 12 public class CatalogServiceImpl implements CatalogService {
11 13 @Autowired
... ... @@ -19,4 +21,7 @@ public class CatalogServiceImpl implements CatalogService {
19 21  
20 22 @Override
21 23 public int update(Catalog catalog){return catalogMapper.update(catalog);}
  24 +
  25 + @Override
  26 + public List<Catalog> getList(int id){return catalogMapper.getList(id);}
22 27 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java
... ... @@ -24,4 +24,7 @@ public class ChannelProductServiceImpl implements ChannelProductService {
24 24  
25 25 @Override
26 26 public int deleteChannelProduct(int id){return channelProductMapper.deleteChannelProduct(id);}
  27 +
  28 + @Override
  29 + public ChannelProduct getDetail(int id){return channelProductMapper.getDetail(id);}
27 30 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
... ... @@ -2,15 +2,12 @@ package com.sincere.wechatbusiness.service.impl;
2 2  
3 3 import com.github.pagehelper.PageHelper;
4 4 import com.sincere.wechatbusiness.mapper.ChannelMapper;
5   -import com.sincere.wechatbusiness.model.Area;
6   -import com.sincere.wechatbusiness.model.Channel;
7   -import com.sincere.wechatbusiness.model.Template;
  5 +import com.sincere.wechatbusiness.model.*;
8 6 import com.sincere.wechatbusiness.service.ChannelService;
9 7 import com.sincere.wechatbusiness.utils.Page;
10 8 import org.springframework.beans.factory.annotation.Autowired;
11 9 import org.springframework.stereotype.Service;
12 10  
13   -import java.util.ArrayList;
14 11 import java.util.List;
15 12  
16 13 @Service
... ... @@ -60,5 +57,11 @@ public class ChannelServiceImpl implements ChannelService {
60 57  
61 58 @Override
62 59 public List<Template> getTemplateList(){return channelMapper.getTemplateList();}
  60 +
  61 + @Override
  62 + public Manager getManagerDetail(String mobile){return channelMapper.getManagerDetail(mobile);}
  63 +
  64 + @Override
  65 + public int insertLog(Log log){return channelMapper.insertLog(log);}
63 66 }
64 67  
... ...
src/main/java/com/sincere/wechatbusiness/utils/HttpClientUtils.java 0 → 100644
... ... @@ -0,0 +1,190 @@
  1 +package com.sincere.wechatbusiness.utils;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import org.apache.http.HttpEntity;
  5 +import org.apache.http.HttpStatus;
  6 +import org.apache.http.client.config.RequestConfig;
  7 +import org.apache.http.client.methods.CloseableHttpResponse;
  8 +import org.apache.http.client.methods.HttpGet;
  9 +import org.apache.http.client.methods.HttpPost;
  10 +import org.apache.http.entity.StringEntity;
  11 +import org.apache.http.impl.client.CloseableHttpClient;
  12 +import org.apache.http.impl.client.HttpClients;
  13 +import org.apache.http.util.EntityUtils;
  14 +
  15 +import java.io.IOException;
  16 +import java.io.InputStream;
  17 +import java.net.HttpURLConnection;
  18 +import java.net.URL;
  19 +
  20 +/**
  21 + * HttpClient4.3工具类
  22 + * @author chen
  23 + * @version 1.0
  24 + * @date 2019/10/11 0011 10:17
  25 + */
  26 +public class HttpClientUtils {
  27 +
  28 + private static RequestConfig requestConfig = null;
  29 +
  30 + static {
  31 + // 设置请求和传输超时时间
  32 + requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000).build();
  33 + }
  34 +
  35 + public static void main(String[] args) throws Exception {
  36 +
  37 + }
  38 +
  39 + /**
  40 + * post请求传输json参数
  41 + * @param url url地址
  42 + * @param jsonParam 参数
  43 + * @return
  44 + */
  45 + public static JSONObject httpPostJson(String url, String jsonParam) {
  46 + // post请求返回结果
  47 + CloseableHttpClient httpClient = HttpClients.createDefault();
  48 + JSONObject jsonResult = null;
  49 + HttpPost httpPost = new HttpPost(url);
  50 + // 设置请求和传输超时时间
  51 + httpPost.setConfig(requestConfig);
  52 + try {
  53 + if (null != jsonParam) {
  54 + // 解决中文乱码问题
  55 + StringEntity entity = new StringEntity(jsonParam, "utf-8");
  56 + entity.setContentEncoding("UTF-8");
  57 + entity.setContentType("application/json");
  58 + httpPost.setEntity(entity);
  59 + }
  60 + CloseableHttpResponse result = httpClient.execute(httpPost);
  61 + // 请求发送成功,并得到响应
  62 + if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  63 + String str = "";
  64 + // 读取服务器返回过来的json字符串数据
  65 + str = EntityUtils.toString(result.getEntity(), "utf-8");
  66 + // 把json字符串转换成json对象
  67 + jsonResult = JSONObject.parseObject(str);
  68 +
  69 + }
  70 + } catch (IOException e) {
  71 + e.printStackTrace();
  72 + } finally {
  73 + httpPost.releaseConnection();
  74 + }
  75 + return jsonResult;
  76 + }
  77 +
  78 + /**
  79 + * post请求传输String参数 例如:name=Jack&sex=1&type=2
  80 + * Content-type:application/x-www-form-urlencoded
  81 + * @param url url地址
  82 + * @param strParam 参数
  83 + * @return
  84 + */
  85 + public static JSONObject httpPost(String url, String strParam) {
  86 + // post请求返回结果
  87 + CloseableHttpClient httpClient = HttpClients.createDefault();
  88 + JSONObject jsonResult = null;
  89 + HttpPost httpPost = new HttpPost(url);
  90 + httpPost.setConfig(requestConfig);
  91 + try {
  92 + if (null != strParam) {
  93 + // 解决中文乱码问题
  94 + StringEntity entity = new StringEntity(strParam, "utf-8");
  95 + entity.setContentEncoding("UTF-8");
  96 + entity.setContentType("application/x-www-form-urlencoded");
  97 + httpPost.setEntity(entity);
  98 + }
  99 + CloseableHttpResponse result = httpClient.execute(httpPost);
  100 + // 请求发送成功,并得到响应
  101 + if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  102 + String str = "";
  103 + // 读取服务器返回过来的json字符串数据
  104 + str = EntityUtils.toString(result.getEntity(), "utf-8");
  105 + // 把json字符串转换成json对象
  106 + jsonResult = JSONObject.parseObject(str);
  107 + }
  108 + } catch (IOException e) {
  109 +
  110 + } finally {
  111 + httpPost.releaseConnection();
  112 + }
  113 + return jsonResult;
  114 + }
  115 +
  116 + /**
  117 + * 发送get请求
  118 + * @param url 路径
  119 + * @return
  120 + */
  121 + public static JSONObject httpGet(String url) {
  122 + // get请求返回结果
  123 + JSONObject jsonResult = null;
  124 + CloseableHttpClient client = HttpClients.createDefault();
  125 + // 发送get请求
  126 + HttpGet request = new HttpGet(url);
  127 + request.setConfig(requestConfig);
  128 + try {
  129 + CloseableHttpResponse response = client.execute(request);
  130 + // 请求发送成功,并得到响应
  131 + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  132 + // 读取服务器返回过来的json字符串数据
  133 + HttpEntity entity = response.getEntity();
  134 + String strResult = EntityUtils.toString(entity, "utf-8");
  135 + // 把json字符串转换成json对象
  136 + jsonResult = JSONObject.parseObject(strResult);
  137 + }
  138 + } catch (IOException e) {
  139 +
  140 + } finally {
  141 + request.releaseConnection();
  142 + }
  143 + return jsonResult;
  144 + }
  145 +
  146 + public static String httpGet2(String url) {
  147 + // get请求返回结果
  148 + JSONObject jsonResult = null;
  149 + String result = "" ;
  150 + CloseableHttpClient client = HttpClients.createDefault();
  151 + // 发送get请求
  152 + HttpGet request = new HttpGet(url);
  153 + request.setConfig(requestConfig);
  154 + try {
  155 + CloseableHttpResponse response = client.execute(request);
  156 + // 请求发送成功,并得到响应
  157 + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  158 + // 读取服务器返回过来的json字符串数据
  159 + HttpEntity entity = response.getEntity();
  160 + String strResult = EntityUtils.toString(entity, "utf-8");
  161 + // 把json字符串转换成json对象
  162 + //jsonResult = JSONObject.parseObject(strResult);
  163 + result = strResult;
  164 + }
  165 + } catch (IOException e) {
  166 +
  167 + } finally {
  168 + request.releaseConnection();
  169 + }
  170 + return result;
  171 + }
  172 +
  173 +
  174 + public static InputStream GetFileInputStream(String fileUrl){
  175 + try{
  176 + URL url = new URL(fileUrl);
  177 + HttpURLConnection conn = (HttpURLConnection)url.openConnection();
  178 + //设置超时间为3秒
  179 + conn.setConnectTimeout(8*1000);
  180 + //得到输入流
  181 + InputStream inputStream = conn.getInputStream();
  182 +
  183 + return inputStream ;
  184 + }catch (Exception e){
  185 +
  186 + }
  187 + return null ;
  188 + }
  189 +
  190 +}
... ...
src/main/java/com/sincere/wechatbusiness/utils/ResultException.java 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +package com.sincere.wechatbusiness.utils;
  2 +
  3 +public class ResultException extends Exception {
  4 +
  5 + private int code ;
  6 + private String message ;
  7 +
  8 + public int getCode() {
  9 + return code;
  10 + }
  11 +
  12 + public void setCode(int code) {
  13 + this.code = code;
  14 + }
  15 +
  16 + @Override
  17 + public String getMessage() {
  18 + return message;
  19 + }
  20 +
  21 + public void setMessage(String message) {
  22 + this.message = message;
  23 + }
  24 +
  25 + public ResultException(int code, String message) {
  26 + this.code = code;
  27 + this.message = message;
  28 + }
  29 +}
... ...
src/main/java/com/sincere/wechatbusiness/utils/TokenUtils.java 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +package com.sincere.wechatbusiness.utils;
  2 +
  3 +import com.nimbusds.jose.*;
  4 +import com.nimbusds.jose.crypto.MACSigner;
  5 +import com.nimbusds.jose.crypto.MACVerifier;
  6 +import com.nimbusds.jwt.JWTClaimsSet;
  7 +import com.nimbusds.jwt.SignedJWT;
  8 +
  9 +import java.util.Date;
  10 +import java.util.Objects;
  11 +
  12 +public class TokenUtils {
  13 +
  14 + /**
  15 + * 创建秘钥
  16 + */
  17 + private static final byte[] SECRET = "6MNSobBRCHGIO0fS6MNSobBRCHGWO0fS".getBytes();
  18 +
  19 + /**
  20 + * 过期时间5秒
  21 + */
  22 + private static final long EXPIRE_TIME = 1000 * 60 * 60 * 24 * 3;
  23 +
  24 +
  25 + /**
  26 + * 生成Token 入参userId
  27 + * @param account
  28 + * @return
  29 + */
  30 + public static String buildToken(String account) {
  31 + try {
  32 + /**
  33 + * 1.创建一个32-byte的密匙
  34 + */
  35 + MACSigner macSigner = new MACSigner(SECRET);
  36 + /**
  37 + * 2. 建立payload 载体
  38 + */
  39 + JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
  40 + .expirationTime(new Date(System.currentTimeMillis() + EXPIRE_TIME))
  41 + .claim("ACCOUNT",account)
  42 + .build();
  43 +
  44 + /**
  45 + * 3. 建立签名
  46 + */
  47 + SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);
  48 + signedJWT.sign(macSigner);
  49 +
  50 + /**
  51 + * 4. 生成token
  52 + */
  53 + String token = signedJWT.serialize();
  54 + return token;
  55 + } catch (KeyLengthException e) {
  56 + e.printStackTrace();
  57 + } catch (JOSEException e) {
  58 + e.printStackTrace();
  59 + }
  60 + return null;
  61 + }
  62 +
  63 + /**
  64 + * 校验token
  65 + * @param token
  66 + * @return
  67 + */
  68 + public static String validToken(String token) throws ResultException {
  69 + try {
  70 + SignedJWT jwt = SignedJWT.parse(token);
  71 + JWSVerifier verifier = new MACVerifier(SECRET);
  72 + //校验是否有效
  73 + if (!jwt.verify(verifier)) {
  74 + throw new ResultException(-1, "Token 无效");
  75 + }
  76 +
  77 + //校验超时
  78 + Date expirationTime = jwt.getJWTClaimsSet().getExpirationTime();
  79 + if (new Date().after(expirationTime)) {
  80 + throw new ResultException(-2, "Token 已过期");
  81 + }
  82 +
  83 + //获取载体中的数据
  84 + Object account = jwt.getJWTClaimsSet().getClaim("ACCOUNT");
  85 + //是否有openUid
  86 + if (Objects.isNull(account)){
  87 + throw new ResultException(-3, "账号为空");
  88 + }
  89 + return account.toString();
  90 + } catch (Exception e) {
  91 + throw new ResultException(-4, "系统繁忙");
  92 + }
  93 + }
  94 +}
... ...
src/main/resources/mapper/AgentMapper.xml 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.wechatbusiness.mapper.AgentMapper">
  4 + <resultMap id="AgentMap" type="com.sincere.wechatbusiness.model.Agent">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="channelId" jdbcType="INTEGER" property="channelId" />
  7 + <result column="name" jdbcType="VARCHAR" property="name" />
  8 + <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  9 + <result column="state" jdbcType="INTEGER" property="state"/>
  10 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  11 + </resultMap>
  12 +
  13 + <select id="getList" parameterType="java.lang.Integer" resultMap="AgentMap">
  14 + select * from agent where state=1 and channelId=#{id} order by create_time
  15 + </select>
  16 +
  17 + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Agent">
  18 + insert into agent (channelId,name,mobile)
  19 + values (#{channelId,jdbcType=INTEGER},#{name,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}
  20 + )
  21 + </insert>
  22 +
  23 + <update id="update" parameterType="com.sincere.wechatbusiness.model.Agent">
  24 + update agent
  25 + <trim prefix="set" suffixOverrides=",">
  26 + <if test="name!=null and name!=''">
  27 + name=#{name},
  28 + </if>
  29 + <if test="mobile!=null and mobile!=''">
  30 + mobile=#{mobile},
  31 + </if>
  32 + </trim>
  33 + where id = #{id}
  34 + </update>
  35 +
  36 + <update id="deleteAgent" parameterType="java.lang.Integer">
  37 + update agent set state=0 where id=#{id}
  38 + </update>
  39 +
  40 +</mapper>
0 41 \ No newline at end of file
... ...
src/main/resources/mapper/CatalogContentMapper.xml
... ... @@ -12,12 +12,29 @@
12 12 <result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
13 13 <result column="state" jdbcType="INTEGER" property="state"/>
14 14 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  15 + <result column="is_start" jdbcType="INTEGER" property="isStart"/>
15 16 </resultMap>
16 17  
17 18 <select id="getList" parameterType="java.lang.Integer" resultMap="CatalogContentMap">
18 19 select * from catalog_content where catalogId=#{id} and state=1 order by create_time
19 20 </select>
20 21  
  22 + <select id="getListByDate" resultMap="CatalogContentMap">
  23 + select *,(case when start_time <![CDATA[>]]> getdate() then 0 when end_time <![CDATA[<]]> getdate() then 2 else 1 end ) as is_start from catalog_content
  24 + <where>
  25 + <if test="state != 0">
  26 + and state=#{state}
  27 + </if>
  28 + <if test="catalogId != 0">
  29 + and catalogId=#{catalogId}
  30 + </if>
  31 + <if test="date != null and date!=''">
  32 + and start_time <![CDATA[<=]]>#{date} and end_time <![CDATA[>=]]>#{date}
  33 + </if>
  34 + </where>
  35 + order by create_time
  36 + </select>
  37 +
21 38 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.CatalogContent">
22 39 insert into catalog_content (catalogId, title,subtitle,start_time,end_time,img_url,link_url)
23 40 values (#{catalogId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{subtitle,jdbcType=VARCHAR},
... ...
src/main/resources/mapper/CatalogMapper.xml
... ... @@ -10,6 +10,10 @@
10 10 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
11 11 </resultMap>
12 12  
  13 + <select id="getList" parameterType="java.lang.Integer" resultMap="CatalogMap">
  14 + select * from catalog where channelId=#{channelId} and state=1 and sort!=6 order by sort
  15 + </select>
  16 +
13 17 <select id="getDetail" parameterType="com.sincere.wechatbusiness.model.Catalog" resultMap="CatalogMap">
14 18 select * from catalog where channelId=#{channelId} and sort=#{sort} and state=1
15 19 </select>
... ...
src/main/resources/mapper/ChannelMapper.xml
... ... @@ -29,6 +29,20 @@
29 29 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
30 30 </resultMap>
31 31  
  32 + <resultMap id="ManagerMap" type="com.sincere.wechatbusiness.model.Manager">
  33 + <id column="id" jdbcType="INTEGER" property="id" />
  34 + <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  35 + <result column="state" jdbcType="INTEGER" property="state"/>
  36 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  37 + </resultMap>
  38 +
  39 + <resultMap id="LogMap" type="com.sincere.wechatbusiness.model.Log">
  40 + <id column="id" jdbcType="INTEGER" property="id" />
  41 + <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  42 + <result column="operation" jdbcType="VARCHAR" property="operation"/>
  43 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  44 + </resultMap>
  45 +
32 46 <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap">
33 47 select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count,
34 48 (select title from template where id=c.templateId) as template_name from channel c
... ... @@ -108,4 +122,14 @@
108 122 <select id="getTemplateList" resultMap="TemplateMap">
109 123 select * from template where state=1 order by create_time
110 124 </select>
  125 +
  126 + <select id="getManagerDetail" parameterType="java.lang.String" resultMap="ManagerMap">
  127 + select * from manager where mobile=#{mobile} and state=1
  128 + </select>
  129 +
  130 + <insert id="insertLog" parameterType="com.sincere.wechatbusiness.model.Log">
  131 + insert into log (mobile,operation)
  132 + values (#{mobile,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR}
  133 + )
  134 + </insert>
111 135 </mapper>
112 136 \ No newline at end of file
... ...
src/main/resources/mapper/ChannelProductMapper.xml
... ... @@ -4,8 +4,10 @@
4 4 <resultMap id="ChannelProductMap" type="com.sincere.wechatbusiness.model.ChannelProduct">
5 5 <id column="id" jdbcType="INTEGER" property="id" />
6 6 <result column="channelId" jdbcType="INTEGER" property="channelId" />
  7 + <result column="productId" jdbcType="INTEGER" property="productId" />
7 8 <result column="product_name" jdbcType="VARCHAR" property="productName" />
8 9 <result column="price" jdbcType="VARCHAR" property="price" />
  10 + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
9 11 <result column="channel_price" jdbcType="VARCHAR" property="channelPrice" />
10 12 <result column="caption" jdbcType="VARCHAR" property="caption" />
11 13 <result column="state" jdbcType="INTEGER" property="state"/>
... ... @@ -17,8 +19,8 @@
17 19 </select>
18 20  
19 21 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
20   - insert into channel_product (channelId, product_name,price)
21   - values (#{channelId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR}
  22 + insert into channel_product (channelId,productId,product_name,price,img_url)
  23 + values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}
22 24 )
23 25 </insert>
24 26  
... ... @@ -38,4 +40,8 @@
38 40 <update id="deleteChannelProduct" parameterType="java.lang.Integer">
39 41 update channel_product set state=0 where channelId=#{id}
40 42 </update>
  43 +
  44 + <select id="getDetail" parameterType="java.lang.Integer" resultMap="ChannelProductMap">
  45 + select * from channel_product where id=#{id}
  46 + </select>
41 47 </mapper>
42 48 \ No newline at end of file
... ...