瀏覽代碼

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

liujunchi 3 年之前
父節點
當前提交
08442af80b
共有 31 個文件被更改,包括 526 次插入47 次删除
  1. 1 0
      cooleshow-auth/auth-server/pom.xml
  2. 2 1
      cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysRoleMapper.xml
  3. 3 8
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/HomeController.java
  4. 3 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/HomeDao.java
  5. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherFreeTimeDao.java
  6. 3 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonPurchaseRecordDao.java
  7. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PracticeTimesSetting.java
  8. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TotalReq.java
  9. 11 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/UserAccountRecordSearch.java
  10. 0 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonPurchaseRecord.java
  11. 3 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/HomeService.java
  12. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserAccountService.java
  13. 10 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/VideoLessonPurchaseRecordService.java
  14. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  15. 3 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/HomeServiceImpl.java
  16. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java
  17. 27 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java
  18. 4 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  19. 117 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonPurchaseRecordServiceImpl.java
  20. 20 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomePage.java
  21. 11 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserAccountRecordVo.java
  22. 96 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/AccountTotal.java
  23. 0 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/OrderCreateRes.java
  24. 59 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/TotalInfoData.java
  25. 5 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  26. 4 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherAuthEntryRecordMapper.xml
  27. 18 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherFreeTimeMapper.xml
  28. 2 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountRecordMapper.xml
  29. 3 3
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderMapper.xml
  30. 3 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonPurchaseRecordMapper.xml
  31. 91 0
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java

+ 1 - 0
cooleshow-auth/auth-server/pom.xml

@@ -83,6 +83,7 @@
 			<groupId>com.yonge.toolset</groupId>
 			<artifactId>thirdparty-component</artifactId>
         </dependency>
+
         <dependency>
             <groupId>cn.rongcloud.im</groupId>
             <artifactId>server-sdk-java</artifactId>

+ 2 - 1
cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysRoleMapper.xml

@@ -90,7 +90,8 @@
 	</select>
 
     <select id="findRoleByUserId" resultMap="SysRole">
-		SELECT sr.* FROM sys_user_role sur LEFT JOIN sys_role sr ON sur.role_id_ = sr.id_ WHERE sur.user_id_ = #{userId} and sr.is_enable_ = 1 AND sr.del_flag_ = 0
+		SELECT sr.* FROM sys_user_role sur LEFT JOIN sys_role sr ON sur.role_id_ = sr.id_
+		WHERE sur.user_id_ = #{userId} and sr.is_enable_ = 1 AND sr.del_flag_ = 0
 	</select>
 
     <select id="findRoleByCode" resultMap="SysRole">

+ 3 - 8
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/HomeController.java

@@ -1,11 +1,7 @@
 package com.yonge.cooleshow.admin.controller;
 
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
-import com.yonge.cooleshow.auth.api.entity.SysUser;
-import com.yonge.cooleshow.biz.dal.dto.req.HomeTotalReq;
-import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.service.HomeService;
-import com.yonge.cooleshow.biz.dal.vo.HomeTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum;
@@ -13,7 +9,6 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -36,14 +31,14 @@ public class HomeController extends BaseController {
     @ApiOperation(value = "老师数据统计")
     @PostMapping("/totalTeacher")
     @PreAuthorize("@pcs.hasPermissions('home/totalTeacher')")
-    public HttpResponseResult<HomeTotalTeacher> totalTeacher(@Valid @RequestBody HomeTotalReq totalReq) {
+    public HttpResponseResult<HomeTotalTeacher> totalTeacher(@Valid @RequestBody TotalReq totalReq) {
         return homeService.totalTeacher(totalReq);
     }
 
     @ApiOperation(value = "学员数据统计")
     @PostMapping("/totalStudent")
     @PreAuthorize("@pcs.hasPermissions('home/totalStudent')")
-    public HttpResponseResult<HomeTotalStudent> totalStudent(@Valid @RequestBody HomeTotalReq totalReq) {
+    public HttpResponseResult<HomeTotalStudent> totalStudent(@Valid @RequestBody TotalReq totalReq) {
         return homeService.totalStudent(totalReq);
     }
 

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

@@ -1,6 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dao;
 
-import com.yonge.cooleshow.biz.dal.dto.req.HomeTotalReq;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum;
@@ -30,7 +30,7 @@ public interface HomeDao {
      * @updateTime 2022/4/21 11:33
      * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher>
      */
-    List<HomeTotalTeacher> totalTeacher(@Param("timeType") String timeType, @Param("param") HomeTotalReq param);
+    List<HomeTotalTeacher> totalTeacher(@Param("timeType") String timeType, @Param("param") TotalReq param);
     /***
      * 统计查询学生信息
      * @author liweifan
@@ -39,5 +39,5 @@ public interface HomeDao {
      * @updateTime 2022/4/21 15:11
      * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent>
      */
-    List<HomeTotalStudent> totalStudent(@Param("timeType") String timeType, @Param("param") HomeTotalReq param);
+    List<HomeTotalStudent> totalStudent(@Param("timeType") String timeType, @Param("param") TotalReq param);
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherFreeTimeDao.java

@@ -48,7 +48,7 @@ public interface TeacherFreeTimeDao extends BaseMapper<TeacherFreeTime> {
     void insertPrice(List<TeacherSubjectPrice> list);
 
     //查询老师配置
-    TeacherFreeTimeVo getDetail(PracticeTimesSetting practiceTimesSetting);
+    TeacherFreeTimeVo getDetail(@Param("param") PracticeTimesSetting practiceTimesSetting);
 
     //根据id查声部售价
     List<TeacherSubjectPrice> getPrice(Long id);

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

@@ -17,4 +17,7 @@ public interface VideoLessonPurchaseRecordDao extends BaseMapper<VideoLessonPurc
 
     //根据课程id查询老师id
     Long selectTeacherByDetail(Long videoId);
+
+    //修改订单状态
+    void updateStatus(String orderNo);
 }

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

@@ -18,6 +18,17 @@ public class PracticeTimesSetting {
     @ApiModelProperty(value = "用户id")
     private Long userId;
 
+    @ApiModelProperty(value = "默认配置(1:是 0:否)")
+    private Integer defaultFlag;
+
+    public Integer getDefaultFlag() {
+        return defaultFlag;
+    }
+
+    public void setDefaultFlag(Integer defaultFlag) {
+        this.defaultFlag = defaultFlag;
+    }
+
     public Long getUserId() {
         return userId;
     }

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/HomeTotalReq.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TotalReq.java

@@ -14,8 +14,8 @@ import java.util.Date;
  * @Author: liweifan
  * @Data: 2022/4/7 15:07
  */
-@ApiModel(value = "HomeTotalReq对象", description = "首页统计查询对象")
-public class HomeTotalReq {
+@ApiModel(value = "TotalReq对象", description = "统计查询对象")
+public class TotalReq {
     @NotNull(message = "时间类型不能为空")
     @ApiModelProperty("时间类型 MONTH、月度  YEAR、年度")
     private TimeTypeEnum timeType;

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

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
@@ -29,6 +28,9 @@ public class UserAccountRecordSearch extends QueryInfo{
 	@ApiModelProperty("业务类型:PRACTICE、陪练课 LIVE、直播课 MUSIC、乐谱 WITHDRAWAL、提现 ")
 	private AccountBizTypeEnum bizType;
 
+	@ApiModelProperty("查询时间(yyyy-mm) ")
+	private String searchDate;
+
 	@ApiModelProperty(value = "交易开始时间")
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -63,6 +65,14 @@ public class UserAccountRecordSearch extends QueryInfo{
 		this.bizType = bizType;
 	}
 
+	public String getSearchDate() {
+		return searchDate;
+	}
+
+	public void setSearchDate(String searchDate) {
+		this.searchDate = searchDate;
+	}
+
 	public Date getStartTime() {
 		return startTime;
 	}

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/VideoLessonPurchaseRecord.java

@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
-import java.util.Date;
 
 /**
  * 视频课购买记录表

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

@@ -1,7 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service;
 
-import com.yonge.cooleshow.biz.dal.dto.req.HomeTotalReq;
-import com.yonge.cooleshow.biz.dal.vo.HomeTotalVo;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum;
@@ -27,7 +26,7 @@ public interface HomeService {
      * @updateTime 2022/4/20 17:00
      * @return: com.yonge.cooleshow.biz.dal.vo.HomeTotalVo.TotalTeacher
      */
-    HttpResponseResult<HomeTotalTeacher> totalTeacher(HomeTotalReq totalReq);
+    HttpResponseResult<HomeTotalTeacher> totalTeacher(TotalReq totalReq);
     /***
      * 统计学员数据
      * @author liweifan
@@ -35,5 +34,5 @@ public interface HomeService {
      * @updateTime 2022/4/21 15:08
      * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher>
      */
-    HttpResponseResult<HomeTotalStudent> totalStudent(HomeTotalReq totalReq);
+    HttpResponseResult<HomeTotalStudent> totalStudent(TotalReq totalReq);
 }

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserAccountService.java

@@ -3,10 +3,12 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.dto.UserAccountRecordDto;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.entity.UserAccountRecord;
 import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
 import com.yonge.cooleshow.biz.dal.dto.search.UserAccountSearch;
 import com.yonge.cooleshow.biz.dal.entity.UserAccount;
+import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 
 /**
@@ -37,4 +39,12 @@ public interface UserAccountService extends IService<UserAccount>  {
      * @return: java.lang.Integer
      */
     HttpResponseResult<UserAccountRecord> accountChange(UserAccountRecordDto accountRecordDto);
+    /***
+     * 账户统计查询
+     * @author liweifan
+     * @param: totalReq
+     * @updateTime 2022/4/24 10:48
+     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.res.AccountTotal>
+     */
+    HttpResponseResult<AccountTotal> accountTotal(TotalReq totalReq);
 }

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

@@ -1,14 +1,23 @@
 package com.yonge.cooleshow.biz.dal.service;
 
+import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonPurchaseRecord;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 
 /**
  * VideoLessonPurchaseRecordService服务类
+ *
  * @author yzp
- * @date 2022-03-25 23:46:29
  * @version v1.0
+ * @date 2022-03-25 23:46:29
  **/
 public interface VideoLessonPurchaseRecordService extends IService<VideoLessonPurchaseRecord> {
+    HttpResponseResult<OrderCreateRes> buyVideoCourse(OrderReq.OrderReqInfo orderReqInfo);
+
+    void buyVideoCourseSuccess(UserOrderDetailVo orderParam);
 
+    void buyVideoCourseFailed(UserOrderDetailVo orderParam);
 }

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

@@ -803,6 +803,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         pageInfo.setAsc(" cs.start_time_");
         return PageUtil.pageInfo(baseMapper.queryStudentLiveCourse(pageInfo, param));
     }
+
     /**
      * 计算课堂每节课价格
      *
@@ -826,6 +827,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         }
         return map;
     }
+
     /**
      * @Description: 学生购买陪练课
      * @Author: cy

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

@@ -1,19 +1,14 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.yonge.cooleshow.biz.dal.dao.HomeDao;
-import com.yonge.cooleshow.biz.dal.dto.req.HomeTotalReq;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.enums.TimeTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.HomeService;
-import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
-import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
-import com.yonge.cooleshow.biz.dal.service.TeacherAuthMusicianRecordService;
-import com.yonge.cooleshow.biz.dal.vo.HomeTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
 import com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.utils.date.DateUtil;
-import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -39,7 +34,7 @@ public class HomeServiceImpl implements HomeService {
     }
 
     @Override
-    public HttpResponseResult<HomeTotalTeacher> totalTeacher(HomeTotalReq totalReq) {
+    public HttpResponseResult<HomeTotalTeacher> totalTeacher(TotalReq totalReq) {
         //参数处理
         Calendar calendar = Calendar.getInstance();
         if (TimeTypeEnum.MONTH.equals(totalReq.getTimeType())) {
@@ -84,7 +79,7 @@ public class HomeServiceImpl implements HomeService {
     }
 
     @Override
-    public HttpResponseResult<HomeTotalStudent> totalStudent(HomeTotalReq totalReq) {
+    public HttpResponseResult<HomeTotalStudent> totalStudent(TotalReq totalReq) {
         //参数处理
         Calendar calendar = Calendar.getInstance();
         if (TimeTypeEnum.MONTH.equals(totalReq.getTimeType())) {

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

@@ -285,7 +285,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
     public HttpResponseResult<TeacherVo> queryTeacherStyle(Long id) {
         TeacherVo detail = detail(id);
         LiveRoom liveRoom = liveRoomService.getliveingRoomBySpeakerId(id);
-        if(null == liveRoom){
+        if(null != liveRoom){
             detail.setRoomUid(liveRoom.getRoomUid());
             detail.setLiveing(YesOrNoEnum.YES);
         }else{

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

@@ -3,13 +3,17 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dto.UserAccountRecordDto;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.entity.UserAccountRecord;
 import com.yonge.cooleshow.biz.dal.enums.CacheNameEnum;
 import com.yonge.cooleshow.biz.dal.enums.FrozenTypeEnum;
+import com.yonge.cooleshow.biz.dal.enums.TimeTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 import com.yonge.cooleshow.biz.dal.support.DistributedLock;
+import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.toolset.utils.date.DateUtil;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -19,6 +23,7 @@ import com.yonge.cooleshow.biz.dal.dto.search.UserAccountSearch;
 import com.yonge.cooleshow.biz.dal.dao.UserAccountDao;
 import com.yonge.cooleshow.biz.dal.service.UserAccountService;
 
+import java.util.Calendar;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
@@ -62,6 +67,28 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         }
     }
 
+    @Override
+    public HttpResponseResult<AccountTotal> accountTotal(TotalReq totalReq) {
+        //参数处理
+        Calendar calendar = Calendar.getInstance();
+        if (TimeTypeEnum.MONTH.equals(totalReq.getTimeType())) {
+            String[] classDateSp = totalReq.getDateTime().split("-");
+            calendar.set(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1, 0, 0, 0);
+            totalReq.setStartTime(calendar.getTime());
+            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } else if (TimeTypeEnum.YEAR.equals(totalReq.getTimeType())) {
+            calendar.set(Integer.parseInt(totalReq.getDateTime()), 1, 1, 0, 0, 0);
+            totalReq.setStartTime(calendar.getTime());
+
+            calendar.set(Integer.parseInt(totalReq.getDateTime()), 12, 1, 0, 0, 0);
+            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } else {
+            return HttpResponseResult.failed("参数异常");
+        }
+
+        return null;
+    }
+
     private HttpResponseResult<UserAccountRecord> doAccountChange(UserAccountRecordDto accountRecordDto) {
         if (FrozenTypeEnum.FROZEN.equals(accountRecordDto.getFrozenType())) {
             baseMapper.frozenChangeAccount(accountRecordDto.getUserId(), accountRecordDto.getTransAmount(), accountRecordDto.getInOrOut().getCode());

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

@@ -239,7 +239,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
 
     @Override
     public void pollingOrder() {
-        //查询创建时间超过半小时还在交易中的订单
+        //WAIT_PAY状态的订单,半个小时自动关闭
+        //PAYING状态的订单,超过2小时还未支付成功关闭
         List<UserOrderVo> orderList = baseMapper.selectPendingList();
         for (UserOrderVo userOrder : orderList) {
             //待支付订单直接取消
@@ -277,13 +278,11 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         }
         try {
             Map<String, Object> resMap = paymentSdk.queryPayment(orderPayment.getTransNo());
-            //支付失败
-            if (PayStatusEnum.failed.getCode().equals(resMap.get("status").toString())) {
-                orderCancel(userOrder);
-            }
             //支付成功
             if (PayStatusEnum.succeeded.getCode().equals(resMap.get("status").toString())) {
                 orderSuccess(userOrder);
+            }else{
+                orderCancel(userOrder);
             }
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -1,29 +1,143 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
-import com.yonge.cooleshow.biz.dal.entity.VideoLessonPurchaseRecord;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDao;
+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.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonPurchaseRecordService;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.exception.BizException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
 
 /**
  * VideoLessonPurchaseRecordService服务实现类
+ *
  * @author yzp
- * @date 2022-03-26 00:01:38
  * @version v1.0
+ * @date 2022-03-26 00:01:38
  **/
 @Service
-public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLessonPurchaseRecordDao,VideoLessonPurchaseRecord> implements VideoLessonPurchaseRecordService {
+public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLessonPurchaseRecordDao, VideoLessonPurchaseRecord> implements VideoLessonPurchaseRecordService {
 
     private final static Logger log = LoggerFactory.getLogger(VideoLessonPurchaseRecordServiceImpl.class);
 
     @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
     private VideoLessonPurchaseRecordDao videoLessonPurchaseRecordDao;
+    @Autowired
+    private VideoLessonGroupDao videoLessonGroupDao;
 
     public VideoLessonPurchaseRecordDao getDao() {
         return videoLessonPurchaseRecordDao;
     }
+
+    /**
+     * @Description: 购买视频课
+     * @Author: cy
+     * @Date: 2022/4/24
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult<OrderCreateRes> buyVideoCourse(OrderReq.OrderReqInfo orderReqInfo) {
+        log.info("学生购买视频课程组,请求参数:{}", JSON.toJSONString(orderReqInfo));
+        Long studentId = orderReqInfo.getUserId();
+        String orderNo = orderReqInfo.getOrderNo();
+
+        //校验学生信息
+        getSysUser(studentId);
+
+        ObjectMapper objectMapper = new ObjectMapper();
+        VideoLessonPurchaseRecord purchaseRecord = objectMapper.convertValue(orderReqInfo.getBizContent(), VideoLessonPurchaseRecord.class);
+
+        //校验视频课信息
+        Long groupId = purchaseRecord.getVideoLessonGroupId();
+        VideoLessonGroup lessonGroup = videoLessonGroupDao.selectById(groupId);
+        if (lessonGroup == null) {
+            throw new BizException("课程组不存在!");
+        }
+
+        orderNo="999";
+        purchaseRecord.setOrderNo(orderNo);
+        purchaseRecord.setStudentId(studentId);
+        purchaseRecord.setOrderStatus(0);
+        videoLessonPurchaseRecordDao.insert(purchaseRecord);
+
+        OrderCreateRes orderCreateRes = new OrderCreateRes();
+        orderCreateRes.setRes(true);
+        orderCreateRes.setMerchId(lessonGroup.getTeacherId());
+        orderCreateRes.setBizId(orderReqInfo.getCouponId());
+        orderCreateRes.setOriginalPrice(BigDecimal.valueOf(lessonGroup.getLessonPrice()));
+        orderCreateRes.setExpectPrice(BigDecimal.valueOf(lessonGroup.getLessonPrice()));
+        orderCreateRes.setActualPrice(purchaseRecord.getPayMoney());
+        orderCreateRes.setGoodNum(lessonGroup.getLessonCount());
+        orderCreateRes.setGoodType(GoodTypeEnum.VIDEO);
+        HttpResponseResult<OrderCreateRes> httpResponseResult = new HttpResponseResult<>();
+        httpResponseResult.setData(orderCreateRes);
+        return httpResponseResult;
+    }
+
+    /**
+     * @Description: 购买视频课-成功-回调
+     * @Author: cy
+     * @Date: 2022/4/24
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void buyVideoCourseSuccess(UserOrderDetailVo orderParam) {
+        log.info("学生购买视频课-成功-回调,请求参数:{}", JSON.toJSONString(orderParam));
+        String orderNo = orderParam.getOrderNo();
+
+        VideoLessonPurchaseRecord videoGroup = videoLessonPurchaseRecordDao.selectOne(Wrappers.<VideoLessonPurchaseRecord>lambdaQuery()
+                .eq(VideoLessonPurchaseRecord::getOrderNo, orderNo));
+        if (videoGroup == null) {
+            throw new BizException("课程组不存在!");
+        }
+
+        //video_lesson_purchase_record中order_status_改为1
+        videoLessonPurchaseRecordDao.updateStatus(orderNo);
+    }
+
+    /**
+     * @Description: 购买视频课-失败-回调
+     * @Author: cy
+     * @Date: 2022/4/24
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void buyVideoCourseFailed(UserOrderDetailVo orderParam) {
+        String orderNo = orderParam.getOrderNo();
+
+        VideoLessonPurchaseRecord videoGroup = videoLessonPurchaseRecordDao.selectOne(Wrappers.<VideoLessonPurchaseRecord>lambdaQuery()
+                .eq(VideoLessonPurchaseRecord::getOrderNo, orderNo));
+        if (videoGroup == null) {
+            throw new BizException("课程组不存在!");
+        }
+
+        //删除video_lesson_purchase_record数据
+        videoLessonPurchaseRecordDao.delete(Wrappers.<VideoLessonPurchaseRecord>lambdaQuery()
+                .eq(VideoLessonPurchaseRecord::getOrderNo, orderNo));
+    }
+
+    /**
+     * 获取用户信息
+     */
+    private SysUser getSysUser(Long userId) {
+        return Optional.ofNullable(userId)
+                .map(sysUserFeignService::queryUserById)
+                .orElseThrow(() -> new BizException("用户不存在"));
+    }
 }

+ 20 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomePage.java

@@ -39,6 +39,16 @@ public class StudentHomePage implements Serializable {
         private String backgroundPic;
         @ApiModelProperty(value = "课程数")
         private Integer courseNum;
+        @ApiModelProperty(value = "购买人数")
+        private Integer buyCount;
+
+        public Integer getBuyCount() {
+            return buyCount;
+        }
+
+        public void setBuyCount(Integer buyCount) {
+            this.buyCount = buyCount;
+        }
 
         public Long getTeacherId() {
             return teacherId;
@@ -137,6 +147,16 @@ public class StudentHomePage implements Serializable {
         private Integer subjectId;
         @ApiModelProperty(value = "声部名称")
         private String subjectName;
+        @ApiModelProperty(value = "购买人数")
+        private Integer buyCount;
+
+        public Integer getBuyCount() {
+            return buyCount;
+        }
+
+        public void setBuyCount(Integer buyCount) {
+            this.buyCount = buyCount;
+        }
 
         public Long getTeacherId() {
             return teacherId;

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserAccountRecordVo.java

@@ -16,6 +16,9 @@ import java.util.Date;
 public class UserAccountRecordVo extends UserAccountRecord{
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty("发生时间(mm-dd) ")
+	private String timeDay;
+
 	@ApiModelProperty(value = "上课时间")
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -26,6 +29,14 @@ public class UserAccountRecordVo extends UserAccountRecord{
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
 	private Date endTime;
 
+	public String getTimeDay() {
+		return timeDay;
+	}
+
+	public void setTimeDay(String timeDay) {
+		this.timeDay = timeDay;
+	}
+
 	public Date getStartTime() {
 		return startTime;
 	}

+ 96 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/AccountTotal.java

@@ -0,0 +1,96 @@
+package com.yonge.cooleshow.biz.dal.vo.res;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/21 11:29
+ */
+@ApiModel(value = "AccountTotal", description = "用户账户统计对象")
+public class AccountTotal {
+    @ApiModelProperty("总收入 ")
+    private BigDecimal amountTotalIn;
+    @ApiModelProperty("陪练课 ")
+    private BigDecimal practiceTotal;
+    @ApiModelProperty("陪练课-百分比 ")
+    private BigDecimal practiceRate;
+    @ApiModelProperty("直播课 ")
+    private BigDecimal liveTotal;
+    @ApiModelProperty("直播课-百分比")
+    private BigDecimal liveRate;
+    @ApiModelProperty("乐谱 ")
+    private BigDecimal musicTotal;
+    @ApiModelProperty("乐谱-百分比 ")
+    private BigDecimal musicRate;
+
+    @ApiModelProperty("详情数据 ")
+    private List<TotalInfoData> infoList;
+
+    public BigDecimal getAmountTotalIn() {
+        return amountTotalIn;
+    }
+
+    public void setAmountTotalIn(BigDecimal amountTotalIn) {
+        this.amountTotalIn = amountTotalIn;
+    }
+
+    public BigDecimal getPracticeTotal() {
+        return practiceTotal;
+    }
+
+    public void setPracticeTotal(BigDecimal practiceTotal) {
+        this.practiceTotal = practiceTotal;
+    }
+
+    public BigDecimal getPracticeRate() {
+        return practiceRate;
+    }
+
+    public void setPracticeRate(BigDecimal practiceRate) {
+        this.practiceRate = practiceRate;
+    }
+
+    public BigDecimal getLiveTotal() {
+        return liveTotal;
+    }
+
+    public void setLiveTotal(BigDecimal liveTotal) {
+        this.liveTotal = liveTotal;
+    }
+
+    public BigDecimal getLiveRate() {
+        return liveRate;
+    }
+
+    public void setLiveRate(BigDecimal liveRate) {
+        this.liveRate = liveRate;
+    }
+
+    public BigDecimal getMusicTotal() {
+        return musicTotal;
+    }
+
+    public void setMusicTotal(BigDecimal musicTotal) {
+        this.musicTotal = musicTotal;
+    }
+
+    public BigDecimal getMusicRate() {
+        return musicRate;
+    }
+
+    public void setMusicRate(BigDecimal musicRate) {
+        this.musicRate = musicRate;
+    }
+
+    public List<TotalInfoData> getInfoList() {
+        return infoList;
+    }
+
+    public void setInfoList(List<TotalInfoData> infoList) {
+        this.infoList = infoList;
+    }
+}

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/OrderCreateRes.java

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.biz.dal.vo.res;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;

+ 59 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/TotalInfoData.java

@@ -0,0 +1,59 @@
+package com.yonge.cooleshow.biz.dal.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/4/24 10:41
+ */
+@ApiModel(value = "TotalInfoData", description = "统计数据详情对象")
+public class TotalInfoData {
+    @ApiModelProperty(value = "统计时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date totalTime;
+    @ApiModelProperty(value = "统计时间(yyyy-MM)")
+    private String totalMonth;
+    @ApiModelProperty(value = "统计时间(yyyy-MM-dd)")
+    private String totalDay;
+    @ApiModelProperty("数值 ")
+    private BigDecimal value;
+
+    public Date getTotalTime() {
+        return totalTime;
+    }
+
+    public void setTotalTime(Date totalTime) {
+        this.totalTime = totalTime;
+    }
+
+    public String getTotalMonth() {
+        return totalMonth;
+    }
+
+    public void setTotalMonth(String totalMonth) {
+        this.totalMonth = totalMonth;
+    }
+
+    public String getTotalDay() {
+        return totalDay;
+    }
+
+    public void setTotalDay(String totalDay) {
+        this.totalDay = totalDay;
+    }
+
+    public BigDecimal getValue() {
+        return value;
+    }
+
+    public void setValue(BigDecimal value) {
+        this.value = value;
+    }
+}

+ 5 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -464,7 +464,8 @@
             g.course_price_ AS courseGroupPrice,
             g.course_start_time_ AS courseStartTime,
             g.background_pic_ AS backgroundPic,
-            g.course_num_ AS courseNum
+            g.course_num_ AS courseNum,
+            g.pre_student_num_ AS buyCount
         FROM course_group g
         LEFT JOIN sys_user u ON g.teacher_id_=u.id_
         WHERE type_='LIVE'
@@ -482,10 +483,12 @@
             g.lesson_cover_url_ AS lessonCoverUrl,
             g.lesson_count_ AS lessonCount,
             g.lesson_subject_ AS subjectId,
-            s.name_ AS subjectName
+            s.name_ AS subjectName,
+            IFNULL(r.count_,0) AS buyCount
         FROM video_lesson_group g
         LEFT JOIN sys_user u ON g.teacher_id_=u.id_
         LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
+        LEFT JOIN (SELECT video_lesson_group_id_ ,COUNT(1) AS count_ FROM video_lesson_purchase_record GROUP BY video_lesson_group_id_) r ON g.id_= r.video_lesson_group_id_
         WHERE g.audit_status_='PASS'
         ORDER BY g.create_time_ DESC LIMIT 4
     </select>

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

@@ -63,7 +63,10 @@
             u.id_card_no_ as idCardNo,
             u.phone_ as phone,
             u.gender_ as gender,
-            v.username_ as verifyUser
+            v.username_ as verifyUser,
+            (
+                SELECT GROUP_CONCAT(name_) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
+            ) as subjectName
         FROM teacher_auth_entry_record t
         left join sys_user u on t.user_id_ = u.id_
         left join sys_user v on t.verify_user_id_ = v.id_

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

@@ -58,7 +58,24 @@
     </select>
     <select id="getDetail" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherFreeTimeVo"
             parameterType="com.yonge.cooleshow.biz.dal.dto.PracticeTimesSetting">
-        SELECT * FROM teacher_free_time WHERE teacher_id_=#{userId} AND free_minutes_=#{freeMinutes} AND course_minutes_=#{courseMinutes}
+        SELECT * FROM teacher_free_time
+        <where>
+            <if test="param.userId != null">
+                AND teacher_id_ = #{param.userId}
+            </if>
+            <if test="param.freeMinutes != null">
+                AND free_minutes_ = #{param.freeMinutes}
+            </if>
+            <if test="param.courseMinutes != null">
+                AND course_minutes_ = #{param.courseMinutes}
+            </if>
+            <if test="param.courseMinutes != null">
+                AND course_minutes_ = #{param.courseMinutes}
+            </if>
+            <if test="param.defaultFlag != null">
+                AND default_flag_ = #{param.defaultFlag}
+            </if>
+        </where>
     </select>
     <select id="getPrice" resultType="com.yonge.cooleshow.biz.dal.entity.TeacherSubjectPrice"
             parameterType="java.lang.Long">

+ 2 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountRecordMapper.xml

@@ -38,6 +38,7 @@
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo">
         SELECT
             <include refid="baseColumns" />,
+            DATE_FORMAT(t.create_time_,'%m-%d') as timeDay,
             a.start_time_ as startTime,
             a.end_time_ as endTime
         FROM user_cash_account_record t
@@ -59,5 +60,6 @@
                 <![CDATA[AND t.create_time_ <= #{param.endTime} ]]>
             </if>
         </where>
+        order by t.create_time_ desc
     </select>
 </mapper>

+ 3 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderMapper.xml

@@ -138,13 +138,13 @@
     <select id="selectList" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderVo">
         <include refid="selectSql"/>
     </select>
+
     <select id="selectPendingList" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderVo">
         SELECT * FROM user_order t
-        where (t.status_ = 'WAIT_PAY' or t.status_ = 'PAYING')
-        and t.create_time_ &lt;= date_sub(now(),interval 30 minute)
+        where (t.status_ = 'WAIT_PAY' and t.create_time_ &lt;= date_sub(now(), interval 30 minute))
+        or ( t.status_ = 'PAYING' and t.create_time_ &lt;= date_sub(now(), interval 120 minute))
     </select>
 
-
     <update id="updateStatusByOrderNo">
         update user_order set status_ = #{orderStatus} where order_no_ = #{orderNo}
     </update>

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonPurchaseRecordMapper.xml

@@ -26,4 +26,7 @@
 		WHERE id_=
 		(SELECT video_lesson_group_id_ FROM video_lesson_group_detail WHERE id_=#{videoId})
 	</select>
+	<update id="updateStatus" parameterType="java.lang.String">
+		UPDATE video_lesson_purchase_record SET order_status_=1 WHERE order_no_=#{orderNo}
+	</update>
 </mapper>

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

@@ -0,0 +1,91 @@
+package com.yonge.cooleshow.teacher.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
+import com.yonge.cooleshow.biz.dal.dto.search.UserAccountRecordSearch;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
+import com.yonge.cooleshow.biz.dal.service.UserAccountService;
+import com.yonge.cooleshow.biz.dal.support.PageUtil;
+import com.yonge.cooleshow.biz.dal.vo.UserAccountRecordVo;
+import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
+import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
+import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.toolset.utils.date.DateUtil;
+import com.yonge.toolset.utils.string.StringUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Calendar;
+import java.util.Date;
+
+@RestController
+@RequestMapping("/userAccount")
+@Api(value = "用户账户表", tags = "用户账户表")
+public class UserAccountController extends BaseController {
+    @Autowired
+    private UserAccountService userAccountService;
+    @Autowired
+    private UserAccountRecordService userAccountRecordService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+	/**
+     * 查询单条
+     */
+    @GetMapping("/detail/{id}")
+    @ApiOperation(value = "详情", notes = "传入id")
+    public HttpResponseResult<UserAccountVo> detail() {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+    	return succeed(userAccountService.detail(user.getId()));
+	}
+
+    /**
+     * 查询分页
+     */
+    @PostMapping("/page")
+    @ApiOperation(value = "查询分页", notes = "传入userAccountRecordSearch")
+    public HttpResponseResult<PageInfo<UserAccountRecordVo>> page(@RequestBody UserAccountRecordSearch query) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        query.setUserId(user.getId());
+        query.setInOrOut(InOrOutEnum.IN);
+        if (StringUtil.isEmpty(query.getSearchDate())) {
+            query.setSearchDate(DateUtil.format(new Date(), "yyyy-MM"));
+        }
+        try {
+            Calendar calendar = Calendar.getInstance();
+            String[] classDateSp = query.getSearchDate().split("-");
+            calendar.set(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1, 0, 0, 0);
+            query.setStartTime(calendar.getTime());
+            query.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } catch (Exception e) {
+            throw new BizException("查询时间格式不正确 [" + query.getSearchDate() + "]");
+        }
+        IPage<UserAccountRecordVo> pages = userAccountRecordService.selectPage(PageUtil.getPage(query), query);
+        return succeed(PageUtil.pageInfo(pages));
+    }
+
+
+    @ApiOperation(value = "收入数据统计")
+    @PostMapping("/accountTotal")
+    public HttpResponseResult<AccountTotal> accountTotal(@Valid @RequestBody TotalReq totalReq) {
+        return userAccountService.accountTotal(totalReq);
+    }
+
+}