shiyunlong 1 år sedan
förälder
incheckning
c68e4e4ffc
84 ändrade filer med 690 tillägg och 222 borttagningar
  1. 98 0
      admin/src/main/java/com/mofangchuxing/aska/admin/config/AopLog.java
  2. 2 2
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java
  3. 8 8
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelController.java
  4. 21 6
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelMngController.java
  5. 7 3
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/FinancialController.java
  6. 12 2
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailController.java
  7. 6 6
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailMngController.java
  8. 7 7
      admin/src/main/java/com/mofangchuxing/aska/admin/controller/SysUserController.java
  9. 31 7
      admin/src/main/java/com/mofangchuxing/aska/admin/cron/StatJob.java
  10. 4 1
      admin/src/main/resources/application.yml
  11. BIN
      admin/target/aska-admin.jar
  12. BIN
      admin/target/aska-admin.jar.original
  13. 4 1
      admin/target/classes/application.yml
  14. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/config/AopLog.class
  15. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/AccountController.class
  16. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/ChannelController.class
  17. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/ChannelMngController.class
  18. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/FinancialController.class
  19. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/RetailController.class
  20. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/RetailMngController.class
  21. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/controller/SysUserController.class
  22. BIN
      admin/target/classes/com/mofangchuxing/aska/admin/cron/StatJob.class
  23. 1 0
      admin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  24. 4 3
      admin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  25. 41 57
      dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaChannels.java
  26. 10 0
      dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaRetails.java
  27. 83 20
      dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaStatMapper.java
  28. 5 1
      dao/src/main/java/com/mofangchuxing/aska/dao/mapper/PayRequestMapper.java
  29. 4 1
      dao/src/main/resources/mapper/AskaAccountsMapper.xml
  30. 30 32
      dao/src/main/resources/mapper/AskaChannelsMapper.xml
  31. 3 2
      dao/src/main/resources/mapper/AskaRetailsMapper.xml
  32. 24 2
      dao/src/main/resources/mapper/PayRequestMapper.xml
  33. BIN
      dao/target/aska-dao-1.0.jar
  34. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaChannels.class
  35. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaRetails.class
  36. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/mapper/AskaStatMapper.class
  37. BIN
      dao/target/classes/com/mofangchuxing/aska/dao/mapper/PayRequestMapper.class
  38. 4 1
      dao/target/classes/mapper/AskaAccountsMapper.xml
  39. 30 32
      dao/target/classes/mapper/AskaChannelsMapper.xml
  40. 3 2
      dao/target/classes/mapper/AskaRetailsMapper.xml
  41. 21 2
      dao/target/classes/mapper/PayRequestMapper.xml
  42. 2 0
      domain/src/main/java/com/mofangchuxing/aska/domain/PayRequestDto.java
  43. 10 0
      domain/src/main/java/com/mofangchuxing/aska/domain/dto/ChannelDto.java
  44. 2 2
      domain/src/main/java/com/mofangchuxing/aska/domain/dto/OrderDto.java
  45. 3 1
      domain/src/main/java/com/mofangchuxing/aska/domain/dto/RetailDto.java
  46. 2 2
      domain/src/main/java/com/mofangchuxing/aska/domain/enums/PayStatusEnum.java
  47. 1 0
      domain/src/main/java/com/mofangchuxing/aska/domain/enums/ResultEnum.java
  48. 3 1
      domain/src/main/java/com/mofangchuxing/aska/domain/vo/AskaChannelsVo.java
  49. 6 1
      domain/src/main/java/com/mofangchuxing/aska/domain/vo/AskaRetailsVo.java
  50. BIN
      domain/target/aska-domain-1.0.jar
  51. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/PayRequestDto.class
  52. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/dto/ChannelDto.class
  53. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/dto/OrderDto.class
  54. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/dto/RetailDto.class
  55. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/enums/PayStatusEnum.class
  56. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/enums/ResultEnum.class
  57. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/vo/AskaChannelsVo.class
  58. BIN
      domain/target/classes/com/mofangchuxing/aska/domain/vo/AskaRetailsVo.class
  59. 98 0
      main/src/main/java/com/mofangchuxing/aska/config/AopLog.java
  60. 2 2
      main/src/main/java/com/mofangchuxing/aska/controller/AskaController.java
  61. BIN
      main/target/aska.jar
  62. BIN
      main/target/aska.jar.original
  63. BIN
      main/target/classes/com/mofangchuxing/aska/config/AopLog.class
  64. BIN
      main/target/classes/com/mofangchuxing/aska/controller/AskaController.class
  65. 1 0
      main/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  66. 1 0
      main/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  67. BIN
      root@
  68. 4 0
      service/src/main/java/com/mofangchuxing/aska/service/ChannelService.java
  69. 2 0
      service/src/main/java/com/mofangchuxing/aska/service/OrderService.java
  70. 10 5
      service/src/main/java/com/mofangchuxing/aska/service/common/DelayNotifyComponent.java
  71. 26 0
      service/src/main/java/com/mofangchuxing/aska/service/impl/ChannelServiceImpl.java
  72. 25 0
      service/src/main/java/com/mofangchuxing/aska/service/impl/OrderServiceImpl.java
  73. 15 7
      service/src/main/java/com/mofangchuxing/aska/service/impl/PayServiceImpl.java
  74. 9 2
      service/src/main/java/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.java
  75. 5 1
      service/src/main/java/com/mofangchuxing/aska/service/impl/RetailServiceImpl.java
  76. BIN
      service/target/aska-service-1.0.jar
  77. BIN
      service/target/classes/com/mofangchuxing/aska/service/ChannelService.class
  78. BIN
      service/target/classes/com/mofangchuxing/aska/service/common/DelayNotifyComponent$1.class
  79. BIN
      service/target/classes/com/mofangchuxing/aska/service/common/DelayNotifyComponent.class
  80. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/ChannelServiceImpl.class
  81. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/OrderServiceImpl.class
  82. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/PayServiceImpl.class
  83. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.class
  84. BIN
      service/target/classes/com/mofangchuxing/aska/service/impl/RetailServiceImpl.class

+ 98 - 0
admin/src/main/java/com/mofangchuxing/aska/admin/config/AopLog.java

@@ -0,0 +1,98 @@
+package com.mofangchuxing.aska.admin.config;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSONUtil;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Objects;
+
+@Aspect
+@Component
+public class AopLog {
+ 
+    private static final Logger log = LoggerFactory.getLogger(AopLog.class);
+ 
+    private static final String START_TIME = "request-start";
+ 
+    private static final String REQUEST_ID = "request_id";
+ 
+    /**
+     * 切入点
+     */
+    @Pointcut("execution(public * com..controller.*Controller.*(..)) || execution(public * com..controller.admin.*Controller.*(..))")
+    public void log() {
+ 
+    }
+ 
+    /**
+     * 前置操作
+     *
+     * @param point 切入点
+     */
+    @Before("log()")
+    public void beforeLog(JoinPoint point) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        StringBuffer sb = new StringBuffer();
+        String requestId = IdUtil.simpleUUID();
+        sb.append("\n【request_id】:").append(requestId);
+        sb.append("\n【请求 URL】:").append(request.getRequestURL());
+        sb.append("\n【请求类名】:").append(point.getSignature().getDeclaringTypeName());
+        sb.append("【请求方法名】:").append(point.getSignature().getName());
+        sb.append("\n【body】:").append(JSONUtil.toJsonStr(point.getArgs()));
+        sb.append("\n【请求参数】:").append(JSONUtil.toJsonStr(parameterMap));
+        log.info(sb.toString());
+        Long start = System.currentTimeMillis();
+        request.setAttribute(START_TIME, start);
+        request.setAttribute(REQUEST_ID, requestId);
+    }
+ 
+    /**
+     * 环绕操作
+     *
+     * @param point 切入点
+     * @return 原方法返回值
+     * @throws Throwable 异常信息
+     */
+    @Around("log()")
+    public Object aroundLog(ProceedingJoinPoint point) throws Throwable {
+        Object result = point.proceed();
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        String requestId = (String) request.getAttribute(REQUEST_ID);
+        StringBuffer sb = new StringBuffer();
+        sb.append("\n【request_id】:").append(requestId);
+        sb.append("\n【返回值】:").append(JSONUtil.toJsonStr(result));
+        log.info(sb.toString());
+//        log.info("\n【request_id】:" + requestId + "\n【返回值】:{}", JSONUtil.toJsonStr(result));
+        return result;
+    }
+ 
+    /**
+     * 后置操作
+     */
+    @AfterReturning("log()")
+    public void afterReturning() {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        String requestId = (String) request.getAttribute(REQUEST_ID);
+        StringBuffer sb = new StringBuffer();
+        sb.append("\n【request_id】:").append(requestId);
+        Long start = (Long) request.getAttribute(START_TIME);
+        Long end = System.currentTimeMillis();
+        sb.append("\n【请求耗时】:").append((end - start)).append("毫秒");
+
+        log.info(sb.toString());
+    }
+ 
+}

+ 2 - 2
admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java

@@ -32,7 +32,7 @@ public class AccountController extends AdminBaseController{
         Map<String, Object> result = new HashMap<>();
         AskaAccounts askaAccounts = getSysUser(accountDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = userService.listUsers(accountDto);
         return R.ok(pageUtils);
@@ -42,7 +42,7 @@ public class AccountController extends AdminBaseController{
     public R addAccount(@RequestBody AccountDto accountDto) {
         AskaAccounts askaAccounts = getSysUser(accountDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaAccounts newAskaAccounts = userService.addAccount(accountDto);
         return R.ok(newAskaAccounts);

+ 8 - 8
admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelController.java

@@ -36,7 +36,7 @@ public class ChannelController extends AdminBaseController{
     public R getOrderList(@RequestBody OrderDto orderDto) {
         AskaAccounts askaAccounts = getSysUser(orderDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = orderService.getOrderList(orderDto);
         return R.ok(pageUtils);
@@ -46,7 +46,7 @@ public class ChannelController extends AdminBaseController{
     public R coupons(@RequestBody ChannelCouponDto channelCouponDto) {
         AskaAccounts askaAccounts = getSysUser(channelCouponDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = channelService.getCouponsList(channelCouponDto);
         return R.ok(pageUtils);
@@ -56,7 +56,7 @@ public class ChannelController extends AdminBaseController{
     public R getChannelNoList(@RequestBody ChannelCouponDto channelCouponDto) {
         AskaAccounts askaAccounts = getSysUser(channelCouponDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = channelService.getChannelNoList(channelCouponDto);
         return R.ok(pageUtils);
@@ -66,7 +66,7 @@ public class ChannelController extends AdminBaseController{
     public R addChannelNo(@RequestBody ChannelNoDto channelNoDto) {
         AskaAccounts askaAccounts = getSysUser(channelNoDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         channelService.addChannelNo(channelNoDto);
         return R.ok();
@@ -81,7 +81,7 @@ public class ChannelController extends AdminBaseController{
     public R getBalance(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaChannelsVo askaChannelsVo = channelService.getBalance(channelDto);
         return R.ok(askaChannelsVo);
@@ -91,7 +91,7 @@ public class ChannelController extends AdminBaseController{
     public R getCash(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         channelService.addCashRequest(askaAccounts, channelDto);
         return R.ok();
@@ -101,7 +101,7 @@ public class ChannelController extends AdminBaseController{
     public R getCashHistory(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = channelService.getCashHistory(channelDto);
         return R.ok(pageUtils);
@@ -111,7 +111,7 @@ public class ChannelController extends AdminBaseController{
     public R setReceivingConfig(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         return R.ok();
     }

+ 21 - 6
admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelMngController.java

@@ -2,8 +2,10 @@ package com.mofangchuxing.aska.admin.controller;
 
 import com.mofangchuxing.aska.dao.domain.AskaAccounts;
 import com.mofangchuxing.aska.dao.domain.AskaChannels;
+import com.mofangchuxing.aska.dao.domain.AskaRetails;
 import com.mofangchuxing.aska.domain.R;
 import com.mofangchuxing.aska.domain.dto.ChannelDto;
+import com.mofangchuxing.aska.domain.dto.RetailDto;
 import com.mofangchuxing.aska.domain.utils.PageUtils;
 import com.mofangchuxing.aska.service.ChannelService;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -29,7 +31,7 @@ public class ChannelMngController extends AdminBaseController{
     public R addChannel(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaChannels askaChannels = channelService.addChannel(channelDto);
         return R.ok(askaChannels);
@@ -39,7 +41,7 @@ public class ChannelMngController extends AdminBaseController{
     public R updateChannel(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaChannels askaChannels = channelService.updateChannel(channelDto);
         return R.ok(askaChannels);
@@ -49,7 +51,7 @@ public class ChannelMngController extends AdminBaseController{
     public R stopChannel(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaChannels askaChannels = channelService.stopChannel(channelDto);
         return R.ok(askaChannels);
@@ -59,17 +61,30 @@ public class ChannelMngController extends AdminBaseController{
     public R setCouponRule(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         channelService.setCouponRule();
         return R.ok();
     }
 
+    @PostMapping("/setSplitRule")
+    public R setSplitRule(@RequestBody ChannelDto channelDto) {
+        AskaAccounts askaAccounts = getSysUser(channelDto.getT());
+        if (askaAccounts == null){
+            return R.error("用户未登录或没有权限");
+        }
+        AskaChannels askaChannels = channelService.setSplitRule(channelDto);
+        if (askaChannels == null) {
+            return R.error("渠道不存在");
+        }
+        return R.ok(askaChannels);
+    }
+
     @PostMapping("/getAllChannels")
     public R getAllChannels(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = channelService.getAllChannels(channelDto);
         return R.ok(pageUtils);
@@ -79,7 +94,7 @@ public class ChannelMngController extends AdminBaseController{
     public R getChannelDetail(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaChannels askaChannels = channelService.getChannelDetail(channelDto);
         return R.ok(askaChannels);

+ 7 - 3
admin/src/main/java/com/mofangchuxing/aska/admin/controller/FinancialController.java

@@ -32,7 +32,7 @@ public class FinancialController extends AdminBaseController{
     public R getOrderList(@RequestBody OrderDto orderDto) {
         AskaAccounts askaAccounts = getSysUser(orderDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = orderService.getOrderList(orderDto);
         return R.ok(pageUtils);
@@ -42,14 +42,18 @@ public class FinancialController extends AdminBaseController{
     public R listCashRequest(@RequestBody ChannelDto channelDto) {
         AskaAccounts askaAccounts = getSysUser(channelDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = channelService.getCashHistory(channelDto);
         return R.ok(pageUtils);
     }
 
     @PostMapping("/getBalance")
-    public R getBalance() {
+    public R getBalance(@RequestBody OrderDto orderDto) {
+        AskaAccounts askaAccounts = getSysUser(orderDto.getT());
+        if (askaAccounts == null){
+            return R.error("用户未登录或没有权限");
+        }
         return R.ok();
     }
 }

+ 12 - 2
admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailController.java

@@ -32,7 +32,7 @@ public class RetailController extends AdminBaseController{
     public R getOrderList(@RequestBody OrderDto orderDto) {
         AskaAccounts askaAccounts = getSysUser(orderDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = orderService.getOrderList(orderDto);
         return R.ok(pageUtils);
@@ -42,9 +42,19 @@ public class RetailController extends AdminBaseController{
     public R getBalance(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetailsVo askaRetailsVo = retailService.getBalance(retailDto);
         return R.ok(askaRetailsVo);
     }
+
+    @PostMapping("/queryPayment")
+    public R queryPayment(@RequestBody OrderDto orderDto) {
+        AskaAccounts askaAccounts = getSysUser(orderDto.getT());
+        if (askaAccounts == null){
+            return R.error("用户未登录或没有权限");
+        }
+        PageUtils pageUtils = orderService.getOrderList(orderDto);
+        return R.ok(pageUtils);
+    }
 }

+ 6 - 6
admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailMngController.java

@@ -29,7 +29,7 @@ public class RetailMngController extends AdminBaseController {
     public R addRetail(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetails askaRetails = retailService.addRetail(retailDto);
         return R.ok(askaRetails);
@@ -39,7 +39,7 @@ public class RetailMngController extends AdminBaseController {
     public R updateRetail(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetails askaRetails = retailService.updateRetail(retailDto);
         if (askaRetails == null) {
@@ -52,7 +52,7 @@ public class RetailMngController extends AdminBaseController {
     public R stopRetail(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetails askaRetails = retailService.stopRetail(retailDto);
         if (askaRetails == null) {
@@ -65,7 +65,7 @@ public class RetailMngController extends AdminBaseController {
     public R setSplitRule(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetails askaRetails = retailService.setSplitRule(retailDto);
         if (askaRetails == null) {
@@ -78,7 +78,7 @@ public class RetailMngController extends AdminBaseController {
     public R listAllRetails(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         PageUtils pageUtils = retailService.listAllRetails(retailDto);
         return R.ok(pageUtils);
@@ -88,7 +88,7 @@ public class RetailMngController extends AdminBaseController {
     public R getRetailDetail(@RequestBody RetailDto retailDto) {
         AskaAccounts askaAccounts = getSysUser(retailDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         AskaRetails askaRetails = retailService.getRetailDetail(retailDto);
         return R.ok(askaRetails);

+ 7 - 7
admin/src/main/java/com/mofangchuxing/aska/admin/controller/SysUserController.java

@@ -99,24 +99,24 @@ public class SysUserController extends AdminBaseController{
         return R.ok(result);
     }
 
-    @PostMapping("/ListMenu")
-    public R ListMenu(@RequestBody LoginDto loginDto) {
-        AskaAccounts askaAccounts = getSysUser(loginDto.getT());
+    @RequestMapping("/ListMenu")
+    public Map<String, Object> ListMenu(String t) {
+        AskaAccounts askaAccounts = getSysUser(t);
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         log.info("accounts = {}", JSONObject.toJSONString(askaAccounts));
         List<SysMenuEntity> menuList = userService.listUserMenu(askaAccounts);
         Map<String, Object> result = new HashMap<>();
-        result.put("menuList", menuList);
-        return R.ok(result);
+        result.put("SystemMenu", menuList);
+        return result;
     }
 
     @PostMapping("/getPayAccount")
     public R getPayAccount(@RequestBody LoginDto loginDto) {
         AskaAccounts askaAccounts = getSysUser(loginDto.getT());
         if (askaAccounts == null){
-            return R.error("token_expire");
+            return R.error("用户未登录或没有权限");
         }
         Map<String, Object> result = new HashMap<>();
         result.put("appId", appId);

+ 31 - 7
admin/src/main/java/com/mofangchuxing/aska/admin/cron/StatJob.java

@@ -3,6 +3,7 @@ package com.mofangchuxing.aska.admin.cron;
 import cn.hutool.core.date.DateUtil;
 import com.mofangchuxing.aska.dao.mapper.AskaStatMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -25,13 +26,36 @@ public class StatJob {
     private AskaStatMapper askaStatMapper;
 
     @Scheduled(cron = "5 0 0 * * ?")
-    public void execute(){
-        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
-        Calendar calendar=Calendar.getInstance();
-        calendar.set(Calendar.HOUR_OF_DAY,-24);
-        String yesterdayDate = dateFormat.format(calendar.getTime());
-        askaStatMapper.insertPayAmountStat(yesterdayDate);
-        askaStatMapper.insertRefundAmountStat(yesterdayDate);
+    public void execute(String dateStr) {
+        if (StringUtils.isEmpty(dateStr)) {
+            DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.HOUR_OF_DAY,-24);
+            String yesterdayDate = dateFormat.format(calendar.getTime());
+            dateStr = yesterdayDate;
+        }
+        askaStatMapper.insertPlatformPayAmountStat(dateStr);
+        askaStatMapper.insertPlatformRefundAmountStat(dateStr);
+        askaStatMapper.insertPlatformRequestAmountStat(dateStr);
+        askaStatMapper.insertPlatformRetailAmountStat(dateStr);
+        askaStatMapper.insertPlatformRetailAccountStat(dateStr);
+        askaStatMapper.insertPlatformRetailRefundAmount(dateStr);
+        askaStatMapper.insertPlatformRetailRefundAccount(dateStr);
+        askaStatMapper.insertPlatformChannelAmount(dateStr);
+        askaStatMapper.insertPlatformChannelAccount(dateStr);
+        askaStatMapper.insertPlatformChannelRefundAmount(dateStr);
+        askaStatMapper.insertPlatformChannelRefundAccount(dateStr);
 
+        askaStatMapper.insertRetailRealtimeAmount(dateStr);
+        askaStatMapper.insertRetailAccount(dateStr);
+        askaStatMapper.insertRetailRefund(dateStr);
+        askaStatMapper.insertRetailAccountRefund(dateStr);
+        askaStatMapper.insertRetailRequestCash(dateStr);
+
+        askaStatMapper.insertChannelAmount(dateStr);
+        askaStatMapper.insertChannelAccount(dateStr);
+        askaStatMapper.insertChannelAmountRefund(dateStr);
+        askaStatMapper.insertChannelAccountRefund(dateStr);
+        askaStatMapper.insertChannelCashRequest(dateStr);
     }
 }

+ 4 - 1
admin/src/main/resources/application.yml

@@ -8,6 +8,8 @@ app.id: aska-admin
 
 
 mybatis:
+  configuration:
+    callSettersOnNulls: true
   typeAliasesPackage: com.mofangchuxing.aska.dao.domain
   mapperLocations: classpath:mapper/*.xml
 
@@ -50,4 +52,5 @@ wx:
   api-serial-no: 22098B381BAE268F47FE823C70C3AA7702EE54C4
   public-serial-no: 5BB0B8268EB289373EDFA3B1572FE3F2F8FD3B80
   unified-order-url: https://api.mch.weixin.qq.com/pay/unifiedorder
-  notify-url: https://biketest.mofangchuxing.com/askay/notify
+  notify-url: https://biketest.mofangchuxing.com/askay/notify
+  refund-notify-url: https://test-crm2gw.adb-tech.com/market/client/refundNotify

BIN
admin/target/aska-admin.jar


BIN
admin/target/aska-admin.jar.original


+ 4 - 1
admin/target/classes/application.yml

@@ -8,6 +8,8 @@ app.id: aska-admin
 
 
 mybatis:
+  configuration:
+    callSettersOnNulls: true
   typeAliasesPackage: com.mofangchuxing.aska.dao.domain
   mapperLocations: classpath:mapper/*.xml
 
@@ -50,4 +52,5 @@ wx:
   api-serial-no: 22098B381BAE268F47FE823C70C3AA7702EE54C4
   public-serial-no: 5BB0B8268EB289373EDFA3B1572FE3F2F8FD3B80
   unified-order-url: https://api.mch.weixin.qq.com/pay/unifiedorder
-  notify-url: https://biketest.mofangchuxing.com/askay/notify
+  notify-url: https://biketest.mofangchuxing.com/askay/notify
+  refund-notify-url: https://test-crm2gw.adb-tech.com/market/client/refundNotify

BIN
admin/target/classes/com/mofangchuxing/aska/admin/config/AopLog.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/AccountController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/ChannelController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/ChannelMngController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/FinancialController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/RetailController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/RetailMngController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/controller/SysUserController.class


BIN
admin/target/classes/com/mofangchuxing/aska/admin/cron/StatJob.class


+ 1 - 0
admin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -6,6 +6,7 @@ com/mofangchuxing/aska/admin/controller/AccountController.class
 com/mofangchuxing/aska/admin/config/WebConfig.class
 com/mofangchuxing/aska/admin/controller/ChannelController.class
 com/mofangchuxing/aska/admin/controller/SysUserController.class
+com/mofangchuxing/aska/admin/config/AopLog.class
 com/mofangchuxing/aska/admin/controller/AdminBaseController.class
 com/mofangchuxing/aska/admin/AdminApplication.class
 com/mofangchuxing/aska/admin/cron/StatJob.class

+ 4 - 3
admin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -1,12 +1,13 @@
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/config/WebConfig.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/AdminApplication.java
-/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/SysUserController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/AdminBaseController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/cron/StatJob.java
-/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/Intercepter/RequestInterceptor.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/FinancialController.java
-/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/RetailMngController.java
+/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/config/AopLog.java
+/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/SysUserController.java
+/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/Intercepter/RequestInterceptor.java
+/Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/ChannelMngController.java
 /Users/syl/Desktop/work/aska/admin/src/main/java/com/mofangchuxing/aska/admin/controller/AccountController.java

+ 41 - 57
dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaChannels.java

@@ -82,6 +82,8 @@ public class AskaChannels implements Serializable {
      */
     private Integer realtimeSplit;
 
+    private Integer cashSplit;
+
     /**
      * 渠道可用状态
      */
@@ -90,22 +92,24 @@ public class AskaChannels implements Serializable {
     /**
      * 收入总额
      */
-    private Integer totalIncome;
+    private Integer accountingIncome;
 
     /**
-     * 实时分账总额
+     * 实时分账总 
      */
-    private Integer totalSplit;
+    private Integer splitIncome;
 
     /**
      * 提现总额
      */
-    private Integer totalCashOut;
+    private Integer accountingRefund;
 
     /**
      * 退款总额
      */
-    private Integer totalRefund;
+    private Integer splitRefund;
+
+    private Integer cashOut;
 
     /**
      * 余额
@@ -324,6 +328,14 @@ public class AskaChannels implements Serializable {
         this.realtimeSplit = realtimeSplit;
     }
 
+    public Integer getCashSplit() {
+        return cashSplit;
+    }
+
+    public void setCashSplit(Integer cashSplit) {
+        this.cashSplit = cashSplit;
+    }
+
     /**
      * 渠道可用状态
      */
@@ -338,60 +350,44 @@ public class AskaChannels implements Serializable {
         this.status = status;
     }
 
-    /**
-     * 收入总额
-     */
-    public Integer getTotalIncome() {
-        return totalIncome;
+    public Integer getAccountingIncome() {
+        return accountingIncome;
     }
 
-    /**
-     * 收入总额
-     */
-    public void setTotalIncome(Integer totalIncome) {
-        this.totalIncome = totalIncome;
+    public void setAccountingIncome(Integer accountingIncome) {
+        this.accountingIncome = accountingIncome;
     }
 
-    /**
-     * 实时分账总额
-     */
-    public Integer getTotalSplit() {
-        return totalSplit;
+    public Integer getSplitIncome() {
+        return splitIncome;
     }
 
-    /**
-     * 实时分账总额
-     */
-    public void setTotalSplit(Integer totalSplit) {
-        this.totalSplit = totalSplit;
+    public void setSplitIncome(Integer splitIncome) {
+        this.splitIncome = splitIncome;
     }
 
-    /**
-     * 提现总额
-     */
-    public Integer getTotalCashOut() {
-        return totalCashOut;
+    public Integer getAccountingRefund() {
+        return accountingRefund;
     }
 
-    /**
-     * 提现总额
-     */
-    public void setTotalCashOut(Integer totalCashOut) {
-        this.totalCashOut = totalCashOut;
+    public void setAccountingRefund(Integer accountingRefund) {
+        this.accountingRefund = accountingRefund;
     }
 
-    /**
-     * 退款总额
-     */
-    public Integer getTotalRefund() {
-        return totalRefund;
+    public Integer getSplitRefund() {
+        return splitRefund;
     }
 
-    /**
-     * 退款总额
-     */
-    public void setTotalRefund(Integer totalRefund) {
-        this.totalRefund = totalRefund;
+    public void setSplitRefund(Integer splitRefund) {
+        this.splitRefund = splitRefund;
+    }
+
+    public Integer getCashOut() {
+        return cashOut;
+    }
+
+    public void setCashOut(Integer cashOut) {
+        this.cashOut = cashOut;
     }
 
     /**
@@ -436,10 +432,6 @@ public class AskaChannels implements Serializable {
             && (this.getTripvalue() == null ? other.getTripvalue() == null : this.getTripvalue().equals(other.getTripvalue()))
             && (this.getRealtimeSplit() == null ? other.getRealtimeSplit() == null : this.getRealtimeSplit().equals(other.getRealtimeSplit()))
             && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
-            && (this.getTotalIncome() == null ? other.getTotalIncome() == null : this.getTotalIncome().equals(other.getTotalIncome()))
-            && (this.getTotalSplit() == null ? other.getTotalSplit() == null : this.getTotalSplit().equals(other.getTotalSplit()))
-            && (this.getTotalCashOut() == null ? other.getTotalCashOut() == null : this.getTotalCashOut().equals(other.getTotalCashOut()))
-            && (this.getTotalRefund() == null ? other.getTotalRefund() == null : this.getTotalRefund().equals(other.getTotalRefund()))
             && (this.getBalance() == null ? other.getBalance() == null : this.getBalance().equals(other.getBalance()));
     }
 
@@ -463,10 +455,6 @@ public class AskaChannels implements Serializable {
         result = prime * result + ((getTripvalue() == null) ? 0 : getTripvalue().hashCode());
         result = prime * result + ((getRealtimeSplit() == null) ? 0 : getRealtimeSplit().hashCode());
         result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
-        result = prime * result + ((getTotalIncome() == null) ? 0 : getTotalIncome().hashCode());
-        result = prime * result + ((getTotalSplit() == null) ? 0 : getTotalSplit().hashCode());
-        result = prime * result + ((getTotalCashOut() == null) ? 0 : getTotalCashOut().hashCode());
-        result = prime * result + ((getTotalRefund() == null) ? 0 : getTotalRefund().hashCode());
         result = prime * result + ((getBalance() == null) ? 0 : getBalance().hashCode());
         return result;
     }
@@ -493,10 +481,6 @@ public class AskaChannels implements Serializable {
         sb.append(", tripvalue=").append(tripvalue);
         sb.append(", realtimeSplit=").append(realtimeSplit);
         sb.append(", status=").append(status);
-        sb.append(", totalIncome=").append(totalIncome);
-        sb.append(", totalSplit=").append(totalSplit);
-        sb.append(", totalCashOut=").append(totalCashOut);
-        sb.append(", totalRefund=").append(totalRefund);
         sb.append(", balance=").append(balance);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");

+ 10 - 0
dao/src/main/java/com/mofangchuxing/aska/dao/domain/AskaRetails.java

@@ -97,6 +97,8 @@ public class AskaRetails implements Serializable {
      */
     private Integer realtimeSplit;
 
+    private Integer cashSplit;
+
     /**
      * 渠道可用状态{运营,暂停}
      */
@@ -383,6 +385,14 @@ public class AskaRetails implements Serializable {
         this.realtimeSplit = realtimeSplit;
     }
 
+    public Integer getCashSplit() {
+        return cashSplit;
+    }
+
+    public void setCashSplit(Integer cashSplit) {
+        this.cashSplit = cashSplit;
+    }
+
     /**
      * 渠道可用状态{运营,暂停}
      */

+ 83 - 20
dao/src/main/java/com/mofangchuxing/aska/dao/mapper/AskaStatMapper.java

@@ -30,82 +30,145 @@ public interface AskaStatMapper {
             "                date(`pay_time`), count(*) `cc`, sum(`pay_amount`) `pay_amount`\n" +
             "            from `pay_request`\n" +
             "            where date(`pay_time`) = #{dateStr}")
-    void insertPayAmountStat(@Param("dateStr") String dateStr);
+    void insertPlatformPayAmountStat(@Param("dateStr") String dateStr);
 
     // 平台退款,包括不可分账退款
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      \n" +
             "            select '平台','1', '退款', \n" +
             "                date(`create_time`), count(*) cc, sum(`refund_amount`) \n" +
             "            from `refund_order` where date(`refund_order`.`create_time`) = #{dateStr}")
-    void insertRefundAmountStat(@Param("dateStr") String dateStr);
+    void insertPlatformRefundAmountStat(@Param("dateStr") String dateStr);
 
     // 平台方同意的提现金额
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '平台','1', '提现', \n" +
             "                date(`payTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
-            "            from `aska_cashrequest` where status='同意' or status='已付款' where date(`aska_cashrequest`.`payTime`) = #{dateStr}")
-    void insertRequestAmountStat(@Param("dateStr") String dateStr);
+            "            from `aska_cashrequest` where status='同意' or status='已付款' and date(`aska_cashrequest`.`payTime`) = #{dateStr}")
+    void insertPlatformRequestAmountStat(@Param("dateStr") String dateStr);
 
     // 平台方计算给门店分账佣金
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '门店分账佣金', \n" +
             "                date(`createTime`), count(*) `cc`, sum(`retailRealtimeAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=1 where date(`createTime`) = #{dateStr}")
-    void insertRetailAmountStat(@Param("dateStr") String dateStr);
+            "            where `recordType`=1 and date(`createTime`) = #{dateStr}")
+    void insertPlatformRetailAmountStat(@Param("dateStr") String dateStr);
 
     // 平台方计算的给门店记账佣金
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '门店记账佣金', \n" +
             "                date(`createTime`), count(*) `cc`, sum(`retailAccountAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=1 where date(`createTime`) = #{dateStr}")
-    void insertRetailAccountStat(@Param("dateStr") String dateStr);
+            "            where `recordType`=1 and date(`createTime`) = #{dateStr}")
+    void insertPlatformRetailAccountStat(@Param("dateStr") String dateStr);
 
     // 平台方计算给门店分账退款
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '门店分账退款', \n" +
             "                date(`createTime`), count(*) `cc`, -sum(`retailRealtimeAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=2 where date(`createTime`) = #{dateStr}")
-    void insertRetailRefundAmount(@Param("dateStr") String dateStr);
+            "            where `recordType`=2 and date(`createTime`) = #{dateStr}")
+    void insertPlatformRetailRefundAmount(@Param("dateStr") String dateStr);
 
     // 平台方计算门店记账退款
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '门店记账退款', \n" +
             "                date(`createTime`), count(*) `cc`, -sum(`retailAccountAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=2 where date(`createTime`) = #{dateStr}")
-    void insertRetailRefundAccount(@Param("dateStr") String dateStr);
+            "            where `recordType`=2 and date(`createTime`) = #{dateStr}")
+    void insertPlatformRetailRefundAccount(@Param("dateStr") String dateStr);
 
     // 平台方计算渠道的分账佣金
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '渠道分账佣金', \n" +
             "                date(`createTime`), count(*) `cc`, sum(`channelRealtimeAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=1 where date(`createTime`) = #{dateStr}")
-    void insertChannelAmount(@Param("dateStr") String dateStr);
+            "            where `recordType`=1 and date(`createTime`) = #{dateStr}")
+    void insertPlatformChannelAmount(@Param("dateStr") String dateStr);
 
     // 平台方计算记账佣金
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '渠道记账佣金', \n" +
             "                date(`createTime`), count(*) `cc`, sum(`channelAccountAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=1 where date(`createTime`) = #{dateStr}")
-    void insertChannelAccount(@Param("dateStr") String dateStr);
+            "            where `recordType`=1 and date(`createTime`) = #{dateStr}")
+    void insertPlatformChannelAccount(@Param("dateStr") String dateStr);
 
     // 平台方计算分账佣金退款
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '渠道分账退款', \n" +
             "                date(`createTime`), count(*) `cc`, -sum(`channelRealtimeAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=2 where date(`createTime`) = #{dateStr}")
-    void insertChannelRefundAmount(@Param("dateStr") String dateStr);
+            "            where `recordType`=2 and date(`createTime`) = #{dateStr}")
+    void insertPlatformChannelRefundAmount(@Param("dateStr") String dateStr);
 
     // 平台方计算记账佣金退款
     @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
             "            select '平台','1', '渠道记账退款', \n" +
             "                date(`createTime`), count(*) `cc`, -sum(`channelAccountAmount`) `pay_amount`\n" +
             "            from `aska_splitrecord`\n" +
-            "            where `recordType`=2 where date(`createTime`) = #{dateStr}")
-    void insertChannelRefundAccount(@Param("dateStr") String dateStr);
+            "            where `recordType`=2 and date(`createTime`) = #{dateStr}")
+    void insertPlatformChannelRefundAccount(@Param("dateStr") String dateStr);
+
+    // 门店方计算分账佣金
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '门店',`retailId`, '门店分账佣金', date(`createTime`), count(*) cc, sum(`retailRealtimeAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=1 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `retailId`")
+    void insertRetailRealtimeAmount(@Param("dateStr") String dateStr);
+
+    // 门店方计算记账佣金
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '门店',`retailId`, '门店记账佣金', date(`createTime`), count(*) cc, sum(`retailAccountAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=1 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `retailId`")
+    void insertRetailAccount(@Param("dateStr") String dateStr);
+    // 门店方计算分账佣金退款
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '门店',`retailId`, '门店分账退款', date(`createTime`), count(*) cc, -sum(`retailRealtimeAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=2 and `retailId`>0" +
+            "            group by `retailId`")
+    void insertRetailRefund(@Param("dateStr") String dateStr);
+    // 门店计算记账佣金退款
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '门店',`retailId`, '门店记账退款', date(`createTime`), count(*) cc, -sum(`retailAccountAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=2 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `retailId`")
+    void insertRetailAccountRefund(@Param("dateStr") String dateStr);
+    // 门店计算同意的提现
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '门店',`partnerId`, '提现', date(`requestTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
+            "            from `aska_cashrequest` \n" +
+            "            where `partnerType`='retail' and (`status`='同意' or `status`='已付款') and date(`aska_cashrequest`.`requestTime`) = #{dateStr}" +
+            "            group by `partnerId`")
+    void insertRetailRequestCash(@Param("dateStr") String dateStr);
+    // 渠道方
+    // 渠道计算分账佣金
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '渠道',`channelId`, '渠道分账佣金', date(`createTime`), count(*) cc, sum(`channelAccountAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=1 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `channelId`")
+    void insertChannelAmount(@Param("dateStr") String dateStr);
+    // 渠道计算记账佣金
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '渠道',`channelId`, '渠道记账佣金', date(`createTime`), count(*) cc, sum(`channelAccountAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=1 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `channelId`")
+    void insertChannelAccount(@Param("dateStr") String dateStr);
+    // 渠道计算分账佣金退款
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '渠道',`channelId`, '渠道分账退款', date(`createTime`), count(*) cc, -sum(`channellRealtimeAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=2 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `channelId`")
+    void insertChannelAmountRefund(@Param("dateStr") String dateStr);
+    // 4. statistics channel income 渠道 记账佣金退款
+    @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '渠道',`channelId`, '渠道记账退款', date(`createTime`), count(*) cc, -sum(`channelAccountAmount`) \n" +
+            "            from `aska_splitrecord` \n" +
+            "            where `recordType`=2 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `channelId`")
+    void insertChannelAccountRefund(@Param("dateStr") String dateStr);
+    // 4:提现
+    @Insert(" INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`)      select '渠道',`partnerId`, '提现', date(`requestTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
+            "            from `aska_cashrequest` \n" +
+            "            where `partnerType`='channel' and (`status`='同意' or `status`='已付款') and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
+            "            group by `partnerId`")
+    void insertChannelCashRequest(@Param("dateStr") String dateStr);
 }

+ 5 - 1
dao/src/main/java/com/mofangchuxing/aska/dao/mapper/PayRequestMapper.java

@@ -29,11 +29,15 @@ public interface PayRequestMapper {
 
     PayRequest selectByOrderSn(String orderSn);
 
+    PayRequest selectByOrderId(String orderId);
+
     PayRequest selectPaySuccessByOrderId(String orderId);
 
     List<PayRequest> selectByUser(@Param("phoneNo") String mobile, @Param("payStatus") Integer payStatus, @Param("itemType")Integer itemType);
 
-    List<PayRequest> selectByOrderId(@Param("phoneNo")String mobile, @Param("orderId") String orderId);
+    List<PayRequest> selectByMobileAndOrderId(@Param("phoneNo")String mobile, @Param("orderId") String orderId);
 
     List<Map<String,Object>> getOrderList(OrderDto orderDto);
+
+    List<Map<String,Object>> queryPayment(OrderDto orderDto);
 }

+ 4 - 1
dao/src/main/resources/mapper/AskaAccountsMapper.xml

@@ -36,7 +36,10 @@
         select
         <include refid="Base_Column_List" />
         from aska_accounts
-        where role = #{role} and status = 'start'
+        where 1=1
+        <if test="role != null and role != ''">
+            and role = #{role}
+        </if>
     </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

+ 30 - 32
dao/src/main/resources/mapper/AskaChannelsMapper.xml

@@ -20,11 +20,13 @@
             <result property="tripartite" column="tripartite" jdbcType="CHAR"/>
             <result property="tripvalue" column="tripvalue" jdbcType="INTEGER"/>
             <result property="realtimeSplit" column="realtimeSplit" jdbcType="INTEGER"/>
+            <result property="cashSplit" column="cashSplit" jdbcType="INTEGER"/>
             <result property="status" column="status" jdbcType="CHAR"/>
-            <result property="totalIncome" column="totalIncome" jdbcType="INTEGER"/>
-            <result property="totalSplit" column="totalSplit" jdbcType="INTEGER"/>
-            <result property="totalCashOut" column="totalCashOut" jdbcType="INTEGER"/>
-            <result property="totalRefund" column="totalRefund" jdbcType="INTEGER"/>
+            <result property="accountingIncome" column="accountingIncome" jdbcType="INTEGER"/>
+            <result property="splitIncome" column="splitIncome" jdbcType="INTEGER"/>
+            <result property="accountingRefund" column="accountingRefund" jdbcType="INTEGER"/>
+            <result property="splitRefund" column="splitRefund" jdbcType="INTEGER"/>
+            <result property="cashOut" column="cashOut" jdbcType="INTEGER"/>
             <result property="balance" column="balance" jdbcType="INTEGER"/>
     </resultMap>
 
@@ -33,9 +35,9 @@
         ownerId,phone,note,
         account,accountName,accountType,
         relation,apiv3,certPath,
-        tripartite,tripvalue,realtimeSplit,
-        status,totalIncome,totalSplit,
-        totalCashOut,totalRefund,balance
+        tripartite,tripvalue,realtimeSplit,cashSplit
+        status,accountingIncome,splitIncome,
+        accountingRefund,splitRefund,cashOut,balance
     </sql>
 
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -50,7 +52,7 @@
         from aska_channels ac left join aska_accounts aa on ac.ownerId = aa.id
         where 1=1
         <if test="channelName != null and channelName != ''">
-            and name = #{channelName,jdbcType=VARCHAR}
+            and ac.name = #{channelName,jdbcType=VARCHAR}
         </if>
     </select>
     <select id="selectByOwnerId" resultType="com.mofangchuxing.aska.domain.vo.AskaChannelsVo">
@@ -68,16 +70,16 @@
         ,account,accountName,accountType
         ,relation,apiv3,certPath
         ,tripartite,tripvalue,realtimeSplit
-        ,status,totalIncome,totalSplit
-        ,totalCashOut,totalRefund,balance
+        ,status,accountingIncome,splitIncome
+        ,accountingRefund,splitRefund,cashOut,balance
         )
         values (#{id,jdbcType=INTEGER},#{name,jdbcType=CHAR},#{prefix,jdbcType=CHAR}
         ,#{ownerId,jdbcType=INTEGER},#{phone,jdbcType=CHAR},#{note,jdbcType=VARCHAR}
         ,#{account,jdbcType=VARCHAR},#{accountName,jdbcType=VARCHAR},#{accountType,jdbcType=CHAR}
         ,#{relation,jdbcType=CHAR},#{apiv3,jdbcType=VARCHAR},#{certPath,jdbcType=VARCHAR}
         ,#{tripartite,jdbcType=CHAR},#{tripvalue,jdbcType=INTEGER},#{realtimeSplit,jdbcType=INTEGER}
-        ,#{status,jdbcType=CHAR},#{totalIncome,jdbcType=INTEGER},#{totalSplit,jdbcType=INTEGER}
-        ,#{totalCashOut,jdbcType=INTEGER},#{totalRefund,jdbcType=INTEGER},#{balance,jdbcType=INTEGER}
+        ,#{status,jdbcType=CHAR},#{accountingIncome,jdbcType=INTEGER},#{splitIncome,jdbcType=INTEGER}
+        ,#{accountingRefund,jdbcType=INTEGER},#{splitRefund,jdbcType=INTEGER},#{cashOut,jdbcType=INTEGER},#{balance,jdbcType=INTEGER}
         )
     </insert>
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaChannels" useGeneratedKeys="true">
@@ -99,10 +101,6 @@
                 <if test="tripvalue != null">tripvalue,</if>
                 <if test="realtimeSplit != null">realtimeSplit,</if>
                 <if test="status != null">status,</if>
-                <if test="totalIncome != null">totalIncome,</if>
-                <if test="totalSplit != null">totalSplit,</if>
-                <if test="totalCashOut != null">totalCashOut,</if>
-                <if test="totalRefund != null">totalRefund,</if>
                 <if test="balance != null">balance,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -122,10 +120,6 @@
                 <if test="tripvalue != null">#{tripvalue,jdbcType=INTEGER},</if>
                 <if test="realtimeSplit != null">#{realtimeSplit,jdbcType=INTEGER},</if>
                 <if test="status != null">#{status,jdbcType=CHAR},</if>
-                <if test="totalIncome != null">#{totalIncome,jdbcType=INTEGER},</if>
-                <if test="totalSplit != null">#{totalSplit,jdbcType=INTEGER},</if>
-                <if test="totalCashOut != null">#{totalCashOut,jdbcType=INTEGER},</if>
-                <if test="totalRefund != null">#{totalRefund,jdbcType=INTEGER},</if>
                 <if test="balance != null">#{balance,jdbcType=INTEGER},</if>
         </trim>
     </insert>
@@ -177,17 +171,20 @@
                 <if test="status != null">
                     status = #{status,jdbcType=CHAR},
                 </if>
-                <if test="totalIncome != null">
-                    totalIncome = #{totalIncome,jdbcType=INTEGER},
+                <if test="accountingIncome != null">
+                    accountingIncome = #{accountingIncome,jdbcType=INTEGER},
                 </if>
-                <if test="totalSplit != null">
-                    totalSplit = #{totalSplit,jdbcType=INTEGER},
+                <if test="splitIncome != null">
+                    splitIncome = #{splitIncome,jdbcType=INTEGER},
                 </if>
-                <if test="totalCashOut != null">
-                    totalCashOut = #{totalCashOut,jdbcType=INTEGER},
+                <if test="accountingRefund != null">
+                    accountingRefund = #{accountingRefund,jdbcType=INTEGER},
                 </if>
-                <if test="totalRefund != null">
-                    totalRefund = #{totalRefund,jdbcType=INTEGER},
+                <if test="splitRefund != null">
+                    splitRefund = #{splitRefund,jdbcType=INTEGER},
+                </if>
+                <if test="cashOut != null">
+                    cashOut = #{cashOut,jdbcType=INTEGER},
                 </if>
                 <if test="balance != null">
                     balance = #{balance,jdbcType=INTEGER},
@@ -213,10 +210,11 @@
             tripvalue =  #{tripvalue,jdbcType=INTEGER},
             realtimeSplit =  #{realtimeSplit,jdbcType=INTEGER},
             status =  #{status,jdbcType=CHAR},
-            totalIncome =  #{totalIncome,jdbcType=INTEGER},
-            totalSplit =  #{totalSplit,jdbcType=INTEGER},
-            totalCashOut =  #{totalCashOut,jdbcType=INTEGER},
-            totalRefund =  #{totalRefund,jdbcType=INTEGER},
+            accountingIncome =  #{accountingIncome,jdbcType=INTEGER},
+            splitIncome =  #{splitIncome,jdbcType=INTEGER},
+            accountingRefund =  #{accountingRefund,jdbcType=INTEGER},
+            splitRefund =  #{splitRefund,jdbcType=INTEGER},
+            cashOut =  #{cashOut,jdbcType=INTEGER},
             balance =  #{balance,jdbcType=INTEGER}
         where   id = #{id,jdbcType=INTEGER} 
     </update>

+ 3 - 2
dao/src/main/resources/mapper/AskaRetailsMapper.xml

@@ -23,6 +23,7 @@
             <result property="tripartite" column="tripartite" jdbcType="CHAR"/>
             <result property="tripvalue" column="tripvalue" jdbcType="INTEGER"/>
             <result property="realtimeSplit" column="realtimeSplit" jdbcType="INTEGER"/>
+            <result property="cashSplit" column="cashSplit" jdbcType="INTEGER"/>
             <result property="status" column="status" jdbcType="CHAR"/>
             <result property="accountingIncome" column="accountingIncome" jdbcType="INTEGER"/>
             <result property="splitIncome" column="splitIncome" jdbcType="INTEGER"/>
@@ -38,7 +39,7 @@
         ownerId,phone,note,
         account,accountName,accountType,
         relation,apiv3,certPath,
-        tripartite,tripvalue,realtimeSplit,
+        tripartite,tripvalue,realtimeSplit,cashSplit,
         status,accountingIncome,splitIncome,
         accountingRefund,splitRefund,cashOut,balance
     </sql>
@@ -52,7 +53,7 @@
 
     <select id="listAllRetails" resultType="com.mofangchuxing.aska.domain.vo.AskaRetailsVo">
         select
-        ar.*,aa.name as username
+        ar.*,aa.name as username,ar.phone as ownername
         from aska_retails ar left join aska_accounts aa on ar.ownerId = aa.id
         where 1=1
         <if test="name != null and name != ''">

+ 24 - 2
dao/src/main/resources/mapper/PayRequestMapper.xml

@@ -74,13 +74,20 @@
         </if>
     </select>
 
-    <select id="selectByOrderId" resultMap="BaseResultMap">
+    <select id="selectByMobileAndOrderId" resultMap="BaseResultMap">
         select order_sn, order_id, item_id, item_name, pay_status
         from pay_request
         where mobile = #{phoneNo} and order_id = #{orderId}
     </select>
     <select id="getOrderList" resultType="java.util.Map">
-        select pr.*,asr.* from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
+        select pr.*,
+               ifnull(asr.channelAmount,0) as channelAmount,
+               ifnull(asr.channelRealtimeAmount,0) as channelRealtimeAmount,
+               ifnull(asr.channelAccountAmount,0) as channelAccountAmount,
+               ifnull(asr.retailAmount,0) as retailAmount,
+               ifnull(asr.retailRealtimeAmount,0) as retailRealtimeAmount,
+               ifnull(asr.retailAccountAmount,0) as retailAccountAmount
+        from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
         where 1=1
         <if test="retailId != null and retailId != ''">
             and pr.retail_id = #{retailId}
@@ -94,8 +101,23 @@
         <if test="channelId != null and channelId != ''">
             and pr.channel_id = #{channelId}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and pr.create_time > #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and pr.create_time &lt; #{endTime}
+        </if>
         order by pr.id desc
     </select>
+    <select id="selectByOrderId" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from pay_request
+        where order_id = #{orderId} limit 1
+    </select>
+    <select id="queryPayment" resultType="java.util.Map">
+        select 
+    </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from pay_request

BIN
dao/target/aska-dao-1.0.jar


BIN
dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaChannels.class


BIN
dao/target/classes/com/mofangchuxing/aska/dao/domain/AskaRetails.class


BIN
dao/target/classes/com/mofangchuxing/aska/dao/mapper/AskaStatMapper.class


BIN
dao/target/classes/com/mofangchuxing/aska/dao/mapper/PayRequestMapper.class


+ 4 - 1
dao/target/classes/mapper/AskaAccountsMapper.xml

@@ -36,7 +36,10 @@
         select
         <include refid="Base_Column_List" />
         from aska_accounts
-        where role = #{role} and status = 'start'
+        where 1=1
+        <if test="role != null and role != ''">
+            and role = #{role}
+        </if>
     </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

+ 30 - 32
dao/target/classes/mapper/AskaChannelsMapper.xml

@@ -20,11 +20,13 @@
             <result property="tripartite" column="tripartite" jdbcType="CHAR"/>
             <result property="tripvalue" column="tripvalue" jdbcType="INTEGER"/>
             <result property="realtimeSplit" column="realtimeSplit" jdbcType="INTEGER"/>
+            <result property="cashSplit" column="cashSplit" jdbcType="INTEGER"/>
             <result property="status" column="status" jdbcType="CHAR"/>
-            <result property="totalIncome" column="totalIncome" jdbcType="INTEGER"/>
-            <result property="totalSplit" column="totalSplit" jdbcType="INTEGER"/>
-            <result property="totalCashOut" column="totalCashOut" jdbcType="INTEGER"/>
-            <result property="totalRefund" column="totalRefund" jdbcType="INTEGER"/>
+            <result property="accountingIncome" column="accountingIncome" jdbcType="INTEGER"/>
+            <result property="splitIncome" column="splitIncome" jdbcType="INTEGER"/>
+            <result property="accountingRefund" column="accountingRefund" jdbcType="INTEGER"/>
+            <result property="splitRefund" column="splitRefund" jdbcType="INTEGER"/>
+            <result property="cashOut" column="cashOut" jdbcType="INTEGER"/>
             <result property="balance" column="balance" jdbcType="INTEGER"/>
     </resultMap>
 
@@ -33,9 +35,9 @@
         ownerId,phone,note,
         account,accountName,accountType,
         relation,apiv3,certPath,
-        tripartite,tripvalue,realtimeSplit,
-        status,totalIncome,totalSplit,
-        totalCashOut,totalRefund,balance
+        tripartite,tripvalue,realtimeSplit,cashSplit
+        status,accountingIncome,splitIncome,
+        accountingRefund,splitRefund,cashOut,balance
     </sql>
 
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -50,7 +52,7 @@
         from aska_channels ac left join aska_accounts aa on ac.ownerId = aa.id
         where 1=1
         <if test="channelName != null and channelName != ''">
-            and name = #{channelName,jdbcType=VARCHAR}
+            and ac.name = #{channelName,jdbcType=VARCHAR}
         </if>
     </select>
     <select id="selectByOwnerId" resultType="com.mofangchuxing.aska.domain.vo.AskaChannelsVo">
@@ -68,16 +70,16 @@
         ,account,accountName,accountType
         ,relation,apiv3,certPath
         ,tripartite,tripvalue,realtimeSplit
-        ,status,totalIncome,totalSplit
-        ,totalCashOut,totalRefund,balance
+        ,status,accountingIncome,splitIncome
+        ,accountingRefund,splitRefund,cashOut,balance
         )
         values (#{id,jdbcType=INTEGER},#{name,jdbcType=CHAR},#{prefix,jdbcType=CHAR}
         ,#{ownerId,jdbcType=INTEGER},#{phone,jdbcType=CHAR},#{note,jdbcType=VARCHAR}
         ,#{account,jdbcType=VARCHAR},#{accountName,jdbcType=VARCHAR},#{accountType,jdbcType=CHAR}
         ,#{relation,jdbcType=CHAR},#{apiv3,jdbcType=VARCHAR},#{certPath,jdbcType=VARCHAR}
         ,#{tripartite,jdbcType=CHAR},#{tripvalue,jdbcType=INTEGER},#{realtimeSplit,jdbcType=INTEGER}
-        ,#{status,jdbcType=CHAR},#{totalIncome,jdbcType=INTEGER},#{totalSplit,jdbcType=INTEGER}
-        ,#{totalCashOut,jdbcType=INTEGER},#{totalRefund,jdbcType=INTEGER},#{balance,jdbcType=INTEGER}
+        ,#{status,jdbcType=CHAR},#{accountingIncome,jdbcType=INTEGER},#{splitIncome,jdbcType=INTEGER}
+        ,#{accountingRefund,jdbcType=INTEGER},#{splitRefund,jdbcType=INTEGER},#{cashOut,jdbcType=INTEGER},#{balance,jdbcType=INTEGER}
         )
     </insert>
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaChannels" useGeneratedKeys="true">
@@ -99,10 +101,6 @@
                 <if test="tripvalue != null">tripvalue,</if>
                 <if test="realtimeSplit != null">realtimeSplit,</if>
                 <if test="status != null">status,</if>
-                <if test="totalIncome != null">totalIncome,</if>
-                <if test="totalSplit != null">totalSplit,</if>
-                <if test="totalCashOut != null">totalCashOut,</if>
-                <if test="totalRefund != null">totalRefund,</if>
                 <if test="balance != null">balance,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -122,10 +120,6 @@
                 <if test="tripvalue != null">#{tripvalue,jdbcType=INTEGER},</if>
                 <if test="realtimeSplit != null">#{realtimeSplit,jdbcType=INTEGER},</if>
                 <if test="status != null">#{status,jdbcType=CHAR},</if>
-                <if test="totalIncome != null">#{totalIncome,jdbcType=INTEGER},</if>
-                <if test="totalSplit != null">#{totalSplit,jdbcType=INTEGER},</if>
-                <if test="totalCashOut != null">#{totalCashOut,jdbcType=INTEGER},</if>
-                <if test="totalRefund != null">#{totalRefund,jdbcType=INTEGER},</if>
                 <if test="balance != null">#{balance,jdbcType=INTEGER},</if>
         </trim>
     </insert>
@@ -177,17 +171,20 @@
                 <if test="status != null">
                     status = #{status,jdbcType=CHAR},
                 </if>
-                <if test="totalIncome != null">
-                    totalIncome = #{totalIncome,jdbcType=INTEGER},
+                <if test="accountingIncome != null">
+                    accountingIncome = #{accountingIncome,jdbcType=INTEGER},
                 </if>
-                <if test="totalSplit != null">
-                    totalSplit = #{totalSplit,jdbcType=INTEGER},
+                <if test="splitIncome != null">
+                    splitIncome = #{splitIncome,jdbcType=INTEGER},
                 </if>
-                <if test="totalCashOut != null">
-                    totalCashOut = #{totalCashOut,jdbcType=INTEGER},
+                <if test="accountingRefund != null">
+                    accountingRefund = #{accountingRefund,jdbcType=INTEGER},
                 </if>
-                <if test="totalRefund != null">
-                    totalRefund = #{totalRefund,jdbcType=INTEGER},
+                <if test="splitRefund != null">
+                    splitRefund = #{splitRefund,jdbcType=INTEGER},
+                </if>
+                <if test="cashOut != null">
+                    cashOut = #{cashOut,jdbcType=INTEGER},
                 </if>
                 <if test="balance != null">
                     balance = #{balance,jdbcType=INTEGER},
@@ -213,10 +210,11 @@
             tripvalue =  #{tripvalue,jdbcType=INTEGER},
             realtimeSplit =  #{realtimeSplit,jdbcType=INTEGER},
             status =  #{status,jdbcType=CHAR},
-            totalIncome =  #{totalIncome,jdbcType=INTEGER},
-            totalSplit =  #{totalSplit,jdbcType=INTEGER},
-            totalCashOut =  #{totalCashOut,jdbcType=INTEGER},
-            totalRefund =  #{totalRefund,jdbcType=INTEGER},
+            accountingIncome =  #{accountingIncome,jdbcType=INTEGER},
+            splitIncome =  #{splitIncome,jdbcType=INTEGER},
+            accountingRefund =  #{accountingRefund,jdbcType=INTEGER},
+            splitRefund =  #{splitRefund,jdbcType=INTEGER},
+            cashOut =  #{cashOut,jdbcType=INTEGER},
             balance =  #{balance,jdbcType=INTEGER}
         where   id = #{id,jdbcType=INTEGER} 
     </update>

+ 3 - 2
dao/target/classes/mapper/AskaRetailsMapper.xml

@@ -23,6 +23,7 @@
             <result property="tripartite" column="tripartite" jdbcType="CHAR"/>
             <result property="tripvalue" column="tripvalue" jdbcType="INTEGER"/>
             <result property="realtimeSplit" column="realtimeSplit" jdbcType="INTEGER"/>
+            <result property="cashSplit" column="cashSplit" jdbcType="INTEGER"/>
             <result property="status" column="status" jdbcType="CHAR"/>
             <result property="accountingIncome" column="accountingIncome" jdbcType="INTEGER"/>
             <result property="splitIncome" column="splitIncome" jdbcType="INTEGER"/>
@@ -38,7 +39,7 @@
         ownerId,phone,note,
         account,accountName,accountType,
         relation,apiv3,certPath,
-        tripartite,tripvalue,realtimeSplit,
+        tripartite,tripvalue,realtimeSplit,cashSplit,
         status,accountingIncome,splitIncome,
         accountingRefund,splitRefund,cashOut,balance
     </sql>
@@ -52,7 +53,7 @@
 
     <select id="listAllRetails" resultType="com.mofangchuxing.aska.domain.vo.AskaRetailsVo">
         select
-        ar.*,aa.name as username
+        ar.*,aa.name as username,ar.phone as ownername
         from aska_retails ar left join aska_accounts aa on ar.ownerId = aa.id
         where 1=1
         <if test="name != null and name != ''">

+ 21 - 2
dao/target/classes/mapper/PayRequestMapper.xml

@@ -74,13 +74,20 @@
         </if>
     </select>
 
-    <select id="selectByOrderId" resultMap="BaseResultMap">
+    <select id="selectByMobileAndOrderId" resultMap="BaseResultMap">
         select order_sn, order_id, item_id, item_name, pay_status
         from pay_request
         where mobile = #{phoneNo} and order_id = #{orderId}
     </select>
     <select id="getOrderList" resultType="java.util.Map">
-        select pr.*,asr.* from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
+        select pr.*,
+               ifnull(asr.channelAmount,0) as channelAmount,
+               ifnull(asr.channelRealtimeAmount,0) as channelRealtimeAmount,
+               ifnull(asr.channelAccountAmount,0) as channelAccountAmount,
+               ifnull(asr.retailAmount,0) as retailAmount,
+               ifnull(asr.retailRealtimeAmount,0) as retailRealtimeAmount,
+               ifnull(asr.retailAccountAmount,0) as retailAccountAmount
+        from pay_request pr left join aska_splitrecord as asr on pr.id = asr.payId
         where 1=1
         <if test="retailId != null and retailId != ''">
             and pr.retail_id = #{retailId}
@@ -94,8 +101,20 @@
         <if test="channelId != null and channelId != ''">
             and pr.channel_id = #{channelId}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and pr.create_time > #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and pr.create_time &lt; #{endTime}
+        </if>
         order by pr.id desc
     </select>
+    <select id="selectByOrderId" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from pay_request
+        where order_id = #{orderId} limit 1
+    </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from pay_request

+ 2 - 0
domain/src/main/java/com/mofangchuxing/aska/domain/PayRequestDto.java

@@ -46,4 +46,6 @@ public class PayRequestDto {
     private String callBackUrl;
 
     private String clientType;
+
+    private String orderNo;
 }

+ 10 - 0
domain/src/main/java/com/mofangchuxing/aska/domain/dto/ChannelDto.java

@@ -33,4 +33,14 @@ public class ChannelDto extends BaseDto{
     private String relation;
 
     private String type;
+
+    private String cashSplit;
+
+    private Integer realtimeSplit;
+
+    private String tripartite;
+
+    private String tripvalue;
+
+    private String retailType;
 }

+ 2 - 2
domain/src/main/java/com/mofangchuxing/aska/domain/dto/OrderDto.java

@@ -18,11 +18,11 @@ public class OrderDto extends BaseDto{
 
     private Boolean download;
 
-    private Date endTime;
+    private String endTime;
 
     private String orderNo;
 
-    private Date startTime;
+    private String startTime;
 
     private String channelId;
 }

+ 3 - 1
domain/src/main/java/com/mofangchuxing/aska/domain/dto/RetailDto.java

@@ -32,11 +32,13 @@ public class RetailDto extends BaseDto{
 
     private String status;
 
-    private Boolean realtimeSplit;
+    private Integer realtimeSplit;
 
     private String tripartite;
 
     private String tripvalue;
 
     private String retailType;
+
+    private String cashSplit;
 }

+ 2 - 2
domain/src/main/java/com/mofangchuxing/aska/domain/enums/PayStatusEnum.java

@@ -7,8 +7,8 @@ package com.mofangchuxing.aska.domain.enums;
  */
 public enum PayStatusEnum {
     not_pay(0,"未支付"),
-    pay_success(1,"支付成功"),
-    auditing(2,"退款审核中"),
+    pay_success(1,"支付成功待分账"),
+    split_success(2,"已分账"),
     refund_success(3,"退款成功"),
     deduct_success(4,"扣款成功"),
     ;

+ 1 - 0
domain/src/main/java/com/mofangchuxing/aska/domain/enums/ResultEnum.java

@@ -13,6 +13,7 @@ public enum ResultEnum {
     AMOUNT_ERROR(206, "金额不匹配,无法退款", "金额不匹配,无法退款"),
     ORDER_PAID_ERROR(207, "订单已支付过", "订单已支付过"),
     NO_RETAIL_ERROR(208, "门店不存在", "门店不存在"),
+    REFUNDED_ERROR(209, "订单已退款", "订单已退款"),
     UNKNOWN_ERROR(-1, "程序出错了,联系客服吧", "未知异常错误"),
     PARAMS_ERROR(-2, "参数错误", "参数错误"),
     ;

+ 3 - 1
domain/src/main/java/com/mofangchuxing/aska/domain/vo/AskaChannelsVo.java

@@ -82,7 +82,7 @@ public class AskaChannelsVo {
     /**
      * 是否实时分账
      */
-    private Integer realtimeSplit;
+    private String realtimeSplit;
 
     /**
      * 渠道可用状态
@@ -119,4 +119,6 @@ public class AskaChannelsVo {
     private String channelId;
 
     private String channelName;
+
+    private Integer cashSplit;
 }

+ 6 - 1
domain/src/main/java/com/mofangchuxing/aska/domain/vo/AskaRetailsVo.java

@@ -101,7 +101,7 @@ public class AskaRetailsVo {
     /**
      * 是否实时分账
      */
-    private Boolean realtimeSplit;
+    private String realtimeSplit;
 
     /**
      * 渠道可用状态{运营,暂停}
@@ -137,4 +137,9 @@ public class AskaRetailsVo {
 
     private String username;
 
+    private String cashSplit;
+
+    private String retailSerial;
+
+    private String ownername;
 }

BIN
domain/target/aska-domain-1.0.jar


BIN
domain/target/classes/com/mofangchuxing/aska/domain/PayRequestDto.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/dto/ChannelDto.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/dto/OrderDto.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/dto/RetailDto.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/enums/PayStatusEnum.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/enums/ResultEnum.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/vo/AskaChannelsVo.class


BIN
domain/target/classes/com/mofangchuxing/aska/domain/vo/AskaRetailsVo.class


+ 98 - 0
main/src/main/java/com/mofangchuxing/aska/config/AopLog.java

@@ -0,0 +1,98 @@
+package com.mofangchuxing.aska.config;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSONUtil;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Objects;
+
+@Aspect
+@Component
+public class AopLog {
+ 
+    private static final Logger log = LoggerFactory.getLogger(AopLog.class);
+ 
+    private static final String START_TIME = "request-start";
+ 
+    private static final String REQUEST_ID = "request_id";
+ 
+    /**
+     * 切入点
+     */
+    @Pointcut("execution(public * com..controller.*Controller.*(..)) || execution(public * com..controller.admin.*Controller.*(..))")
+    public void log() {
+ 
+    }
+ 
+    /**
+     * 前置操作
+     *
+     * @param point 切入点
+     */
+    @Before("log()")
+    public void beforeLog(JoinPoint point) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        StringBuffer sb = new StringBuffer();
+        String requestId = IdUtil.simpleUUID();
+        sb.append("\n【request_id】:").append(requestId);
+        sb.append("\n【请求 URL】:").append(request.getRequestURL());
+        sb.append("\n【请求类名】:").append(point.getSignature().getDeclaringTypeName());
+        sb.append("【请求方法名】:").append(point.getSignature().getName());
+        sb.append("\n【body】:").append(JSONUtil.toJsonStr(point.getArgs()));
+        sb.append("\n【请求参数】:").append(JSONUtil.toJsonStr(parameterMap));
+        log.info(sb.toString());
+        Long start = System.currentTimeMillis();
+        request.setAttribute(START_TIME, start);
+        request.setAttribute(REQUEST_ID, requestId);
+    }
+ 
+    /**
+     * 环绕操作
+     *
+     * @param point 切入点
+     * @return 原方法返回值
+     * @throws Throwable 异常信息
+     */
+    @Around("log()")
+    public Object aroundLog(ProceedingJoinPoint point) throws Throwable {
+        Object result = point.proceed();
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        String requestId = (String) request.getAttribute(REQUEST_ID);
+        StringBuffer sb = new StringBuffer();
+        sb.append("\n【request_id】:").append(requestId);
+        sb.append("\n【返回值】:").append(JSONUtil.toJsonStr(result));
+        log.info(sb.toString());
+//        log.info("\n【request_id】:" + requestId + "\n【返回值】:{}", JSONUtil.toJsonStr(result));
+        return result;
+    }
+ 
+    /**
+     * 后置操作
+     */
+    @AfterReturning("log()")
+    public void afterReturning() {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = Objects.requireNonNull(attributes).getRequest();
+        String requestId = (String) request.getAttribute(REQUEST_ID);
+        StringBuffer sb = new StringBuffer();
+        sb.append("\n【request_id】:").append(requestId);
+        Long start = (Long) request.getAttribute(START_TIME);
+        Long end = System.currentTimeMillis();
+        sb.append("\n【请求耗时】:").append((end - start)).append("毫秒");
+
+        log.info(sb.toString());
+    }
+ 
+}

+ 2 - 2
main/src/main/java/com/mofangchuxing/aska/controller/AskaController.java

@@ -129,8 +129,8 @@ public class AskaController {
     }
 
     @PostMapping("/Splitting")
-    public ResponseResult Splitting(String orderSn) {
-        delayNotifyComponent.handleSplit(orderSn);
+    public ResponseResult Splitting(@RequestBody PayRequestDto payRequestDto) {
+        delayNotifyComponent.handleSplit(payRequestDto.getOrderNo());
         return new ResponseResult<>();
     }
 }

BIN
main/target/aska.jar


BIN
main/target/aska.jar.original


BIN
main/target/classes/com/mofangchuxing/aska/config/AopLog.class


BIN
main/target/classes/com/mofangchuxing/aska/controller/AskaController.class


+ 1 - 0
main/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -1,4 +1,5 @@
 com/mofangchuxing/aska/handler/GlobalExceptionHandler.class
+com/mofangchuxing/aska/config/AopLog.class
 com/mofangchuxing/aska/config/WebConfig.class
 com/mofangchuxing/aska/Interceptor/RequestInterceptor.class
 com/mofangchuxing/aska/Application.class

+ 1 - 0
main/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -1,6 +1,7 @@
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/handler/GlobalExceptionHandler.java
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/Interceptor/RequestInterceptor.java
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/controller/AskaController.java
+/Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/config/AopLog.java
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/Application.java
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/ApplicationRunner.java
 /Users/syl/Desktop/work/aska/main/src/main/java/com/mofangchuxing/aska/config/WebConfig.java

BIN
root@


+ 4 - 0
service/src/main/java/com/mofangchuxing/aska/service/ChannelService.java

@@ -3,9 +3,11 @@ package com.mofangchuxing.aska.service;
 import com.mofangchuxing.aska.dao.domain.AskaAccounts;
 import com.mofangchuxing.aska.dao.domain.AskaChannelcouponnos;
 import com.mofangchuxing.aska.dao.domain.AskaChannels;
+import com.mofangchuxing.aska.dao.domain.AskaRetails;
 import com.mofangchuxing.aska.domain.dto.ChannelCouponDto;
 import com.mofangchuxing.aska.domain.dto.ChannelDto;
 import com.mofangchuxing.aska.domain.dto.ChannelNoDto;
+import com.mofangchuxing.aska.domain.dto.RetailDto;
 import com.mofangchuxing.aska.domain.utils.PageUtils;
 import com.mofangchuxing.aska.domain.vo.AskaChannelsVo;
 import com.mofangchuxing.aska.domain.vo.AskaRetailsVo;
@@ -44,4 +46,6 @@ public interface ChannelService {
     PageUtils getCashHistory(ChannelDto channelDto);
 
     void setReceivingConfig(ChannelDto channelDto);
+
+    AskaChannels setSplitRule(ChannelDto channelDto);
 }

+ 2 - 0
service/src/main/java/com/mofangchuxing/aska/service/OrderService.java

@@ -10,4 +10,6 @@ import com.mofangchuxing.aska.domain.utils.PageUtils;
  */
 public interface OrderService {
     PageUtils getOrderList(OrderDto orderDto);
+
+    PageUtils queryPayment(OrderDto orderDto);
 }

+ 10 - 5
service/src/main/java/com/mofangchuxing/aska/service/common/DelayNotifyComponent.java

@@ -10,6 +10,7 @@ import com.mofangchuxing.aska.dao.mapper.PayRequestMapper;
 import com.mofangchuxing.aska.domain.BizException;
 import com.mofangchuxing.aska.domain.DelayObjectWrapper;
 import com.mofangchuxing.aska.domain.enums.DelayTypeEnum;
+import com.mofangchuxing.aska.domain.enums.PayStatusEnum;
 import com.mofangchuxing.aska.service.ProfitSharingService;
 import lombok.extern.slf4j.Slf4j;
 import org.redisson.RedissonShutdownException;
@@ -124,17 +125,21 @@ public class DelayNotifyComponent {
         }
     }
 
-    public void handleSplit(String orderSn) {
-        PayRequest payRequest = payRequestMapper.selectByOrderSn(orderSn);
+    public void handleSplit(String orderId) {
+        PayRequest payRequest = payRequestMapper.selectByOrderId(orderId);
         if (payRequest == null) {
-            log.error("handleSplit payRequest 不存在? orderSn = {}",orderSn);
+            log.error("handleSplit payRequest 不存在? orderSn = {}",orderId);
             throw new BizException("订单不存在");
         }
         if (payRequest.getCansplit() == 0) {
-            log.error("payRequest 不需要分账");
+            log.error("payRequest 不需要分账 orderSn = {}", orderId);
             throw new BizException("订单不需要分账");
         }
-        profitSharingService.profitSharing(payRequest.getClientType(), orderSn, payRequest.getTransactionId(), payRequest.getPayAmount(), Long.parseLong(payRequest.getRetailId()), payRequest.getUseCouponId());
+        if (payRequest.getPayStatus() != PayStatusEnum.pay_success.getCode().intValue()) {
+            log.error("payRequest 状态不是已支付待分账 orderSn = {}", orderId);
+            throw new BizException("订单不是待分账状态");
+        }
+        profitSharingService.profitSharing(payRequest.getClientType(), payRequest.getOrderSn(), payRequest.getTransactionId(), payRequest.getPayAmount(), Long.parseLong(payRequest.getRetailId()), payRequest.getUseCouponId());
     }
 
     public boolean notifyDown(String orderId, String url) {

+ 26 - 0
service/src/main/java/com/mofangchuxing/aska/service/impl/ChannelServiceImpl.java

@@ -14,6 +14,8 @@ import com.mofangchuxing.aska.domain.dto.ChannelNoDto;
 import com.mofangchuxing.aska.domain.utils.PageUtils;
 import com.mofangchuxing.aska.domain.vo.AskaChannelsVo;
 import com.mofangchuxing.aska.service.ChannelService;
+import com.mofangchuxing.aska.service.utils.PropertyCopyUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -39,6 +41,11 @@ public class ChannelServiceImpl implements ChannelService {
     public AskaChannels addChannel(ChannelDto channelDto) {
         AskaChannels askaChannels = new AskaChannels();
         BeanUtil.copyProperties(channelDto, askaChannels);
+        askaChannels.setAccountType("merchant");
+        askaChannels.setRelation("partner");
+        if (StringUtils.isEmpty(channelDto.getOwnerId())) {
+            askaChannels.setOwnerId(0);
+        }
         askaChannelsMapper.insertSelective(askaChannels);
         return askaChannels;
     }
@@ -150,4 +157,23 @@ public class ChannelServiceImpl implements ChannelService {
         askaChannels.setAccountType(channelDto.getType());
         askaChannelsMapper.updateByPrimaryKeySelective(askaChannels);
     }
+
+    @Override
+    public AskaChannels setSplitRule(ChannelDto channelDto) {
+        AskaChannels askaChannels = askaChannelsMapper.selectByPrimaryKey(channelDto.getChannelId().longValue());
+        if (askaChannels != null) {
+            AskaChannels updateChannels = new AskaChannels();
+            updateChannels.setId(askaChannels.getId());
+            if (StringUtils.isNotEmpty(channelDto.getCashSplit())) {
+                updateChannels.setCashSplit(Integer.parseInt(channelDto.getCashSplit()));
+            }
+            updateChannels.setRealtimeSplit(channelDto.getRealtimeSplit());
+            updateChannels.setTripartite(channelDto.getTripartite());
+            updateChannels.setTripvalue(Integer.parseInt(channelDto.getTripvalue()));
+            updateChannels.setStatus(channelDto.getStatus());
+            askaChannelsMapper.updateByPrimaryKeySelective(updateChannels);
+            PropertyCopyUtils.copyPropertiesNotNull(updateChannels,askaChannels);
+        }
+        return askaChannels;
+    }
 }

+ 25 - 0
service/src/main/java/com/mofangchuxing/aska/service/impl/OrderServiceImpl.java

@@ -1,5 +1,6 @@
 package com.mofangchuxing.aska.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.mofangchuxing.aska.dao.mapper.PayRequestMapper;
@@ -10,9 +11,11 @@ import com.mofangchuxing.aska.domain.vo.AskaChannelsVo;
 import com.mofangchuxing.aska.domain.vo.PayRequestVo;
 import com.mofangchuxing.aska.service.OrderService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -30,10 +33,32 @@ public class OrderServiceImpl implements OrderService {
 
     @Override
     public PageUtils getOrderList(OrderDto orderDto) {
+        if (StringUtils.isNotEmpty(orderDto.getStartTime())) {
+            String startTime = DateUtil.parse(orderDto.getStartTime(), "yyyy/MM/dd").toDateStr();
+            orderDto.setStartTime(startTime);
+        }
+        if (StringUtils.isNotEmpty(orderDto.getEndTime())) {
+            String endTime = DateUtil.parse(orderDto.getEndTime(), "yyyy/MM/dd").toDateStr();
+            orderDto.setEndTime(endTime);
+        }
         PageHelper.startPage(orderDto.getPageNum(), orderDto.getPageSize());
         List<Map<String,Object>> list = payRequestMapper.getOrderList(orderDto);
         PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(list);
         PageUtils page = new PageUtils(pageInfo.getList(), (int) pageInfo.getTotal(), pageInfo.getPageSize(), pageInfo.getPageNum());
         return page;
     }
+
+    @Override
+    public PageUtils queryPayment(OrderDto orderDto) {
+        if (StringUtils.isNotEmpty(orderDto.getStartTime())) {
+            String startTime = DateUtil.parse(orderDto.getStartTime(), "yyyy/MM/dd").toDateStr();
+            orderDto.setStartTime(startTime);
+        }
+        if (StringUtils.isNotEmpty(orderDto.getEndTime())) {
+            String endTime = DateUtil.parse(orderDto.getEndTime(), "yyyy/MM/dd").toDateStr();
+            orderDto.setEndTime(endTime);
+        }
+
+        return null;
+    }
 }

+ 15 - 7
service/src/main/java/com/mofangchuxing/aska/service/impl/PayServiceImpl.java

@@ -132,10 +132,13 @@ public class PayServiceImpl implements PayService {
         if (StringUtils.isEmpty(payRequestDto.getPaymentId()) || payRequestDto.getAmount() == null) {
             return new ResponseResult(ResultEnum.PARAMS_ERROR);
         }
-        PayRequest payRequest = payRequestMapper.selectPaySuccessByOrderId(payRequestDto.getPaymentId());
+        PayRequest payRequest = payRequestMapper.selectByOrderId(payRequestDto.getPaymentId());
         if (payRequest == null) {
             return new ResponseResult(ResultEnum.NO_ORDER_ERROR);
         }
+        if (payRequest.getPayStatus() == 3) {
+            return new ResponseResult(ResultEnum.REFUNDED_ERROR);
+        }
         Integer refundAmount = payRequestDto.getAmount().multiply(new BigDecimal(100)).intValue();
         String refundOrderNo = "refund" + payRequest.getOrderSn() + GenerateCodeUtil.getFiveNumber();
         boolean result = wxRefund(payRequest, refundAmount, refundOrderNo);
@@ -179,7 +182,7 @@ public class PayServiceImpl implements PayService {
         if (StringUtils.isEmpty(payRequestDto.getUserId()) || StringUtils.isEmpty(payRequestDto.getPhoneNo()) || StringUtils.isEmpty(payRequestDto.getOrderId())) {
             return new ResponseResult(ResultEnum.PARAMS_ERROR);
         }
-        List<PayRequest> requestList = payRequestMapper.selectByOrderId(payRequestDto.getPhoneNo(), payRequestDto.getOrderId());
+        List<PayRequest> requestList = payRequestMapper.selectByMobileAndOrderId(payRequestDto.getPhoneNo(), payRequestDto.getOrderId());
         return new ResponseResult(requestList);
     }
 
@@ -241,11 +244,16 @@ public class PayServiceImpl implements PayService {
                     partTwo = "OK";
                     log.info("订单已处理订单号:{},out_trade_no:{}", payRequest.getOrderSn(), out_trade_no);
                     if (payRequest.getCansplit() != null && payRequest.getCansplit() == 1) {
-                        try {
-                            profitSharingService.addSplitReceivers(payRequest.getClientType(), Long.parseLong(payRequest.getRetailId()), payRequest.getUseCouponId());
-                            delayNotifyComponent.delay(payRequest.getOrderSn(), DelayTypeEnum.TYPE_SPLIT, 2, TimeUnit.MINUTES);
-                        } catch (Exception e) {
-                            e.printStackTrace();
+                        Long retailId = Long.parseLong(payRequest.getRetailId());
+                        AskaRetails askaRetails = askaRetailsMapper.selectByPrimaryKey(retailId);
+                        // 实时分账
+                        if (askaRetails != null && askaRetails.getRealtimeSplit() == 1) {
+                            try {
+                                profitSharingService.addSplitReceivers(payRequest.getClientType(), retailId, payRequest.getUseCouponId());
+                                delayNotifyComponent.delay(payRequest.getOrderSn(), DelayTypeEnum.TYPE_SPLIT, 2, TimeUnit.MINUTES);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 } else {

+ 9 - 2
service/src/main/java/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.java

@@ -7,6 +7,7 @@ import com.mofangchuxing.aska.dao.domain.*;
 import com.mofangchuxing.aska.dao.mapper.*;
 import com.mofangchuxing.aska.domain.Constant;
 import com.mofangchuxing.aska.domain.enums.ClientTypeEnum;
+import com.mofangchuxing.aska.domain.enums.PayStatusEnum;
 import com.mofangchuxing.aska.domain.enums.RecordTypeEnum;
 import com.mofangchuxing.aska.service.ProfitSharingService;
 import com.mofangchuxing.aska.service.utils.WxPayV3Utils;
@@ -125,6 +126,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
         boolean retailRealtimeSplit = true;
         Map<String, Object> retailReceiver = new HashMap<>();
         if (askaRetails != null) {
+            log.info("askaRetails = {}", askaRetails);
             retailReceiver = getReceiverMap(askaRetails.getAccountType(),
                     askaRetails.getAccount().trim(), askaRetails.getTripartite(), payMoney, askaRetails.getTripvalue(), askaRetails.getAccountName().trim(), "分账给门店-" + askaRetails.getName());
             askaSplitrecord.setRetailId(askaRetails.getId());
@@ -132,7 +134,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
             retailAmount = Integer.parseInt(retailReceiver.get("amount").toString());
             askaSplitrecord.setRetailAccount(askaRetails.getAccount());
             askaSplitrecord.setRetailAmount(retailAmount.toString());
-            if (askaRetails.getRealtimeSplit() == 0) {
+            if (askaRetails.getCashSplit() == 0) {
                 askaSplitrecord.setRetailRealtimeAmount(0);
                 askaSplitrecord.setRetailAccountAmount(retailAmount);
                 retailRealtimeSplit = false;
@@ -153,7 +155,7 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
             channelAmount = Integer.parseInt(channelReceiver.get("amount").toString());
             askaSplitrecord.setChannelAccount(askaChannels.getAccount());
             askaSplitrecord.setChannelAmount(channelAmount.toString());
-            if (askaChannels.getRealtimeSplit() == 0) {
+            if (askaChannels.getCashSplit() == 0) {
                 askaSplitrecord.setChannelRealtimeAmount(0);
                 askaSplitrecord.setChannelAccountAmount(channelAmount);
                 channelRealtimeSplit = false;
@@ -197,6 +199,11 @@ public class ProfitSharingServiceImpl implements ProfitSharingService {
                 handleSplitFailed(askaSplitrecord);
             }
         }
+        // payRequest状态更新为已分账
+        PayRequest updateRequest = new PayRequest();
+        updateRequest.setId(payRequest.getId());
+        updateRequest.setPayStatus(PayStatusEnum.split_success.getCode());
+        payRequestMapper.updateByPrimaryKeySelective(updateRequest);
         notifyAmountChange(askaSplitrecord.getPayId());
     }
 

+ 5 - 1
service/src/main/java/com/mofangchuxing/aska/service/impl/RetailServiceImpl.java

@@ -10,6 +10,7 @@ import com.mofangchuxing.aska.domain.utils.PageUtils;
 import com.mofangchuxing.aska.domain.vo.AskaRetailsVo;
 import com.mofangchuxing.aska.service.RetailService;
 import com.mofangchuxing.aska.service.utils.PropertyCopyUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -63,7 +64,10 @@ public class RetailServiceImpl implements RetailService {
         if (askaRetails != null) {
             AskaRetails updateRetails = new AskaRetails();
             updateRetails.setId(askaRetails.getId());
-            updateRetails.setRealtimeSplit(retailDto.getRealtimeSplit() ? 0 : 1);
+            if (StringUtils.isNotEmpty(retailDto.getCashSplit())) {
+                updateRetails.setCashSplit(Integer.parseInt(retailDto.getCashSplit()));
+            }
+            updateRetails.setRealtimeSplit(retailDto.getRealtimeSplit());
             updateRetails.setTripartite(retailDto.getTripartite());
             updateRetails.setTripvalue(Integer.parseInt(retailDto.getTripvalue()));
             updateRetails.setStatus(retailDto.getStatus());

BIN
service/target/aska-service-1.0.jar


BIN
service/target/classes/com/mofangchuxing/aska/service/ChannelService.class


BIN
service/target/classes/com/mofangchuxing/aska/service/common/DelayNotifyComponent$1.class


BIN
service/target/classes/com/mofangchuxing/aska/service/common/DelayNotifyComponent.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/ChannelServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/OrderServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/PayServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/ProfitSharingServiceImpl.class


BIN
service/target/classes/com/mofangchuxing/aska/service/impl/RetailServiceImpl.class