Commit 9a842beed09c11e597c6aca2ff489651715a62fc
1 parent
dd2acb67
Exists in
master
微信分享accesstoken做缓存处理
Showing
21 changed files
with
1337 additions
and
26 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
| @@ -3,14 +3,19 @@ package com.sincere.wechatbusiness.controller; | @@ -3,14 +3,19 @@ package com.sincere.wechatbusiness.controller; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.alibaba.fastjson.TypeReference; | 5 | import com.alibaba.fastjson.TypeReference; |
| 6 | +import com.fasterxml.jackson.databind.ser.Serializers; | ||
| 6 | import com.sincere.wechatbusiness.dto.BaseDto; | 7 | import com.sincere.wechatbusiness.dto.BaseDto; |
| 7 | import com.sincere.wechatbusiness.dto.ChannelDto; | 8 | import com.sincere.wechatbusiness.dto.ChannelDto; |
| 9 | +import com.sincere.wechatbusiness.logs.LogName; | ||
| 10 | +import com.sincere.wechatbusiness.logs.LoggerUtils; | ||
| 8 | import com.sincere.wechatbusiness.model.*; | 11 | import com.sincere.wechatbusiness.model.*; |
| 9 | import com.sincere.wechatbusiness.service.*; | 12 | import com.sincere.wechatbusiness.service.*; |
| 10 | import com.sincere.wechatbusiness.utils.HttpClientUtils; | 13 | import com.sincere.wechatbusiness.utils.HttpClientUtils; |
| 11 | import com.sincere.wechatbusiness.utils.Page; | 14 | import com.sincere.wechatbusiness.utils.Page; |
| 12 | import com.sincere.wechatbusiness.utils.TokenUtils; | 15 | import com.sincere.wechatbusiness.utils.TokenUtils; |
| 16 | +import io.swagger.annotations.Api; | ||
| 13 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
| 18 | +import org.slf4j.Logger; | ||
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.web.bind.annotation.RequestBody; | 20 | import org.springframework.web.bind.annotation.RequestBody; |
| 16 | import org.springframework.web.bind.annotation.RequestMapping; | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
| @@ -22,8 +27,9 @@ import java.net.HttpURLConnection; | @@ -22,8 +27,9 @@ import java.net.HttpURLConnection; | ||
| 22 | import java.net.MalformedURLException; | 27 | import java.net.MalformedURLException; |
| 23 | import java.net.URL; | 28 | import java.net.URL; |
| 24 | import java.net.URLConnection; | 29 | import java.net.URLConnection; |
| 25 | -import java.util.List; | ||
| 26 | -import java.util.Map; | 30 | +import java.security.MessageDigest; |
| 31 | +import java.security.NoSuchAlgorithmException; | ||
| 32 | +import java.util.*; | ||
| 27 | 33 | ||
| 28 | @RestController | 34 | @RestController |
| 29 | public class ChannelController { | 35 | public class ChannelController { |
| @@ -48,8 +54,10 @@ public class ChannelController { | @@ -48,8 +54,10 @@ public class ChannelController { | ||
| 48 | @Autowired | 54 | @Autowired |
| 49 | AgentService agentService; | 55 | AgentService agentService; |
| 50 | 56 | ||
| 51 | - private String domain="https://mytest.myjxt.com:51314"; | ||
| 52 | -// private String domain="https://proxy.shunzhi.net:51314"; | 57 | + private static final Logger log_channel = LoggerUtils.Logger(LogName.channel); |
| 58 | + | ||
| 59 | +// private String domain="https://mytest.myjxt.com:51314"; | ||
| 60 | + private String domain="https://proxy.shunzhi.net:51314"; | ||
| 53 | 61 | ||
| 54 | @RequestMapping(value = "GetChannelList",method = RequestMethod.POST) | 62 | @RequestMapping(value = "GetChannelList",method = RequestMethod.POST) |
| 55 | @ApiOperation(value = "获取渠道商列表") | 63 | @ApiOperation(value = "获取渠道商列表") |
| @@ -318,11 +326,45 @@ public class ChannelController { | @@ -318,11 +326,45 @@ public class ChannelController { | ||
| 318 | @ApiOperation(value = "获取微信分享签名") | 326 | @ApiOperation(value = "获取微信分享签名") |
| 319 | public BaseDto<WxSign> GetWxSign(String url){ | 327 | public BaseDto<WxSign> GetWxSign(String url){ |
| 320 | BaseDto<WxSign> result=new BaseDto<>(); | 328 | 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); | 329 | +// String r=Get("http://114.55.30.100:1111/api/UserRegisterApp/GetWxShareSign","url="+url); |
| 330 | +// JSONObject jsonObject= JSONObject.parseObject(r); | ||
| 331 | +// String data = jsonObject.getString("result"); | ||
| 332 | +// WxSign wxSign=JSON.parseObject(data,new TypeReference<WxSign>(){}); | ||
| 333 | +// result.setData(wxSign); | ||
| 334 | + | ||
| 335 | + WxSign wxSign1=new WxSign(); | ||
| 336 | + wxSign1.setTimestamp(Long.toString(System.currentTimeMillis())); | ||
| 337 | + wxSign1.setNoncestr(UUID.randomUUID().toString()); | ||
| 338 | + AccessToken accessToken=channelService.getAccessToken(); | ||
| 339 | + Token token=new Token(); | ||
| 340 | + if(accessToken!=null) { | ||
| 341 | + Calendar dateOne=Calendar.getInstance(); | ||
| 342 | + Calendar dateTwo=Calendar.getInstance(); | ||
| 343 | + dateOne.setTime(new Date()); | ||
| 344 | + dateTwo.setTime(accessToken.getCreateTime()); | ||
| 345 | + long timeOne=dateOne.getTimeInMillis(); | ||
| 346 | + long timeTwo=dateTwo.getTimeInMillis(); | ||
| 347 | + long minute=(timeOne-timeTwo)/(1000*60); | ||
| 348 | + | ||
| 349 | + if(minute<60) token.setAccess_token(accessToken.getAccessToken()); | ||
| 350 | + else{ | ||
| 351 | + token=getAccessToken("wx6078ff3f67524996","8a0465b8ad0f000f568f48853e2818c8"); | ||
| 352 | + accessToken.setAccessToken(token.getAccess_token()); | ||
| 353 | + channelService.insertAccessToken(accessToken); | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + else { | ||
| 357 | + token=getAccessToken("wx6078ff3f67524996","8a0465b8ad0f000f568f48853e2818c8"); | ||
| 358 | + accessToken=new AccessToken(); | ||
| 359 | + accessToken.setAccessToken(token.getAccess_token()); | ||
| 360 | + channelService.insertAccessToken(accessToken); | ||
| 361 | + } | ||
| 362 | + String js=Get("https://api.weixin.qq.com/cgi-bin/ticket/getticket","type=jsapi&access_token="+token.getAccess_token()); | ||
| 363 | + JSONObject jsonObject= JSONObject.parseObject(js); | ||
| 364 | + wxSign1.setJsapi_ticket(jsonObject.getString("ticket")); | ||
| 365 | + String rawstring = "jsapi_ticket=" + wxSign1.getJsapi_ticket() + "&noncestr=" + wxSign1.getNoncestr() + "×tamp=" + wxSign1.getTimestamp() + "&url=" + url + ""; | ||
| 366 | + wxSign1.setSignature(SHA1(rawstring)); | ||
| 367 | + result.setData(wxSign1); | ||
| 326 | return result; | 368 | return result; |
| 327 | } | 369 | } |
| 328 | 370 | ||
| @@ -363,25 +405,44 @@ public class ChannelController { | @@ -363,25 +405,44 @@ public class ChannelController { | ||
| 363 | 405 | ||
| 364 | @RequestMapping(value = "IsDianXin",method = RequestMethod.GET) | 406 | @RequestMapping(value = "IsDianXin",method = RequestMethod.GET) |
| 365 | @ApiOperation(value = "判断是否是电信用户") | 407 | @ApiOperation(value = "判断是否是电信用户") |
| 366 | - public BaseDto<List<Coupon>> IsDianXin(String mobile,int productId){ | 408 | + public BaseDto<List<Coupon>> IsDianXin(String mobile,String password,int productId){ |
| 367 | BaseDto<List<Coupon>> result=new BaseDto(); | 409 | BaseDto<List<Coupon>> result=new BaseDto(); |
| 368 | String r=Get(domain+"/admin/Voluntary/GetAccount","mobile="+mobile); | 410 | String r=Get(domain+"/admin/Voluntary/GetAccount","mobile="+mobile); |
| 369 | JSONObject jsonObject= JSONObject.parseObject(r); | 411 | JSONObject jsonObject= JSONObject.parseObject(r); |
| 370 | String data = jsonObject.getString("data"); | 412 | String data = jsonObject.getString("data"); |
| 413 | + Account account=JSON.parseObject(data,new TypeReference<Account>(){}); | ||
| 371 | if(data==null){ | 414 | if(data==null){ |
| 372 | result.setSuccess(false); | 415 | result.setSuccess(false); |
| 373 | result.setMessage("非VIP邀请号码"); | 416 | result.setMessage("非VIP邀请号码"); |
| 374 | } | 417 | } |
| 375 | else { | 418 | 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>>(){})); | 419 | +// Get(domain+"/h5/MyVoluntary/AddVerificationCode","code=206&mobile="+mobile+"&type=1"); |
| 420 | + if(!account.getPassword().equals(password)){ | ||
| 421 | + result.setSuccess(false); | ||
| 422 | + result.setMessage("密码错误"); | ||
| 423 | + } | ||
| 424 | + else{ | ||
| 425 | + String re=Get(domain+"/University/getMyCouponDetail","mobile="+mobile+"&type="+productId); | ||
| 426 | + JSONObject jsonObject1= JSONObject.parseObject(re); | ||
| 427 | + String data1 = jsonObject1.getString("data"); | ||
| 428 | + result.setData(JSON.parseObject(data1,new TypeReference<List<Coupon>>(){})); | ||
| 429 | + } | ||
| 381 | } | 430 | } |
| 382 | return result; | 431 | return result; |
| 383 | } | 432 | } |
| 384 | 433 | ||
| 434 | + @RequestMapping(value = "AddUser",method = RequestMethod.POST) | ||
| 435 | + @ApiOperation(value = "新增用户") | ||
| 436 | + public BaseDto AddUser(@RequestBody Users users){ | ||
| 437 | + JSONObject object = new JSONObject(); | ||
| 438 | + object.put("phone",users.getPhone()); | ||
| 439 | + object.put("channelId",users.getChannelId()); | ||
| 440 | + object.put("agentId",users.getAgentId()); | ||
| 441 | + object.put("userType",1); | ||
| 442 | + JSONObject jsonObject=HttpClientUtils.httpPostJson(domain+"/admin/Voluntary/AddUser",object.toJSONString()); | ||
| 443 | + return new BaseDto(); | ||
| 444 | + } | ||
| 445 | + | ||
| 385 | @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) | 446 | @RequestMapping(value = "GetAddOrderDetail",method = RequestMethod.POST) |
| 386 | @ApiOperation(value = "生成预支付订单并返回详情") | 447 | @ApiOperation(value = "生成预支付订单并返回详情") |
| 387 | public BaseDto<List<Order>> GetAddOrderDetail(@RequestBody Order order) { | 448 | public BaseDto<List<Order>> GetAddOrderDetail(@RequestBody Order order) { |
| @@ -398,12 +459,25 @@ public class ChannelController { | @@ -398,12 +459,25 @@ public class ChannelController { | ||
| 398 | object.put("user_name",order.getUser_name()); | 459 | object.put("user_name",order.getUser_name()); |
| 399 | object.put("buycount",0); | 460 | object.put("buycount",0); |
| 400 | object.put("score_id",0); | 461 | object.put("score_id",0); |
| 462 | + object.put("channelId",order.getChannelId()); | ||
| 463 | + object.put("agentId",order.getAgentId()); | ||
| 401 | JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); | 464 | JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/University/GetAddOrderDetail",object.toJSONString()); |
| 402 | String data = jsonObject.getString("data"); | 465 | String data = jsonObject.getString("data"); |
| 403 | result.setData(JSON.parseObject(data,new TypeReference<List<Order>>(){})); | 466 | result.setData(JSON.parseObject(data,new TypeReference<List<Order>>(){})); |
| 404 | return result; | 467 | return result; |
| 405 | } | 468 | } |
| 406 | 469 | ||
| 470 | + @RequestMapping(value = "GetToken",method = RequestMethod.GET) | ||
| 471 | + @ApiOperation(value = "获取openid") | ||
| 472 | + public BaseDto<Token> GetToken(String code){ | ||
| 473 | + BaseDto<Token> result=new BaseDto<>(); | ||
| 474 | + String re=Get("http://campus.myjxt.com/api/EasyMessage/GetTokenYKT","code="+code); | ||
| 475 | + JSONObject jsonObject1= JSONObject.parseObject(re); | ||
| 476 | + String data1 = jsonObject1.getString("data"); | ||
| 477 | + result.setData(JSON.parseObject(data1,new TypeReference<Token>(){})); | ||
| 478 | + return result; | ||
| 479 | + } | ||
| 480 | + | ||
| 407 | @RequestMapping(value = "WxPay",method = RequestMethod.POST) | 481 | @RequestMapping(value = "WxPay",method = RequestMethod.POST) |
| 408 | @ApiOperation(value = "微信支付") | 482 | @ApiOperation(value = "微信支付") |
| 409 | public BaseDto<WxResult> WxPay(@RequestBody WxPay pay){ | 483 | public BaseDto<WxResult> WxPay(@RequestBody WxPay pay){ |
| @@ -418,9 +492,78 @@ public class ChannelController { | @@ -418,9 +492,78 @@ public class ChannelController { | ||
| 418 | object.put("subject",pay.getSubject()); | 492 | object.put("subject",pay.getSubject()); |
| 419 | object.put("totalFee",pay.getTotalFee()); | 493 | object.put("totalFee",pay.getTotalFee()); |
| 420 | object.put("coupon_num",pay.getCoupon_num()); | 494 | object.put("coupon_num",pay.getCoupon_num()); |
| 495 | + object.put("openid",pay.getOpenid()); | ||
| 421 | JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); | 496 | JSONObject jsonObject = HttpClientUtils.httpPostJson(domain+"/Payment/WxPay",object.toJSONString()); |
| 422 | - String data = jsonObject.getString("data"); | ||
| 423 | - result.setData(JSON.parseObject(data,new TypeReference<WxResult>(){})); | 497 | + if(jsonObject!=null) { |
| 498 | + String data = jsonObject.getString("data"); | ||
| 499 | + result.setData(JSON.parseObject(data,new TypeReference<WxResult>(){})); | ||
| 500 | + } | ||
| 501 | + return result; | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + @RequestMapping(value = "GetStatistics",method = RequestMethod.GET) | ||
| 505 | + @ApiOperation(value = "获取渠道商统计,type:1-今日;2-本月;3-累计") | ||
| 506 | + public BaseDto<List<Statistics>> GetStatistics(int channelId,int agentId,int type){ | ||
| 507 | + BaseDto<List<Statistics>> result=new BaseDto(); | ||
| 508 | + List<Statistics> list=new ArrayList<>(); | ||
| 509 | + Statistics register=new Statistics(); | ||
| 510 | + register.setCount(channelService.getRegisterCount(channelId,agentId,type)); | ||
| 511 | + List<Users> registerList=new ArrayList<>(); | ||
| 512 | + Users channelRegister=new Users(); | ||
| 513 | + channelRegister=channelService.getChannelRegister(channelId,type); | ||
| 514 | + if(channelRegister!=null) registerList.add(channelRegister); | ||
| 515 | + registerList.addAll(channelService.getAgentRegisterList(channelId,type)); | ||
| 516 | + register.setUsersList(registerList); | ||
| 517 | + list.add(register); | ||
| 518 | + Statistics order=new Statistics(); | ||
| 519 | + order.setCount(channelService.getOrderCount(channelId,agentId,type)); | ||
| 520 | + List<Users> orderList=new ArrayList<>(); | ||
| 521 | + Users channelOrder=new Users(); | ||
| 522 | + channelOrder=channelService.getChannelOrder(channelId,type); | ||
| 523 | + if(channelOrder!=null) orderList.add(channelOrder); | ||
| 524 | + orderList.addAll(channelService.getAgentOrderList(channelId,type)); | ||
| 525 | + order.setUsersList(orderList); | ||
| 526 | + list.add(order); | ||
| 527 | + Statistics statistics=new Statistics(); | ||
| 528 | + statistics.setDiscountPackageList(channelService.getOrderList(channelId,type)); | ||
| 529 | + list.add(statistics); | ||
| 530 | + result.setData(list); | ||
| 531 | + return result; | ||
| 532 | + } | ||
| 533 | + | ||
| 534 | + @RequestMapping(value = "GetStatisticsRegisterDetailList",method = RequestMethod.GET) | ||
| 535 | + @ApiOperation(value = "获取注册详情") | ||
| 536 | + public BaseDto<List<Users>> GetStatisticsRegisterDetailList(int channelId,int agentId,int type){ | ||
| 537 | + BaseDto<List<Users>> result=new BaseDto<>(); | ||
| 538 | + result.setData(channelService.getRegisterDetailList(channelId,agentId,type)); | ||
| 539 | + return result; | ||
| 540 | + } | ||
| 541 | + | ||
| 542 | + @RequestMapping(value = "GetStatisticsOrderDetailList",method = RequestMethod.GET) | ||
| 543 | + @ApiOperation(value = "获取订购详情") | ||
| 544 | + public BaseDto<List<DiscountPackage>> GetStatisticsOrderDetailList(int channelId,int agentId,int type,int productId){ | ||
| 545 | + BaseDto<List<DiscountPackage>> result=new BaseDto<>(); | ||
| 546 | + result.setData(channelService.getOrderDetailList(channelId,agentId,type,productId)); | ||
| 547 | + return result; | ||
| 548 | + } | ||
| 549 | + | ||
| 550 | + @RequestMapping(value = "GetAgentStatistics",method = RequestMethod.GET) | ||
| 551 | + @ApiOperation(value = "获取推广统计,type:1-今日;2-本月;3-累计") | ||
| 552 | + public BaseDto<List<Statistics>> GetAgentStatistics(int channelId,int agentId,int type){ | ||
| 553 | + BaseDto<List<Statistics>> result=new BaseDto<>(); | ||
| 554 | + List<Statistics> list=new ArrayList<>(); | ||
| 555 | + Statistics register=new Statistics(); | ||
| 556 | + register.setCount(channelService.getRegisterCount(channelId,agentId,type)); | ||
| 557 | + register.setUsersList(channelService.getRegisterDetailList(channelId,agentId,type)); | ||
| 558 | + list.add(register); | ||
| 559 | + Statistics order=new Statistics(); | ||
| 560 | + order.setCount(channelService.getOrderCount(channelId,agentId,type)); | ||
| 561 | + order.setDiscountPackageList(channelService.getOrderDetailList(channelId,agentId,type,0)); | ||
| 562 | + list.add(order); | ||
| 563 | + Statistics statistics=new Statistics(); | ||
| 564 | + statistics.setDiscountPackageList(channelService.getOrderList(channelId,type)); | ||
| 565 | + list.add(statistics); | ||
| 566 | + result.setData(list); | ||
| 424 | return result; | 567 | return result; |
| 425 | } | 568 | } |
| 426 | 569 | ||
| @@ -550,4 +693,60 @@ public class ChannelController { | @@ -550,4 +693,60 @@ public class ChannelController { | ||
| 550 | return result; | 693 | return result; |
| 551 | } | 694 | } |
| 552 | 695 | ||
| 696 | + public Token getAccessToken(String appID, String appScret) { | ||
| 697 | + Token token = new Token(); | ||
| 698 | + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appID + "&secret=" | ||
| 699 | + + appScret; | ||
| 700 | + try { | ||
| 701 | + URL getUrl=new URL(url); | ||
| 702 | + HttpURLConnection http=(HttpURLConnection)getUrl.openConnection(); | ||
| 703 | + http.setRequestMethod("GET"); | ||
| 704 | + http.setRequestProperty("Content-Type", | ||
| 705 | + "application/x-www-form-urlencoded"); | ||
| 706 | + http.setDoOutput(true); | ||
| 707 | + http.setDoInput(true); | ||
| 708 | + | ||
| 709 | + | ||
| 710 | + http.connect(); | ||
| 711 | + InputStream is = http.getInputStream(); | ||
| 712 | + int size = is.available(); | ||
| 713 | + byte[] b = new byte[size]; | ||
| 714 | + is.read(b); | ||
| 715 | + | ||
| 716 | + String message = new String(b, "UTF-8"); | ||
| 717 | + JSONObject json = JSONObject.parseObject(message); | ||
| 718 | + | ||
| 719 | + | ||
| 720 | + token.setAccess_token(json.getString("access_token")); | ||
| 721 | + token.setExpires_in(new Integer(json.getString("expires_in"))); | ||
| 722 | + } catch (MalformedURLException e) { | ||
| 723 | + e.printStackTrace(); | ||
| 724 | + } catch (IOException e) { | ||
| 725 | + e.printStackTrace(); | ||
| 726 | + } | ||
| 727 | + return token; | ||
| 728 | + } | ||
| 729 | + | ||
| 730 | + public static String SHA1(String str) { | ||
| 731 | + try { | ||
| 732 | + MessageDigest digest = java.security.MessageDigest.getInstance("SHA-1"); //如果是SHA加密只需要将"SHA-1"改成"SHA"即可 | ||
| 733 | + digest.update(str.getBytes()); | ||
| 734 | + byte messageDigest[] = digest.digest(); | ||
| 735 | + // Create Hex String | ||
| 736 | + StringBuffer hexStr = new StringBuffer(); | ||
| 737 | + // 字节数组转换为 十六进制 数 | ||
| 738 | + for (int i = 0; i < messageDigest.length; i++) { | ||
| 739 | + String shaHex = Integer.toHexString(messageDigest[i] & 0xFF); | ||
| 740 | + if (shaHex.length() < 2) { | ||
| 741 | + hexStr.append(0); | ||
| 742 | + } | ||
| 743 | + hexStr.append(shaHex); | ||
| 744 | + } | ||
| 745 | + return hexStr.toString(); | ||
| 746 | + | ||
| 747 | + } catch (NoSuchAlgorithmException e) { | ||
| 748 | + e.printStackTrace(); | ||
| 749 | + } | ||
| 750 | + return null; | ||
| 751 | + } | ||
| 553 | } | 752 | } |
src/main/java/com/sincere/wechatbusiness/logs/LogName.java
0 → 100644
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +package com.sincere.wechatbusiness.logs; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @author chen | ||
| 5 | + * @version 1.0 | ||
| 6 | + * @date 2019/10/12 0012 16:18 | ||
| 7 | + */ | ||
| 8 | +public enum LogName { | ||
| 9 | + channel("channel"); | ||
| 10 | + | ||
| 11 | + private String logFileName; | ||
| 12 | + | ||
| 13 | + LogName(String fileName) { | ||
| 14 | + this.logFileName = fileName; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public String getLogFileName() { | ||
| 18 | + return logFileName; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setLogFileName(String logFileName) { | ||
| 22 | + this.logFileName = logFileName; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public static com.sincere.wechatbusiness.logs.LogName getAwardTypeEnum(String value) { | ||
| 26 | + com.sincere.wechatbusiness.logs.LogName[] arr = values(); | ||
| 27 | + for (com.sincere.wechatbusiness.logs.LogName item : arr) { | ||
| 28 | + if (null != item && !item.logFileName.equals("")) { | ||
| 29 | + return item; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return null; | ||
| 33 | + } | ||
| 34 | +} | ||
| 35 | + |
src/main/java/com/sincere/wechatbusiness/logs/LoggerUtils.java
0 → 100644
| @@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
| 1 | +package com.sincere.wechatbusiness.logs; | ||
| 2 | + | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @author chen | ||
| 8 | + * @version 1.0 | ||
| 9 | + * @date 2019/10/12 0012 16:19 | ||
| 10 | + */ | ||
| 11 | +public class LoggerUtils { | ||
| 12 | + | ||
| 13 | + public static <T> Logger Logger(Class<T> clazz) { | ||
| 14 | + return LoggerFactory.getLogger(clazz); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 打印到指定的文件下 | ||
| 19 | + * | ||
| 20 | + * @param desc 日志文件名称 | ||
| 21 | + * @return | ||
| 22 | + */ | ||
| 23 | + public static Logger Logger(LogName desc) { | ||
| 24 | + return LoggerFactory.getLogger(desc.getLogFileName()); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +} |
src/main/java/com/sincere/wechatbusiness/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java
0 → 100644
| @@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
| 1 | +package com.sincere.wechatbusiness.logs; | ||
| 2 | + | ||
| 3 | +import ch.qos.logback.core.joran.spi.NoAutoStart; | ||
| 4 | +import ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @author chen | ||
| 8 | + * @version 1.0 | ||
| 9 | + * @date 2019/10/31 0031 13:42 | ||
| 10 | + */ | ||
| 11 | +@NoAutoStart | ||
| 12 | +public class MyTimeBasedFileNamingAndTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> { | ||
| 13 | + | ||
| 14 | + //这个用来指定时间间隔 | ||
| 15 | + private Integer multiple = 1; | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + protected void computeNextCheck() { | ||
| 19 | + nextCheck = rc.getEndOfNextNthPeriod(dateInCurrentPeriod, multiple).getTime(); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public Integer getMultiple() { | ||
| 23 | + return multiple; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setMultiple(Integer multiple) { | ||
| 27 | + if (multiple > 1) { | ||
| 28 | + this.multiple = multiple; | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java
| @@ -14,5 +14,5 @@ public interface CatalogContentMapper { | @@ -14,5 +14,5 @@ public interface CatalogContentMapper { | ||
| 14 | 14 | ||
| 15 | int deleteCatalogContent(int id); | 15 | int deleteCatalogContent(int id); |
| 16 | 16 | ||
| 17 | - List<CatalogContent> getListByDate(@Param("catalogId") int catalogId,@Param("date") String date,@Param("state") int state); | 17 | + List<CatalogContent> getListByDate(@Param("catalogId") int catalogId,@Param("date1") String date1,@Param("date2") String date2,@Param("state") int state); |
| 18 | } | 18 | } |
src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
| 1 | package com.sincere.wechatbusiness.mapper; | 1 | package com.sincere.wechatbusiness.mapper; |
| 2 | 2 | ||
| 3 | import com.sincere.wechatbusiness.model.*; | 3 | import com.sincere.wechatbusiness.model.*; |
| 4 | +import org.apache.ibatis.annotations.Param; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 4 | 6 | ||
| 5 | import java.util.List; | 7 | import java.util.List; |
| 6 | 8 | ||
| @@ -28,4 +30,26 @@ public interface ChannelMapper { | @@ -28,4 +30,26 @@ public interface ChannelMapper { | ||
| 28 | Manager getManagerDetail(String mobile); | 30 | Manager getManagerDetail(String mobile); |
| 29 | 31 | ||
| 30 | int insertLog(Log log); | 32 | int insertLog(Log log); |
| 33 | + | ||
| 34 | + int getRegisterCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type); | ||
| 35 | + | ||
| 36 | + int getOrderCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type,@Param("state") int state); | ||
| 37 | + | ||
| 38 | + List<Users> getAgentRegisterList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); | ||
| 39 | + | ||
| 40 | + List<Users> getAgentOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); | ||
| 41 | + | ||
| 42 | + Users getChannelRegister(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); | ||
| 43 | + | ||
| 44 | + Users getChannelOrder(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); | ||
| 45 | + | ||
| 46 | + List<DiscountPackage> getOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); | ||
| 47 | + | ||
| 48 | + List<Users> getRegisterDetailList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type); | ||
| 49 | + | ||
| 50 | + List<DiscountPackage> getOrderDetailList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("productId") int productId); | ||
| 51 | + | ||
| 52 | + int insertAccessToken(AccessToken accessToken); | ||
| 53 | + | ||
| 54 | + AccessToken getAccessToken(); | ||
| 31 | } | 55 | } |
src/main/java/com/sincere/wechatbusiness/model/AccessToken.java
0 → 100644
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +package com.sincere.wechatbusiness.model; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +public class AccessToken { | ||
| 6 | + private Integer id; | ||
| 7 | + | ||
| 8 | + private String accessToken; | ||
| 9 | + | ||
| 10 | + private Date createTime; | ||
| 11 | + | ||
| 12 | + public Integer getId() { | ||
| 13 | + return id; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public void setId(Integer id) { | ||
| 17 | + this.id = id; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + public String getAccessToken() { | ||
| 21 | + return accessToken; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public void setAccessToken(String accessToken) { | ||
| 25 | + this.accessToken = accessToken; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public Date getCreateTime() { | ||
| 29 | + return createTime; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setCreateTime(Date createTime) { | ||
| 33 | + this.createTime = createTime; | ||
| 34 | + } | ||
| 35 | +} |
src/main/java/com/sincere/wechatbusiness/model/Account.java
0 → 100644
| @@ -0,0 +1,58 @@ | @@ -0,0 +1,58 @@ | ||
| 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 Account { | ||
| 10 | + private Integer id; | ||
| 11 | + | ||
| 12 | + private Integer projectId; | ||
| 13 | + | ||
| 14 | + private String phone; | ||
| 15 | + | ||
| 16 | + private String password; | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "0-删除;1-正常;2-停用") | ||
| 19 | + private Integer state; | ||
| 20 | + | ||
| 21 | + private Integer isLogin; | ||
| 22 | + | ||
| 23 | + private Integer isOrder; | ||
| 24 | + | ||
| 25 | + private Date createTime; | ||
| 26 | + | ||
| 27 | + public Integer getId(){return id;} | ||
| 28 | + | ||
| 29 | + public void setId(Integer id){this.id=id;} | ||
| 30 | + | ||
| 31 | + public Integer getProjectId(){return projectId;} | ||
| 32 | + | ||
| 33 | + public void setProjectId(Integer projectId){this.projectId=projectId;} | ||
| 34 | + | ||
| 35 | + public String getPhone(){return phone;} | ||
| 36 | + | ||
| 37 | + public void setPhone(String phone){this.phone=phone;} | ||
| 38 | + | ||
| 39 | + public String getPassword(){return password;} | ||
| 40 | + | ||
| 41 | + public void setPassword(String password){this.password=password;} | ||
| 42 | + | ||
| 43 | + public Integer getState(){return state;} | ||
| 44 | + | ||
| 45 | + public void setState(Integer state){this.state=state;} | ||
| 46 | + | ||
| 47 | + public Integer getIsLogin(){return isLogin;} | ||
| 48 | + | ||
| 49 | + public void setIsLogin(Integer isLogin){this.isLogin=isLogin;} | ||
| 50 | + | ||
| 51 | + public Integer getIsOrder(){return isOrder;} | ||
| 52 | + | ||
| 53 | + public void setIsOrder(Integer isOrder){this.isOrder=isOrder;} | ||
| 54 | + | ||
| 55 | + public Date getCreateTime(){return createTime;} | ||
| 56 | + | ||
| 57 | + public void setCreateTime(Date createTime){this.createTime=createTime;} | ||
| 58 | +} |
src/main/java/com/sincere/wechatbusiness/model/DiscountPackage.java
| @@ -14,6 +14,12 @@ public class DiscountPackage { | @@ -14,6 +14,12 @@ public class DiscountPackage { | ||
| 14 | 14 | ||
| 15 | private String isSelect; | 15 | private String isSelect; |
| 16 | 16 | ||
| 17 | + private Integer count; | ||
| 18 | + | ||
| 19 | + private String account; | ||
| 20 | + | ||
| 21 | + private Date intime; | ||
| 22 | + | ||
| 17 | public Integer getId() { | 23 | public Integer getId() { |
| 18 | return id; | 24 | return id; |
| 19 | } | 25 | } |
| @@ -85,4 +91,28 @@ public class DiscountPackage { | @@ -85,4 +91,28 @@ public class DiscountPackage { | ||
| 85 | public void setIsSelect(String isSelect) { | 91 | public void setIsSelect(String isSelect) { |
| 86 | this.isSelect = isSelect; | 92 | this.isSelect = isSelect; |
| 87 | } | 93 | } |
| 94 | + | ||
| 95 | + public Integer getCount() { | ||
| 96 | + return count; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public void setCount(Integer count) { | ||
| 100 | + this.count = count; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public String getAccount() { | ||
| 104 | + return account; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public void setAccount(String account) { | ||
| 108 | + this.account = account; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public Date getIntime() { | ||
| 112 | + return intime; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public void setIntime(Date intime) { | ||
| 116 | + this.intime = intime; | ||
| 117 | + } | ||
| 88 | } | 118 | } |
src/main/java/com/sincere/wechatbusiness/model/Jsapi.java
0 → 100644
| @@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
| 1 | +package com.sincere.wechatbusiness.model; | ||
| 2 | + | ||
| 3 | +public class Jsapi { | ||
| 4 | + public Integer errcode; | ||
| 5 | + | ||
| 6 | + public String errmsg; | ||
| 7 | + | ||
| 8 | + public String ticket; | ||
| 9 | + | ||
| 10 | + public Integer expires_in; | ||
| 11 | + | ||
| 12 | + public Integer getErrcode() { | ||
| 13 | + return errcode; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public void setErrcode(Integer errcode) { | ||
| 17 | + this.errcode = errcode; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + public String getErrmsg() { | ||
| 21 | + return errmsg; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public void setErrmsg(String errmsg) { | ||
| 25 | + this.errmsg = errmsg; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public String getTicket() { | ||
| 29 | + return ticket; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setTicket(String ticket) { | ||
| 33 | + this.ticket = ticket; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public Integer getExpires_in() { | ||
| 37 | + return expires_in; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public void setExpires_in(Integer expires_in) { | ||
| 41 | + this.expires_in = expires_in; | ||
| 42 | + } | ||
| 43 | +} |
src/main/java/com/sincere/wechatbusiness/model/Order.java
| @@ -50,6 +50,10 @@ public class Order { | @@ -50,6 +50,10 @@ public class Order { | ||
| 50 | 50 | ||
| 51 | private String discount; | 51 | private String discount; |
| 52 | 52 | ||
| 53 | + private Integer channelId; | ||
| 54 | + | ||
| 55 | + private Integer agentId; | ||
| 56 | + | ||
| 53 | 57 | ||
| 54 | public Integer getId() { | 58 | public Integer getId() { |
| 55 | return id; | 59 | return id; |
| @@ -214,4 +218,20 @@ public class Order { | @@ -214,4 +218,20 @@ public class Order { | ||
| 214 | public void setDiscount(String discount) { | 218 | public void setDiscount(String discount) { |
| 215 | this.discount = discount; | 219 | this.discount = discount; |
| 216 | } | 220 | } |
| 221 | + | ||
| 222 | + public Integer getChannelId() { | ||
| 223 | + return channelId; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public void setChannelId(Integer channelId) { | ||
| 227 | + this.channelId = channelId; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + public Integer getAgentId() { | ||
| 231 | + return agentId; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + public void setAgentId(Integer agentId) { | ||
| 235 | + this.agentId = agentId; | ||
| 236 | + } | ||
| 217 | } | 237 | } |
src/main/java/com/sincere/wechatbusiness/model/Statistics.java
0 → 100644
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +package com.sincere.wechatbusiness.model; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +public class Statistics { | ||
| 6 | + private Integer Count; | ||
| 7 | + | ||
| 8 | + private List<Users> usersList; | ||
| 9 | + | ||
| 10 | + private List<DiscountPackage> discountPackageList; | ||
| 11 | + | ||
| 12 | + public Integer getCount() { | ||
| 13 | + return Count; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public void setCount(Integer count) { | ||
| 17 | + Count = count; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + public List<Users> getUsersList() { | ||
| 21 | + return usersList; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public void setUsersList(List<Users> usersList) { | ||
| 25 | + this.usersList = usersList; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public List<DiscountPackage> getDiscountPackageList() { | ||
| 29 | + return discountPackageList; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setDiscountPackageList(List<DiscountPackage> discountPackageList) { | ||
| 33 | + this.discountPackageList = discountPackageList; | ||
| 34 | + } | ||
| 35 | +} |
src/main/java/com/sincere/wechatbusiness/model/Token.java
0 → 100644
| @@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
| 1 | +package com.sincere.wechatbusiness.model; | ||
| 2 | + | ||
| 3 | +public class Token { | ||
| 4 | + public String access_token; | ||
| 5 | + | ||
| 6 | + public Integer expires_in; | ||
| 7 | + | ||
| 8 | + public String refresh_token; | ||
| 9 | + | ||
| 10 | + public String openid; | ||
| 11 | + | ||
| 12 | + public String scope; | ||
| 13 | + | ||
| 14 | + public String getAccess_token() { | ||
| 15 | + return access_token; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public void setAccess_token(String access_token) { | ||
| 19 | + this.access_token = access_token; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public Integer getExpires_in() { | ||
| 23 | + return expires_in; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setExpires_in(Integer expires_in) { | ||
| 27 | + this.expires_in = expires_in; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public String getRefresh_token() { | ||
| 31 | + return refresh_token; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setRefresh_token(String refresh_token) { | ||
| 35 | + this.refresh_token = refresh_token; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public String getOpenid() { | ||
| 39 | + return openid; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setOpenid(String openid) { | ||
| 43 | + this.openid = openid; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public String getScope() { | ||
| 47 | + return scope; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setScope(String scope) { | ||
| 51 | + this.scope = scope; | ||
| 52 | + } | ||
| 53 | +} |
src/main/java/com/sincere/wechatbusiness/model/Users.java
0 → 100644
| @@ -0,0 +1,451 @@ | @@ -0,0 +1,451 @@ | ||
| 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 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@ApiModel | ||
| 10 | +public class Users { | ||
| 11 | + private Integer id; | ||
| 12 | + | ||
| 13 | + private String userName; | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "1-用户;2-专家") | ||
| 16 | + private Integer userType; | ||
| 17 | + | ||
| 18 | + private String password; | ||
| 19 | + | ||
| 20 | + private String sex; | ||
| 21 | + | ||
| 22 | + private String phone; | ||
| 23 | + | ||
| 24 | + private String weChat; | ||
| 25 | + | ||
| 26 | + private String face; | ||
| 27 | + | ||
| 28 | + private Integer age; | ||
| 29 | + | ||
| 30 | + private String province; | ||
| 31 | + | ||
| 32 | + private String city; | ||
| 33 | + | ||
| 34 | + private String graduateSchool; | ||
| 35 | + | ||
| 36 | + private String expertIntroduction; | ||
| 37 | + | ||
| 38 | + @ApiModelProperty(value = "0-未激活;1-已激活") | ||
| 39 | + private Integer isActive; | ||
| 40 | + | ||
| 41 | + @ApiModelProperty(value="1-普通志愿;2-三位一体志愿;用,分割") | ||
| 42 | + private String service; | ||
| 43 | + | ||
| 44 | + private Integer sort; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty(value = "1-启用;2-停用") | ||
| 47 | + private Integer state; | ||
| 48 | + | ||
| 49 | + private Date createTime; | ||
| 50 | + | ||
| 51 | + private String beginTime; | ||
| 52 | + | ||
| 53 | + private String endTime; | ||
| 54 | + | ||
| 55 | + private String para; | ||
| 56 | + | ||
| 57 | + private String provinceCode; | ||
| 58 | + | ||
| 59 | + private String cityCode; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty(value = "报名人数") | ||
| 62 | + private Integer applyCount; | ||
| 63 | + | ||
| 64 | + @ApiModelProperty(value = "未报名人数") | ||
| 65 | + private Integer noCount; | ||
| 66 | + | ||
| 67 | + @ApiModelProperty(value = "报名百分比") | ||
| 68 | + private Integer percentage; | ||
| 69 | + | ||
| 70 | + @ApiModelProperty(value = "1-普通志愿;2-三位一体") | ||
| 71 | + private Integer type; | ||
| 72 | + | ||
| 73 | + private Integer firstCount; | ||
| 74 | + | ||
| 75 | + private Integer secondCount; | ||
| 76 | + | ||
| 77 | + private Integer overCount; | ||
| 78 | + | ||
| 79 | + @ApiModelProperty(value = "是否电信用户,1-是") | ||
| 80 | + private Integer isDianXin; | ||
| 81 | + | ||
| 82 | + private Double price; | ||
| 83 | + | ||
| 84 | + @ApiModelProperty(value = "收货人") | ||
| 85 | + private String consignee; | ||
| 86 | + | ||
| 87 | + @ApiModelProperty(value = "收货手机号") | ||
| 88 | + private String receivePhone; | ||
| 89 | + | ||
| 90 | + @ApiModelProperty(value = "收货地区code") | ||
| 91 | + private String areaCode; | ||
| 92 | + | ||
| 93 | + @ApiModelProperty(value = "收货地区") | ||
| 94 | + private String areaName; | ||
| 95 | + | ||
| 96 | + @ApiModelProperty(value = "详细地址") | ||
| 97 | + private String address; | ||
| 98 | + | ||
| 99 | + @ApiModelProperty(value = "三位一体服务人数") | ||
| 100 | + private Integer trinityServiceNumber; | ||
| 101 | + | ||
| 102 | + @ApiModelProperty(value = "基本信息") | ||
| 103 | + private String trinityIntroduction; | ||
| 104 | + | ||
| 105 | + @ApiModelProperty(value = "专家服务") | ||
| 106 | + private String trinityService; | ||
| 107 | + | ||
| 108 | + @ApiModelProperty(value = "普通志愿服务人数") | ||
| 109 | + private Integer pointServiceNumber; | ||
| 110 | + | ||
| 111 | + @ApiModelProperty(value = "基本信息") | ||
| 112 | + private String pointIntroduction; | ||
| 113 | + | ||
| 114 | + @ApiModelProperty(value = "专家服务") | ||
| 115 | + private String pointService; | ||
| 116 | + | ||
| 117 | + @ApiModelProperty(value = "1-上架;2-下架") | ||
| 118 | + private int putAway; | ||
| 119 | + | ||
| 120 | + private String newMobile; | ||
| 121 | + | ||
| 122 | + private Integer channelId; | ||
| 123 | + | ||
| 124 | + private Integer agentId; | ||
| 125 | + | ||
| 126 | + @ApiModelProperty(value = "统计账号后四位") | ||
| 127 | + private String account; | ||
| 128 | + | ||
| 129 | + @ApiModelProperty(value = "统计人数") | ||
| 130 | + private Integer count; | ||
| 131 | + | ||
| 132 | + public Integer getId(){return id;} | ||
| 133 | + | ||
| 134 | + public void setId(Integer id){this.id=id;} | ||
| 135 | + | ||
| 136 | + public String getUserName(){return userName;} | ||
| 137 | + | ||
| 138 | + public void setUserName(String userName){this.userName=userName;} | ||
| 139 | + | ||
| 140 | + public Integer getUserType(){return userType;} | ||
| 141 | + | ||
| 142 | + public void setUserType(Integer userType){this.userType=userType;} | ||
| 143 | + | ||
| 144 | + public String getPassword(){return password;} | ||
| 145 | + | ||
| 146 | + public void setPassword(String password){this.password=password;} | ||
| 147 | + | ||
| 148 | + public String getSex(){return sex;} | ||
| 149 | + | ||
| 150 | + public void setSex(String sex){this.sex=sex;} | ||
| 151 | + | ||
| 152 | + public String getPhone(){return phone;} | ||
| 153 | + | ||
| 154 | + public void setPhone(String phone){this.phone=phone;} | ||
| 155 | + | ||
| 156 | + public String getWeChat(){return weChat;} | ||
| 157 | + | ||
| 158 | + public void setWeChat(String weChat){this.weChat=weChat;} | ||
| 159 | + | ||
| 160 | + public String getFace(){return face;} | ||
| 161 | + | ||
| 162 | + public void setFace(String face){this.face=face;} | ||
| 163 | + | ||
| 164 | + public Integer getAge(){return age;} | ||
| 165 | + | ||
| 166 | + public void setAge(Integer age){this.age=age;} | ||
| 167 | + | ||
| 168 | + public String getProvince(){return province;} | ||
| 169 | + | ||
| 170 | + public void setProvince(String province){this.province=province;} | ||
| 171 | + | ||
| 172 | + public String getCity(){return city;} | ||
| 173 | + | ||
| 174 | + public void setCity(String city){this.city=city;} | ||
| 175 | + | ||
| 176 | + public String getGraduateSchool(){return graduateSchool;} | ||
| 177 | + | ||
| 178 | + public void setGraduateSchool(String graduateSchool){this.graduateSchool=graduateSchool;} | ||
| 179 | + | ||
| 180 | + public String getExpertIntroduction(){return expertIntroduction;} | ||
| 181 | + | ||
| 182 | + public void setExpertIntroduction(String expertIntroduction){this.expertIntroduction=expertIntroduction;} | ||
| 183 | + | ||
| 184 | + public Integer getState(){return state;} | ||
| 185 | + | ||
| 186 | + public void setState(Integer state){this.state=state;} | ||
| 187 | + | ||
| 188 | + public Date getCreateTime(){return createTime;} | ||
| 189 | + | ||
| 190 | + public void setCreateTime(Date createTime){this.createTime=createTime;} | ||
| 191 | + | ||
| 192 | + public String getBeginTime(){return beginTime;} | ||
| 193 | + | ||
| 194 | + public void setBeginTime(String beginTime){this.beginTime=beginTime;} | ||
| 195 | + | ||
| 196 | + public String getEndTime(){return endTime;} | ||
| 197 | + | ||
| 198 | + public void setEndTime(String endTime){this.endTime=endTime;} | ||
| 199 | + | ||
| 200 | + public String getPara(){return para;} | ||
| 201 | + | ||
| 202 | + public void setPara(String para){this.para=para;} | ||
| 203 | + | ||
| 204 | + public Integer getIsActive() { | ||
| 205 | + return isActive; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public void setIsActive(Integer isActive) { | ||
| 209 | + this.isActive = isActive; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public String getService() { | ||
| 213 | + return service; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public void setService(String service) { | ||
| 217 | + this.service = service; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public Integer getSort() { | ||
| 221 | + return sort; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public void setSort(Integer sort) { | ||
| 225 | + this.sort = sort; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public String getProvinceCode() { | ||
| 229 | + return provinceCode; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + public void setProvinceCode(String provinceCode) { | ||
| 233 | + this.provinceCode = provinceCode; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + public String getCityCode() { | ||
| 237 | + return cityCode; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + public void setCityCode(String cityCode) { | ||
| 241 | + this.cityCode = cityCode; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + public Integer getApplyCount() { | ||
| 245 | + return applyCount; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + public void setApplyCount(Integer applyCount) { | ||
| 249 | + this.applyCount = applyCount; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + public Integer getNoCount() { | ||
| 253 | + return noCount; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + public void setNoCount(Integer noCount) { | ||
| 257 | + this.noCount = noCount; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + public Integer getPercentage() { | ||
| 261 | + return percentage; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + public void setPercentage(Integer percentage) { | ||
| 265 | + this.percentage = percentage; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + public Integer getType() { | ||
| 269 | + return type; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + public void setType(Integer type) { | ||
| 273 | + this.type = type; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + public Integer getFirstCount() { | ||
| 277 | + return firstCount; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + public void setFirstCount(Integer firstCount) { | ||
| 281 | + this.firstCount = firstCount; | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + public Integer getSecondCount() { | ||
| 285 | + return secondCount; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + public void setSecondCount(Integer secondCount) { | ||
| 289 | + this.secondCount = secondCount; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + public Integer getOverCount() { | ||
| 293 | + return overCount; | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + public void setOverCount(Integer overCount) { | ||
| 297 | + this.overCount = overCount; | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + public Integer getIsDianXin() { | ||
| 301 | + return isDianXin; | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + public void setIsDianXin(Integer isDianXin) { | ||
| 305 | + this.isDianXin = isDianXin; | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + public Double getPrice() { | ||
| 309 | + return price; | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + public void setPrice(Double price) { | ||
| 313 | + this.price = price; | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + public String getConsignee() { | ||
| 317 | + return consignee; | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + public void setConsignee(String consignee) { | ||
| 321 | + this.consignee = consignee; | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + public String getReceivePhone() { | ||
| 325 | + return receivePhone; | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | + public void setReceivePhone(String receivePhone) { | ||
| 329 | + this.receivePhone = receivePhone; | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + public String getAreaCode() { | ||
| 333 | + return areaCode; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + public void setAreaCode(String areaCode) { | ||
| 337 | + this.areaCode = areaCode; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + public String getAreaName() { | ||
| 341 | + return areaName; | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + public void setAreaName(String areaName) { | ||
| 345 | + this.areaName = areaName; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + public String getAddress() { | ||
| 349 | + return address; | ||
| 350 | + } | ||
| 351 | + | ||
| 352 | + public void setAddress(String address) { | ||
| 353 | + this.address = address; | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + public Integer getTrinityServiceNumber() { | ||
| 357 | + return trinityServiceNumber; | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + public void setTrinityServiceNumber(Integer trinityServiceNumber) { | ||
| 361 | + this.trinityServiceNumber = trinityServiceNumber; | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + public String getTrinityIntroduction() { | ||
| 365 | + return trinityIntroduction; | ||
| 366 | + } | ||
| 367 | + | ||
| 368 | + public void setTrinityIntroduction(String trinityIntroduction) { | ||
| 369 | + this.trinityIntroduction = trinityIntroduction; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + public String getTrinityService() { | ||
| 373 | + return trinityService; | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + public void setTrinityService(String trinityService) { | ||
| 377 | + this.trinityService = trinityService; | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + public Integer getPointServiceNumber() { | ||
| 381 | + return pointServiceNumber; | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + public void setPointServiceNumber(Integer pointServiceNumber) { | ||
| 385 | + this.pointServiceNumber = pointServiceNumber; | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | + public String getPointIntroduction() { | ||
| 389 | + return pointIntroduction; | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + public void setPointIntroduction(String pointIntroduction) { | ||
| 393 | + this.pointIntroduction = pointIntroduction; | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + public String getPointService() { | ||
| 397 | + return pointService; | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + public void setPointService(String pointService) { | ||
| 401 | + this.pointService = pointService; | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + public int getPutAway() { | ||
| 405 | + return putAway; | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + public void setPutAway(int putAway) { | ||
| 409 | + this.putAway = putAway; | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + public String getNewMobile() { | ||
| 413 | + return newMobile; | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + public void setNewMobile(String newMobile) { | ||
| 417 | + this.newMobile = newMobile; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + public Integer getChannelId() { | ||
| 421 | + return channelId; | ||
| 422 | + } | ||
| 423 | + | ||
| 424 | + public void setChannelId(Integer channelId) { | ||
| 425 | + this.channelId = channelId; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + public Integer getAgentId() { | ||
| 429 | + return agentId; | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + public void setAgentId(Integer agentId) { | ||
| 433 | + this.agentId = agentId; | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + public String getAccount() { | ||
| 437 | + return account; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + public void setAccount(String account) { | ||
| 441 | + this.account = account; | ||
| 442 | + } | ||
| 443 | + | ||
| 444 | + public Integer getCount() { | ||
| 445 | + return count; | ||
| 446 | + } | ||
| 447 | + | ||
| 448 | + public void setCount(Integer count) { | ||
| 449 | + this.count = count; | ||
| 450 | + } | ||
| 451 | +} |
src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
| @@ -2,6 +2,8 @@ package com.sincere.wechatbusiness.service; | @@ -2,6 +2,8 @@ package com.sincere.wechatbusiness.service; | ||
| 2 | 2 | ||
| 3 | import com.sincere.wechatbusiness.model.*; | 3 | import com.sincere.wechatbusiness.model.*; |
| 4 | import com.sincere.wechatbusiness.utils.Page; | 4 | import com.sincere.wechatbusiness.utils.Page; |
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 5 | 7 | ||
| 6 | import java.util.List; | 8 | import java.util.List; |
| 7 | 9 | ||
| @@ -23,4 +25,26 @@ public interface ChannelService { | @@ -23,4 +25,26 @@ public interface ChannelService { | ||
| 23 | Manager getManagerDetail(String mobile); | 25 | Manager getManagerDetail(String mobile); |
| 24 | 26 | ||
| 25 | int insertLog(Log log); | 27 | int insertLog(Log log); |
| 28 | + | ||
| 29 | + int getRegisterCount(int channelId,int agentId,int type); | ||
| 30 | + | ||
| 31 | + int getOrderCount(int channelId,int agentId,int type); | ||
| 32 | + | ||
| 33 | + List<Users> getAgentRegisterList(int channelId,int type); | ||
| 34 | + | ||
| 35 | + List<Users> getAgentOrderList(int channelId,int type); | ||
| 36 | + | ||
| 37 | + Users getChannelRegister(int channelId,int type); | ||
| 38 | + | ||
| 39 | + Users getChannelOrder(int channelId,int type); | ||
| 40 | + | ||
| 41 | + List<DiscountPackage> getOrderList(int channelId,int type); | ||
| 42 | + | ||
| 43 | + List<Users> getRegisterDetailList(int channelId,int agentId,int type); | ||
| 44 | + | ||
| 45 | + List<DiscountPackage> getOrderDetailList(int channelId,int agentId,int type,int productId); | ||
| 46 | + | ||
| 47 | + int insertAccessToken(AccessToken accessToken); | ||
| 48 | + | ||
| 49 | + AccessToken getAccessToken(); | ||
| 26 | } | 50 | } |
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java
| @@ -27,5 +27,5 @@ public class CatalogContentServiceImpl implements CatalogContentService { | @@ -27,5 +27,5 @@ public class CatalogContentServiceImpl implements CatalogContentService { | ||
| 27 | public int deleteCatalogContent(int id){return catalogContentMapper.deleteCatalogContent(id);} | 27 | public int deleteCatalogContent(int id){return catalogContentMapper.deleteCatalogContent(id);} |
| 28 | 28 | ||
| 29 | @Override | 29 | @Override |
| 30 | - public List<CatalogContent> getListByDate(int catalogId,String date){return catalogContentMapper.getListByDate(catalogId,date,1);} | 30 | + public List<CatalogContent> getListByDate(int catalogId,String date){return catalogContentMapper.getListByDate(catalogId,date+" 23:59:59",date+" 00:00:00",1);} |
| 31 | } | 31 | } |
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
| @@ -63,5 +63,38 @@ public class ChannelServiceImpl implements ChannelService { | @@ -63,5 +63,38 @@ public class ChannelServiceImpl implements ChannelService { | ||
| 63 | 63 | ||
| 64 | @Override | 64 | @Override |
| 65 | public int insertLog(Log log){return channelMapper.insertLog(log);} | 65 | public int insertLog(Log log){return channelMapper.insertLog(log);} |
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public int getRegisterCount(int channelId,int agentId,int type){return channelMapper.getRegisterCount(channelId,agentId,type);} | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public int getOrderCount(int channelId,int agentId,int type){return channelMapper.getOrderCount(channelId,agentId,type,1);} | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public List<Users> getAgentRegisterList(int channelId,int type){return channelMapper.getAgentRegisterList(channelId,type,1);} | ||
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public List<Users> getAgentOrderList(int channelId,int type){return channelMapper.getAgentOrderList(channelId,type,1);} | ||
| 78 | + | ||
| 79 | + @Override | ||
| 80 | + public Users getChannelRegister(int channelId,int type){return channelMapper.getChannelRegister(channelId,type,1);} | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public Users getChannelOrder(int channelId,int type){return channelMapper.getChannelOrder(channelId,type,1);} | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public List<DiscountPackage> getOrderList(int channelId,int type){return channelMapper.getOrderList(channelId,type,1);} | ||
| 87 | + | ||
| 88 | + @Override | ||
| 89 | + public List<Users> getRegisterDetailList(int channelId,int agentId,int type){return channelMapper.getRegisterDetailList(channelId,agentId,type);} | ||
| 90 | + | ||
| 91 | + @Override | ||
| 92 | + public List<DiscountPackage> getOrderDetailList(int channelId,int agentId,int type,int productId){return channelMapper.getOrderDetailList(channelId,agentId,type,productId);} | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public int insertAccessToken(AccessToken accessToken){return channelMapper.insertAccessToken(accessToken);} | ||
| 96 | + | ||
| 97 | + @Override | ||
| 98 | + public AccessToken getAccessToken(){return channelMapper.getAccessToken();} | ||
| 66 | } | 99 | } |
| 67 | 100 |
src/main/resources/application.yaml
| @@ -4,9 +4,12 @@ spring: | @@ -4,9 +4,12 @@ spring: | ||
| 4 | application: | 4 | application: |
| 5 | name: wechatBusiness | 5 | name: wechatBusiness |
| 6 | datasource: | 6 | datasource: |
| 7 | - username: SZJXTUSER | ||
| 8 | - password: xst200919 | ||
| 9 | - url: jdbc:sqlserver://60.190.202.57:14333;database=wechatbusiness | 7 | +# username: SZJXTUSER |
| 8 | +# password: xst200919 | ||
| 9 | +# url: jdbc:sqlserver://60.190.202.57:14333;database=wechatbusiness | ||
| 10 | + username: report | ||
| 11 | + password: QWer123$%^ | ||
| 12 | + url: jdbc:sqlserver://116.62.241.27:33419;database=wechatbusiness | ||
| 10 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 13 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| 11 | 14 | ||
| 12 | jackson: | 15 | jackson: |
src/main/resources/logback.xml
| @@ -19,11 +19,11 @@ | @@ -19,11 +19,11 @@ | ||
| 19 | <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | 19 | <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> |
| 20 | </encoder> | 20 | </encoder> |
| 21 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | 21 | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| 22 | - <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.report.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | 22 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.wechatbusiness.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> |
| 23 | <multiple>1</multiple> | 23 | <multiple>1</multiple> |
| 24 | </timeBasedFileNamingAndTriggeringPolicy> | 24 | </timeBasedFileNamingAndTriggeringPolicy> |
| 25 | <!-- 输出路径 --> | 25 | <!-- 输出路径 --> |
| 26 | - <fileNamePattern>${logPath}/channel/%d{yyyy-MM-dd}.log</fileNamePattern> | 26 | + <fileNamePattern>${logPath}/%d{yyyy-MM-dd}.log</fileNamePattern> |
| 27 | <maxHistory>${maxHistory}</maxHistory> | 27 | <maxHistory>${maxHistory}</maxHistory> |
| 28 | </rollingPolicy> | 28 | </rollingPolicy> |
| 29 | </appender> | 29 | </appender> |
src/main/resources/mapper/CatalogContentMapper.xml
| @@ -28,8 +28,8 @@ | @@ -28,8 +28,8 @@ | ||
| 28 | <if test="catalogId != 0"> | 28 | <if test="catalogId != 0"> |
| 29 | and catalogId=#{catalogId} | 29 | and catalogId=#{catalogId} |
| 30 | </if> | 30 | </if> |
| 31 | - <if test="date != null and date!=''"> | ||
| 32 | - and start_time <![CDATA[<=]]>#{date} and end_time <![CDATA[>=]]>#{date} | 31 | + <if test="date1 != null and date1!='' and date2!='' and date2!=null"> |
| 32 | + and start_time <![CDATA[<=]]>#{date1} and end_time <![CDATA[>=]]>#{date2} | ||
| 33 | </if> | 33 | </if> |
| 34 | </where> | 34 | </where> |
| 35 | order by create_time | 35 | order by create_time |
src/main/resources/mapper/ChannelMapper.xml
| @@ -43,6 +43,28 @@ | @@ -43,6 +43,28 @@ | ||
| 43 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | 43 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| 44 | </resultMap> | 44 | </resultMap> |
| 45 | 45 | ||
| 46 | + <resultMap id="UsersMap" type="com.sincere.wechatbusiness.model.Users"> | ||
| 47 | + <result column="account" jdbcType="VARCHAR" property="account" /> | ||
| 48 | + <result column="userName" jdbcType="VARCHAR" property="userName"/> | ||
| 49 | + <result column="count" jdbcType="INTEGER" property="count" /> | ||
| 50 | + <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||
| 51 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
| 52 | + </resultMap> | ||
| 53 | + | ||
| 54 | + <resultMap id="PackageMap" type="com.sincere.wechatbusiness.model.DiscountPackage"> | ||
| 55 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
| 56 | + <result column="package_name" jdbcType="VARCHAR" property="package_name" /> | ||
| 57 | + <result column="account" jdbcType="VARCHAR" property="account" /> | ||
| 58 | + <result column="count" jdbcType="INTEGER" property="count" /> | ||
| 59 | + <result column="intime" jdbcType="TIMESTAMP" property="intime" /> | ||
| 60 | + </resultMap> | ||
| 61 | + | ||
| 62 | + <resultMap id="AccessTokenMap" type="com.sincere.wechatbusiness.model.AccessToken"> | ||
| 63 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
| 64 | + <result column="access_token" jdbcType="VARCHAR" property="accessToken" /> | ||
| 65 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
| 66 | + </resultMap> | ||
| 67 | + | ||
| 46 | <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap"> | 68 | <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap"> |
| 47 | select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count, | 69 | select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count, |
| 48 | (select title from template where id=c.templateId) as template_name from channel c | 70 | (select title from template where id=c.templateId) as template_name from channel c |
| @@ -132,4 +154,191 @@ | @@ -132,4 +154,191 @@ | ||
| 132 | values (#{mobile,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR} | 154 | values (#{mobile,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR} |
| 133 | ) | 155 | ) |
| 134 | </insert> | 156 | </insert> |
| 157 | + | ||
| 158 | + <select id="getRegisterCount" resultType="java.lang.Integer"> | ||
| 159 | + select count(0) from report_voluntary.dbo.users | ||
| 160 | + <where> | ||
| 161 | + <if test="channelId > 0"> | ||
| 162 | + and channelId=#{channelId} | ||
| 163 | + </if> | ||
| 164 | + <if test="agentId>0"> | ||
| 165 | + and agentId=#{agentId} | ||
| 166 | + </if> | ||
| 167 | + <if test="type==1"> | ||
| 168 | + and DateDiff(dd,create_time,getdate())=0 | ||
| 169 | + </if> | ||
| 170 | + <if test="type==2"> | ||
| 171 | + and DateDiff(mm,create_time,getdate())=0 | ||
| 172 | + </if> | ||
| 173 | + </where> | ||
| 174 | + </select> | ||
| 175 | + | ||
| 176 | + <select id="getOrderCount" resultType="java.lang.Integer"> | ||
| 177 | + select count(0) from (select distinct account from report_voluntary.dbo.orderpay | ||
| 178 | + <where> | ||
| 179 | + <if test="channelId > 0"> | ||
| 180 | + and channelId=#{channelId} | ||
| 181 | + </if> | ||
| 182 | + <if test="agentId>0"> | ||
| 183 | + and agentId=#{agentId} | ||
| 184 | + </if> | ||
| 185 | + <if test="type==1"> | ||
| 186 | + and DateDiff(dd,intime,getdate())=0 | ||
| 187 | + </if> | ||
| 188 | + <if test="type==2"> | ||
| 189 | + and DateDiff(mm,intime,getdate())=0 | ||
| 190 | + </if> | ||
| 191 | + <if test="state==1"> | ||
| 192 | + and paystate=1 | ||
| 193 | + </if> | ||
| 194 | + </where> | ||
| 195 | + ) a | ||
| 196 | + </select> | ||
| 197 | + | ||
| 198 | + <select id="getAgentRegisterList" resultMap="UsersMap"> | ||
| 199 | + select * from (select a.id as agentId,0 as channelId,RIGHT(mobile,4) as account,name as userName,(select count(0) from report_voluntary.dbo.users | ||
| 200 | + <where> | ||
| 201 | + <if test="state==1"> | ||
| 202 | + and agentId=a.id | ||
| 203 | + </if> | ||
| 204 | + <if test="type==1"> | ||
| 205 | + and DateDiff(dd,create_time,getdate())=0 | ||
| 206 | + </if> | ||
| 207 | + <if test="type==2"> | ||
| 208 | + and DateDiff(mm,create_time,getdate())=0 | ||
| 209 | + </if> | ||
| 210 | + </where> | ||
| 211 | + ) as count | ||
| 212 | + from agent a where channelId=#{channelId} and state=1) b where count>0 | ||
| 213 | + </select> | ||
| 214 | + | ||
| 215 | + <select id="getChannelRegister" resultMap="UsersMap"> | ||
| 216 | + select * from (select c.id as channelId,0 as agentId,RIGHT(mobile,4) as account,name+'(本人)' as userName,(select count(0) from report_voluntary.dbo.users | ||
| 217 | + <where> | ||
| 218 | + <if test="state==1"> | ||
| 219 | + and channelId=c.id and (agentId=0 or agentId=null) | ||
| 220 | + </if> | ||
| 221 | + <if test="type==1"> | ||
| 222 | + and DateDiff(dd,create_time,getdate())=0 | ||
| 223 | + </if> | ||
| 224 | + <if test="type==2"> | ||
| 225 | + and DateDiff(mm,create_time,getdate())=0 | ||
| 226 | + </if> | ||
| 227 | + </where> | ||
| 228 | + ) as count | ||
| 229 | + from channel c where id=#{channelId} and state=1) b where count>0 | ||
| 230 | + </select> | ||
| 231 | + | ||
| 232 | + <select id="getAgentOrderList" resultMap="UsersMap"> | ||
| 233 | + select * from (select a.id as agentId,0 as channelId,RIGHT(mobile,4) as account,name as userName,(select count(0) from (select | ||
| 234 | + distinct account from report_voluntary.dbo.orderpay | ||
| 235 | + <where> | ||
| 236 | + <if test="state==1"> | ||
| 237 | + and agentId=a.id and paystate=1 | ||
| 238 | + </if> | ||
| 239 | + <if test="type==1"> | ||
| 240 | + and DateDiff(dd,intime,getdate())=0 | ||
| 241 | + </if> | ||
| 242 | + <if test="type==2"> | ||
| 243 | + and DateDiff(mm,intime,getdate())=0 | ||
| 244 | + </if> | ||
| 245 | + </where> | ||
| 246 | + ) b) as count | ||
| 247 | + from agent a where channelId=#{channelId} and state=1) c where count>0 | ||
| 248 | + </select> | ||
| 249 | + | ||
| 250 | + <select id="getChannelOrder" resultMap="UsersMap"> | ||
| 251 | + select * from (select c.id as channelId,0 as agentId,RIGHT(mobile,4) as account,name+'(本人)' as userName,(select | ||
| 252 | + count(0) from (select distinct account from report_voluntary.dbo.orderpay | ||
| 253 | + <where> | ||
| 254 | + <if test="state==1"> | ||
| 255 | + and channelId=c.id and ( agentId=0 or agentId=null) and paystate=1 | ||
| 256 | + </if> | ||
| 257 | + <if test="type==1"> | ||
| 258 | + and DateDiff(dd,intime,getdate())=0 | ||
| 259 | + </if> | ||
| 260 | + <if test="type==2"> | ||
| 261 | + and DateDiff(mm,intime,getdate())=0 | ||
| 262 | + </if> | ||
| 263 | + </where> | ||
| 264 | + ) b) as count | ||
| 265 | + from channel c where id=#{channelId} and state=1) c where count>0 | ||
| 266 | + </select> | ||
| 267 | + | ||
| 268 | + <select id="getOrderList" resultMap="PackageMap"> | ||
| 269 | + select * from (select p.package_name,p.id,(select count(0) from (select distinct account from | ||
| 270 | + report_voluntary.dbo.orderpay | ||
| 271 | + <where> | ||
| 272 | + <if test="state==1"> | ||
| 273 | + and product_id=p.id and paystate=1 | ||
| 274 | + </if> | ||
| 275 | + <if test="channelId>0"> | ||
| 276 | + and channelId=#{channelId} | ||
| 277 | + </if> | ||
| 278 | + <if test="type==1"> | ||
| 279 | + and DateDiff(dd,intime,getdate())=0 | ||
| 280 | + </if> | ||
| 281 | + <if test="type==2"> | ||
| 282 | + and DateDiff(mm,intime,getdate())=0 | ||
| 283 | + </if> | ||
| 284 | + </where> | ||
| 285 | + ) b) as count | ||
| 286 | + from channel_product c inner join report_voluntary.dbo.package p on c.productId=p.id | ||
| 287 | + where channelId=#{channelId} and c.state=1) c where count>0 | ||
| 288 | + </select> | ||
| 289 | + | ||
| 290 | + <select id="getRegisterDetailList" resultMap="UsersMap"> | ||
| 291 | + select phone,create_time from report_voluntary.dbo.users | ||
| 292 | + <where> | ||
| 293 | + <if test="channelId>0"> | ||
| 294 | + and channelId=#{channelId} | ||
| 295 | + </if> | ||
| 296 | + <if test="agentId==0"> | ||
| 297 | + and (agentId=0 or agentId=null) | ||
| 298 | + </if> | ||
| 299 | + <if test="agentId>0"> | ||
| 300 | + and agentId=#{agentId} | ||
| 301 | + </if> | ||
| 302 | + <if test="type==1"> | ||
| 303 | + and DateDiff(dd,create_time,getdate())=0 | ||
| 304 | + </if> | ||
| 305 | + <if test="type==2"> | ||
| 306 | + and DateDiff(mm,create_time,getdate())=0 | ||
| 307 | + </if> | ||
| 308 | + </where> | ||
| 309 | + </select> | ||
| 310 | + | ||
| 311 | + <select id="getOrderDetailList" resultMap="PackageMap"> | ||
| 312 | + select account,product_name as package_name,intime from report_voluntary.dbo.orderpay | ||
| 313 | + <where> | ||
| 314 | + <if test="channelId>0"> | ||
| 315 | + and channelId=#{channelId} | ||
| 316 | + </if> | ||
| 317 | + <if test="agentId>0"> | ||
| 318 | + and agentId=#{agentId} | ||
| 319 | + </if> | ||
| 320 | + <if test="agentId==0"> | ||
| 321 | + and (agentId=0 or agentId=null) | ||
| 322 | + </if> | ||
| 323 | + <if test="productId>0"> | ||
| 324 | + and product_id=#{productId} | ||
| 325 | + </if> | ||
| 326 | + <if test="type==1"> | ||
| 327 | + and DateDiff(dd,intime,getdate())=0 | ||
| 328 | + </if> | ||
| 329 | + <if test="type==2"> | ||
| 330 | + and DateDiff(mm,intime,getdate())=0 | ||
| 331 | + </if> | ||
| 332 | + </where> | ||
| 333 | + </select> | ||
| 334 | + | ||
| 335 | + <insert id="insertAccessToken" parameterType="com.sincere.wechatbusiness.model.AccessToken"> | ||
| 336 | + insert into access_token (access_token) | ||
| 337 | + values (#{accessToken,jdbcType=VARCHAR} | ||
| 338 | + ) | ||
| 339 | + </insert> | ||
| 340 | + | ||
| 341 | + <select id="getAccessToken" resultMap="AccessTokenMap"> | ||
| 342 | + select top 1.* from access_token order by create_time desc | ||
| 343 | + </select> | ||
| 135 | </mapper> | 344 | </mapper> |
| 136 | \ No newline at end of file | 345 | \ No newline at end of file |