Kaynağa Gözat

Merge branch 'master' of http://git.dayaedu.com/yonge/cooleshow

yonge 3 yıl önce
ebeveyn
işleme
08e1322d2e
43 değiştirilmiş dosya ile 805 ekleme ve 151 silme
  1. 0 5
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/SysUserServiceImpl.java
  2. 5 3
      cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/MallAdminApplication.java
  3. 1 1
      cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/config/ResourceServerConfig.java
  4. 0 27
      cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/OmsOrderReturnApplyController.java
  5. 71 0
      cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenController.java
  6. 9 0
      cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java
  7. 88 2
      cooleshow-mall/mall-common/src/main/java/com/yonge/cooleshow/mall/common/domain/WebLog.java
  8. 5 3
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/MallPortalApplication.java
  9. 12 0
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java
  10. 17 3
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java
  11. 34 1
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/PlatformCashAccountRecordController.java
  12. 39 6
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserAccountRecordController.java
  13. 13 0
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserOrderRefundController.java
  14. 16 0
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/UserOrderClient.java
  15. 42 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/AccountBizTypeEnumConvert.java
  16. 43 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/InOrOutEnumConvert.java
  17. 42 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/PostStatusConvert.java
  18. 3 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/PlatformCashAccountRecordDao.java
  19. 4 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserAccountRecordDao.java
  20. 89 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/PlatformCashAccountRecordExport.java
  21. 85 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/UserAccountRecordExport.java
  22. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/VideoLessonGroupSearch.java
  23. 1 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java
  24. 5 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/PlatformCashAccountRecordService.java
  25. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserAccountRecordService.java
  26. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderRefundService.java
  27. 4 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderService.java
  28. 4 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java
  29. 6 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  30. 36 23
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java
  31. 5 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/PlatformCashAccountRecordServiceImpl.java
  32. 27 16
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountRecordServiceImpl.java
  33. 1 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java
  34. 4 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundServiceImpl.java
  35. 4 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  36. 2 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupServiceImpl.java
  37. 6 7
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonPurchaseRecordServiceImpl.java
  38. 12 5
      cooleshow-user/user-biz/src/main/resources/config/mybatis/PlatformCashAccountRecordMapper.xml
  39. 7 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountMapper.xml
  40. 8 23
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountRecordMapper.xml
  41. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderDetailMapper.xml
  42. 15 0
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java
  43. 25 0
      cooleshow-user/user-website/src/main/java/com/yonge/cooleshow/website/controller/open/OpenSubjectController.java

+ 0 - 5
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/SysUserServiceImpl.java

@@ -1,20 +1,15 @@
 package com.yonge.cooleshow.auth.service.impl;
 
-import java.util.Date;
 import java.util.List;
 
 import com.yonge.cooleshow.auth.api.dto.*;
 import com.yonge.cooleshow.auth.config.RongCloudConfig;
-import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.CacheNameEnum;
-import com.yonge.cooleshow.common.security.AuthUser;
-import com.yonge.cooleshow.common.security.SecurityUtils;
 import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
 import io.rong.models.user.UserModel;
 import org.apache.commons.lang3.StringUtils;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 

+ 5 - 3
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/MallAdminApplication.java

@@ -1,6 +1,8 @@
 package com.yonge.cooleshow.admin;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
+import com.yonge.cooleshow.common.constant.AppConstant;
+import com.yonge.toolset.base.BaseApplication;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -14,13 +16,13 @@ import org.springframework.context.annotation.ComponentScan;
  */
 @SpringBootApplication
 @EnableDiscoveryClient
-@MapperScan({"com.yonge.cooleshow.admin.dao","com.yonge.cooleshow.mbg.mapper", "com.yonge.toolset.payment.core.dao"})
+@MapperScan({"com.yonge.cooleshow.admin.dao", "com.yonge.cooleshow.mbg.mapper", "com.yonge.toolset.payment.core.dao"})
 @ComponentScan(basePackages = {"com.yonge.cooleshow.admin", "com.yonge.cooleshow.mbg", "com.yonge.cooleshow.mall.common",
-                               "com.yonge.cooleshow.common","com.yonge.toolset.thirdparty","com.yonge.toolset.payment","com.yonge.toolset.log"})
+        "com.yonge.cooleshow.common", "com.yonge.toolset.thirdparty", "com.yonge.toolset.payment", "com.yonge.toolset.log"})
 @EnableSwagger2Doc
 @EnableFeignClients("com.yonge.cooleshow")
 public class MallAdminApplication {
     public static void main(String[] args) {
-        SpringApplication.run(MallAdminApplication.class, args);
+        BaseApplication.run(AppConstant.APPLICATION_MALL_ADMIN, MallAdminApplication.class, args);
     }
 }

+ 1 - 1
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/config/ResourceServerConfig.java

@@ -30,7 +30,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                 .permitAll()
             .and()
                 .authorizeRequests()
-                .antMatchers("/wechat/*","/feign-client/**","/v2/api-docs", "/code/*","/payment/callback","/admin/login","/returnApply/test/returnApply/**")
+                .antMatchers("/wechat/*","/feign-client/**","/v2/api-docs", "/code/*","/payment/callback","/admin/login","/open/**")
             .permitAll().anyRequest().authenticated().and().httpBasic();
     }
 

+ 0 - 27
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/OmsOrderReturnApplyController.java

@@ -93,31 +93,4 @@ public class OmsOrderReturnApplyController {
         return CommonResult.failed();
     }
 
-
-
-    @ApiOperation("完成退货测试接口")
-    @GetMapping(value = "/test/returnApply/{id}")
-    @ResponseBody
-    public CommonResult test(@PathVariable Long id) {
-        RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_REFUND_ORDER_MALL + ":refundOrder:" + id);
-        try {
-            boolean b = lock.tryLock(60, 60, TimeUnit.SECONDS);
-            if (b) {
-
-                returnApplyService.setTestReturnApply(id);
-                return CommonResult.success(true);
-
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            log.warn("");
-        } finally {
-            if (lock.getHoldCount() >0) {
-                lock.unlock();
-            }
-        }
-
-        return CommonResult.failed();
-    }
-
 }

+ 71 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenController.java

@@ -0,0 +1,71 @@
+package com.yonge.cooleshow.admin.controller.open;
+
+import com.yonge.cooleshow.admin.controller.OmsOrderReturnApplyController;
+import com.yonge.cooleshow.admin.service.OmsOrderReturnApplyService;
+import com.yonge.cooleshow.mall.common.api.CommonResult;
+import com.yonge.cooleshow.mall.common.enums.OrderCacheEnum;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-07-28
+ */
+@Controller
+@RequestMapping("/open")
+public class OpenController {
+    @Autowired
+    private OmsOrderReturnApplyService returnApplyService;
+
+
+    @Value("${message.debugMode}")
+    private boolean debugMode;
+
+    @Autowired
+    private RedissonClient redissonClient;
+
+    private static final Logger log = LoggerFactory.getLogger(OmsOrderReturnApplyController.class);
+
+    @ApiOperation("完成退货测试接口")
+    @GetMapping(value = "/test/returnApply/{id}")
+    @ResponseBody
+    public CommonResult test(@PathVariable Long id) {
+        if (!debugMode) {
+            return CommonResult.failed("当前环境不可使用");
+        }
+        RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_REFUND_ORDER_MALL + ":refundOrder:" + id);
+        try {
+            boolean b = lock.tryLock(60, 60, TimeUnit.SECONDS);
+            if (b) {
+
+                returnApplyService.setTestReturnApply(id);
+                return CommonResult.success(true);
+
+            }
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        } finally {
+            if (lock.getHoldCount() >0) {
+                lock.unlock();
+            }
+        }
+
+        return CommonResult.failed();
+    }
+
+}

+ 9 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java

@@ -14,6 +14,7 @@ import com.yonge.cooleshow.mbg.model.OmsOrder;
 import com.yonge.cooleshow.mbg.model.OmsOrderExample;
 import com.yonge.cooleshow.mbg.model.OmsOrderOperateHistory;
 import com.yonge.cooleshow.admin.service.OmsOrderService;
+import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.utils.date.DateUtil;
 import com.yonge.cooleshow.admin.enums.OrderStatisticalEnum;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -84,6 +85,14 @@ public class OmsOrderServiceImpl implements OmsOrderService {
         record.setStatus(4);
         OmsOrderExample example = new OmsOrderExample();
         example.createCriteria().andDeleteStatusEqualTo(0).andIdIn(ids);
+
+        List<OmsOrder> omsOrders = orderMapper.selectByExample(example);
+        long count1 = omsOrders.stream()
+                               .filter(omsOrder -> omsOrder.getStatus() != 0 && omsOrder.getStatus() != 6)
+                               .count();
+        if (count1 != 0) {
+            throw new BizException("订单不处于待支付状态,不能关闭");
+        }
         int count = orderMapper.updateByExampleSelective(record, example);
         List<OmsOrderOperateHistory> historyList = ids.stream().map(orderId -> {
             OmsOrderOperateHistory history = new OmsOrderOperateHistory();

+ 88 - 2
cooleshow-mall/mall-common/src/main/java/com/yonge/cooleshow/mall/common/domain/WebLog.java

@@ -7,8 +7,6 @@ import lombok.EqualsAndHashCode;
  * Controller层的日志封装类
  * Created by macro on 2018/4/26.
  */
-@Data
-@EqualsAndHashCode(callSuper = false)
 public class WebLog {
     /**
      * 操作描述
@@ -65,4 +63,92 @@ public class WebLog {
      */
     private Object result;
 
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public Long getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Long startTime) {
+        this.startTime = startTime;
+    }
+
+    public Integer getSpendTime() {
+        return spendTime;
+    }
+
+    public void setSpendTime(Integer spendTime) {
+        this.spendTime = spendTime;
+    }
+
+    public String getBasePath() {
+        return basePath;
+    }
+
+    public void setBasePath(String basePath) {
+        this.basePath = basePath;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public Object getParameter() {
+        return parameter;
+    }
+
+    public void setParameter(Object parameter) {
+        this.parameter = parameter;
+    }
+
+    public Object getResult() {
+        return result;
+    }
+
+    public void setResult(Object result) {
+        this.result = result;
+    }
 }

+ 5 - 3
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/MallPortalApplication.java

@@ -1,6 +1,8 @@
 package com.yonge.cooleshow.portal;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
+import com.yonge.cooleshow.common.constant.AppConstant;
+import com.yonge.toolset.base.BaseApplication;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -9,15 +11,15 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
 
 @SpringBootApplication
-@MapperScan({ "com.yonge.cooleshow.portal.dao", "com.yonge.toolset.payment.core.dao", "com.yonge.cooleshow.mbg.mapper"})
-@ComponentScan(basePackages = {"com.yonge.cooleshow.portal","com.yonge.cooleshow.mbg", "com.yonge.cooleshow.mall.common", "com.yonge.cooleshow.common","com.yonge.toolset.payment","com.yonge.toolset.log"})
+@MapperScan({"com.yonge.cooleshow.portal.dao", "com.yonge.toolset.payment.core.dao", "com.yonge.cooleshow.mbg.mapper"})
+@ComponentScan(basePackages = {"com.yonge.cooleshow.portal", "com.yonge.cooleshow.mbg", "com.yonge.cooleshow.mall.common", "com.yonge.cooleshow.common", "com.yonge.toolset.payment", "com.yonge.toolset.log"})
 @EnableSwagger2Doc
 @EnableDiscoveryClient
 @EnableFeignClients("com.yonge.cooleshow")
 public class MallPortalApplication {
 
     public static void main(String[] args) {
-        SpringApplication.run(MallPortalApplication.class, args);
+        BaseApplication.run(AppConstant.APPLICATION_MALL_PORTAL, MallPortalApplication.class, args);
     }
 
 }

+ 12 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java

@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
@@ -36,6 +37,10 @@ public class OmsPortalOrderController {
     private OmsPortalOrderService portalOrderService;
 
 
+
+    @Value("${message.debugMode}")
+    private boolean debugMode;
+
     @Autowired
     private RedissonClient redissonClient;
 
@@ -167,6 +172,9 @@ public class OmsPortalOrderController {
     @RequestMapping(value = "/paySuccess/test", method = RequestMethod.GET)
     @ResponseBody
     public CommonResult paySuccessTest(@RequestParam Long orderId,@RequestParam Integer payType) {
+        if (!debugMode) {
+            return CommonResult.failed("当前环境不可使用");
+        }
         OmsOrder omsOrder = portalOrderService.getOrderById(orderId);
         if (omsOrder == null) {
             return CommonResult.failed("未找到订单");
@@ -190,6 +198,10 @@ public class OmsPortalOrderController {
     @ResponseBody
     public CommonResult cancelUserOrderTest(@RequestParam Long orderId) {
 
+        if (!debugMode) {
+            return CommonResult.failed("当前环境不可使用");
+        }
+
         OmsOrder omsOrder = portalOrderService.getOrderById(orderId);
         if (omsOrder == null) {
             return CommonResult.failed("未找到订单");

+ 17 - 3
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -421,7 +421,11 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
                                        if (timeOutOrder.getStatus() == 0) {
                                            payingOrderHandle(timeOutOrder);
                                        } else if (timeOutOrder.getStatus() == 6) {
-                                           cancelOrder(timeOutOrder.getId(), "超时取消", null);
+                                           try {
+                                               cancelOrder(timeOutOrder.getId(), "超时取消", null);
+                                           } catch (Exception e) {
+                                               LOG.warn("订单取消失败,{}",e.fillInStackTrace());
+                                           }
                                        }
                                    }, 60L, TimeUnit.SECONDS);
 
@@ -791,7 +795,12 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
             DistributedLock.of(redissonClient)
                            .runIfLockCanGet(OrderCacheEnum.LOCK_ORDER_NO_MALL.getRedisKey(omsOrder.getOrderSn())
                                    , () -> {
-                                       this.confirmReceiveOrder(omsOrder.getId());
+                                        try {
+                                            this.confirmReceiveOrder(omsOrder.getId());
+
+                                        }catch (Exception e) {
+                                            LOG.warn("订单收货,{}",e.fillInStackTrace());
+                                        }
                                    }, 60L, TimeUnit.SECONDS);
         }
         return omsOrders.size();
@@ -818,7 +827,12 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
             DistributedLock.of(redissonClient)
                            .runIfLockCanGet(OrderCacheEnum.LOCK_ORDER_NO_MALL.getRedisKey(omsOrder.getOrderSn())
                                    , () -> {
-                                       this.FinishReceiveOrder(omsOrder.getId());
+                               try {
+                                   this.FinishReceiveOrder(omsOrder.getId());
+
+                               } catch (Exception e) {
+                                   LOG.warn("停止售后失败,{}",e.fillInStackTrace());
+                               }
                                    }, 60L, TimeUnit.SECONDS);
         }
         return omsOrders.size();

+ 34 - 1
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/PlatformCashAccountRecordController.java

@@ -1,11 +1,18 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.yonge.cooleshow.biz.dal.dto.excel.PlatformCashAccountRecordExport;
+import com.yonge.cooleshow.biz.dal.dto.excel.UserAccountRecordExport;
+import com.yonge.cooleshow.biz.dal.dto.search.UserAccountRecordSearch;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
 import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountPageVo;
+import com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo;
+import com.yonge.toolset.utils.easyexcel.ExcelUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 import javax.validation.Valid;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.ui.ModelMap;
@@ -22,6 +29,10 @@ import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.mybatis.support.PageUtil;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
 @RestController
 @RequestMapping("/platformCashAccountRecord")
 @Api(value = "平台账户记录", tags = "平台账户记录")
@@ -33,7 +44,7 @@ public class PlatformCashAccountRecordController extends BaseController {
 	@ApiOperation(value = "平台账户记录-列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
 	@PostMapping(value = "/list", consumes = "application/json", produces = "application/json")
 	@PreAuthorize("@pcs.hasPermissions('platformCashAccountRecord/list')")
-	public HttpResponseResult<PlatformCashAccountPageVo> list(@Valid @RequestBody PlatformCashAccountRecordSearch query) {
+	public HttpResponseResult<PlatformCashAccountPageVo> list(@RequestBody PlatformCashAccountRecordSearch query) {
 		PlatformCashAccountPageVo model = new PlatformCashAccountPageVo();
 		PageInfo<PlatformCashAccountRecord> pageInfo = PageUtil.pageInfo(platformCashAccountRecordService.queryPage(PageUtil.getPage(query),query));
 		model.setPageInfo(pageInfo);
@@ -41,4 +52,26 @@ public class PlatformCashAccountRecordController extends BaseController {
 		return succeed(model);
 	}
 
+	/**
+	 * 查询导出
+	 */
+	@PostMapping("/export")
+	@ApiOperation(value = "查询导出", notes = "传入orderSearch")
+	@PreAuthorize("@pcs.hasPermissions('platformCashAccountRecord/export')")
+	public void export(@RequestBody PlatformCashAccountRecordSearch query) {
+		List<PlatformCashAccountRecord> platformCashAccountRecords = platformCashAccountRecordService.queryAll(query);
+
+		List<PlatformCashAccountRecordExport> list = new ArrayList<>();
+		platformCashAccountRecords.forEach(o -> {
+			PlatformCashAccountRecordExport export = new PlatformCashAccountRecordExport();
+			BeanUtils.copyProperties(o, export);
+			if (null == export.getTransAmount()) {
+				export.setTransAmount(BigDecimal.ZERO);
+			}
+			list.add(export);
+		});
+		ExcelUtils.exportExcel(list, "平台收支列表数据" + System.currentTimeMillis(),
+				"平台收支列表数据");
+	}
+
 }

+ 39 - 6
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserAccountRecordController.java

@@ -3,15 +3,21 @@ package com.yonge.cooleshow.admin.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.excel.UserAccountRecordExport;
+import com.yonge.cooleshow.biz.dal.dto.excel.UserOrderExport;
 import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
+import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch;
 import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
 import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
 import com.yonge.toolset.mybatis.support.PageUtil;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
+import com.yonge.toolset.utils.easyexcel.ExcelUtils;
 import io.swagger.annotations.*;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -22,6 +28,9 @@ import com.yonge.cooleshow.biz.dal.dto.search.UserAccountRecordSearch;
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 
 import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
 
 @RestController
 @RequestMapping("/userAccountRecord")
@@ -31,16 +40,16 @@ public class UserAccountRecordController extends BaseController {
     @Autowired
     private UserAccountRecordService userAccountRecordService;
 
-	/**
+    /**
      * 查询单条
      */
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     @PreAuthorize("@pcs.hasPermissions('userAccountRecord/detail')")
     public HttpResponseResult<UserAccountRecordVo> detail(@PathVariable("id") Long id) {
-    	return succeed(userAccountRecordService.detail(id));
-	}
-    
+        return succeed(userAccountRecordService.detail(id));
+    }
+
     /**
      * 查询分页
      */
@@ -49,9 +58,32 @@ public class UserAccountRecordController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('userAccountRecord/page')")
     public HttpResponseResult<PageInfo<UserAccountRecordVo>> page(@RequestBody UserAccountRecordSearch query) {
         query.setInOrOut(InOrOutEnum.IN);
-		IPage<UserAccountRecordVo> pages = userAccountRecordService.selectPage(PageUtil.getPage(query), query);
+        IPage<UserAccountRecordVo> pages = userAccountRecordService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
-	}
+    }
+
+    /**
+     * 查询导出
+     */
+    @PostMapping("/export")
+    @ApiOperation(value = "查询导出", notes = "传入orderSearch")
+    @PreAuthorize("@pcs.hasPermissions('userAccountRecord/export')")
+    public void export(@RequestBody UserAccountRecordSearch query) {
+        query.setInOrOut(InOrOutEnum.IN);
+        List<UserAccountRecordVo> userAccountRecordVos = userAccountRecordService.selectAll(query);
+
+        List<UserAccountRecordExport> list = new ArrayList<>();
+        userAccountRecordVos.forEach(o -> {
+            UserAccountRecordExport export = new UserAccountRecordExport();
+            BeanUtils.copyProperties(o, export);
+            if (null == export.getTransAmount()) {
+                export.setTransAmount(BigDecimal.ZERO);
+            }
+            list.add(export);
+        });
+        ExcelUtils.exportExcel(list, "老师收入列表数据" + System.currentTimeMillis(),
+                "老师收入列表数据");
+    }
 
     @ApiOperation(value = "收入数据统计")
     @PostMapping("/accountTotal")
@@ -61,4 +93,5 @@ public class UserAccountRecordController extends BaseController {
         return userAccountRecordService.accountTotal(query);
     }
 
+
 }

+ 13 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/UserOrderRefundController.java

@@ -73,4 +73,17 @@ public class UserOrderRefundController extends BaseController {
 		}
 		return userOrderRefundService.orderRefund(orderNo, reason);
 	}
+
+	@PostMapping("/orderRefundSuccessBizHandle")
+	@ApiOperation(value = "调用退款后处理业务逻辑", notes = "传入authOperaReq")
+	@PreAuthorize("@pcs.hasPermissions('userOrderRefunds/orderRefundSuccessBizHandle')")
+	public HttpResponseResult<UserOrderRefundBill> orderRefundSuccessBizHandle(Long refundId) throws Exception {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (user == null || null == user.getId()) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		userOrderRefundService.orderRefundSuccessBizHandle(refundId);
+		return HttpResponseResult.succeed();
+	}
+
 }

+ 16 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/UserOrderClient.java

@@ -29,6 +29,7 @@ import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -51,6 +52,9 @@ public class UserOrderClient extends BaseController {
     @Autowired
     private RedissonClient redissonClient;
 
+    @Value("${message.debugMode}")
+    private boolean debugMode;
+
     @ApiOperation(value = "查询付款单")
     @GetMapping("/queryPayment")
     public HttpResponseResult<Payment> queryPayment(String paymentNo) {
@@ -130,6 +134,9 @@ public class UserOrderClient extends BaseController {
      */
     @PostMapping("/testCallback")
     public void testCallback(@RequestBody PaymentCallBack data) {
+        if(!debugMode){
+            return;
+        }
         if (MethodNameEnum.executePayment.equals(data.getMethodName())) {
             //支付交易
             paymentService.executePaymentCallBack(data);
@@ -145,6 +152,9 @@ public class UserOrderClient extends BaseController {
     @GetMapping("/setSuccessStatus")
     @ApiOperation(value = "完成所有订单(测试用)")
     public HttpResponseResult<Boolean> setSuccessStatus() {
+        if(!debugMode){
+            return HttpResponseResult.failed("当前环境不允许调用");
+        }
         userOrderService.setSuccessStatus();
         return succeed(true);
     }
@@ -154,6 +164,9 @@ public class UserOrderClient extends BaseController {
     public HttpResponseResult<Boolean> setOrderStatus(
             @RequestParam("orderNo") String orderNo,
             @RequestParam("orderStatus") OrderStatusEnum orderStatus) {
+        if(!debugMode){
+            return HttpResponseResult.failed("当前环境不允许调用");
+        }
         userOrderService.setOrderStatus(orderNo, orderStatus);
         return succeed(true);
     }
@@ -162,6 +175,9 @@ public class UserOrderClient extends BaseController {
     @ApiOperation(value = "退款(测试用)")
     public HttpResponseResult<UserOrderRefundBill> orderRefound(
             @RequestParam("orderNo") String orderNo) {
+        if(!debugMode){
+            return HttpResponseResult.failed("当前环境不允许调用");
+        }
         return userOrderRefundService.orderRefound(orderNo);
     }
 

+ 42 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/AccountBizTypeEnumConvert.java

@@ -0,0 +1,42 @@
+package com.yonge.cooleshow.biz.dal.convert;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/15 15:36
+ */
+public class AccountBizTypeEnumConvert implements Converter<AccountBizTypeEnum> {
+
+    @Override
+    public Class supportJavaTypeKey() {
+        return CellDataTypeEnum.class;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return CellDataTypeEnum.STRING;
+    }
+
+    @Override
+    public AccountBizTypeEnum convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        try {
+            return AccountBizTypeEnum.valueOf(cellData.getStringValue());
+        }catch (Exception e){
+            return null;
+        }
+    }
+
+    @Override
+    public CellData convertToExcelData(AccountBizTypeEnum statusEnum, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        if(null != statusEnum){
+            return new CellData(statusEnum.getMsg());
+        }
+        return new CellData("异常数据");
+    }
+}

+ 43 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/InOrOutEnumConvert.java

@@ -0,0 +1,43 @@
+package com.yonge.cooleshow.biz.dal.convert;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.common.enums.PostStatusEnum;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/15 15:36
+ */
+public class InOrOutEnumConvert implements Converter<InOrOutEnum> {
+
+    @Override
+    public Class supportJavaTypeKey() {
+        return CellDataTypeEnum.class;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return CellDataTypeEnum.STRING;
+    }
+
+    @Override
+    public InOrOutEnum convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        try {
+            return InOrOutEnum.valueOf(cellData.getStringValue());
+        }catch (Exception e){
+            return null;
+        }
+    }
+
+    @Override
+    public CellData convertToExcelData(InOrOutEnum statusEnum, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        if(null != statusEnum){
+            return new CellData(statusEnum.getMsg());
+        }
+        return new CellData("异常数据");
+    }
+}

+ 42 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/convert/PostStatusConvert.java

@@ -0,0 +1,42 @@
+package com.yonge.cooleshow.biz.dal.convert;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+import com.yonge.cooleshow.common.enums.PostStatusEnum;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/15 15:36
+ */
+public class PostStatusConvert implements Converter<PostStatusEnum> {
+
+    @Override
+    public Class supportJavaTypeKey() {
+        return CellDataTypeEnum.class;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return CellDataTypeEnum.STRING;
+    }
+
+    @Override
+    public PostStatusEnum convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        try {
+            return PostStatusEnum.valueOf(cellData.getStringValue());
+        }catch (Exception e){
+            return null;
+        }
+    }
+
+    @Override
+    public CellData convertToExcelData(PostStatusEnum statusEnum, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        if(null != statusEnum){
+            return new CellData(statusEnum.getMsg());
+        }
+        return new CellData("异常数据");
+    }
+}

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/PlatformCashAccountRecordDao.java

@@ -25,6 +25,8 @@ public interface PlatformCashAccountRecordDao extends BaseMapper<PlatformCashAcc
 
     IPage<PlatformCashAccountRecord> queryPage(@Param("page") IPage<PlatformCashAccountRecord> page, @Param("param") PlatformCashAccountRecordSearch query);
 
+    List<PlatformCashAccountRecord> queryAll(@Param("param")PlatformCashAccountRecordSearch query);
+
     PlatformCashAccountRecordSummaryVo querySummary(@Param("param") PlatformCashAccountRecordSearch query);
 
     List<PlatformCashAccountRecord> queryCanAccountByBizType(@Param("bizTypes")List<String> bizTypes);
@@ -34,5 +36,6 @@ public interface PlatformCashAccountRecordDao extends BaseMapper<PlatformCashAcc
     Integer cancelRecord(@Param("orderNo")String orderNo,@Param("bizType") String bizType, @Param("bizId") Long bizId);
 
     Integer mallRecordedRecord(@Param("orderNo")String orderNo,@Param("bizType") String bizType, @Param("bizId") Long bizId);
+
 }
 

+ 4 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserAccountRecordDao.java

@@ -40,7 +40,7 @@ public interface UserAccountRecordDao extends BaseMapper<UserAccountRecord> {
      */
     List<UserAccountRecordVo> selectPage(@Param("page") IPage page, @Param("param") UserAccountRecordSearch userAccountRecord);
 
-    List<UserAccountRecordVo> selectAllPage(@Param("param") UserAccountRecordSearch userAccountRecord);
+    List<UserAccountRecordVo> selectAll(@Param("param") UserAccountRecordSearch userAccountRecord);
 
     List<UserAccountRecordVo> sharePage(@Param("page") IPage page, @Param("param") UserAccountRecordSearch userAccountRecord);
 
@@ -82,11 +82,12 @@ public interface UserAccountRecordDao extends BaseMapper<UserAccountRecord> {
     /**
      * 通过订单详情和业务id查询该详情对应的所有账户记录
      *
-     * @param param
+     * @param orderNo
+     * @param bizType
      * @param bizIds
      * @return
      */
-    List<UserAccountRecord> selectRecordByOrderDetail(@Param("param") UserOrderDetailVo param, @Param("bizIds") List<Long> bizIds);
+    List<UserAccountRecord> selectRecordByOrderDetail(@Param("orderNo") String orderNo,@Param("bizType")AccountBizTypeEnum bizType , @Param("bizIds") List<Long> bizIds);
 
     /**
      * 入账记录可以通过以下三个字段确定唯一

+ 89 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/PlatformCashAccountRecordExport.java

@@ -0,0 +1,89 @@
+package com.yonge.cooleshow.biz.dal.dto.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.yonge.cooleshow.biz.dal.convert.AccountBizTypeEnumConvert;
+import com.yonge.cooleshow.biz.dal.convert.InOrOutEnumConvert;
+import com.yonge.cooleshow.biz.dal.convert.PostStatusConvert;
+import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.common.enums.PostStatusEnum;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/15 17:32
+ */
+public class PlatformCashAccountRecordExport {
+    @ExcelProperty(value = "关联订单", index = 0)
+    private String orderNo;
+    @ExcelProperty(value = "金额", index = 1)
+    private BigDecimal transAmount;
+    @ExcelProperty(value = "产品编号", index = 2)
+    private Long bizId;
+    @ExcelProperty(value = "收支类型", index = 3, converter = InOrOutEnumConvert.class)
+    private InOrOutEnum inOrOut;
+    @ExcelProperty(value = "内容", index = 4, converter = AccountBizTypeEnumConvert.class)
+    private AccountBizTypeEnum bizType;
+    @ExcelProperty(value = "入账状态", index = 5, converter = PostStatusConvert.class)
+    private PostStatusEnum postStatus;
+    @ExcelProperty(value = "更新时间", index = 6)
+    private Date updateTime;
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public BigDecimal getTransAmount() {
+        return transAmount;
+    }
+
+    public void setTransAmount(BigDecimal transAmount) {
+        this.transAmount = transAmount;
+    }
+
+    public Long getBizId() {
+        return bizId;
+    }
+
+    public void setBizId(Long bizId) {
+        this.bizId = bizId;
+    }
+
+    public InOrOutEnum getInOrOut() {
+        return inOrOut;
+    }
+
+    public void setInOrOut(InOrOutEnum inOrOut) {
+        this.inOrOut = inOrOut;
+    }
+
+    public AccountBizTypeEnum getBizType() {
+        return bizType;
+    }
+
+    public void setBizType(AccountBizTypeEnum bizType) {
+        this.bizType = bizType;
+    }
+
+    public PostStatusEnum getPostStatus() {
+        return postStatus;
+    }
+
+    public void setPostStatus(PostStatusEnum postStatus) {
+        this.postStatus = postStatus;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 85 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/excel/UserAccountRecordExport.java

@@ -0,0 +1,85 @@
+package com.yonge.cooleshow.biz.dal.dto.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.yonge.cooleshow.biz.dal.convert.PostStatusConvert;
+import com.yonge.cooleshow.common.enums.PostStatusEnum;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/15 17:32
+ */
+public class UserAccountRecordExport {
+    @ExcelProperty(value = "关联订单", index = 0)
+    private String orderNo;
+    @ExcelProperty(value = "老师编号", index = 1)
+    private Long accountId;
+    @ExcelProperty(value = "老师姓名", index = 2)
+    private String accountName;
+    @ExcelProperty(value = "金额", index = 3)
+    private BigDecimal transAmount;
+    @ExcelProperty(value = "产品编号", index = 4)
+    private Long bizId;
+    @ExcelProperty(value = "入账状态", index = 5, converter = PostStatusConvert.class)
+    private PostStatusEnum postStatus;
+    @ExcelProperty(value = "更新时间", index = 6)
+    private Date updateTime;
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    public BigDecimal getTransAmount() {
+        return transAmount;
+    }
+
+    public void setTransAmount(BigDecimal transAmount) {
+        this.transAmount = transAmount;
+    }
+
+    public Long getBizId() {
+        return bizId;
+    }
+
+    public void setBizId(Long bizId) {
+        this.bizId = bizId;
+    }
+
+    public PostStatusEnum getPostStatus() {
+        return postStatus;
+    }
+
+    public void setPostStatus(PostStatusEnum postStatus) {
+        this.postStatus = postStatus;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/VideoLessonGroupSearch.java

@@ -51,6 +51,17 @@ public class VideoLessonGroupSearch extends QueryInfo {
         this.myself = myself;
     }
 
+    @ApiModelProperty("当前课程组id(查看其他课程时,筛选掉)")
+    private Long videoLessonGroupId;
+
+    public Long getVideoLessonGroupId() {
+        return videoLessonGroupId;
+    }
+
+    public void setVideoLessonGroupId(Long videoLessonGroupId) {
+        this.videoLessonGroupId = videoLessonGroupId;
+    }
+
     public Long getLessonSubject() {
         return lessonSubject;
     }

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java

@@ -20,6 +20,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     VIDEO_SHEET_AUTH_UNPASS("视频课审核失败"),
 
     STUDENT_BUY_MUSIC_SHEET_SUCCESS("学员购买乐谱成功"),
+    TEACHER_BUY_MUSIC_SHEET_SUCCESS("老师购买乐谱成功"),
     SMS_STUDENT_BUY_MUSIC_SHEET_SUCCESS("学员购买乐谱(短信)"),
 
     TEACHER_DECORATE_HOMEWORK("老师布置作业"),

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/PlatformCashAccountRecordService.java

@@ -9,6 +9,8 @@ import com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo;
 
+import java.util.List;
+
 /**
  * 平台账户流水表(PlatformCashAccountRecord)表服务接口
  *
@@ -20,7 +22,9 @@ public interface PlatformCashAccountRecordService extends IService<PlatformCashA
     PlatformCashAccountRecordDao getDao();
     
     IPage<PlatformCashAccountRecord> queryPage(IPage<PlatformCashAccountRecord> page, PlatformCashAccountRecordSearch query);
-    
+
+    List<PlatformCashAccountRecord> queryAll(PlatformCashAccountRecordSearch query);
+
     PlatformCashAccountRecordSummaryVo querySummary(PlatformCashAccountRecordSearch query);
     
     /**

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserAccountRecordService.java

@@ -40,7 +40,7 @@ public interface UserAccountRecordService extends IService<UserAccountRecord> {
      */
     IPage<UserAccountRecordVo> selectPage(IPage<UserAccountRecordVo> page, UserAccountRecordSearch query);
 
-    List<UserAccountRecordVo> selectAllPage(UserAccountRecordSearch query);
+    List<UserAccountRecordVo> selectAll(UserAccountRecordSearch query);
 
 
     /**

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderRefundService.java

@@ -82,4 +82,6 @@ public interface UserOrderRefundService extends IService<UserOrderRefund>  {
 	 * @param orderNo
 	 */
 	HttpResponseResult<UserOrderRefundBill> orderRefound(String orderNo);
+
+	void orderRefundSuccessBizHandle(Long refundId);
 }

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderService.java

@@ -7,6 +7,7 @@ import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.entity.UserOrder;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch;
 import com.yonge.cooleshow.biz.dal.vo.res.OrderPayRes;
@@ -14,6 +15,7 @@ import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.payment.base.model.callback.PaymentCallBack;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -165,5 +167,7 @@ public interface UserOrderService extends IService<UserOrder> {
     void orderSuccess(UserOrderVo detail, PaymentCallBack data);
 
 
+    Date getAccountPeriodTime(UserOrderDetailVo orderDetailVo);
+
     public BigDecimal getShareFreeByGoodType(GoodTypeEnum goodType);
 }

+ 4 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -809,11 +809,14 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
 
     //写入老师账户
     private void addTeacherAccount(UserOrderDetailVo orderParam, List<CourseScheduleTeacherSalary> teacherSalaryList, BigDecimal totalExpectPrice) {
+        //获取账期时间
+        Date accountPeriodTime = userOrderService.getAccountPeriodTime(orderParam);
+
         //老师待入账
         List<UserAccountRecordDto> userAccountRecordDtos = new ArrayList<>();
         for (CourseScheduleTeacherSalary salary : teacherSalaryList) {
             UserAccountRecordDto dto = new UserAccountRecordDto(orderParam.getMerchId(), PostStatusEnum.WAIT, salary.getActualSalary(),
-                    InOrOutEnum.IN, AccountBizTypeEnum.LIVE, salary.getCourseScheduleId(), orderParam.getGoodName(), orderParam.getOrderNo(), orderParam.getUserId());
+                    InOrOutEnum.IN, AccountBizTypeEnum.LIVE, salary.getCourseScheduleId(), orderParam.getGoodName(), orderParam.getOrderNo(), orderParam.getUserId(),accountPeriodTime);
             userAccountRecordDtos.add(dto);
         }
         userAccountService.accountRecord(userAccountRecordDtos);

+ 6 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -117,6 +117,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     private UserAccountService userAccountService;
     @Autowired
     private UserAccountRecordService userAccountRecordService;
+    @Autowired
+    private UserOrderService userOrderService;
 
     @Override
     public CourseScheduleDao getDao() {
@@ -1143,11 +1145,14 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
     //写入老师账户
     private void addTeacherAccount(UserOrderDetailVo orderParam, List<CourseScheduleTeacherSalary> teacherSalaryList) {
+        //获取账期时间
+        Date accountPeriodTime = userOrderService.getAccountPeriodTime(orderParam);
+
         //老师待入账
         List<UserAccountRecordDto> userAccountRecordDtos = new ArrayList<>();
         for (CourseScheduleTeacherSalary salary : teacherSalaryList) {
             UserAccountRecordDto dto = new UserAccountRecordDto(orderParam.getMerchId(), PostStatusEnum.WAIT, salary.getActualSalary(),
-                    InOrOutEnum.IN, AccountBizTypeEnum.PRACTICE, salary.getCourseScheduleId(), orderParam.getGoodName(), orderParam.getOrderNo(), orderParam.getUserId());
+                    InOrOutEnum.IN, AccountBizTypeEnum.PRACTICE, salary.getCourseScheduleId(), orderParam.getGoodName(), orderParam.getOrderNo(), orderParam.getUserId(), accountPeriodTime);
             userAccountRecordDtos.add(dto);
         }
         userAccountService.accountRecord(userAccountRecordDtos);

+ 36 - 23
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -102,6 +102,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     @Autowired
     private StudentStarService studentStarService;
+    @Autowired
+    private UserOrderService userOrderService;
 
     public MusicSheetDao getDao() {
         return musicSheetDao;
@@ -179,7 +181,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     }
 
     @Override
-    public MusicSheetDetailVo detail(Long id, SysUser sysUser,ClientEnum userType) {
+    public MusicSheetDetailVo detail(Long id, SysUser sysUser, ClientEnum userType) {
         MusicSheetDetailVo detail = baseMapper.detail(id);
         if (detail == null) {
             throw new BizException("未找到曲目信息");
@@ -193,13 +195,13 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         }
         if (ChargeTypeEnum.FREE.getCode().equals(detail.getChargeType().getCode())) {
             detail.setPlay(YesOrNoEnum.YES);
-        }  else if (ClientEnum.STUDENT.getCode().equals(userType.getCode())
+        } else if (ClientEnum.STUDENT.getCode().equals(userType.getCode())
                 || ClientEnum.TEACHER.getCode().equals(userType.getCode())) {
             // 2022 7 20  老师也能购买曲目
             if (ClientEnum.TEACHER.getCode().equals(userType.getCode()) && detail.getUserId().equals(sysUser.getId())) {
                 detail.setPlay(YesOrNoEnum.YES);
             } else {
-                setMusicSheetPlay(sysUser.getId(), detail,userType);
+                setMusicSheetPlay(sysUser.getId(), detail, userType);
             }
         } else {
             detail.setPlay(YesOrNoEnum.YES);
@@ -213,11 +215,12 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     /**
      * 设置学生曲目信息
-     *
+     * <p>
      * 2022 7 20  老师也能购买曲目
-     *  @param studentId 学生id
-     * @param detail 曲目详情
-     * @param userType 用户类型
+     *
+     * @param studentId 学生id
+     * @param detail    曲目详情
+     * @param userType  用户类型
      */
     private void setMusicSheetPlay(Long studentId, MusicSheetDetailVo detail, ClientEnum userType) {
         detail.setPlay(YesOrNoEnum.NO);
@@ -225,7 +228,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         if (ChargeTypeEnum.CHARGE.getCode().equals(detail.getChargeType().getCode())) {
             // 学生须判断是否能播放曲目
             MusicSheetPurchaseRecord musicSheetPurchaseRecord = musicSheetPurchaseRecordService.checkPurchase(
-                    studentId, detail.getId(),userType);
+                    studentId, detail.getId(), userType);
             if (musicSheetPurchaseRecord != null) {
                 detail.setOrderStatus(musicSheetPurchaseRecord.getOrderStatus());
                 detail.setOrderNo(musicSheetPurchaseRecord.getOrderNo());
@@ -241,7 +244,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                     detail.setPlay(YesOrNoEnum.YES);
                 }
             } else if (userType.equals(ClientEnum.TEACHER)) {
-                TeacherVo teacher= teacherService.detail(studentId);
+                TeacherVo teacher = teacherService.detail(studentId);
                 if (teacher != null && YesOrNoEnum.YES.getCode().equals(teacher.getIsVip().getCode())) {
                     detail.setPlay(YesOrNoEnum.YES);
                 }
@@ -477,7 +480,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         }
 
         // 检查已经购买
-        checkoutPay(orderReqInfo.getUserId(), musicSheetPayDto.getMusicSheetId(),musicSheetPayDto.getClientType());
+        checkoutPay(orderReqInfo.getUserId(), musicSheetPayDto.getMusicSheetId(), musicSheetPayDto.getClientType());
 
         orderCreateRes.setRes(true);
         if (!musicSheet.getSourceType().getCode().equals(SourceTypeEnum.PLATFORM.getCode())) {
@@ -494,7 +497,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     /**
      * 检查是否已购买当前曲目
-     *  @param userId       用户id
+     *
+     * @param userId       用户id
      * @param musicSheetId 曲目id
      * @param clientType
      */
@@ -534,7 +538,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
         // 消息通知
         try {
-            sendBuyMessage(userOrderDetailVo.getMerchId(), userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(),userOrderDetailVo.getOrderClient());
+            sendBuyMessage(userOrderDetailVo.getMerchId(), userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(), userOrderDetailVo.getOrderClient());
         } catch (Exception e) {
             log.warn("购买曲目消息推送失败 {}", e.getMessage());
         }
@@ -542,7 +546,8 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     /**
      * 发送购买消息通知
-     *  @param teacherId    老师id
+     *
+     * @param teacherId    老师id
      * @param studentId    学生id
      * @param musicSheetId 曲目id
      * @param orderClient
@@ -568,12 +573,17 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         // 推送学生
         Map<Long, String> studentReceivers = new HashMap<>();
         studentReceivers.put(studentId, student.getPhone());
+        MessageTypeEnum messageType;
+        if (orderClient.equals(ClientEnum.STUDENT)) {
+            messageType = MessageTypeEnum.STUDENT_BUY_MUSIC_SHEET_SUCCESS;
+        } else {
+            messageType = MessageTypeEnum.TEACHER_BUY_MUSIC_SHEET_SUCCESS;
+        }
 
-
-        String url = sysMessageService.selectConfigUrl(MessageTypeEnum.STUDENT_BUY_MUSIC_SHEET_SUCCESS.getCode());
+        String url = sysMessageService.selectConfigUrl(messageType.getCode());
 
         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
-                MessageTypeEnum.STUDENT_BUY_MUSIC_SHEET_SUCCESS, studentReceivers, null,
+                                           messageType, studentReceivers, null,
                 0, url, orderClient.getCode(), musicSheet.getMusicSheetName());
         // 推送学生
         Map<Long, String> studentSMS = new HashMap<>();
@@ -595,7 +605,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
      */
     private void addMusicSheetPurchaseRecord(UserOrderDetailVo userOrderDetailVo, BigDecimal actualPrice, BigDecimal serviceFeeAmount) {
         MusicSheetPurchaseRecord musicSheetPurchaseRecord = musicSheetPurchaseRecordService
-                .checkPurchase(userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(),userOrderDetailVo.getOrderClient());
+                .checkPurchase(userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(), userOrderDetailVo.getOrderClient());
         if (musicSheetPurchaseRecord == null) {
             musicSheetPurchaseRecord = new MusicSheetPurchaseRecord();
         }
@@ -622,11 +632,14 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
      */
     private void addTeacherAccount(UserOrderDetailVo userOrderDetailVo, BigDecimal actualPrice, BigDecimal serviceFeeAmount,
                                    Long musicSheetId) {
+        //获取账期时间
+        Date accountPeriodTime = userOrderService.getAccountPeriodTime(userOrderDetailVo);
+
         BigDecimal transAmount = actualPrice.subtract(serviceFeeAmount).setScale(2, RoundingMode.HALF_UP);
         //插入老师账户变更记录-老师预收
         userAccountService.accountRecord(
                 new UserAccountRecordDto(userOrderDetailVo.getMerchId(), PostStatusEnum.WAIT, transAmount, InOrOutEnum.IN,
-                        AccountBizTypeEnum.MUSIC, musicSheetId, userOrderDetailVo.getGoodName(), userOrderDetailVo.getOrderNo(),userOrderDetailVo.getUserId()));
+                        AccountBizTypeEnum.MUSIC, musicSheetId, userOrderDetailVo.getGoodName(), userOrderDetailVo.getOrderNo(), userOrderDetailVo.getUserId(), accountPeriodTime));
     }
 
     @Override
@@ -634,7 +647,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     public void orderAfterSheet(UserOrderDetailVo userOrderDetailVo) {
         // 保存购买记录
         MusicSheetPurchaseRecord musicSheetPurchaseRecord = musicSheetPurchaseRecordService
-                .checkPurchase(userOrderDetailVo.getUserId(),userOrderDetailVo.getBizId(),userOrderDetailVo.getOrderClient());
+                .checkPurchase(userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(), userOrderDetailVo.getOrderClient());
         if (musicSheetPurchaseRecord == null) {
             musicSheetPurchaseRecord = new MusicSheetPurchaseRecord();
         }
@@ -652,7 +665,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     @Transactional(rollbackFor = Exception.class)
     public void buyMusicSheetCancel(UserOrderDetailVo userOrderDetailVo) {
         MusicSheetPurchaseRecord musicSheetPurchaseRecord = musicSheetPurchaseRecordService
-                .checkPurchase(userOrderDetailVo.getUserId(),userOrderDetailVo.getBizId(),userOrderDetailVo.getOrderClient());
+                .checkPurchase(userOrderDetailVo.getUserId(), userOrderDetailVo.getBizId(), userOrderDetailVo.getOrderClient());
 
         if (musicSheetPurchaseRecord == null) return;
         musicSheetPurchaseRecordService.removeById(musicSheetPurchaseRecord.getId());
@@ -852,15 +865,15 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     @Override
     public ShareProfitVo shareMusicSheetProfit(SysUser sysUser, Long musicSheetId) {
         ShareProfitVo result = new ShareProfitVo();
-        MusicSheetDetailVo musicSheet = detail(musicSheetId,null,null);
+        MusicSheetDetailVo musicSheet = detail(musicSheetId, null, null);
 
         result.setTeacherId(sysUser.getId());
         result.setType("MUSIC");
         result.setMusicSheet(musicSheet);
         result.setAvatar(sysUser.getAvatar());
         result.setName(sysUser.getUsername());
-        String teacherMusicShareProfitUrl= sysConfigService.findConfigValue(SysConfigConstant.TEACHER_MUSIC_SHEET_SHARE_PROFIT_URL);
-        result.setUrl(MessageFormatter.arrayFormat(teacherMusicShareProfitUrl,musicSheetId, sysUser.getId()));
+        String teacherMusicShareProfitUrl = sysConfigService.findConfigValue(SysConfigConstant.TEACHER_MUSIC_SHEET_SHARE_PROFIT_URL);
+        result.setUrl(MessageFormatter.arrayFormat(teacherMusicShareProfitUrl, musicSheetId, sysUser.getId()));
         return result;
     }
 

+ 5 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/PlatformCashAccountRecordServiceImpl.java

@@ -3,11 +3,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 import com.yonge.toolset.base.util.StringUtil;
 import org.slf4j.Logger;
@@ -21,12 +17,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dao.PlatformCashAccountRecordDao;
 import com.yonge.cooleshow.biz.dal.dto.search.PlatformCashAccountRecordSearch;
 import com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord;
-import com.yonge.cooleshow.biz.dal.entity.SysConfig;
 import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.PlatformCashAccountRecordService;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo;
-import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.common.enums.PostStatusEnum;
 import org.springframework.util.CollectionUtils;
 
@@ -57,6 +51,11 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
     }
 
     @Override
+    public List<PlatformCashAccountRecord> queryAll(PlatformCashAccountRecordSearch query) {
+        return getDao().queryAll(query);
+    }
+
+    @Override
     public PlatformCashAccountRecordSummaryVo querySummary(PlatformCashAccountRecordSearch query) {
         return getDao().querySummary(query);
     }

+ 27 - 16
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountRecordServiceImpl.java

@@ -31,10 +31,7 @@ import org.springframework.util.CollectionUtils;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 
 @Service
@@ -69,8 +66,8 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
     }
 
     @Override
-    public List<UserAccountRecordVo> selectAllPage(UserAccountRecordSearch query) {
-        return baseMapper.selectAllPage(query);
+    public List<UserAccountRecordVo> selectAll(UserAccountRecordSearch query) {
+        return baseMapper.selectAll(query);
     }
 
     @Override
@@ -149,26 +146,40 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
 
     @Override
     public List<UserAccountRecord> selectRecordByOrderDetail(UserOrderDetailVo userOrderDetailVo) {
+        List<UserAccountRecord> records = new ArrayList<>();
         //订单类型: 学生端( VIP、开通会员  PRACTICE、陪练课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ) 老师端(VIP、开通会员 PINAO_ROOM、琴房时长)
         //获取业务id
         List<Long> bizIds = new ArrayList<>();
-        if (GoodTypeEnum.VIP.equals(userOrderDetailVo.getGoodType())
-                || GoodTypeEnum.VIDEO.equals(userOrderDetailVo.getGoodType())
-                || GoodTypeEnum.MUSIC.equals(userOrderDetailVo.getGoodType())) {
+        if (GoodTypeEnum.VIP.equals(userOrderDetailVo.getGoodType())){
             bizIds.add(userOrderDetailVo.getBizId());
-        } else if (GoodTypeEnum.PRACTICE.equals(userOrderDetailVo.getGoodType()) || GoodTypeEnum.LIVE.equals(userOrderDetailVo.getGoodType())) {
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIP, bizIds));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIP_SHARE, bizIds));
+        }else if(GoodTypeEnum.VIDEO.equals(userOrderDetailVo.getGoodType())){
+            bizIds.add(userOrderDetailVo.getBizId());
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIDEO, bizIds));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIDEO_SHARE, bizIds));
+        }else if(GoodTypeEnum.MUSIC.equals(userOrderDetailVo.getGoodType())){
+            bizIds.add(userOrderDetailVo.getBizId());
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.MUSIC, bizIds));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.MUSIC_SHARE, bizIds));
+        }else if(GoodTypeEnum.PRACTICE.equals(userOrderDetailVo.getGoodType())){
             //查询课程组下所有课程id
             List<CourseSchedule> cancel = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
                     .eq(CourseSchedule::getCourseGroupId, userOrderDetailVo.getBizId())
-                    .ne(CourseSchedule::getStatus, "CANCEL")
             );
             cancel.stream().forEach(o -> bizIds.add(o.getId()));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.PRACTICE, bizIds));
+        }else if(GoodTypeEnum.LIVE.equals(userOrderDetailVo.getGoodType())){
+            List<Long> groupId = Arrays.asList(userOrderDetailVo.getBizId());
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.LIVE_SHARE, groupId));
+            //查询课程组下所有课程id
+            List<CourseSchedule> cancel = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
+                    .eq(CourseSchedule::getCourseGroupId, userOrderDetailVo.getBizId())
+            );
+            cancel.stream().forEach(o -> bizIds.add(o.getId()));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.LIVE, bizIds));
         }
-        if (CollectionUtils.isEmpty(bizIds)) {
-            return new ArrayList<>();
-        }
-        return baseMapper.selectRecordByOrderDetail(userOrderDetailVo, bizIds);
+        return records;
     }
 
-
 }

+ 1 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java

@@ -295,7 +295,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
             info.setVideoShareAmount(null == info.getVideoShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
             info.setMusicShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMusicShareAmount());
             info.setVipShareAmount(null == info.getVipShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
-            info.setMallShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMusicShareAmount());
+            info.setMallShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMallShareAmount());
 
             practiceAmount = practiceAmount.add(info.getPracticeAmount());
             liveAmount = liveAmount.add(info.getLiveAmount());
@@ -410,7 +410,6 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
     }
 
     public void mallTeacherRecordState(MallOrderItemDto shareDto) {
-
         // 平台修改收入状态
         if (shareDto.getStatus().equals(PostStatusEnum.RECORDED)) {
             platformCashAccountRecordService.mallRecordedRecord(shareDto.getProductSkuId(),shareDto.getOrderSn(),GoodTypeEnum.MALL.getCode());

+ 4 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundServiceImpl.java

@@ -12,7 +12,6 @@ import com.yonge.cooleshow.biz.dal.dto.req.OrderRefundReq;
 import com.yonge.cooleshow.biz.dal.dto.search.OrderDetailSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
-import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
@@ -512,7 +511,7 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
 
 
     @Transactional(rollbackFor = Exception.class)
-    HttpResponseResult<UserOrderRefundBill> doOrderRefundTest(UserOrderRefund orderRefund) {
+    public HttpResponseResult<UserOrderRefundBill> doOrderRefundTest(UserOrderRefund orderRefund) {
         UserOrderPayment payment = orderPaymentService.getOne(Wrappers.<UserOrderPayment>lambdaQuery()
                 .eq(UserOrderPayment::getOrderNo, orderRefund.getOrderNo())
                 .eq(UserOrderPayment::getStatus, TradeStatusEnum.succeeded)
@@ -600,10 +599,11 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
      *
      * @param refundId 退款单id
      */
-    private void orderRefundSuccessBizHandle(Long refundId) {
+    @Override
+    public void orderRefundSuccessBizHandle(Long refundId) {
         //处理业务
         UserOrderRefund orderRefund = getById(refundId);
-        if (StringUtil.isEmpty(orderRefund.getOredrDetilIds())) {
+        if (!StringUtil.isEmpty(orderRefund.getOredrDetilIds())) {
             List<Long> ids = new ArrayList<>();
             for (String id : orderRefund.getOredrDetilIds().split(",")) {
                 ids.add(Long.parseLong(id));

+ 4 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -306,7 +306,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
             orderDetailVo.setUserId(orderReq.getUserId());
             orderDetailVo.setOrderId(orderVo.getId());
             orderDetailVo.setRecomUserId(orderReq.getRecomUserId());
-
+            orderDetailVo.setOrderClient(orderVo.getOrderClient());
             Consumer<UserOrderDetailVo> afterFunction = orderAfter.get(orderDetailVo.getGoodType());
             if (!Objects.isNull(afterFunction)) {
                 afterFunction.accept(orderDetailVo);
@@ -822,7 +822,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
 
         //卖家不能分润自己
         if (null != orderDetailVo.getRecomUserId()
-                && orderDetailVo.getRecomUserId().equals(orderDetailVo.getMerchId())) {
+                && !orderDetailVo.getRecomUserId().equals(orderDetailVo.getMerchId())) {
             //获取分润收益费率
             BigDecimal shareFeeRate = getShareFreeByGoodType(orderDetailVo.getGoodType());
             //入老师账户
@@ -851,7 +851,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
      * @param orderDetailVo
      * @return
      */
-    private Date getAccountPeriodTime(UserOrderDetailVo orderDetailVo) {
+    @Override
+    public Date getAccountPeriodTime(UserOrderDetailVo orderDetailVo) {
         Calendar instance = Calendar.getInstance();
         GoodTypeEnum goodType = orderDetailVo.getGoodType();
 

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupServiceImpl.java

@@ -91,7 +91,8 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
 
     public List<VideoLessonGroupVo> selectPage(VideoLessonGroupSearch query) {
         List<VideoLessonGroupVo> list = baseMapper.selectPage(null, query);
-        List<VideoLessonGroupVo> collect = list.stream().sorted(Comparator.comparing(VideoLessonGroupVo::getCountStudent, Comparator.reverseOrder())).limit(2).collect(Collectors.toList());
+        List<VideoLessonGroupVo> collect = list.stream().filter(videoLessonGroupVo -> !videoLessonGroupVo.getId().equals(query.getVideoLessonGroupId()))
+                                               .sorted(Comparator.comparing(VideoLessonGroupVo::getCountStudent, Comparator.reverseOrder())).limit(2).collect(Collectors.toList());
         return collect;
     }
 

+ 6 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonPurchaseRecordServiceImpl.java

@@ -12,10 +12,7 @@ import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.dao.VideoLessonPurchaseRecordDao;
 import com.yonge.cooleshow.biz.dal.enums.*;
-import com.yonge.cooleshow.biz.dal.service.SysConfigService;
-import com.yonge.cooleshow.biz.dal.service.SysMessageService;
-import com.yonge.cooleshow.biz.dal.service.UserAccountService;
-import com.yonge.cooleshow.biz.dal.service.VideoLessonPurchaseRecordService;
+import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
@@ -61,6 +58,8 @@ public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLesso
     private UserOrderDao userOrderDao;
     @Autowired
     private SysMessageService sysMessageService;
+    @Autowired
+    private UserOrderService userOrderService;
 
     public VideoLessonPurchaseRecordDao getDao() {
         return videoLessonPurchaseRecordDao;
@@ -157,9 +156,9 @@ public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLesso
      * @param lessonGroup
      */
     private void addTeacherAccount(UserOrderDetailVo userOrderDetailVo, VideoLessonGroup lessonGroup) {
-        if(null == userOrderDetailVo.getMerchId()){
+        //获取账期时间
+        Date accountPeriodTime = userOrderService.getAccountPeriodTime(userOrderDetailVo);
 
-        }
         //查询视频课服务费
         BigDecimal liveServiceRate = new BigDecimal(sysConfigService.findConfigValue(SysConfigConstant.VIDEO_LESSON_SERVICE_FEE))
                 .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
@@ -173,7 +172,7 @@ public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLesso
         //插入老师账户变更记录-老师预收
         userAccountService.accountRecord(
                 new UserAccountRecordDto(userOrderDetailVo.getMerchId(), PostStatusEnum.WAIT, transAmount, InOrOutEnum.IN,
-                        AccountBizTypeEnum.VIDEO, lessonGroup.getId(), lessonGroup.getLessonName(), userOrderDetailVo.getOrderNo(),userOrderDetailVo.getUserId()));
+                        AccountBizTypeEnum.VIDEO, lessonGroup.getId(), lessonGroup.getLessonName(), userOrderDetailVo.getOrderNo(), userOrderDetailVo.getUserId(), accountPeriodTime));
     }
 
     /**

+ 12 - 5
cooleshow-user/user-biz/src/main/resources/config/mybatis/PlatformCashAccountRecordMapper.xml

@@ -69,8 +69,8 @@
         </foreach>
     </update>
 
-	<select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
-    	select * from platform_cash_account_record
+	<sql id="selectSql">
+		select * from platform_cash_account_record
 		<where>
 			<if test="param.orderNo">
 				and order_no_ = #{param.orderNo}
@@ -94,9 +94,16 @@
 				and update_time_ &lt;= #{param.endDate}
 			</if>
 		</where>
+	</sql>
+	<select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
+		<include refid="selectSql"/>
     </select>
-    
-    <select id="querySummary" resultType="com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo">
+
+	<select id="queryAll" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
+		<include refid="selectSql"/>
+	</select>
+
+	<select id="querySummary" resultType="com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo">
 		select
 			sum(case when in_or_out_ = 'IN' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancesReceived,
 			sum(case when in_or_out_ = 'IN' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledReceived,
@@ -144,7 +151,7 @@
 		</foreach>
 	</select>
 
-	<update id="cancelRecord">
+    <update id="cancelRecord">
 		update platform_cash_account_record set post_status_ = 'CANCEL'
 		where post_status_ = 'WAIT' and order_no_ = #{orderNo} and biz_id_ = #{bizId}
 		and biz_type_ = #{bizType}

+ 7 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountMapper.xml

@@ -81,6 +81,8 @@
             (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
                 and a.post_status_ = 'WAIT' and a.in_or_out_ = 'IN') as amountUnrecorded,
             (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
+                and a.post_status_ = 'RECORDED' and a.in_or_out_ = 'IN') as amountRecorded,
+            (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
                 and a.post_status_ = 'RECORDED' and a.in_or_out_ = 'IN'
                 and a.biz_type_ in ('LIVE_SHARE','VIDEO_SHARE','MUSIC_SHARE','VIP_SHARE','MALL_SHARE')) as amountShare
         FROM user_cash_account t
@@ -125,6 +127,8 @@
                 sum(if(t.biz_type_ = 'MALL_SHARE',t.trans_amount_,0)) as mallShareAmount
         from user_cash_account_record t
             <where>
+                and t.post_status_ = 'RECORDED'
+                and t.in_or_out_ = 'IN' and t.err_flag_ != 1
                 <if test="param.startTime !=null">
                     <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
                 </if>
@@ -156,7 +160,7 @@
 
     <select id="totalTransAmountByOrderNo" resultType="java.math.BigDecimal">
         select sum(trans_amount_) from user_cash_account_record
-        where post_status_ in ('WAIT','FROZEN','RECORDED') and in_or_out_ = 'IN' and err_flag_ = 0
+        where post_status_ in ('WAIT','FROZEN','RECORDED') and in_or_out_ = 'IN' and err_flag_ != 1
             and order_no_ = #{orderNo}
     </select>
 
@@ -168,7 +172,8 @@
             sum(if(t.post_status_ = 'CANCEL',t.trans_amount_,0)) as cancelAmount,
             count(distinct t.buy_user_) as studentNum
         from user_cash_account_record t
-        where t.account_id_ = #{param.userId}
+        where t.in_or_out_ = 'IN' and t.err_flag_ != 1
+          and t.account_id_ = #{param.userId}
           and t.biz_type_ in ('LIVE_SHARE','VIDEO_SHARE','MUSIC_SHARE','VIP_SHARE','MALL_SHARE')
     </select>
 </mapper>

+ 8 - 23
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountRecordMapper.xml

@@ -99,7 +99,7 @@
         <include refid="selectSql"/>
     </select>
 
-    <select id="selectAllPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo">
+    <select id="selectAll" resultType="com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo">
         <include refid="selectSql"/>
     </select>
 
@@ -285,28 +285,13 @@
         SELECT
             <include refid="baseColumns"/>
         FROM user_cash_account_record t
-        where t.order_no_ = #{param.orderNo}
-        <if test="null != param.goodType">
-            <if test="param.goodType.code == 'VIP'">
-                and t.biz_type_ = 'VIP_SHARE'
-            </if>
-            <if test="param.goodType.code == 'PRACTICE'">
-                and t.biz_type_ = 'PRACTICE'
-            </if>
-            <if test="param.goodType.code == 'LIVE'">
-                and t.biz_type_ in ('LIVE','LIVE_SHARE')
-            </if>
-            <if test="param.goodType.code == 'VIDEO'">
-                and t.biz_type_ in ('VIDEO','VIDEO_SHARE')
-            </if>
-            <if test="param.goodType.code == 'MUSIC'">
-                and t.biz_type_ in ('MUSIC','MUSIC_SHARE')
-            </if>
-        </if>
-        and t.biz_id_ IN
-        <foreach collection="bizIds" item="item" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+        where t.post_status_ = 'WAIT'
+          and t.order_no_ = #{orderNo}
+            and t.biz_type_ = #{bizType}
+            and t.biz_id_ IN
+            <foreach collection="bizIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
     </select>
 
     <select id="detailByBiz" resultType="com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo">

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderDetailMapper.xml

@@ -77,7 +77,7 @@
         left join user_order o on t.order_no_ = o.order_no_
         <where>
             <if test="param.orderNo != null and param.orderNo != ''">
-                AND t.order_no_ = #{orderNo}
+                AND t.order_no_ = #{param.orderNo}
             </if>
             <if test="param.ids != null and param.ids.size()>0">
                 AND t.id_ IN

+ 15 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java

@@ -120,6 +120,21 @@ public class UserAccountController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         query.setUserId(user.getId());
+        if (StringUtil.isEmpty(query.getSearchDate())) {
+            query.setSearchDate(DateUtil.format(new Date(), "yyyy-MM"));
+        }
+        String[] classDateSp = query.getSearchDate().split("-");
+        try {
+            LocalDate date = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+
+            LocalDateTime firstDay = LocalDateTime.of(date.with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+            LocalDateTime lastDay = LocalDateTime.of(date.with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+
+            query.setStartTime(firstDay);
+            query.setEndTime(lastDay);
+        } catch (Exception e) {
+            throw new BizException("查询时间格式不正确 [" + query.getSearchDate() + "]");
+        }
         IPage<UserAccountRecordVo> pages = userAccountRecordService.sharePage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
     }

+ 25 - 0
cooleshow-user/user-website/src/main/java/com/yonge/cooleshow/website/controller/open/OpenSubjectController.java

@@ -1,19 +1,24 @@
 package com.yonge.cooleshow.website.controller.open;
 
 import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.queryInfo.SubjectQueryInfo;
 import com.yonge.cooleshow.biz.dal.service.SubjectService;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.base.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RequestMapping("/open/subject")
 @Api(tags = "声部服务")
@@ -35,4 +40,24 @@ public class OpenSubjectController extends BaseController {
         return succeed(subjectSelect);
     }
 
+    @ApiOperation(value = "分页查询声部列表")
+    @GetMapping("/queryPage")
+    public HttpResponseResult<PageInfo<Subject>> queryPage(SubjectQueryInfo queryInfo) {
+        PageInfo<Subject> pageInfo = subjectService.queryPage(queryInfo);
+
+        if(pageInfo.getRows().size() == 0){
+            return succeed(pageInfo);
+        }
+
+        Map<Long, Subject> map = subjectService.findBySubjectByIdList(pageInfo.getRows().stream().map(t -> t.getParentSubjectId()).collect(
+                                                       Collectors.toList())).stream()
+                                               .collect(Collectors.toMap(Subject::getId, t -> t));
+
+        pageInfo.getRows().forEach(row -> {
+            if(row.getParentSubjectId() != null && row.getParentSubjectId() > 0) {
+                row.setParentSubjectName(map.get(row.getParentSubjectId()).getName());
+            }
+        });
+        return succeed(pageInfo);
+    }
 }