diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java index 7b49b3957..9a89aa1b9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java @@ -123,10 +123,14 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActiveRecommend::getId,id); + lambdaQueryWrapper.eq(ActiveRecommend::getStoreId,TokenUtil.getNowAccountInfo().getStoreId()); + ActiveRecommend activeRecommend = getOne(lambdaQueryWrapper); + //ActiveRecommend activeRecommend = getById(id); //获取兑换物品信息 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ActiveRecommendChild::getActiveRecommendId,id); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java index ed4fa2dda..d4fa90939 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java @@ -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"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java index 17efbb2d4..14233fa18 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java @@ -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 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); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java index 0db3ed557..a8d0f9749 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/AccountInfo.java @@ -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; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/SMSUtils.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/SMSUtils.java index 05853e4b6..aafb53546 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/SMSUtils.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/SMSUtils.java @@ -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(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java index ed678ab07..0f515ca75 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java @@ -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, "登录信息已失效,请重新登录"); }