修改Bug

This commit is contained in:
齐天大圣 2023-11-25 14:41:54 +08:00
parent 87147fbcf3
commit 492179cb24
9 changed files with 66 additions and 24 deletions

View File

@ -123,10 +123,14 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
activeConsumptionVO.setActiveGift(s.getActiveGift().split(","));
//获取会员等级
String str = "";
for (String gradeId : s.getDieselUserLevel().split(",")) {
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
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);
return activeConsumptionVO;
}).collect(Collectors.toList());

View File

@ -123,10 +123,14 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
.toArray(Integer[]::new));
//获取会员等级
String str = "";
for (String gradeId : s.getDieselUserLevel().split(",")) {
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
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);
return activeDiscountVO;
}).collect(Collectors.toList());

View File

@ -120,10 +120,14 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
.toArray(Integer[]::new));
//获取会员等级
String str = "";
for (String gradeId : s.getDieselUserLevel().split(",")) {
str += userGradeService.selectUserGradeById(Integer.parseInt(gradeId)).getName() + ",";
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){
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);
return activeFullminusVO;
}).collect(Collectors.toList());

View File

@ -91,7 +91,11 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
activeRecommendVO.setInviterGiftType(new String[0]);
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<>();
queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,id);

View File

@ -117,7 +117,7 @@ public class CardFuelDieselController extends BaseController {
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
}
//活动时间
cardFuelDiesel.setStartTime(new Date());
cardFuelDiesel.setEndTime(new Date());
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");

View File

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -115,11 +116,13 @@ public class CardValueController extends BaseController {
queryWrapper.eq(CardValueChild::getCardValueId,id);
queryWrapper.orderByDesc(CardValueChild::getCreateTime);
List<CardValueChild> activeNewlywedsChildList = cardValueChildService.list(queryWrapper);
BeanUtils.copyProperties(cardValue,cardValueVO);
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){
//封装VO返回
BeanUtils.copyProperties(cardValue,cardValueVO);
cardValueVO.setMembershipLevel(cardValue.getMembershipLevel().split(","));
cardValueVO.setCardValueChildList(activeNewlywedsChildList);
}else {
cardValueVO.setCardValueChildList(new ArrayList<>());
}
}
return getSuccessResult(cardValueVO);

View File

@ -17,6 +17,7 @@ public class AccountInfo implements Serializable {
private Integer id;
private String accountKey;
private String accountName;
private String roleName;
private int accountStatus;
private String isActive;
private Date createDate;

View File

@ -19,7 +19,7 @@ public class SMSUtils {
* @param 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);
SendSmsRequest request = new SendSmsRequest();

View File

@ -3,6 +3,8 @@ package com.fuint.module.backendApi.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
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.UserDto;
import com.fuint.common.enums.AdminRoleEnum;
@ -22,6 +24,7 @@ import com.fuint.system.role.service.DutyService;
import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
@ -69,6 +72,8 @@ public class BackendLoginController extends BaseController {
* */
@Resource
private CaptchaService captchaService;
@Autowired
private LJUserService userService;
@Autowired
public RedisTemplate redisTemplate;
@ -119,7 +124,7 @@ public class BackendLoginController extends BaseController {
}
/**
* 后台登录
* 发送手机验证码
* */
@ApiOperation(value = "发送手机验证码")
@RequestMapping(value="/sendMsg", method = RequestMethod.POST)
@ -128,37 +133,49 @@ public class BackendLoginController extends BaseController {
//获取手机号
String phone = userDto.getMobile();
if(StringUtils.isNotEmpty(phone)){
//获取用户信息
LJUser ljUser = userService.selectUserByMobile(phone);
if (ObjectUtils.isEmpty(ljUser)){
return getSuccessResult("用户不存在,请先注册账号!");
}
//生成随机的四位验证码
String code = ValidateCodeUtils.verificationCode(4);
//String code = "1234";
//调用阿里云提供的短信服务API完成发送短信
SMSUtils.sendMessage("蓝鲸智慧油站","SMS_154950909",phone,code);
//需要将生成的验证码保存到redis,过期时间60s
redisTemplate.opsForValue().set(phone,code,60, TimeUnit.SECONDS);
SMSUtils.sendMessage("阿里云短信测试","SMS_154950909",phone,code);
//SMSUtils.sendMessage("蓝鲸智慧油站", "SMS_291345282",phone,code);
//需要将生成的验证码保存到redis,过期时间300s
redisTemplate.opsForValue().set(phone,code,300, TimeUnit.SECONDS);
return getSuccessResult("手机验证码发送成功");
}
return getFailureResult("短信发送失败");
}
/**
*
*手机验证码登录
* @param map
* @param session
* @param
* @return
*/
@PostMapping("/loginByPhone")
public ResponseObject loginByPhone(@RequestBody Map map) {
//获取手机号 1234
//获取手机号
String phone = map.get("mobile").toString();
//获取用户信息
LJUser ljUser = userService.selectUserByMobile(phone);
//获取验证码
String code = map.get("code").toString();
//从redis中获取保存的验证码
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 {
String token = request.getHeader("Access-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) {
return getFailureResult(401, "登录信息已失效,请重新登录");
}