From a7402e90dcfe148f05b53253520e338550709d84 Mon Sep 17 00:00:00 2001
From: licc <lichuchuan@jtep.com.cn>
Date: Tue, 2 Mar 2021 15:30:34 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=90=AF=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../common/utils/HttpContextUtils.java        |  3 +
 .../model/vo/MonthTotalRevenueVo.java         | 20 ++++-
 .../wisenergy/service/app/AccountService.java |  3 +-
 .../wisenergy/service/app/WalletService.java  | 19 ++++
 .../app/impl/UserLevelServiceImlp.java        |  6 +-
 .../service/app/impl/WalletServiceImpl.java   | 25 ++++++
 .../main/java/cn/wisenergy/Application.java   |  4 -
 .../admin/controller/app/IndexController.java |  8 +-
 .../admin/controller/app/UserController.java  | 90 +++++++++----------
 .../config/GlobalConversConfiguration.java    | 86 +++++++++---------
 .../web/shiro/filter/AuthFilter.java          |  1 +
 11 files changed, 164 insertions(+), 101 deletions(-)
 create mode 100644 wisenergy-service/src/main/java/cn/wisenergy/service/app/WalletService.java
 create mode 100644 wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/WalletServiceImpl.java

diff --git a/wisenergy-common/src/main/java/cn/wisenergy/common/utils/HttpContextUtils.java b/wisenergy-common/src/main/java/cn/wisenergy/common/utils/HttpContextUtils.java
index a86f0ef..ea01cc5 100644
--- a/wisenergy-common/src/main/java/cn/wisenergy/common/utils/HttpContextUtils.java
+++ b/wisenergy-common/src/main/java/cn/wisenergy/common/utils/HttpContextUtils.java
@@ -5,6 +5,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 
+/**
+ * @author 86187
+ */
 public class HttpContextUtils {
 
     public static HttpServletRequest getHttpServletRequest() {
diff --git a/wisenergy-model/src/main/java/cn/wisenergy/model/vo/MonthTotalRevenueVo.java b/wisenergy-model/src/main/java/cn/wisenergy/model/vo/MonthTotalRevenueVo.java
index 471167e..616f22d 100644
--- a/wisenergy-model/src/main/java/cn/wisenergy/model/vo/MonthTotalRevenueVo.java
+++ b/wisenergy-model/src/main/java/cn/wisenergy/model/vo/MonthTotalRevenueVo.java
@@ -3,6 +3,8 @@ package cn.wisenergy.model.vo;
 import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * @author 86187
  * @ Description: 当月总收益Vo
@@ -12,7 +14,23 @@ import lombok.Data;
 @Data
 @ApiModel("MonthTotalRevenueVo")
 public class MonthTotalRevenueVo {
+    /**
+     * 用户id
+     */
     private String userId;
 
-    private Double balance;
+    /**
+     * 余额
+     */
+    private BigDecimal balance;
+
+    /**
+     * 待结算
+     */
+    private BigDecimal waitMoney;
+
+    /**
+     * 累计收益
+     */
+    private BigDecimal accumulatedIncome;
 }
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
index 65ecda5..0183f94 100644
--- a/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
@@ -5,6 +5,7 @@ import cn.wisenergy.common.utils.R;
 import cn.wisenergy.model.app.AccountInfo;
 import cn.wisenergy.model.app.OrderInfo;
 import cn.wisenergy.model.app.User;
+import cn.wisenergy.model.vo.MonthTotalRevenueVo;
 
 import java.util.List;
 
@@ -52,6 +53,4 @@ public interface AccountService {
      * @return true or false
      */
     R<Boolean> progressPrizeCount();
-
-
 }
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/WalletService.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/WalletService.java
new file mode 100644
index 0000000..4f0a0af
--- /dev/null
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/WalletService.java
@@ -0,0 +1,19 @@
+package cn.wisenergy.service.app;
+
+import cn.wisenergy.model.vo.MonthTotalRevenueVo;
+
+/**
+*@ Description: 钱包相关接口定义
+*@ Author     : 86187
+*@ Date       : 2021/3/2 14:33
+ * @author 86187
+ */
+public interface WalletService {
+    /**
+     * 用户当月总收益
+     *
+     * @param userId 用户id
+     * @return 当月总收益
+     */
+    MonthTotalRevenueVo monthTotalRevenue(String userId);
+}
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLevelServiceImlp.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLevelServiceImlp.java
index 8b71c27..4de6b6a 100644
--- a/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLevelServiceImlp.java
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLevelServiceImlp.java
@@ -26,13 +26,13 @@ import java.math.BigDecimal;
 public class UserLevelServiceImlp extends ServiceImpl<UsersMapper,User> implements UserLevelService {
 
     @Autowired
-    UsersMapper usersMapper;
+    private UsersMapper usersMapper;
 
     @Autowired
-    RecommendUserMapper recommendUserMapper;
+    private RecommendUserMapper recommendUserMapper;
 
     @Autowired
-    TeamUserInfoMapper teamUserInfoMapper;
+    private TeamUserInfoMapper teamUserInfoMapper;
 
     @Override
     @Transactional
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/WalletServiceImpl.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/WalletServiceImpl.java
new file mode 100644
index 0000000..afa9b56
--- /dev/null
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/WalletServiceImpl.java
@@ -0,0 +1,25 @@
+package cn.wisenergy.service.app.impl;
+
+import cn.wisenergy.mapper.AccountMapper;
+import cn.wisenergy.model.vo.MonthTotalRevenueVo;
+import cn.wisenergy.service.app.WalletService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author 86187
+ */
+@Service
+@Slf4j
+public class WalletServiceImpl implements WalletService {
+    @Autowired
+    private AccountMapper accountMapper;
+
+
+    @Override
+    public MonthTotalRevenueVo monthTotalRevenue(String userId) {
+        log.info("shop-mall[]WalletServiceImpl[]monthTotalRevenue[]input.param.userId:" + userId);
+        return null;
+    }
+}
diff --git a/wisenergy-web-admin/src/main/java/cn/wisenergy/Application.java b/wisenergy-web-admin/src/main/java/cn/wisenergy/Application.java
index 2172aa3..4165de6 100644
--- a/wisenergy-web-admin/src/main/java/cn/wisenergy/Application.java
+++ b/wisenergy-web-admin/src/main/java/cn/wisenergy/Application.java
@@ -12,7 +12,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
  * 配置netty启动
  */
 @EnableCaching
-//@SpringBootApplication(scanBasePackages = “com.mall”)
 @SpringBootApplication(exclude = {MultipartAutoConfiguration.class})
 @MapperScan(
         basePackages = "cn.wisenergy.mapper")
@@ -22,8 +21,5 @@ public class Application {
     public static void main(String[] args) {
         SpringApplication.run(Application.class, args);
     }
-
-
-
 }
 
diff --git a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/IndexController.java b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/IndexController.java
index 18d9336..6003bca 100644
--- a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/IndexController.java
+++ b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/IndexController.java
@@ -1,15 +1,17 @@
 package cn.wisenergy.web.admin.controller.app;
 
-import org.springframework.stereotype.Controller;
+
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * Created by m1991 on 2021/2/27 0:43
+ * @author 86187
  */
-@Controller
+@RestController
 public class IndexController {
 
-    @GetMapping("/")
+    @GetMapping("/index")
     public String index() {
         return "index";
     }
diff --git a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java
index d5184bc..34a9f41 100644
--- a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java
+++ b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java
@@ -79,49 +79,49 @@ public class UserController extends BaseController {
         return R.ok(token);
     }
 
-    /**
-     * 手机号登录
-     * @param userId
-     * @param sms
-     * @return
-     * @throws Exception
-     */
-    @ApiOperation(value = "获取用户手机号登录接口", notes = "获取用户手机号登录接口", httpMethod = "POST")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "sms", value = "短信验证码", required = true, dataType = "String")})
-    @RequestMapping("/login/sms")
-    public Result loginBySms(String userId, String sms)throws Exception{
-        User users=null;
-        String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
-        String redisCode=redisUtils.getValue(key);
-        if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
-            throw new BaseException(ResultEnum.FAIL_VERIFY);
-        }
-        redisUtils.delete(key);
-        //根据手机号判断用户是否存在
-        //不存在则保存用户信息
-        users=userService.queryUsersByPhone(userId);
-        if(null==users){
-            users=new User();
-//            users.setAccount(phone);
-//            users.setUserName(phone);
-//            userService.qdtxAddUsers(users);
-        }
-        String token=createToken(users);
-        if(!StringUtil.isBlank(token)){
-            return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token));
-        }
-        return ResultUtils.returnFail();
-    }
-
-    public String createToken(User users)throws Exception{
-        String token=StringUtil.createToken();
-        //保存token
-        String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
-        UsersDto usersDto=new UsersDto();
-        BeanUtils.copyProperties(users,usersDto);
-        redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT);
-        return token;
-    }
+//    /**
+//     * 手机号登录
+//     * @param userId
+//     * @param sms
+//     * @return
+//     * @throws Exception
+//     */
+//    @ApiOperation(value = "获取用户手机号登录接口", notes = "获取用户手机号登录接口", httpMethod = "POST")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"),
+//            @ApiImplicitParam(name = "sms", value = "短信验证码", required = true, dataType = "String")})
+//    @RequestMapping("/login/sms")
+//    public Result loginBySms(String userId, String sms)throws Exception{
+//        User users=null;
+//        String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
+//        String redisCode=redisUtils.getValue(key);
+//        if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
+//            throw new BaseException(ResultEnum.FAIL_VERIFY);
+//        }
+//        redisUtils.delete(key);
+//        //根据手机号判断用户是否存在
+//        //不存在则保存用户信息
+//        users=userService.queryUsersByPhone(userId);
+//        if(null==users){
+//            users=new User();
+////            users.setAccount(phone);
+////            users.setUserName(phone);
+////            userService.qdtxAddUsers(users);
+//        }
+//        String token=createToken(users);
+//        if(!StringUtil.isBlank(token)){
+//            return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token));
+//        }
+//        return ResultUtils.returnFail();
+//    }
+//
+//    public String createToken(User users)throws Exception{
+//        String token=StringUtil.createToken();
+//        //保存token
+//        String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
+//        UsersDto usersDto=new UsersDto();
+//        BeanUtils.copyProperties(users,usersDto);
+//        redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT);
+//        return token;
+//    }
 }
diff --git a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/GlobalConversConfiguration.java b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/GlobalConversConfiguration.java
index ec1ae91..36e057d 100644
--- a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/GlobalConversConfiguration.java
+++ b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/GlobalConversConfiguration.java
@@ -1,43 +1,43 @@
-package cn.wisenergy.web.config;
-
-
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.StringHttpMessageConverter;
-import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-
-import java.nio.charset.Charset;
-import java.util.List;
-
-/**
- * 配置全局编码格式 utf-8
- * Created by m1991 on 2021/3/1 4:15
- */
-
-@Configuration
-public class GlobalConversConfiguration extends WebMvcConfigurationSupport {
-
-    @Bean
-    public HttpMessageConverter<String> responseBodyConverter() {
-        StringHttpMessageConverter converter = new StringHttpMessageConverter(
-                Charset.forName("UTF-8"));
-        return converter;
-    }
-
-    @Override
-    public void configureMessageConverters(
-            List<HttpMessageConverter<?>> converters) {
-        super.configureMessageConverters(converters);
-        converters.add(responseBodyConverter());
-    }
-
-    @Override
-    public void configureContentNegotiation(
-            ContentNegotiationConfigurer configurer) {
-        configurer.favorPathExtension(false);
-    }
-}
-
+//package cn.wisenergy.web.config;
+//
+//
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.http.converter.HttpMessageConverter;
+//import org.springframework.http.converter.StringHttpMessageConverter;
+//import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
+//import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+//
+//import java.nio.charset.Charset;
+//import java.util.List;
+//
+///**
+// * 配置全局编码格式 utf-8
+// * Created by m1991 on 2021/3/1 4:15
+// */
+//
+//@Configuration
+//public class GlobalConversConfiguration extends WebMvcConfigurationSupport {
+//
+//    @Bean
+//    public HttpMessageConverter<String> responseBodyConverter() {
+//        StringHttpMessageConverter converter = new StringHttpMessageConverter(
+//                Charset.forName("UTF-8"));
+//        return converter;
+//    }
+//
+//    @Override
+//    public void configureMessageConverters(
+//            List<HttpMessageConverter<?>> converters) {
+//        super.configureMessageConverters(converters);
+//        converters.add(responseBodyConverter());
+//    }
+//
+//    @Override
+//    public void configureContentNegotiation(
+//            ContentNegotiationConfigurer configurer) {
+//        configurer.favorPathExtension(false);
+//    }
+//}
+//
diff --git a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthFilter.java b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthFilter.java
index a6262ce..c157f80 100644
--- a/wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthFilter.java
+++ b/wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthFilter.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 
 /**
  * oauth2过滤器
+ * @author 86187
  */
 @Slf4j
 public class AuthFilter extends AuthenticatingFilter {
-- 
2.18.1