Commit a7402e90 authored by licc's avatar licc

本地启动

parent d4d97cc7
......@@ -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() {
......
......@@ -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;
}
......@@ -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();
}
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;
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
......
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;
* 配置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);
}
}
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";
}
......
......@@ -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;
// }
}
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);
// }
//}
//
......@@ -21,6 +21,7 @@ import java.io.IOException;
/**
* oauth2过滤器
* @author 86187
*/
@Slf4j
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