This commit is contained in:
sxu 2025-02-02 22:22:02 +08:00
parent 1248591c91
commit 85d88f01d0
49 changed files with 207 additions and 201 deletions

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
public enum DelFlagEnum { public enum DelFlagEnum {
DEL_TRUE(1, "删除"), DEL_TRUE(1, "删除"),

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
/** /**
* 全局常量 * 全局常量

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
public enum LeCodeUseSceneEnum { public enum LeCodeUseSceneEnum {
PAIRING(1, "配餐"), PAIRING(1, "配餐"),

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
public interface LeConstants { public interface LeConstants {
String ID_TEMPORARY_PRE = "xnznkjxnznkj"; String ID_TEMPORARY_PRE = "xnznkjxnznkj";

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
public enum RetCodeEnum { public enum RetCodeEnum {
SUCC(10000, "成功"), SUCC(10000, "成功"),

View File

@ -1,4 +1,4 @@
package net.xnzn.constant; package com.bonus.constant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package net.xnzn.domain; package com.bonus.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@ -0,0 +1,54 @@
//package com.bonus.service;
//
//import com.bonus.common.core.constant.CacheConstants;
//import com.bonus.common.core.utils.StringUtils;
//import com.bonus.common.core.utils.VerificationCodeUtils;
//import com.bonus.common.redis.service.RedisService;
//import com.bonus.common.security.config.VerificationCodeConfig;
//import org.springframework.mail.SimpleMailMessage;
//import org.springframework.mail.javamail.JavaMailSender;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.concurrent.TimeUnit;
//
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
//
///**
// * @author bonus
// */
//@Service
//public class EmailService {
// @Resource
// private VerificationCodeConfig verificationCodeConfig;
// @Resource
// private RedisService redisService;
// @Resource
// private JavaMailSender mailSender;
//
// /**
// * 发送简单邮件
// *
// * @param to 接收者邮箱地址
// */
// public String sendSimpleEmail(String to) {
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
// String str = verificationCodeConfig.getContent().replace("<code>", code);
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
// SimpleMailMessage message = new SimpleMailMessage();
// // 发件人邮箱地址
// message.setFrom("2642480752@qq.com");
// // 收件人邮箱地址
// message.setTo(to);
// // 邮件主题
// message.setSubject(verificationCodeConfig.getTitle());
// // 邮件内容
// message.setText(str);
// // 发送邮件
// mailSender.send(message);
// String uuid = StringUtils.randomUUID();
// String verifyKey = CacheConstants.VERIFICATION_CODE + uuid;
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
// return uuid;
// }
//}

View File

@ -0,0 +1,52 @@
//package com.bonus.service;
//
//import com.bonus.common.core.constant.CacheConstants;
//import com.bonus.common.core.exception.CaptchaException;
//import com.bonus.common.core.utils.StringUtils;
//import com.bonus.common.core.utils.VerificationCodeUtils;
//import com.bonus.common.core.utils.sms.SmsUtils;
//import com.bonus.common.redis.service.RedisService;
//import com.bonus.common.security.config.VerificationCodeConfig;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.concurrent.TimeUnit;
//
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
//
///**
// * @author bonus
// */
//@Component
//public class SmsService {
// @Resource
// private VerificationCodeConfig verificationCodeConfig;
// @Resource
// private RedisService redisService;
//
// /**
// * 生成手机验证码
// *
// * @return AjaxResult
// * @throws CaptchaException 自定义captcha 异常
// */
// public void sendSimplePhone(String to) {
// if (StringUtils.isEmpty(to)) {
// throw new CaptchaException("手机号不能为空");
// }
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
// String str = verificationCodeConfig.getContent().replace("<code>", code);
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
// String s = SmsUtils.smsToken(to, str, "");
// if (StringUtils.isNotEmpty(s)) {
// if (s.contains("ok")) {
// String verifyKey = CacheConstants.VERIFICATION_CODE + StringUtils.nvl(to, "");
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
// } else {
// throw new CaptchaException("获取短信失败");
// }
// } else {
// throw new CaptchaException("获取短信失败");
// }
// }
//}

View File

@ -1,4 +1,4 @@
package net.xnzn.utils; package com.bonus.utils;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -59,6 +59,8 @@ public class AesEncryptUtil {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(aesEncrypt("Bonus$2026")); System.out.println(aesEncrypt("Bonus$2026"));
System.out.println(aesDecode("PCAGz8j5ByU2AzoT6vtlLA==")); System.out.println(aesDecode("PCAGz8j5ByU2AzoT6vtlLA=="));
System.out.println(aesEncrypt("Bonus$2027"));
System.out.println(aesDecode("MF1Nui79h/OHRGoUx1jhcg=="));
System.out.println(aesEncrypt("18110922397")); System.out.println(aesEncrypt("18110922397"));
System.out.println(aesDecode("poEWO1yyC/EaUR9vmrrNSA==")); System.out.println(aesDecode("poEWO1yyC/EaUR9vmrrNSA=="));
System.out.println(aesDecode("poEWO1yyC/EaUR9vmrrNSA==")); System.out.println(aesDecode("poEWO1yyC/EaUR9vmrrNSA=="));

View File

@ -1,4 +1,4 @@
package net.xnzn.utils; package com.bonus.utils;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package net.xnzn.utils; package com.bonus.utils;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;

View File

@ -1,4 +1,4 @@
package net.xnzn.utils; package com.bonus.utils;
import cn.hutool.core.util.DesensitizedUtil; import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;

View File

@ -1,54 +0,0 @@
package net.xnzn.service;
import com.bonus.common.core.constant.CacheConstants;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.VerificationCodeUtils;
import com.bonus.common.redis.service.RedisService;
import com.bonus.common.security.config.VerificationCodeConfig;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
/**
* @author bonus
*/
@Service
public class EmailService {
@Resource
private VerificationCodeConfig verificationCodeConfig;
@Resource
private RedisService redisService;
@Resource
private JavaMailSender mailSender;
/**
* 发送简单邮件
*
* @param to 接收者邮箱地址
*/
public String sendSimpleEmail(String to) {
String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
String str = verificationCodeConfig.getContent().replace("<code>", code);
str = str.replace("<time>", verificationCodeConfig.getTime().toString());
SimpleMailMessage message = new SimpleMailMessage();
// 发件人邮箱地址
message.setFrom("2642480752@qq.com");
// 收件人邮箱地址
message.setTo(to);
// 邮件主题
message.setSubject(verificationCodeConfig.getTitle());
// 邮件内容
message.setText(str);
// 发送邮件
mailSender.send(message);
String uuid = StringUtils.randomUUID();
String verifyKey = CacheConstants.VERIFICATION_CODE + uuid;
redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
return uuid;
}
}

View File

@ -1,52 +0,0 @@
package net.xnzn.service;
import com.bonus.common.core.constant.CacheConstants;
import com.bonus.common.core.exception.CaptchaException;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.VerificationCodeUtils;
import com.bonus.common.core.utils.sms.SmsUtils;
import com.bonus.common.redis.service.RedisService;
import com.bonus.common.security.config.VerificationCodeConfig;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
/**
* @author bonus
*/
@Component
public class SmsService {
@Resource
private VerificationCodeConfig verificationCodeConfig;
@Resource
private RedisService redisService;
/**
* 生成手机验证码
*
* @return AjaxResult
* @throws CaptchaException 自定义captcha 异常
*/
public void sendSimplePhone(String to) {
if (StringUtils.isEmpty(to)) {
throw new CaptchaException("手机号不能为空");
}
String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
String str = verificationCodeConfig.getContent().replace("<code>", code);
str = str.replace("<time>", verificationCodeConfig.getTime().toString());
String s = SmsUtils.smsToken(to, str, "");
if (StringUtils.isNotEmpty(s)) {
if (s.contains("ok")) {
String verifyKey = CacheConstants.VERIFICATION_CODE + StringUtils.nvl(to, "");
redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
} else {
throw new CaptchaException("获取短信失败");
}
} else {
throw new CaptchaException("获取短信失败");
}
}
}

View File

@ -2,7 +2,7 @@ package com.bonus.auth.api;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.redis.service.RedisService; import com.bonus.common.redis.service.RedisService;
import net.xnzn.domain.SmsCodeVerifyDTO; import com.bonus.domain.SmsCodeVerifyDTO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -2,22 +2,22 @@ package com.bonus.auth.controller;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.bonus.auth.mapper.AuthCustInfoMapper;
import com.bonus.common.core.constant.CacheConstants; import com.bonus.common.core.constant.CacheConstants;
import com.bonus.auth.api.SmsCodeApi; import com.bonus.auth.api.SmsCodeApi;
import net.xnzn.constant.CustLoginTypeEnum; import com.bonus.constant.CustLoginTypeEnum;
import net.xnzn.constant.DelFlagEnum; import com.bonus.constant.DelFlagEnum;
import net.xnzn.constant.LeConstants; import com.bonus.constant.LeConstants;
import net.xnzn.domain.CustCasual; import com.bonus.domain.CustCasual;
import net.xnzn.domain.CustInfo; import com.bonus.domain.CustInfo;
import net.xnzn.domain.CustInfoAppIdLoginVO; import com.bonus.domain.CustInfoAppIdLoginVO;
import com.bonus.auth.form.LoginBody; import com.bonus.auth.form.LoginBody;
import com.bonus.auth.mapper.CustCasualMapper; import com.bonus.auth.mapper.AuthCustCasualMapper;
import com.bonus.auth.mapper.CustInfoMapper;
import com.bonus.auth.service.*; import com.bonus.auth.service.*;
import net.xnzn.domain.SmsCodeVerifyDTO; import com.bonus.domain.SmsCodeVerifyDTO;
import net.xnzn.utils.AesEncryptUtil; import com.bonus.utils.AesEncryptUtil;
import net.xnzn.utils.Id; import com.bonus.utils.Id;
import net.xnzn.utils.SM4EncryptUtils; import com.bonus.utils.SM4EncryptUtils;
import com.bonus.common.core.domain.R; import com.bonus.common.core.domain.R;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.JwtUtils; import com.bonus.common.core.utils.JwtUtils;
@ -68,10 +68,10 @@ public class TokenController {
private SmsCodeApi smsCodeApi; private SmsCodeApi smsCodeApi;
@Autowired @Autowired
private CustInfoMapper custInfoMapper; private AuthCustInfoMapper custInfoMapper;
@Autowired @Autowired
private CustCasualMapper custCasualMapper; private AuthCustCasualMapper authCustCasualMapper;
private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
//private static final String CUST_LOGIN_TOKEN_KEY = "cust_login_tokens:"; //private static final String CUST_LOGIN_TOKEN_KEY = "cust_login_tokens:";
@ -162,7 +162,7 @@ public class TokenController {
public CustInfoAppIdLoginVO addOrUpdateCustCasual(Integer sourceType, CustInfoAppIdLoginVO result) { public CustInfoAppIdLoginVO addOrUpdateCustCasual(Integer sourceType, CustInfoAppIdLoginVO result) {
Long custId = result.getCustId(); Long custId = result.getCustId();
CustCasual custCasual = this.custCasualMapper.selectCustCasualByCustId(custId, sourceType, DelFlagEnum.DEL_FALSE.key()); CustCasual custCasual = this.authCustCasualMapper.selectCustCasualByCustId(custId, sourceType, DelFlagEnum.DEL_FALSE.key());
String openid; String openid;
if (Objects.isNull(custCasual)) { if (Objects.isNull(custCasual)) {
CustCasual insertCasual = new CustCasual(); CustCasual insertCasual = new CustCasual();
@ -173,12 +173,12 @@ public class TokenController {
insertCasual.setMobile(result.getMobile()); insertCasual.setMobile(result.getMobile());
insertCasual.setOpenid(openid); insertCasual.setOpenid(openid);
insertCasual.setSourceType(sourceType); insertCasual.setSourceType(sourceType);
this.custCasualMapper.addCustCasual(insertCasual); this.authCustCasualMapper.addCustCasual(insertCasual);
} else { } else {
openid = custCasual.getOpenid(); openid = custCasual.getOpenid();
if (StringUtils.isBlank(openid)) { if (StringUtils.isBlank(openid)) {
openid = IdUtil.simpleUUID(); openid = IdUtil.simpleUUID();
this.custCasualMapper.updateCustCasual(custCasual); this.authCustCasualMapper.updateCustCasual(custCasual);
} }
} }
@ -219,7 +219,7 @@ public class TokenController {
tokenService.delExistingToken(Long.valueOf(userId)); tokenService.delExistingToken(Long.valueOf(userId));
Long custId = Long.parseLong(headers.get("custId")); Long custId = Long.parseLong(headers.get("custId"));
String openId = (String)headers.get("openid"); String openId = (String)headers.get("openid");
custCasualMapper.updateByCustIdAndOpenId(custId, LeConstants.COMMON_NO, openId); authCustCasualMapper.updateByCustIdAndOpenId(custId, LeConstants.COMMON_NO, openId);
sysLoginService.logout(username, userId); sysLoginService.logout(username, userId);
logService.saveLogout(username, "退出登录", "退出成功", userId, "成功"); logService.saveLogout(username, "退出登录", "退出成功", userId, "成功");
} }

View File

@ -1,14 +1,14 @@
package com.bonus.auth.mapper; package com.bonus.auth.mapper;
import net.xnzn.domain.CustCasual; import com.bonus.domain.CustCasual;
import net.xnzn.domain.CustCasualModel; import com.bonus.domain.CustCasualModel;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface CustCasualMapper { public interface AuthCustCasualMapper {
List<CustCasualModel> queryPageCustCasual(@Param("custCasual") CustCasual custCasual); List<CustCasualModel> queryPageCustCasual(@Param("custCasual") CustCasual custCasual);
String selectOpenidByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel); String selectOpenidByCustId(@Param("custId") Long custId, @Param("sourceType") Integer sourceType, @Param("ifDel") Integer ifDel);

View File

@ -1,11 +1,11 @@
package com.bonus.auth.mapper; package com.bonus.auth.mapper;
import net.xnzn.domain.CustInfo; import com.bonus.domain.CustInfo;
import net.xnzn.domain.CustInfoAppIdLoginVO; import com.bonus.domain.CustInfoAppIdLoginVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CustInfoMapper { public interface AuthCustInfoMapper {
CustInfoAppIdLoginVO selectLoginInfo(CustInfo custInfo); CustInfoAppIdLoginVO selectLoginInfo(CustInfo custInfo);
} }

View File

@ -10,7 +10,7 @@ import com.bonus.common.redis.service.RedisService;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.config.SystemConfig; import com.bonus.config.SystemConfig;
import com.bonus.system.api.RemoteUserService; import com.bonus.system.api.RemoteUserService;
import net.xnzn.domain.CustInfoAppIdLoginVO; import com.bonus.domain.CustInfoAppIdLoginVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bonus.auth.mapper.CustCasualMapper"> <mapper namespace="com.bonus.auth.mapper.AuthCustCasualMapper">
<resultMap id="custCasualMap" type="net.xnzn.domain.CustCasual"> <resultMap id="custCasualMap" type="com.bonus.domain.CustCasual">
<id property="id" column="id"/> <id property="id" column="id"/>
<result property="casualId" column="casual_id"/> <result property="casualId" column="casual_id"/>
<result property="casualName" column="casual_name"/> <result property="casualName" column="casual_name"/>
@ -21,7 +21,7 @@
</resultMap> </resultMap>
<resultMap id="custCasualModel" extends="custCasualMap" <resultMap id="custCasualModel" extends="custCasualMap"
type="net.xnzn.domain.CustCasualModel"> type="com.bonus.domain.CustCasualModel">
<result property="custNum" column="cust_num"/> <result property="custNum" column="cust_num"/>
<result property="custName" column="cust_name"/> <result property="custName" column="cust_name"/>
<result property="age" column="age"/> <result property="age" column="age"/>
@ -29,7 +29,7 @@
<!-- 分页查询临时人员,并关联查询相关人员信息 --> <!-- 分页查询临时人员,并关联查询相关人员信息 -->
<select id="queryPageCustCasual" resultMap="custCasualModel" <select id="queryPageCustCasual" resultMap="custCasualModel"
parameterType="net.xnzn.domain.CustCasual"> parameterType="com.bonus.domain.CustCasual">
select * select *
from cust_casual t1 from cust_casual t1
left join cust_info t2 on t1.cust_id = t2.cust_id left join cust_info t2 on t1.cust_id = t2.cust_id
@ -59,7 +59,7 @@
select openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel} select openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}
</select> </select>
<select id="selectCustCasualByCustId" resultType="net.xnzn.domain.CustCasual"> <select id="selectCustCasualByCustId" resultType="com.bonus.domain.CustCasual">
select casual_id, openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel} select casual_id, openid from cust_casual where cust_id = #{custId} and source_type = #{sourceType} and if_del = #{ifDel}
</select> </select>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bonus.auth.mapper.CustInfoMapper"> <mapper namespace="com.bonus.auth.mapper.AuthCustInfoMapper">
<!--根据人员id集合获取人员信息--> <!--根据人员id集合获取人员信息-->
<select id="selectLoginInfo" resultType="net.xnzn.domain.CustInfoAppIdLoginVO"> <select id="selectLoginInfo" resultType="com.bonus.domain.CustInfoAppIdLoginVO">
select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd
from cust_info from cust_info
<where> <where>

View File

@ -1,4 +1,4 @@
package net.xnzn.core; package com.bonus.core;
import com.bonus.common.security.annotation.EnableCustomConfig; import com.bonus.common.security.annotation.EnableCustomConfig;
import com.bonus.common.security.annotation.EnableRyFeignClients; import com.bonus.common.security.annotation.EnableRyFeignClients;
@ -19,7 +19,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling @EnableScheduling
@EnableRyFeignClients @EnableRyFeignClients
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@MapperScan("net.xnzn.core")
public class BonusSmartCanteenApplication public class BonusSmartCanteenApplication
{ {
public static void main(String[] args) public static void main(String[] args)

View File

@ -1,6 +1,6 @@
package net.xnzn.core.customer.api; package com.bonus.core.customer.api;
import net.xnzn.core.customer.service.CustCasualRelationService; import com.bonus.core.customer.service.CustCasualRelationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -1,4 +1,4 @@
package net.xnzn.core.customer.constants; package com.bonus.core.customer.constants;
public enum PersonalStatusEnum { public enum PersonalStatusEnum {
NORMAL(1, "正常"), NORMAL(1, "正常"),

View File

@ -1,13 +1,13 @@
package net.xnzn.core.customer.controller; package com.bonus.core.customer.controller;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.utils.AesEncryptUtil;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.xnzn.core.customer.dto.CustChangePasswordDTO; import com.bonus.core.customer.dto.CustChangePasswordDTO;
import net.xnzn.core.customer.dto.CustForgetPasswordDTO; import com.bonus.core.customer.dto.CustForgetPasswordDTO;
import net.xnzn.core.customer.service.CustInfoService; import com.bonus.core.customer.service.CustInfoService;
import net.xnzn.utils.AesEncryptUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -33,8 +33,8 @@ public class CustInfoController extends BaseController {
@ApiOperation("忘记密码") @ApiOperation("忘记密码")
@PostMapping({"/forget/password"}) @PostMapping({"/forget/password"})
public AjaxResult forgetPassword(@Validated @RequestBody CustForgetPasswordDTO content) { public AjaxResult forgetPassword(@Validated @RequestBody CustForgetPasswordDTO content) {
// content.setMobile(AesEncryptUtil.aesDecode(content.getMobile())); //content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
// content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword())); //content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
this.custInfoService.custForgetPassword(content); this.custInfoService.custForgetPassword(content);
return success(); return success();
} }

View File

@ -1,4 +1,4 @@
package net.xnzn.core.customer.dto; package com.bonus.core.customer.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package net.xnzn.core.customer.dto; package com.bonus.core.customer.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,6 +1,6 @@
package net.xnzn.core.customer.mapper; package com.bonus.core.customer.mapper;
import net.xnzn.core.customer.model.CustCasualRelation; import com.bonus.core.customer.model.CustCasualRelation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper

View File

@ -1,8 +1,7 @@
package net.xnzn.core.customer.mapper; package com.bonus.core.customer.mapper;
import net.xnzn.domain.CustInfo; import com.bonus.domain.CustInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface CustInfoMapper { public interface CustInfoMapper {

View File

@ -1,4 +1,4 @@
package net.xnzn.core.customer.model; package com.bonus.core.customer.model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -1,14 +1,12 @@
package net.xnzn.core.customer.service; package com.bonus.core.customer.service;
import net.xnzn.constant.LeConstants; import com.bonus.core.customer.mapper.CustCasualRelationMapper;
import net.xnzn.core.customer.mapper.CustCasualRelationMapper; import com.bonus.core.customer.model.CustCasualRelation;
import net.xnzn.core.customer.model.CustCasualRelation; import com.bonus.constant.LeConstants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service @Service
public class CustCasualRelationService { public class CustCasualRelationService {

View File

@ -1,7 +1,7 @@
package net.xnzn.core.customer.service; package com.bonus.core.customer.service;
import net.xnzn.core.customer.dto.CustChangePasswordDTO; import com.bonus.core.customer.dto.CustChangePasswordDTO;
import net.xnzn.core.customer.dto.CustForgetPasswordDTO; import com.bonus.core.customer.dto.CustForgetPasswordDTO;
public interface CustInfoService { public interface CustInfoService {

View File

@ -1,19 +1,19 @@
package net.xnzn.core.customer.service.impl; package com.bonus.core.customer.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.core.constant.CacheConstants; import com.bonus.common.core.constant.CacheConstants;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.redis.service.RedisService; import com.bonus.common.redis.service.RedisService;
import net.xnzn.constant.RetCodeEnum; import com.bonus.core.customer.dto.CustChangePasswordDTO;
import net.xnzn.core.customer.api.CustCasualApi; import com.bonus.core.customer.dto.CustForgetPasswordDTO;
import net.xnzn.core.customer.dto.CustChangePasswordDTO; import com.bonus.core.customer.mapper.CustInfoMapper;
import net.xnzn.core.customer.dto.CustForgetPasswordDTO; import com.bonus.core.customer.service.CustInfoService;
import net.xnzn.core.customer.mapper.CustInfoMapper; import com.bonus.constant.RetCodeEnum;
import net.xnzn.core.customer.service.*; import com.bonus.core.customer.api.CustCasualApi;
import net.xnzn.domain.SmsCodeVerifyDTO; import com.bonus.domain.SmsCodeVerifyDTO;
import net.xnzn.domain.CustInfo; import com.bonus.domain.CustInfo;
import net.xnzn.utils.AesEncryptUtil; import com.bonus.utils.AesEncryptUtil;
import net.xnzn.utils.SM4EncryptUtils; import com.bonus.utils.SM4EncryptUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +44,8 @@ public class CustInfoServiceImpl implements CustInfoService {
log.error("小程序修改密码错误:人员不存在:" + String.valueOf(custInfo)); log.error("小程序修改密码错误:人员不存在:" + String.valueOf(custInfo));
throw new ServiceException("小程序修改密码错误:人员不存在"); throw new ServiceException("小程序修改密码错误:人员不存在");
} else { } else {
content.setOldPassword(AesEncryptUtil.aesDecode(content.getOldPassword()));
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
String oldPassword = content.getOldPassword(); String oldPassword = content.getOldPassword();
String newPassword = content.getNewPassword(); String newPassword = content.getNewPassword();
if (Objects.equals(oldPassword, newPassword)) { if (Objects.equals(oldPassword, newPassword)) {
@ -64,9 +66,15 @@ public class CustInfoServiceImpl implements CustInfoService {
} }
} }
public static void main(String[] args) {
BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
boolean flag = bCrypt.matches("Bonus$2026", "$2a$10$vrcmG0TyvgH5tS9g8ptaVOK2K3pYWVAa13SWEK7pQBGRtNAPlGV7O");
System.out.println(flag);
}
public void custForgetPassword(CustForgetPasswordDTO content) { public void custForgetPassword(CustForgetPasswordDTO content) {
// content.setMobile(AesEncryptUtil.aesDecode(content.getMobile())); // content.setMobile(AesEncryptUtil.aesDecode(content.getMobile()));
// content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword())); content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO(); SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile()); smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
smsCodeVerifyDTO.setCode(content.getCode()); smsCodeVerifyDTO.setCode(content.getCode());

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="net.xnzn.core.customer.mapper.CustCasualRelationMapper"> <mapper namespace="com.bonus.core.customer.mapper.CustCasualRelationMapper">
<update id="updateByCustIdAndOpenId"> <update id="updateByCustIdAndOpenId">
update cust_casual_relation update cust_casual_relation

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="net.xnzn.core.customer.mapper.CustInfoMapper"> <mapper namespace="com.bonus.core.customer.mapper.CustInfoMapper">
<!--根据人员id集合获取人员信息--> <!--根据人员id集合获取人员信息-->
<select id="selectOne" resultType="net.xnzn.domain.CustInfo"> <select id="selectOne" resultType="com.bonus.domain.CustInfo">
select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd
from cust_info from cust_info
<where> <where>
@ -27,7 +27,7 @@
<update id="updateById"> <update id="updateById">
update cust_info update cust_info
set cust_name = #{custName}, cust_num = #{custNum}, mobile = #{mobile}, id_card = #{idCard} set cust_name = #{custName}, cust_num = #{custNum}, mobile = #{mobile}, id_card = #{idCard}, pwd = #{pwd}
where cust_id = #{custId} where cust_id = #{custId}
</update> </update>