修改Bug
This commit is contained in:
parent
87147fbcf3
commit
492179cb24
@ -123,10 +123,14 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
|
|||||||
activeConsumptionVO.setActiveGift(s.getActiveGift().split(","));
|
activeConsumptionVO.setActiveGift(s.getActiveGift().split(","));
|
||||||
//获取会员等级
|
//获取会员等级
|
||||||
String str = "";
|
String str = "";
|
||||||
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
|
||||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
||||||
|
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||||
|
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeConsumptionVO.setDieselUserLevel(str.split(","));
|
||||||
}
|
}
|
||||||
activeConsumptionVO.setDieselUserLevel(str.split(","));
|
|
||||||
activeConsumptionVO.setActiveConsumptionChildList(activeConsumptionChildList);
|
activeConsumptionVO.setActiveConsumptionChildList(activeConsumptionChildList);
|
||||||
return activeConsumptionVO;
|
return activeConsumptionVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -123,10 +123,14 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
|
|||||||
.toArray(Integer[]::new));
|
.toArray(Integer[]::new));
|
||||||
//获取会员等级
|
//获取会员等级
|
||||||
String str = "";
|
String str = "";
|
||||||
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
|
||||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
||||||
|
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||||
|
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeDiscountVO.setDieselUserLevel(str.split(","));
|
||||||
}
|
}
|
||||||
activeDiscountVO.setDieselUserLevel(str.split(","));
|
|
||||||
activeDiscountVO.setActiveDiscountChildList(activeDiscountChildList);
|
activeDiscountVO.setActiveDiscountChildList(activeDiscountChildList);
|
||||||
return activeDiscountVO;
|
return activeDiscountVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -120,10 +120,14 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
|
|||||||
.toArray(Integer[]::new));
|
.toArray(Integer[]::new));
|
||||||
//获取会员等级
|
//获取会员等级
|
||||||
String str = "";
|
String str = "";
|
||||||
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
|
||||||
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
for (String gradeId : s.getDieselUserLevel().split(",")) {
|
||||||
|
if (ObjectUtils.isNotEmpty(userGradeService.selectUserGradeById(Integer.parseInt(gradeId)))){
|
||||||
|
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeFullminusVO.setDieselUserLevel(str.split(","));
|
||||||
}
|
}
|
||||||
activeFullminusVO.setDieselUserLevel(str.split(","));
|
|
||||||
activeFullminusVO.setActiveDiscountChildList(activeDiscountChildList);
|
activeFullminusVO.setActiveDiscountChildList(activeDiscountChildList);
|
||||||
return activeFullminusVO;
|
return activeFullminusVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -91,7 +91,11 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
|
|||||||
activeRecommendVO.setInviterGiftType(new String[0]);
|
activeRecommendVO.setInviterGiftType(new String[0]);
|
||||||
if (ObjectUtils.isNotEmpty(id)){
|
if (ObjectUtils.isNotEmpty(id)){
|
||||||
//获取新人有礼活动信息
|
//获取新人有礼活动信息
|
||||||
ActiveRecommend activeRecommend = getById(id);
|
LambdaQueryWrapper<ActiveRecommend> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(ActiveRecommend::getId,id);
|
||||||
|
lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
|
ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper);
|
||||||
|
//ActiveRecommend activeRecommend = getById(id);
|
||||||
//获取兑换物品信息
|
//获取兑换物品信息
|
||||||
LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ActiveRecommendChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,id);
|
queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,id);
|
||||||
|
@ -117,7 +117,7 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||||
}
|
}
|
||||||
//活动时间
|
|
||||||
cardFuelDiesel.setStartTime(new Date());
|
cardFuelDiesel.setStartTime(new Date());
|
||||||
cardFuelDiesel.setEndTime(new Date());
|
cardFuelDiesel.setEndTime(new Date());
|
||||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||||
|
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -115,11 +116,13 @@ public class CardValueController extends BaseController {
|
|||||||
queryWrapper.eq(CardValueChild::getCardValueId,id);
|
queryWrapper.eq(CardValueChild::getCardValueId,id);
|
||||||
queryWrapper.orderByDesc(CardValueChild::getCreateTime);
|
queryWrapper.orderByDesc(CardValueChild::getCreateTime);
|
||||||
List<CardValueChild> activeNewlywedsChildList = cardValueChildService.list(queryWrapper);
|
List<CardValueChild> activeNewlywedsChildList = cardValueChildService.list(queryWrapper);
|
||||||
|
BeanUtils.copyProperties(cardValue,cardValueVO);
|
||||||
|
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
|
||||||
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
|
||||||
//封装VO返回
|
//封装VO返回
|
||||||
BeanUtils.copyProperties(cardValue,cardValueVO);
|
|
||||||
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
|
|
||||||
cardValueVO.setCardValueChildList(activeNewlywedsChildList);
|
cardValueVO.setCardValueChildList(activeNewlywedsChildList);
|
||||||
|
}else {
|
||||||
|
cardValueVO.setCardValueChildList(new ArrayList<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getSuccessResult(cardValueVO);
|
return getSuccessResult(cardValueVO);
|
||||||
|
@ -17,6 +17,7 @@ public class AccountInfo implements Serializable {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
private String accountKey;
|
private String accountKey;
|
||||||
private String accountName;
|
private String accountName;
|
||||||
|
private String roleName;
|
||||||
private int accountStatus;
|
private int accountStatus;
|
||||||
private String isActive;
|
private String isActive;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
@ -19,7 +19,7 @@ public class SMSUtils {
|
|||||||
* @param param 参数
|
* @param param 参数
|
||||||
*/
|
*/
|
||||||
public static void sendMessage(String signName, String templateCode,String phoneNumbers,String param){
|
public static void sendMessage(String signName, String templateCode,String phoneNumbers,String param){
|
||||||
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "", "");
|
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI5t7GEqGL46cwjYs6aanu", "d9MpwlyXbHOTrQaA5n8URVz40x5AX3");
|
||||||
IAcsClient client = new DefaultAcsClient(profile);
|
IAcsClient client = new DefaultAcsClient(profile);
|
||||||
|
|
||||||
SendSmsRequest request = new SendSmsRequest();
|
SendSmsRequest request = new SendSmsRequest();
|
||||||
|
@ -3,6 +3,8 @@ package com.fuint.module.backendApi.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.api.R;
|
import com.baomidou.mybatisplus.extension.api.R;
|
||||||
|
import com.fuint.business.userManager.entity.LJUser;
|
||||||
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.dto.UserDto;
|
import com.fuint.common.dto.UserDto;
|
||||||
import com.fuint.common.enums.AdminRoleEnum;
|
import com.fuint.common.enums.AdminRoleEnum;
|
||||||
@ -22,6 +24,7 @@ import com.fuint.system.role.service.DutyService;
|
|||||||
import com.fuint.utils.StringUtil;
|
import com.fuint.utils.StringUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
@ -69,6 +72,8 @@ public class BackendLoginController extends BaseController {
|
|||||||
* */
|
* */
|
||||||
@Resource
|
@Resource
|
||||||
private CaptchaService captchaService;
|
private CaptchaService captchaService;
|
||||||
|
@Autowired
|
||||||
|
private LJUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
@ -119,7 +124,7 @@ public class BackendLoginController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后台登录
|
* 发送手机验证码
|
||||||
* */
|
* */
|
||||||
@ApiOperation(value = "发送手机验证码")
|
@ApiOperation(value = "发送手机验证码")
|
||||||
@RequestMapping(value="/sendMsg", method = RequestMethod.POST)
|
@RequestMapping(value="/sendMsg", method = RequestMethod.POST)
|
||||||
@ -128,37 +133,49 @@ public class BackendLoginController extends BaseController {
|
|||||||
//获取手机号
|
//获取手机号
|
||||||
String phone = userDto.getMobile();
|
String phone = userDto.getMobile();
|
||||||
if(StringUtils.isNotEmpty(phone)){
|
if(StringUtils.isNotEmpty(phone)){
|
||||||
|
//获取用户信息
|
||||||
|
LJUser ljUser = userService.selectUserByMobile(phone);
|
||||||
|
if (ObjectUtils.isEmpty(ljUser)){
|
||||||
|
return getSuccessResult("用户不存在,请先注册账号!");
|
||||||
|
}
|
||||||
//生成随机的四位验证码
|
//生成随机的四位验证码
|
||||||
String code = ValidateCodeUtils.verificationCode(4);
|
String code = ValidateCodeUtils.verificationCode(4);
|
||||||
|
//String code = "1234";
|
||||||
//调用阿里云提供的短信服务API完成发送短信
|
//调用阿里云提供的短信服务API完成发送短信
|
||||||
SMSUtils.sendMessage("蓝鲸智慧油站","SMS_154950909",phone,code);
|
SMSUtils.sendMessage("阿里云短信测试","SMS_154950909",phone,code);
|
||||||
//需要将生成的验证码保存到redis,过期时间60s
|
//SMSUtils.sendMessage("蓝鲸智慧油站", "SMS_291345282",phone,code);
|
||||||
redisTemplate.opsForValue().set(phone,code,60, TimeUnit.SECONDS);
|
//需要将生成的验证码保存到redis,过期时间300s
|
||||||
|
redisTemplate.opsForValue().set(phone,code,300, TimeUnit.SECONDS);
|
||||||
return getSuccessResult("手机验证码发送成功");
|
return getSuccessResult("手机验证码发送成功");
|
||||||
}
|
}
|
||||||
return getFailureResult("短信发送失败");
|
return getFailureResult("短信发送失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*手机验证码登录
|
||||||
* @param map
|
* @param map
|
||||||
* @param session
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/loginByPhone")
|
@PostMapping("/loginByPhone")
|
||||||
public ResponseObject loginByPhone(@RequestBody Map map) {
|
public ResponseObject loginByPhone(@RequestBody Map map) {
|
||||||
//获取手机号 1234
|
//获取手机号
|
||||||
String phone = map.get("mobile").toString();
|
String phone = map.get("mobile").toString();
|
||||||
|
//获取用户信息
|
||||||
|
LJUser ljUser = userService.selectUserByMobile(phone);
|
||||||
//获取验证码
|
//获取验证码
|
||||||
String code = map.get("code").toString();
|
String code = map.get("code").toString();
|
||||||
//从redis中获取保存的验证码
|
//从redis中获取保存的验证码
|
||||||
Object codeInRedis = redisTemplate.opsForValue().get(phone);
|
Object codeInRedis = redisTemplate.opsForValue().get(phone);
|
||||||
//进行验证码的比对
|
//进行验证码的比对
|
||||||
if (codeInRedis != null && codeInRedis.equals(code)) {
|
if (codeInRedis != null && codeInRedis.equals(code) && ObjectUtils.isNotEmpty(ljUser)) {
|
||||||
//如果能够比对成功,说明登录成功
|
//如果能够比对成功,说明登录成功
|
||||||
return getSuccessResult("登录成功!");
|
return getSuccessResult("登录成功!",ljUser);
|
||||||
|
}else if (codeInRedis != null && codeInRedis.equals(code) && ObjectUtils.isEmpty(ljUser)){
|
||||||
|
return getSuccessResult("用户不存在,请先注册账号!");
|
||||||
|
}else {
|
||||||
|
return getFailureResult("登录失败,请输入正确的验证码");
|
||||||
}
|
}
|
||||||
return getFailureResult("登录失败,请输入正确的验证码");
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取登录信息接口
|
* 获取登录信息接口
|
||||||
@ -168,6 +185,11 @@ public class BackendLoginController extends BaseController {
|
|||||||
public ResponseObject getInfo(HttpServletRequest request) throws BusinessCheckException {
|
public ResponseObject getInfo(HttpServletRequest request) throws BusinessCheckException {
|
||||||
String token = request.getHeader("Access-Token");
|
String token = request.getHeader("Access-Token");
|
||||||
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
||||||
|
if (ObjectUtils.isNotEmpty(accountInfo.getRoleIds()) &&
|
||||||
|
ObjectUtils.isNotEmpty((long)Integer.parseInt(accountInfo.getRoleIds())) &&
|
||||||
|
ObjectUtils.isNotEmpty(dutyService.getRoleById((long)Integer.parseInt(accountInfo.getRoleIds())))){
|
||||||
|
accountInfo.setRoleName(dutyService.getRoleById((long)Integer.parseInt(accountInfo.getRoleIds())).getDutyName());
|
||||||
|
}
|
||||||
if (accountInfo == null) {
|
if (accountInfo == null) {
|
||||||
return getFailureResult(401, "登录信息已失效,请重新登录");
|
return getFailureResult(401, "登录信息已失效,请重新登录");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user