diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java index 7d9758a..ebbf347 100644 --- a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java +++ b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java @@ -16,6 +16,7 @@ import com.sincere.wechatbusiness.utils.TokenUtils; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -58,8 +59,8 @@ public class ChannelController { private static final Logger log_channel = LoggerUtils.Logger(LogName.channel); - //private String domain="https://mytest.myjxt.com:51314"; - private String domain="https://proxy.shunzhi.net:51314"; + @Value("${reportVoluntary}") + private String domain; private static String appId = "wx6078ff3f67524996"; private static String secret = "8a0465b8ad0f000f568f48853e2818c8" ; @@ -170,18 +171,6 @@ public class ChannelController { return result; } - @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) - @ApiOperation(value = "获取代理商品列表") - public BaseDto> GetPackageList(){ - BaseDto> result=new BaseDto<>(); - String r=Get(domain+"/University/getPackageList",""); - JSONObject jsonObject= JSONObject.parseObject(r); - String data = jsonObject.getString("data"); - List list=JSON.parseObject(data,new TypeReference>(){}); - result.setData(list); - return result; - } - @RequestMapping(value="GetAreaList",method = RequestMethod.POST) @ApiOperation(value = "获取省市") public BaseDto> GetAreaList(){ @@ -441,18 +430,6 @@ public class ChannelController { return new BaseDto(); } - @RequestMapping(value = "GetDiscountPackage",method = RequestMethod.GET) - @ApiOperation(value = "获取商品详情") - public BaseDto GetDiscountPackage(int id){ - BaseDto result=new BaseDto<>(); - String r=Get(domain+"/University/getPackageById","id="+id); - JSONObject jsonObject= JSONObject.parseObject(r); - String data = jsonObject.getString("data"); - DiscountPackage model=JSON.parseObject(data,new TypeReference(){}); - result.setData(model); - return result; - } - @RequestMapping(value = "GetWxSign",method = RequestMethod.GET) @ApiOperation(value = "获取微信分享签名") public BaseDto GetWxSign(String url){ @@ -463,11 +440,6 @@ public class ChannelController { } url=url.replaceAll("\\+", "%2B"); BaseDto result=new BaseDto<>(); -// String r=Get("http://114.55.30.100:1111/api/UserRegisterApp/GetWxShareSign","url="+url); -// JSONObject jsonObject= JSONObject.parseObject(r); -// String data = jsonObject.getString("result"); -// WxSign wxSign=JSON.parseObject(data,new TypeReference(){}); -// result.setData(wxSign); WxSign wxSign1=new WxSign(); wxSign1.setTimestamp(Long.toString(System.currentTimeMillis())); @@ -515,23 +487,6 @@ public class ChannelController { return result; } - @RequestMapping(value = "AddVerificationCode",method = RequestMethod.GET) - @ApiOperation(value = "获取验证码") - public BaseDto AddVerificationCode(String mobile){ - Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1"); - return new BaseDto(); - } - - @RequestMapping(value = "CheckCodeIsRight",method = RequestMethod.GET) - @ApiOperation(value = "判断验证码是否正确") - public BaseDto CheckCodeIsRight(String mobile, String captcha){ - BaseDto result=new BaseDto(); - String r=Get(domain+"/h5/MyVoluntary/CheckCodeIsRight","mobile="+mobile+"&captcha="+captcha); - JSONObject jsonObject= JSONObject.parseObject(r); - result.setSuccess(jsonObject.getString("success")=="true"?true:false); - result.setMessage(jsonObject.getString("message")); - return result; - } @RequestMapping(value = "AdminLogin",method = RequestMethod.GET) @ApiOperation(value = "管理员登录") @@ -550,71 +505,6 @@ public class ChannelController { return result; } - @RequestMapping(value = "IsDianXin",method = RequestMethod.GET) - @ApiOperation(value = "判断是否是电信用户") - public BaseDto> IsDianXin(String mobile,String password,int productId){ - BaseDto> result=new BaseDto(); - String r=Get(domain+"/admin/Voluntary/GetAccount","mobile="+mobile); - JSONObject jsonObject= JSONObject.parseObject(r); - String data = jsonObject.getString("data"); - Account account=JSON.parseObject(data,new TypeReference(){}); - if(data==null){ - result.setSuccess(false); - result.setMessage("非VIP邀请号码"); - } - else { -// Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1"); - if(!account.getPassword().equals(password)){ - result.setSuccess(false); - result.setMessage("密码错误"); - } - else{ - String re=Get(domain+"/University/getMyCouponDetail","mobile="+mobile+"&type="+productId); - JSONObject jsonObject1= JSONObject.parseObject(re); - String data1 = jsonObject1.getString("data"); - result.setData(JSON.parseObject(data1,new TypeReference>(){})); - } - } - return result; - } - - @RequestMapping(value = "AddUser",method = RequestMethod.POST) - @ApiOperation(value = "新增用户") - public BaseDto AddUser(@RequestBody Users users){ - JSONObject object = new JSONObject(); - object.put("phone",users.getPhone()); - object.put("channelId",users.getChannelId()); - object.put("agentId",users.getAgentId()); - object.put("userType",1); - JSONObject jsonObject=HttpClientUtils.httpPostJson(domain+"/admin/Voluntary/AddUser",object.toJSONString()); - return new BaseDto(); - } - - @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) - @ApiOperation(value = "生成预支付订单并返回详情") - public BaseDto> GetAddOrderDetail(@RequestBody Order order) { - BaseDto> result=new BaseDto<>(); - JSONObject object = new JSONObject(); - object.put("account",order.getAccount()); - object.put("expert_id",0); - object.put("paymoney",order.getPaymoney()); - object.put("payway",2); - object.put("product_detail","升学汇产品-代理商"); - object.put("product_id",order.getProduct_id()); - object.put("product_name",order.getProduct_name()); - object.put("type",order.getProduct_id()); - object.put("user_name",order.getUser_name()); - object.put("buycount",0); - object.put("score_id",0); - object.put("channelId",order.getChannelId()); - object.put("agentId",order.getAgentId()); - object.put("address",order.getAddress()); - JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); - String data = jsonObject.getString("data"); - result.setData(JSON.parseObject(data,new TypeReference>(){})); - return result; - } - @RequestMapping(value = "GetToken",method = RequestMethod.GET) @ApiOperation(value = "获取openid") public BaseDto GetToken(String code){ @@ -626,29 +516,6 @@ public class ChannelController { return result; } - @RequestMapping(value = "WxPay",method = RequestMethod.POST) - @ApiOperation(value = "微信支付") - public BaseDto WxPay(@RequestBody WxPay pay){ - BaseDto result = new BaseDto(); - JSONObject object = new JSONObject(); - object.put("attach",pay.getAttach()); - object.put("notify_url",domain+"/Payment/WXPayBack"); - object.put("outTradeNo",pay.getOutTradeNo()); - object.put("payType",2); - object.put("payWay",2); - object.put("productId",pay.getProductId()); - object.put("subject",pay.getSubject()); - object.put("totalFee",pay.getTotalFee()); - object.put("coupon_num",pay.getCoupon_num()); - object.put("openid",pay.getOpenid()); - JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); - if(jsonObject!=null) { - String data = jsonObject.getString("data"); - result.setData(JSON.parseObject(data,new TypeReference(){})); - } - return result; - } - @RequestMapping(value = "GetStatistics",method = RequestMethod.GET) @ApiOperation(value = "获取渠道商统计,type:1-今日;2-本月;3-累计") public BaseDto> GetStatistics(int channelId,int agentId,int type){ diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java b/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java new file mode 100644 index 0000000..f872c22 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java @@ -0,0 +1,113 @@ +package com.sincere.wechatbusiness.controller; + +import com.alibaba.fastjson.JSONObject; +import com.sincere.wechatbusiness.model.Order; +import com.sincere.wechatbusiness.model.Users; +import com.sincere.wechatbusiness.model.WxPay; +import com.sincere.wechatbusiness.utils.HttpClientUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("reportVoluntary") +public class ReportVoluntaryController { + + @Value("${reportVoluntary}") + private String domain ; + + + @ApiOperation("获取支付成功之后分享列表 coupon_type AI 1 || 专家 2 ") + @RequestMapping(value = "/getShareCouponList" , method = RequestMethod.GET) + public JSONObject GetShareCouponList(int coupon_type) { + String url = domain + "/h5/order/getShareCouponList?coupon_type="+coupon_type; + return HttpClientUtils.httpGet(url); + } + + @ApiOperation("领券 coupon_type AI 1 || 专家 2 ; type 1订购 2分享 ") + @RequestMapping(value = "/getCoupon" , method = RequestMethod.GET) + public JSONObject GetCoupon(int coupon_type,int type,String phone) { + String url = domain + "/h5/order/getCoupon?coupon_type="+coupon_type+"&type="+type+"&phone="+phone; + return HttpClientUtils.httpGet(url); + } + + @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) + @ApiOperation(value = "获取代理商品列表") + public JSONObject GetPackageList(){ + String url = domain+"/University/getPackageList" ; + return HttpClientUtils.httpGet(url); + } + + @RequestMapping(value = "GetDiscountPackage",method = RequestMethod.GET) + @ApiOperation(value = "获取商品详情") + public JSONObject GetDiscountPackage(int id){ + String url = domain+"/University/getPackageById?id="+id ; + return HttpClientUtils.httpGet(url); + } + + @RequestMapping(value = "AddVerificationCode",method = RequestMethod.GET) + @ApiOperation(value = "获取验证码") + public JSONObject AddVerificationCode(String mobile){ + String url = domain+"/h5/MyVoluntary/AddVerificationCode?code=206&mobile="+mobile+"&type=1" ; + return HttpClientUtils.httpGet(url); + } + + @RequestMapping(value = "CheckCodeIsRight",method = RequestMethod.GET) + @ApiOperation(value = "判断验证码是否正确") + public JSONObject CheckCodeIsRight(String mobile, String captcha){ + String url = domain+"/h5/MyVoluntary/CheckCodeIsRight?mobile="+mobile+"&captcha="+captcha ; + return HttpClientUtils.httpGet(url); + } + + @RequestMapping(value = "AddUser",method = RequestMethod.POST) + @ApiOperation(value = "新增用户") + public JSONObject AddUser(@RequestBody Users users){ + JSONObject object = new JSONObject(); + object.put("phone",users.getPhone()); + object.put("channelId",users.getChannelId()); + object.put("agentId",users.getAgentId()); + object.put("userType",1); + return HttpClientUtils.httpPostJson(domain+"/admin/Voluntary/AddUser",object.toJSONString()); + } + + @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) + @ApiOperation(value = "生成预支付订单并返回详情") + public JSONObject GetAddOrderDetail(@RequestBody Order order) { + JSONObject object = new JSONObject(); + object.put("account",order.getAccount()); + object.put("expert_id",0); + object.put("paymoney",order.getPaymoney()); + object.put("payway",2); + object.put("product_detail","升学汇产品-代理商"); + object.put("product_id",order.getProduct_id()); + object.put("product_name",order.getProduct_name()); + object.put("type",order.getProduct_id()); + object.put("user_name",order.getUser_name()); + object.put("buycount",0); + object.put("score_id",0); + object.put("channelId",order.getChannelId()); + object.put("agentId",order.getAgentId()); + object.put("address",order.getAddress()); + return HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); + } + + @RequestMapping(value = "WxPay",method = RequestMethod.POST) + @ApiOperation(value = "微信支付") + public JSONObject WxPay(@RequestBody WxPay pay){ + JSONObject object = new JSONObject(); + object.put("attach",pay.getAttach()); + object.put("notify_url",domain+"/Payment/WXPayBack"); + object.put("outTradeNo",pay.getOutTradeNo()); + object.put("payType",2); + object.put("payWay",2); + object.put("productId",pay.getProductId()); + object.put("subject",pay.getSubject()); + object.put("totalFee",pay.getTotalFee()); + object.put("coupon_num",pay.getCoupon_num()); + object.put("openid",pay.getOpenid()); + return HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); + } +} -- libgit2 0.21.0