Commit a7402e90 authored by licc's avatar licc

本地启动

parent d4d97cc7
...@@ -5,6 +5,9 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -5,6 +5,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/**
* @author 86187
*/
public class HttpContextUtils { public class HttpContextUtils {
public static HttpServletRequest getHttpServletRequest() { public static HttpServletRequest getHttpServletRequest() {
......
...@@ -3,6 +3,8 @@ package cn.wisenergy.model.vo; ...@@ -3,6 +3,8 @@ package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* @author 86187 * @author 86187
* @ Description: 当月总收益Vo * @ Description: 当月总收益Vo
...@@ -12,7 +14,23 @@ import lombok.Data; ...@@ -12,7 +14,23 @@ import lombok.Data;
@Data @Data
@ApiModel("MonthTotalRevenueVo") @ApiModel("MonthTotalRevenueVo")
public class MonthTotalRevenueVo { public class MonthTotalRevenueVo {
/**
* 用户id
*/
private String userId; private String userId;
private Double balance; /**
* 余额
*/
private BigDecimal balance;
/**
* 待结算
*/
private BigDecimal waitMoney;
/**
* 累计收益
*/
private BigDecimal accumulatedIncome;
} }
...@@ -5,6 +5,7 @@ import cn.wisenergy.common.utils.R; ...@@ -5,6 +5,7 @@ import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.AccountInfo; import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.app.OrderInfo; import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import cn.wisenergy.model.vo.MonthTotalRevenueVo;
import java.util.List; import java.util.List;
...@@ -52,6 +53,4 @@ public interface AccountService { ...@@ -52,6 +53,4 @@ public interface AccountService {
* @return true or false * @return true or false
*/ */
R<Boolean> progressPrizeCount(); R<Boolean> progressPrizeCount();
} }
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);
}
...@@ -26,13 +26,13 @@ import java.math.BigDecimal; ...@@ -26,13 +26,13 @@ import java.math.BigDecimal;
public class UserLevelServiceImlp extends ServiceImpl<UsersMapper,User> implements UserLevelService { public class UserLevelServiceImlp extends ServiceImpl<UsersMapper,User> implements UserLevelService {
@Autowired @Autowired
UsersMapper usersMapper; private UsersMapper usersMapper;
@Autowired @Autowired
RecommendUserMapper recommendUserMapper; private RecommendUserMapper recommendUserMapper;
@Autowired @Autowired
TeamUserInfoMapper teamUserInfoMapper; private TeamUserInfoMapper teamUserInfoMapper;
@Override @Override
@Transactional @Transactional
......
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;
}
}
...@@ -12,7 +12,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -12,7 +12,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
* 配置netty启动 * 配置netty启动
*/ */
@EnableCaching @EnableCaching
//@SpringBootApplication(scanBasePackages = “com.mall”)
@SpringBootApplication(exclude = {MultipartAutoConfiguration.class}) @SpringBootApplication(exclude = {MultipartAutoConfiguration.class})
@MapperScan( @MapperScan(
basePackages = "cn.wisenergy.mapper") basePackages = "cn.wisenergy.mapper")
...@@ -22,8 +21,5 @@ public class Application { ...@@ -22,8 +21,5 @@ public class Application {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(Application.class, args); SpringApplication.run(Application.class, args);
} }
} }
package cn.wisenergy.web.admin.controller.app; 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.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* Created by m1991 on 2021/2/27 0:43 * Created by m1991 on 2021/2/27 0:43
* @author 86187
*/ */
@Controller @RestController
public class IndexController { public class IndexController {
@GetMapping("/") @GetMapping("/index")
public String index() { public String index() {
return "index"; return "index";
} }
......
...@@ -79,49 +79,49 @@ public class UserController extends BaseController { ...@@ -79,49 +79,49 @@ public class UserController extends BaseController {
return R.ok(token); return R.ok(token);
} }
/** // /**
* 手机号登录 // * 手机号登录
* @param userId // * @param userId
* @param sms // * @param sms
* @return // * @return
* @throws Exception // * @throws Exception
*/ // */
@ApiOperation(value = "获取用户手机号登录接口", notes = "获取用户手机号登录接口", httpMethod = "POST") // @ApiOperation(value = "获取用户手机号登录接口", notes = "获取用户手机号登录接口", httpMethod = "POST")
@ApiImplicitParams({ // @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"), // @ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String"),
@ApiImplicitParam(name = "sms", value = "短信验证码", required = true, dataType = "String")}) // @ApiImplicitParam(name = "sms", value = "短信验证码", required = true, dataType = "String")})
@RequestMapping("/login/sms") // @RequestMapping("/login/sms")
public Result loginBySms(String userId, String sms)throws Exception{ // public Result loginBySms(String userId, String sms)throws Exception{
User users=null; // User users=null;
String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+""); // String key= StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.SMS_PRIFIX,userId,Constants.Sms.CodeType.LOGIN_OR_REGISTER+"");
String redisCode=redisUtils.getValue(key); // String redisCode=redisUtils.getValue(key);
if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){ // if(StringUtil.isBlank(redisCode) || !sms.equals(redisCode)){
throw new BaseException(ResultEnum.FAIL_VERIFY); // throw new BaseException(ResultEnum.FAIL_VERIFY);
} // }
redisUtils.delete(key); // redisUtils.delete(key);
//根据手机号判断用户是否存在 // //根据手机号判断用户是否存在
//不存在则保存用户信息 // //不存在则保存用户信息
users=userService.queryUsersByPhone(userId); // users=userService.queryUsersByPhone(userId);
if(null==users){ // if(null==users){
users=new User(); // users=new User();
// users.setAccount(phone); //// users.setAccount(phone);
// users.setUserName(phone); //// users.setUserName(phone);
// userService.qdtxAddUsers(users); //// userService.qdtxAddUsers(users);
} // }
String token=createToken(users); // String token=createToken(users);
if(!StringUtil.isBlank(token)){ // if(!StringUtil.isBlank(token)){
return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token)); // return ResultUtils.returnDataSuccess(StringUtil.createSimpleMap("token",token));
} // }
return ResultUtils.returnFail(); // return ResultUtils.returnFail();
} // }
//
public String createToken(User users)throws Exception{ // public String createToken(User users)throws Exception{
String token=StringUtil.createToken(); // String token=StringUtil.createToken();
//保存token // //保存token
String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token); // String tokenKey=StringUtil.formatKeyWithPrefix(Constants.RedisKey.PROJECT_PRIFIX,Constants.RedisKey.TOKEN_PRIFIX,token);
UsersDto usersDto=new UsersDto(); // UsersDto usersDto=new UsersDto();
BeanUtils.copyProperties(users,usersDto); // BeanUtils.copyProperties(users,usersDto);
redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT); // redisUtils.set(tokenKey, JSONObject.toJSONString(usersDto),Constants.Duration.HALF_HOUR_INT);
return token; // return token;
} // }
} }
package cn.wisenergy.web.config; //package cn.wisenergy.web.config;
//
//
//
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter; //import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter; //import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; //import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; //import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
//
import java.nio.charset.Charset; //import java.nio.charset.Charset;
import java.util.List; //import java.util.List;
//
/** ///**
* 配置全局编码格式 utf-8 // * 配置全局编码格式 utf-8
* Created by m1991 on 2021/3/1 4:15 // * Created by m1991 on 2021/3/1 4:15
*/ // */
//
@Configuration //@Configuration
public class GlobalConversConfiguration extends WebMvcConfigurationSupport { //public class GlobalConversConfiguration extends WebMvcConfigurationSupport {
//
@Bean // @Bean
public HttpMessageConverter<String> responseBodyConverter() { // public HttpMessageConverter<String> responseBodyConverter() {
StringHttpMessageConverter converter = new StringHttpMessageConverter( // StringHttpMessageConverter converter = new StringHttpMessageConverter(
Charset.forName("UTF-8")); // Charset.forName("UTF-8"));
return converter; // return converter;
} // }
//
@Override // @Override
public void configureMessageConverters( // public void configureMessageConverters(
List<HttpMessageConverter<?>> converters) { // List<HttpMessageConverter<?>> converters) {
super.configureMessageConverters(converters); // super.configureMessageConverters(converters);
converters.add(responseBodyConverter()); // converters.add(responseBodyConverter());
} // }
//
@Override // @Override
public void configureContentNegotiation( // public void configureContentNegotiation(
ContentNegotiationConfigurer configurer) { // ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(false); // configurer.favorPathExtension(false);
} // }
} //}
//
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
/** /**
* oauth2过滤器 * oauth2过滤器
* @author 86187
*/ */
@Slf4j @Slf4j
public class AuthFilter extends AuthenticatingFilter { public class AuthFilter extends AuthenticatingFilter {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment