Commit 10cb26e0ea61ee924006e80fcaa8b2bdece52f50
1 parent
92b8383d
Exists in
master
接口整理
Showing
2 changed files
with
116 additions
and
136 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
| ... | ... | @@ -16,6 +16,7 @@ import com.sincere.wechatbusiness.utils.TokenUtils; |
| 16 | 16 | import io.swagger.annotations.ApiOperation; |
| 17 | 17 | import org.slf4j.Logger; |
| 18 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | +import org.springframework.beans.factory.annotation.Value; | |
| 19 | 20 | import org.springframework.web.bind.annotation.RequestBody; |
| 20 | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
| 21 | 22 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -58,8 +59,8 @@ public class ChannelController { |
| 58 | 59 | |
| 59 | 60 | private static final Logger log_channel = LoggerUtils.Logger(LogName.channel); |
| 60 | 61 | |
| 61 | - //private String domain="https://mytest.myjxt.com:51314"; | |
| 62 | - private String domain="https://proxy.shunzhi.net:51314"; | |
| 62 | + @Value("${reportVoluntary}") | |
| 63 | + private String domain; | |
| 63 | 64 | |
| 64 | 65 | private static String appId = "wx6078ff3f67524996"; |
| 65 | 66 | private static String secret = "8a0465b8ad0f000f568f48853e2818c8" ; |
| ... | ... | @@ -170,18 +171,6 @@ public class ChannelController { |
| 170 | 171 | return result; |
| 171 | 172 | } |
| 172 | 173 | |
| 173 | - @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) | |
| 174 | - @ApiOperation(value = "获取代理商品列表") | |
| 175 | - public BaseDto<List<DiscountPackage>> GetPackageList(){ | |
| 176 | - BaseDto<List<DiscountPackage>> result=new BaseDto<>(); | |
| 177 | - String r=Get(domain+"/University/getPackageList",""); | |
| 178 | - JSONObject jsonObject= JSONObject.parseObject(r); | |
| 179 | - String data = jsonObject.getString("data"); | |
| 180 | - List<DiscountPackage> list=JSON.parseObject(data,new TypeReference<List<DiscountPackage>>(){}); | |
| 181 | - result.setData(list); | |
| 182 | - return result; | |
| 183 | - } | |
| 184 | - | |
| 185 | 174 | @RequestMapping(value="GetAreaList",method = RequestMethod.POST) |
| 186 | 175 | @ApiOperation(value = "获取省市") |
| 187 | 176 | public BaseDto<List<Area>> GetAreaList(){ |
| ... | ... | @@ -441,18 +430,6 @@ public class ChannelController { |
| 441 | 430 | return new BaseDto(); |
| 442 | 431 | } |
| 443 | 432 | |
| 444 | - @RequestMapping(value = "GetDiscountPackage",method = RequestMethod.GET) | |
| 445 | - @ApiOperation(value = "获取商品详情") | |
| 446 | - public BaseDto<DiscountPackage> GetDiscountPackage(int id){ | |
| 447 | - BaseDto<DiscountPackage> result=new BaseDto<>(); | |
| 448 | - String r=Get(domain+"/University/getPackageById","id="+id); | |
| 449 | - JSONObject jsonObject= JSONObject.parseObject(r); | |
| 450 | - String data = jsonObject.getString("data"); | |
| 451 | - DiscountPackage model=JSON.parseObject(data,new TypeReference<DiscountPackage>(){}); | |
| 452 | - result.setData(model); | |
| 453 | - return result; | |
| 454 | - } | |
| 455 | - | |
| 456 | 433 | @RequestMapping(value = "GetWxSign",method = RequestMethod.GET) |
| 457 | 434 | @ApiOperation(value = "获取微信分享签名") |
| 458 | 435 | public BaseDto<WxSign> GetWxSign(String url){ |
| ... | ... | @@ -463,11 +440,6 @@ public class ChannelController { |
| 463 | 440 | } |
| 464 | 441 | url=url.replaceAll("\\+", "%2B"); |
| 465 | 442 | BaseDto<WxSign> result=new BaseDto<>(); |
| 466 | -// String r=Get("http://114.55.30.100:1111/api/UserRegisterApp/GetWxShareSign","url="+url); | |
| 467 | -// JSONObject jsonObject= JSONObject.parseObject(r); | |
| 468 | -// String data = jsonObject.getString("result"); | |
| 469 | -// WxSign wxSign=JSON.parseObject(data,new TypeReference<WxSign>(){}); | |
| 470 | -// result.setData(wxSign); | |
| 471 | 443 | |
| 472 | 444 | WxSign wxSign1=new WxSign(); |
| 473 | 445 | wxSign1.setTimestamp(Long.toString(System.currentTimeMillis())); |
| ... | ... | @@ -515,23 +487,6 @@ public class ChannelController { |
| 515 | 487 | return result; |
| 516 | 488 | } |
| 517 | 489 | |
| 518 | - @RequestMapping(value = "AddVerificationCode",method = RequestMethod.GET) | |
| 519 | - @ApiOperation(value = "获取验证码") | |
| 520 | - public BaseDto AddVerificationCode(String mobile){ | |
| 521 | - Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1"); | |
| 522 | - return new BaseDto(); | |
| 523 | - } | |
| 524 | - | |
| 525 | - @RequestMapping(value = "CheckCodeIsRight",method = RequestMethod.GET) | |
| 526 | - @ApiOperation(value = "判断验证码是否正确") | |
| 527 | - public BaseDto CheckCodeIsRight(String mobile, String captcha){ | |
| 528 | - BaseDto result=new BaseDto(); | |
| 529 | - String r=Get(domain+"/h5/MyVoluntary/CheckCodeIsRight","mobile="+mobile+"&captcha="+captcha); | |
| 530 | - JSONObject jsonObject= JSONObject.parseObject(r); | |
| 531 | - result.setSuccess(jsonObject.getString("success")=="true"?true:false); | |
| 532 | - result.setMessage(jsonObject.getString("message")); | |
| 533 | - return result; | |
| 534 | - } | |
| 535 | 490 | |
| 536 | 491 | @RequestMapping(value = "AdminLogin",method = RequestMethod.GET) |
| 537 | 492 | @ApiOperation(value = "管理员登录") |
| ... | ... | @@ -550,71 +505,6 @@ public class ChannelController { |
| 550 | 505 | return result; |
| 551 | 506 | } |
| 552 | 507 | |
| 553 | - @RequestMapping(value = "IsDianXin",method = RequestMethod.GET) | |
| 554 | - @ApiOperation(value = "判断是否是电信用户") | |
| 555 | - public BaseDto<List<Coupon>> IsDianXin(String mobile,String password,int productId){ | |
| 556 | - BaseDto<List<Coupon>> result=new BaseDto(); | |
| 557 | - String r=Get(domain+"/admin/Voluntary/GetAccount","mobile="+mobile); | |
| 558 | - JSONObject jsonObject= JSONObject.parseObject(r); | |
| 559 | - String data = jsonObject.getString("data"); | |
| 560 | - Account account=JSON.parseObject(data,new TypeReference<Account>(){}); | |
| 561 | - if(data==null){ | |
| 562 | - result.setSuccess(false); | |
| 563 | - result.setMessage("非VIP邀请号码"); | |
| 564 | - } | |
| 565 | - else { | |
| 566 | -// Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1"); | |
| 567 | - if(!account.getPassword().equals(password)){ | |
| 568 | - result.setSuccess(false); | |
| 569 | - result.setMessage("密码错误"); | |
| 570 | - } | |
| 571 | - else{ | |
| 572 | - String re=Get(domain+"/University/getMyCouponDetail","mobile="+mobile+"&type="+productId); | |
| 573 | - JSONObject jsonObject1= JSONObject.parseObject(re); | |
| 574 | - String data1 = jsonObject1.getString("data"); | |
| 575 | - result.setData(JSON.parseObject(data1,new TypeReference<List<Coupon>>(){})); | |
| 576 | - } | |
| 577 | - } | |
| 578 | - return result; | |
| 579 | - } | |
| 580 | - | |
| 581 | - @RequestMapping(value = "AddUser",method = RequestMethod.POST) | |
| 582 | - @ApiOperation(value = "新增用户") | |
| 583 | - public BaseDto AddUser(@RequestBody Users users){ | |
| 584 | - JSONObject object = new JSONObject(); | |
| 585 | - object.put("phone",users.getPhone()); | |
| 586 | - object.put("channelId",users.getChannelId()); | |
| 587 | - object.put("agentId",users.getAgentId()); | |
| 588 | - object.put("userType",1); | |
| 589 | - JSONObject jsonObject=HttpClientUtils.httpPostJson(domain+"/admin/Voluntary/AddUser",object.toJSONString()); | |
| 590 | - return new BaseDto(); | |
| 591 | - } | |
| 592 | - | |
| 593 | - @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) | |
| 594 | - @ApiOperation(value = "生成预支付订单并返回详情") | |
| 595 | - public BaseDto<List<Order>> GetAddOrderDetail(@RequestBody Order order) { | |
| 596 | - BaseDto<List<Order>> result=new BaseDto<>(); | |
| 597 | - JSONObject object = new JSONObject(); | |
| 598 | - object.put("account",order.getAccount()); | |
| 599 | - object.put("expert_id",0); | |
| 600 | - object.put("paymoney",order.getPaymoney()); | |
| 601 | - object.put("payway",2); | |
| 602 | - object.put("product_detail","升学汇产品-代理商"); | |
| 603 | - object.put("product_id",order.getProduct_id()); | |
| 604 | - object.put("product_name",order.getProduct_name()); | |
| 605 | - object.put("type",order.getProduct_id()); | |
| 606 | - object.put("user_name",order.getUser_name()); | |
| 607 | - object.put("buycount",0); | |
| 608 | - object.put("score_id",0); | |
| 609 | - object.put("channelId",order.getChannelId()); | |
| 610 | - object.put("agentId",order.getAgentId()); | |
| 611 | - object.put("address",order.getAddress()); | |
| 612 | - JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); | |
| 613 | - String data = jsonObject.getString("data"); | |
| 614 | - result.setData(JSON.parseObject(data,new TypeReference<List<Order>>(){})); | |
| 615 | - return result; | |
| 616 | - } | |
| 617 | - | |
| 618 | 508 | @RequestMapping(value = "GetToken",method = RequestMethod.GET) |
| 619 | 509 | @ApiOperation(value = "获取openid") |
| 620 | 510 | public BaseDto<Token> GetToken(String code){ |
| ... | ... | @@ -626,29 +516,6 @@ public class ChannelController { |
| 626 | 516 | return result; |
| 627 | 517 | } |
| 628 | 518 | |
| 629 | - @RequestMapping(value = "WxPay",method = RequestMethod.POST) | |
| 630 | - @ApiOperation(value = "微信支付") | |
| 631 | - public BaseDto<WxResult> WxPay(@RequestBody WxPay pay){ | |
| 632 | - BaseDto<WxResult> result = new BaseDto(); | |
| 633 | - JSONObject object = new JSONObject(); | |
| 634 | - object.put("attach",pay.getAttach()); | |
| 635 | - object.put("notify_url",domain+"/Payment/WXPayBack"); | |
| 636 | - object.put("outTradeNo",pay.getOutTradeNo()); | |
| 637 | - object.put("payType",2); | |
| 638 | - object.put("payWay",2); | |
| 639 | - object.put("productId",pay.getProductId()); | |
| 640 | - object.put("subject",pay.getSubject()); | |
| 641 | - object.put("totalFee",pay.getTotalFee()); | |
| 642 | - object.put("coupon_num",pay.getCoupon_num()); | |
| 643 | - object.put("openid",pay.getOpenid()); | |
| 644 | - JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); | |
| 645 | - if(jsonObject!=null) { | |
| 646 | - String data = jsonObject.getString("data"); | |
| 647 | - result.setData(JSON.parseObject(data,new TypeReference<WxResult>(){})); | |
| 648 | - } | |
| 649 | - return result; | |
| 650 | - } | |
| 651 | - | |
| 652 | 519 | @RequestMapping(value = "GetStatistics",method = RequestMethod.GET) |
| 653 | 520 | @ApiOperation(value = "获取渠道商统计,type:1-今日;2-本月;3-累计") |
| 654 | 521 | public BaseDto<List<Statistics>> GetStatistics(int channelId,int agentId,int type){ | ... | ... |
src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
0 → 100644
| ... | ... | @@ -0,0 +1,113 @@ |
| 1 | +package com.sincere.wechatbusiness.controller; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.sincere.wechatbusiness.model.Order; | |
| 5 | +import com.sincere.wechatbusiness.model.Users; | |
| 6 | +import com.sincere.wechatbusiness.model.WxPay; | |
| 7 | +import com.sincere.wechatbusiness.utils.HttpClientUtils; | |
| 8 | +import io.swagger.annotations.ApiOperation; | |
| 9 | +import org.springframework.beans.factory.annotation.Value; | |
| 10 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | +import org.springframework.web.bind.annotation.RestController; | |
| 14 | + | |
| 15 | +@RestController | |
| 16 | +@RequestMapping("reportVoluntary") | |
| 17 | +public class ReportVoluntaryController { | |
| 18 | + | |
| 19 | + @Value("${reportVoluntary}") | |
| 20 | + private String domain ; | |
| 21 | + | |
| 22 | + | |
| 23 | + @ApiOperation("获取支付成功之后分享列表 coupon_type AI 1 || 专家 2 ") | |
| 24 | + @RequestMapping(value = "/getShareCouponList" , method = RequestMethod.GET) | |
| 25 | + public JSONObject GetShareCouponList(int coupon_type) { | |
| 26 | + String url = domain + "/h5/order/getShareCouponList?coupon_type="+coupon_type; | |
| 27 | + return HttpClientUtils.httpGet(url); | |
| 28 | + } | |
| 29 | + | |
| 30 | + @ApiOperation("领券 coupon_type AI 1 || 专家 2 ; type 1订购 2分享 ") | |
| 31 | + @RequestMapping(value = "/getCoupon" , method = RequestMethod.GET) | |
| 32 | + public JSONObject GetCoupon(int coupon_type,int type,String phone) { | |
| 33 | + String url = domain + "/h5/order/getCoupon?coupon_type="+coupon_type+"&type="+type+"&phone="+phone; | |
| 34 | + return HttpClientUtils.httpGet(url); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) | |
| 38 | + @ApiOperation(value = "获取代理商品列表") | |
| 39 | + public JSONObject GetPackageList(){ | |
| 40 | + String url = domain+"/University/getPackageList" ; | |
| 41 | + return HttpClientUtils.httpGet(url); | |
| 42 | + } | |
| 43 | + | |
| 44 | + @RequestMapping(value = "GetDiscountPackage",method = RequestMethod.GET) | |
| 45 | + @ApiOperation(value = "获取商品详情") | |
| 46 | + public JSONObject GetDiscountPackage(int id){ | |
| 47 | + String url = domain+"/University/getPackageById?id="+id ; | |
| 48 | + return HttpClientUtils.httpGet(url); | |
| 49 | + } | |
| 50 | + | |
| 51 | + @RequestMapping(value = "AddVerificationCode",method = RequestMethod.GET) | |
| 52 | + @ApiOperation(value = "获取验证码") | |
| 53 | + public JSONObject AddVerificationCode(String mobile){ | |
| 54 | + String url = domain+"/h5/MyVoluntary/AddVerificationCode?code=206&mobile="+mobile+"&type=1" ; | |
| 55 | + return HttpClientUtils.httpGet(url); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @RequestMapping(value = "CheckCodeIsRight",method = RequestMethod.GET) | |
| 59 | + @ApiOperation(value = "判断验证码是否正确") | |
| 60 | + public JSONObject CheckCodeIsRight(String mobile, String captcha){ | |
| 61 | + String url = domain+"/h5/MyVoluntary/CheckCodeIsRight?mobile="+mobile+"&captcha="+captcha ; | |
| 62 | + return HttpClientUtils.httpGet(url); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @RequestMapping(value = "AddUser",method = RequestMethod.POST) | |
| 66 | + @ApiOperation(value = "新增用户") | |
| 67 | + public JSONObject AddUser(@RequestBody Users users){ | |
| 68 | + JSONObject object = new JSONObject(); | |
| 69 | + object.put("phone",users.getPhone()); | |
| 70 | + object.put("channelId",users.getChannelId()); | |
| 71 | + object.put("agentId",users.getAgentId()); | |
| 72 | + object.put("userType",1); | |
| 73 | + return HttpClientUtils.httpPostJson(domain+"/admin/Voluntary/AddUser",object.toJSONString()); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) | |
| 77 | + @ApiOperation(value = "生成预支付订单并返回详情") | |
| 78 | + public JSONObject GetAddOrderDetail(@RequestBody Order order) { | |
| 79 | + JSONObject object = new JSONObject(); | |
| 80 | + object.put("account",order.getAccount()); | |
| 81 | + object.put("expert_id",0); | |
| 82 | + object.put("paymoney",order.getPaymoney()); | |
| 83 | + object.put("payway",2); | |
| 84 | + object.put("product_detail","升学汇产品-代理商"); | |
| 85 | + object.put("product_id",order.getProduct_id()); | |
| 86 | + object.put("product_name",order.getProduct_name()); | |
| 87 | + object.put("type",order.getProduct_id()); | |
| 88 | + object.put("user_name",order.getUser_name()); | |
| 89 | + object.put("buycount",0); | |
| 90 | + object.put("score_id",0); | |
| 91 | + object.put("channelId",order.getChannelId()); | |
| 92 | + object.put("agentId",order.getAgentId()); | |
| 93 | + object.put("address",order.getAddress()); | |
| 94 | + return HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @RequestMapping(value = "WxPay",method = RequestMethod.POST) | |
| 98 | + @ApiOperation(value = "微信支付") | |
| 99 | + public JSONObject WxPay(@RequestBody WxPay pay){ | |
| 100 | + JSONObject object = new JSONObject(); | |
| 101 | + object.put("attach",pay.getAttach()); | |
| 102 | + object.put("notify_url",domain+"/Payment/WXPayBack"); | |
| 103 | + object.put("outTradeNo",pay.getOutTradeNo()); | |
| 104 | + object.put("payType",2); | |
| 105 | + object.put("payWay",2); | |
| 106 | + object.put("productId",pay.getProductId()); | |
| 107 | + object.put("subject",pay.getSubject()); | |
| 108 | + object.put("totalFee",pay.getTotalFee()); | |
| 109 | + object.put("coupon_num",pay.getCoupon_num()); | |
| 110 | + object.put("openid",pay.getOpenid()); | |
| 111 | + return HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); | |
| 112 | + } | |
| 113 | +} | ... | ... |