From 99af3b25eb3084532dbc19bc29a31770c826c35c Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 27 Jan 2025 13:13:10 +0800 Subject: [PATCH] login --- .../core/common/utils/AesEncryptUtil.java | 1 + .../core/customer/mapper/CustInfoMapper.java | 6 +- .../core/customer/mapper/CustInfoMapper.xml | 846 +----------------- .../service/impl/CustInfoBusinessImpl.java | 26 +- 4 files changed, 26 insertions(+), 853 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/utils/AesEncryptUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/utils/AesEncryptUtil.java index c72152d9..164f86da 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/utils/AesEncryptUtil.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/utils/AesEncryptUtil.java @@ -57,5 +57,6 @@ public class AesEncryptUtil { public static void main(String[] args) { System.out.println(aesEncrypt("123")); System.out.println(aesDecode("Ko0muw9mxpn4mKcd40W0gw==")); + //System.out.println(aesDecode("$2a$10$WoMFC/Qwh/fgVeJoywyqZ.ua6OFU8wxdzaZj4SM14PYa6GimETwMe")); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.java index fabc638c..01ca8219 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.java @@ -11,7 +11,9 @@ import org.apache.ibatis.annotations.Select; @Mapper public interface CustInfoMapper extends BaseMapper { - @Select({"select cust_id, cust_name, cust_num, cust_photo_url, mobile ,pwd from cust_info ${ew.customSqlSegment}"}) - CustInfoAppIdLoginVO selectLoginInfo(@Param("ew") Wrapper wrapper); +// @Select({"select cust_id, cust_name, cust_num, cust_photo_url, mobile ,pwd from cust_info ${ew.customSqlSegment}"}) +// CustInfoAppIdLoginVO selectLoginInfo(@Param("ew") Wrapper wrapper); + + CustInfoAppIdLoginVO selectLoginInfo(CustInfo custInfo); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.xml index 7c8af431..120d31c3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/mapper/CustInfoMapper.xml @@ -1,847 +1,25 @@ - - - - cc.openid, - cc.source_type, - ci.cust_id, - ci.cust_third_id, - ci.cust_name, - ci.mobile, - ai.acc_bal, - ai.subsidy, - ai.red_envelope, - ai.scope - - - - - cc.openid, - ci.cust_third_id, - ci.pwd, - cc.source_type, - ci.cust_id, - ci.cust_name, - ci.mobile, - ci.email, - ci.sex, - ci.age, - ci.birthday, - ci.cust_photo_url, - ci.id_card, - ci.grade_name, - ci.home_addr, - ci.org_id, - ci.psn_type - - - - - ci.cust_id, - ci.cust_num, - ci.cust_name, - ci.mobile, - ci.email, - ci.sex, --- ci.age, - ci.id_card, - ci.birthday, - ci.cust_photo_url, - ci.org_id, - ci.cust_third_id, - ci.org_num, - ci.org_full_name, - ci.place_id, - place.place_num, - place.place_full_name, - ci.psn_type, - ci.psn_type_name, - ci.home_addr, - ci.qq, - ci.wechat, - ci.company_wechat, - ci.dingtalk, - ci.emer_contact_person, - ci.emer_contact_num, - ci.emer_contact_card, - ci.job, - ci.job_rank, - ci.job_level, - ci.job_title, - ci.job_title_rank, - ci.auth_strength, - ci.entry_date, - ci.signing_date, - ci.expiry_date, --- ci.cust_type, - ci.birthday, - cd.label_ids, - cd.label_names, - cd.taste_ids, - cd.taste_names, - ai.end_date accEndDate, - ci.doctor_num, - ci.hospital_num - - - UPDATE cust_info A - LEFT JOIN cust_org B ON A.org_id = B.org_id - set A.org_num = B.org_num, A.org_full_name = B.org_full_name - where A.org_id IN - - #{item} - - - - - + select cust_id, cust_name, cust_num, cust_photo_url, mobile, pwd + from cust_info - - and (ci.cust_num LIKE CONCAT('%', #{infoParam.keyword},'%') - or ci.cust_name = #{infoParam.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler} - or ci.cust_name_like LIKE CONCAT('%',#{infoParam.keyword,typeHandler=net.xnzn.core.common.encrypt.CipherQueryLikeHandler},'%') - or ci.mobile = #{infoParam.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler} - or ci.mobile_suffix = #{infoParam.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler} - ) - - - and ci.cust_name = #{infoParam.custName,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler} - - - and ci.cust_num = #{infoParam.custNum} - - - and ci.org_id in - - #{orgId} - - - - and ci.mobile = #{infoParam.mobile,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler} - - - and ci.cust_state = #{infoParam.custState} - - - order by ci.id desc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/service/impl/CustInfoBusinessImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/service/impl/CustInfoBusinessImpl.java index 9d4114bb..a52c86ee 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/service/impl/CustInfoBusinessImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/customer/service/impl/CustInfoBusinessImpl.java @@ -51,26 +51,21 @@ public class CustInfoBusinessImpl implements CustInfoBusiness { Integer loginType = content.getLoginType(); if (loginType != null && CustLoginTypeEnum.contains(loginType)) { Long merchantId = 1L; -// Long merchantId = (Long)Executors.readInSystem(() -> { -// return this.allocMerchantApi.getMerchantIdByAppid(LoginSourceTypeEnum.getAppIdKey(sourceType), content.getAppId()); -// }); if (ObjectUtil.isEmpty(merchantId)) { throw new ServiceException("商户appId不存在"); } else { - //TenantContextHolder.setTenantId(merchantId); if (CharSequenceUtil.isNotBlank(content.getMobile())) { content.setMobile(this.aesEncryptUtil.aesDecode(content.getMobile())); } - LambdaQueryWrapper custInfoWrapper = (LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(CustInfo.class).eq(CustInfo::getCustState, PersonalStatusEnum.NORMAL.getKey())).and((wrapper) -> { - ((LambdaQueryWrapper)((LambdaQueryWrapper)wrapper.ne(CustInfo::getPsnType, CustConstant.TEMPORARY_PSN_TYPE)).or()).isNull(CustInfo::getPsnType); - }); + CustInfo custInfo = new CustInfo(); if (CustLoginTypeEnum.NAME_PWD.key().equals(content.getLoginType())) { - custInfoWrapper.eq(CustInfo::getCustName, SM4EncryptUtils.sm4Encryptbyconfig(content.getCustName())); + custInfo.setCustName(SM4EncryptUtils.sm4Encryptbyconfig(content.getCustName())); } else if (CustLoginTypeEnum.NAME_CUST_NUM_PWD.key().equals(content.getLoginType())) { - ((LambdaQueryWrapper)custInfoWrapper.eq(CustInfo::getCustName, SM4EncryptUtils.sm4Encryptbyconfig(content.getCustName()))).eq(CustInfo::getCustNum, content.getCustNum()); + custInfo.setCustName(SM4EncryptUtils.sm4Encryptbyconfig(content.getCustName())); + custInfo.setCustNum(content.getCustNum()); } else if (CustLoginTypeEnum.TEL_PWD.key().equals(content.getLoginType())) { - custInfoWrapper.eq(CustInfo::getMobile, SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile())); + custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile())); } else if (CustLoginTypeEnum.TEL_CODE.key().equals(content.getLoginType())) { SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO(); smsCodeVerifyDTO.setCode(content.getCode()); @@ -79,17 +74,14 @@ public class CustInfoBusinessImpl implements CustInfoBusiness { if (!flag) { throw new ServiceException("验证码错误"); } - - custInfoWrapper.eq(CustInfo::getMobile, SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile())); + custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile())); } else { if (!CustLoginTypeEnum.ID_CARD_PWD.key().equals(content.getLoginType())) { throw new ServiceException("参数错误"); } - - custInfoWrapper.eq(CustInfo::getIdCard, SM4EncryptUtils.sm4Encryptbyconfig(content.getIdCard())); + custInfo.setIdCard(SM4EncryptUtils.sm4Encryptbyconfig(content.getIdCard())); } - - CustInfoAppIdLoginVO result = this.custInfoMapper.selectLoginInfo(custInfoWrapper); + CustInfoAppIdLoginVO result = this.custInfoMapper.selectLoginInfo(custInfo); if (ObjectUtil.isEmpty(result)) { throw new ServiceException("未找到用户"); } else { @@ -127,7 +119,7 @@ public class CustInfoBusinessImpl implements CustInfoBusiness { openid = custCasual.getOpenid(); if (StringUtils.isBlank(openid)) { openid = IdUtil.simpleUUID(); - this.custCasualMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustCasual.class).eq(CustCasual::getCasualId, custCasual.getCasualId())).set(CustCasual::getOpenid, openid)); + //this.custCasualMapper.update((Object)null, (Wrapper)((LambdaUpdateWrapper)Wrappers.lambdaUpdate(CustCasual.class).eq(CustCasual::getCasualId, custCasual.getCasualId())).set(CustCasual::getOpenid, openid)); } }