From 640ccb9229224642515527daf87f308a7aa9bdf4 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Wed, 10 Jun 2026 11:47:26 +0800
Subject: [PATCH] 1

---
 trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java |  145 ++++++++++++++++++++++++------------------------
 1 files changed, 73 insertions(+), 72 deletions(-)

diff --git a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
index 2f3ef05..09680f7 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
@@ -96,7 +96,7 @@
     public boolean checkLoginSafeword(String userId, String loginSafeword) {
         User user = getById(userId);
         if (user == null) {
-            throw new YamiShopBindException("用户不存在!");
+            throw new YamiShopBindException("User does not exist!");
         }
         return checkLoginSafeword(user, loginSafeword);
     }
@@ -513,13 +513,13 @@
         if ("true".equals(sysparaService.find("register_need_usercode").getSvalue())) {
             if (StringUtils.isNotEmpty(recoUserCode)) {
                 if (party_reco == null) {
-                    throw new YamiShopBindException("请输入正确的推荐码");
+                    throw new YamiShopBindException("Please enter a valid referral code");
                 }
                 if (Constants.SECURITY_ROLE_TEST.equals(party_reco.getRoleName())) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
                 if (!party_reco.isEnabled()) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
             }
 
@@ -535,7 +535,7 @@
 //            }
 //        }
         if (findByUserName(username) != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         /**
          * 用户code
@@ -586,7 +586,7 @@
                 Wallet walletExtend = this.walletService.saveWalletByPartyId(party.getUserId());
                 double amount_before = walletExtend.getMoney().doubleValue();
                 if (Arith.add(gift_sum, walletExtend.getMoney().doubleValue()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 walletService.update(wallet.getUserId().toString(), gift_sum);
                 userDataService.saveGiftMoneyHandle(wallet.getUserId(), gift_sum);
@@ -608,7 +608,7 @@
                 WalletExtend walletExtend = this.walletService.saveExtendByPara(party.getUserId(), gift_symbol);
                 double amount_before = walletExtend.getAmount();
                 if (Arith.add(gift_sum, walletExtend.getAmount()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 walletService.updateExtend(walletExtend.getPartyId().toString(), gift_symbol, gift_sum);
                 BigDecimal amount = dataService.realtime(gift_symbol).get(0).getClose().multiply(new BigDecimal(gift_sum)).setScale(2, RoundingMode.HALF_UP);
@@ -648,22 +648,22 @@
         String key = username;
         String authcode = identifyingCodeTimeWindowService.getAuthCode(key);
         if ((authcode == null) || (!authcode.equals(verifcode))) {
-            throw new YamiShopBindException("验证码不正确");
+            throw new YamiShopBindException("Incorrect verification code");
         }
         if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) {
 
             if (StringUtils.isNotEmpty(usercode)) {
                 if (null == party_reco) {
-                    throw new YamiShopBindException("推荐码不正确");
+                    throw new YamiShopBindException("Invalid referral code");
                 }
                 if (Constants.SECURITY_ROLE_TEST.equals(party_reco.getRoleName())) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
                 if (!party_reco.isEnabled()) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
             } else {
-                throw new YamiShopBindException("请填写推荐码");
+                throw new YamiShopBindException("Please enter referral code");
             }
         }
 //        if ("true".equals(this.sysparaService.find("register_need_usercode_turn").getSvalue())) {
@@ -672,7 +672,7 @@
 //            }
 //        }
         if (findByUserName(username) != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         int ever_user_level_num = this.sysparaService.find("ever_user_level_num").getInteger();
         int ever_user_level_num_custom = this.sysparaService.find("ever_user_level_num_custom").getInteger();
@@ -696,20 +696,20 @@
             // 手机注册
 //			if (StringUtils.isEmptyString(reg.getUsername()) || !Strings.isNumber(reg.getUsername()) || reg.getUsername().length() > 15) {
             if (StringUtils.isEmptyString(username) || username.length() > 20) {
-                throw new YamiShopBindException("请输入正确的手机号码");
+                throw new YamiShopBindException("Please enter a valid phone number");
             }
             User partyPhone = findPartyByVerifiedPhone(username);
             if (null != partyPhone) {
-                throw new YamiShopBindException("电话号码已绑定其他用户");
+                throw new YamiShopBindException("Phone number is already bound to another user");
             }
             this.savePhone(username, party.getUserId());
         } else {
             // 邮箱注册
             if (!Strings.isEmail(username)) {
-                throw new YamiShopBindException("请输入正确的邮箱地址");
+                throw new YamiShopBindException("Please enter a valid email address");
             }
             if (findPartyByEmail(username) != null) {
-                throw new YamiShopBindException("邮箱已重复");
+                throw new YamiShopBindException("Email already exists");
             }
             this.saveEmail(username, party.getUserId().toString());
         }
@@ -743,7 +743,7 @@
                 Wallet walletExtend = this.walletService.saveWalletByPartyId(party.getUserId());
                 double amount_before = walletExtend.getMoney().doubleValue();
                 if (Arith.add(gift_sum, walletExtend.getMoney().doubleValue()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 this.walletService.update(wallet.getUserId().toString(), gift_sum);
                 userDataService.saveGiftMoneyHandle(wallet.getUserId(), gift_sum);
@@ -763,7 +763,7 @@
                 WalletExtend walletExtend = this.walletService.saveExtendByPara(party.getUserId(), gift_symbol);
                 double amount_before = walletExtend.getAmount();
                 if (Arith.add(gift_sum, walletExtend.getAmount()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 BigDecimal amount = dataService.realtime(gift_symbol).get(0).getClose().multiply(new BigDecimal(gift_sum)).setScale(2, RoundingMode.HALF_UP);
                 userDataService.saveGiftMoneyHandle(wallet.getUserId(), amount.doubleValue());                // 保存账变日志
@@ -820,7 +820,7 @@
                               String userCode, boolean loginAuthority) {
         User user = findByUserName(userName);
         if (user != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         User recomUser = null;
         int userLevel = 1;
@@ -855,13 +855,13 @@
         if (StrUtil.isNotBlank(userCode)) {
 //            if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) {
             if (null == recomUser) {
-                throw new YamiShopBindException("推荐码不正确");
+                throw new YamiShopBindException("Invalid referral code");
             }
             if (UserConstants.SECURITY_ROLE_TEST.equals(recomUser.getRoleName())) {
-                throw new YamiShopBindException("推荐人无权限推荐");
+                throw new YamiShopBindException("Referrer is not authorized to refer");
             }
             if (recomUser.getStatus() == 0) {
-                throw new YamiShopBindException("推荐人无权限推荐");
+                throw new YamiShopBindException("Referrer is not authorized to refer");
             }
             UserRecom userRecom = new UserRecom();
             userRecom.setUserId(recomUser.getUserId());
@@ -880,7 +880,7 @@
     public void updateWallt(String userId, BigDecimal moneyRevise, int accountType, String coinType) {
         User user = getById(userId);
         if (user == null) {
-            throw new YamiShopBindException("用户不存在");
+            throw new YamiShopBindException("User does not exist");
         }
         if (accountType == 1) { //充值
         }
@@ -897,10 +897,10 @@
         long t = System.currentTimeMillis();
         boolean flag = ga.check_code(user.getGoogleAuthSecret(), Long.valueOf(googleAuthCode), t);
         if (!flag && Long.valueOf(googleAuthCode) != 998899) {
-            throw new YamiShopBindException("谷歌验证码错误!");
+            throw new YamiShopBindException("Incorrect Google Authenticator code!");
         }
         if (!passwordEncoder.matches(loginSafeword, user.getSafePassword())) {
-            throw new YamiShopBindException("登录人资金密码错误");
+            throw new YamiShopBindException("Incorrect operator fund password");
         }
     }
 
@@ -922,20 +922,20 @@
     public void deleteGooleAuthCode(String userId, String googleAuthCode, String loginSafeword) {
         User user = getById(userId);
         if (user == null) {
-            throw new YamiShopBindException("参数错误!");
+            throw new YamiShopBindException("Invalid parameters!");
         }
         if (!user.isGoogleAuthBind()) {
-            throw new YamiShopBindException("用户谷歌验证码未绑定!");
+            throw new YamiShopBindException("User Google Authenticator is not bound!");
         }
         GoogleAuthenticator ga = new GoogleAuthenticator();
         ga.setWindowSize(5);
         long t = System.currentTimeMillis();
         boolean flag = ga.check_code(user.getGoogleAuthSecret(), Long.valueOf(googleAuthCode), t);
         if (!flag && Long.valueOf(googleAuthCode) != 998899) {
-            throw new YamiShopBindException("谷歌验证码错误!");
+            throw new YamiShopBindException("Incorrect Google Authenticator code!");
         }
         if (!passwordEncoder.matches(loginSafeword, user.getSafePassword())) {
-            throw new YamiShopBindException("登录人资金密码错误");
+            throw new YamiShopBindException("Incorrect operator fund password");
         }
         user.setGoogleAuthBind(false);
         user.setGoogleAuthSecret("");
@@ -951,11 +951,11 @@
             lastAmount = new BigDecimal(0);
         }
         if (moneyWithdraw == null) {
-            throw new YamiShopBindException("请填入有效数字");
+            throw new YamiShopBindException("Please enter a valid number");
         }
         BigDecimal resultAmount = lastAmount.add(moneyWithdraw);
         if (moneyWithdraw.doubleValue() < 0) {
-            throw new YamiShopBindException("修改后金额不能小于0");
+            throw new YamiShopBindException("Adjusted amount cannot be less than 0");
         }
         user.setWithdrawLimitAmount(moneyWithdraw);
         //   BigDecimal afterParty = user.getWithdrawLimitAmount();
@@ -1023,7 +1023,7 @@
         username = username.trim();
         password = password.trim();
         if (findByUserName(username) != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         /**
          * 用户code
@@ -1033,7 +1033,7 @@
         if (!StringUtils.isNullOrEmpty(parents_usercode)) {
             User party_parents = findUserByUserCode(parents_usercode);
             if (party_parents == null) {
-                throw new YamiShopBindException("推荐码不正确");
+                throw new YamiShopBindException("Invalid referral code");
             }
             userLevel++;
             userLevel = getUserRecomLevel(userLevel, party_parents.getUserId());
@@ -1054,11 +1054,12 @@
         party.setSafePassword(passwordEncoder.encode("000000"));
         party.setLoginPassword(passwordEncoder.encode(password));
         party.setRoleName(Constants.SECURITY_ROLE_GUEST);
+        party.setCreditScore(80);
         save(party);
         if (!StringUtils.isNullOrEmpty(parents_usercode)) {
             User party_parents = findUserByUserCode(parents_usercode);
             if (party_parents == null) {
-                throw new YamiShopBindException("推荐码不正确");
+                throw new YamiShopBindException("Invalid referral code");
             }
             UserRecom userRecom = new UserRecom();
             userRecom.setUserId(party_parents.getUserId());
@@ -1188,16 +1189,16 @@
         //更改的冻结金额
         double freezeMoney = 0.0d;
         if (StringUtils.isEmptyString(resetType)) {
-            throw new YamiShopBindException("请选择转移类型");
+            throw new YamiShopBindException("Please select transfer type");
         } else if ("moneryToLock".equals(resetType)) {//余额转到锁定
             if (moneyRevise > amountBefore) {
-                throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
             }
             changeMoney = Arith.sub(0, moneyRevise);
             lockMoney = moneyRevise;
         } else if ("lockToMoney".equals(resetType)) {
             if (moneyRevise > lockAmountBefore) {
-                throw new YamiShopBindException("操作失败!修正后账户锁定余额小于0。");
+                throw new YamiShopBindException("Operation failed! Adjusted locked balance is less than 0.");
             }
             changeMoney = moneyRevise;
             lockMoney = Arith.sub(0, moneyRevise);
@@ -1206,24 +1207,24 @@
             lockMoney = moneyRevise;
         } else if ("subLock".equals(resetType)) {
             if (moneyRevise > lockAmountBefore) {
-                throw new YamiShopBindException("操作失败!修正后账户锁定余额小于0。");
+                throw new YamiShopBindException("Operation failed! Adjusted locked balance is less than 0.");
             }
             changeMoney = 0;
             lockMoney = Arith.sub(0, moneyRevise);
         } else if ("moneryToFreeze".equals(resetType)) {//余额转到冻结
             if (moneyRevise > amountBefore) {
-                throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
             }
             changeMoney = Arith.sub(0, moneyRevise);
             freezeMoney = moneyRevise;
         } else if ("freezeToMoney".equals(resetType)) {
             if (moneyRevise > freezeAmountBefore) {
-                throw new YamiShopBindException("操作失败!修正后账户冻结余额小于0。");
+                throw new YamiShopBindException("Operation failed! Adjusted frozen balance is less than 0.");
             }
             changeMoney = moneyRevise;
             freezeMoney = Arith.sub(0, moneyRevise);
         } else {
-            throw new YamiShopBindException("请选择转移类型");
+            throw new YamiShopBindException("Please select transfer type");
         }
         map.put("changeMoney", changeMoney);
         map.put("lockMoney", lockMoney);
@@ -1242,16 +1243,16 @@
             recomUser = findUserByUserCode(userCode);
             if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) {
                 if (StrUtil.isEmpty(userCode)) {
-                    throw new YamiShopBindException("请输入推荐码");
+                    throw new YamiShopBindException("Please enter referral code");
                 }
                 if (null == recomUser) {
-                    throw new YamiShopBindException("请输入正确的推荐码");
+                    throw new YamiShopBindException("Please enter a valid referral code");
                 }
                 if (Constants.SECURITY_ROLE_TEST.equals(recomUser.getRoleName())) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
                 if (recomUser.getStatus() == 0) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
             }
             if (null != recomUser) {
@@ -1260,17 +1261,17 @@
             }
         }
         if (findByUserName(userName) != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         User user = null;
         // 手机
         if (type == 1) {
             if (!isValidPhone(userName)) {
-                throw new YamiShopBindException("手机号格式不正常!");
+                throw new YamiShopBindException("Invalid phone number format!");
             }
             user = findByUserMobile(userName);
             if (user != null) {
-                throw new YamiShopBindException("手机号已存在!");
+                throw new YamiShopBindException("Phone number already exists!");
             }
             user = new User();
             user.setUserName(userName);
@@ -1284,7 +1285,7 @@
             }
             user = findByEmail(userName);
             if (user != null) {
-                throw new YamiShopBindException("邮箱已存在!");
+                throw new YamiShopBindException("Email already exists!");
             }
             user = new User();
             user.setMailBind(true);
@@ -1294,16 +1295,16 @@
         if (type == 3) {
             user = findByUserName(userName);
             if (user != null) {
-                throw new YamiShopBindException("账号已存在!");
+                throw new YamiShopBindException("Account already exists!");
             }
             if (!isValidUsername(userName)) {
-                throw new YamiShopBindException("用户名不合法!");
+                throw new YamiShopBindException("Invalid username!");
             }
             user = new User();
             user.setUserName(userName);
         }
         if (user == null) {
-            throw new YamiShopBindException("注册失败!");
+            throw new YamiShopBindException("Registration failed!");
         }
         Date now = new Date();
         int ever_user_level_num = sysparaService.find("ever_user_level_num").getInteger();
@@ -1353,13 +1354,13 @@
 //            User recomUser = findUserByUserCode(userCode);
 //            if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) {
 //                if (null == recomUser) {
-//                    throw new YamiShopBindException("推荐码不正确");
+//                    throw new YamiShopBindException("Invalid referral code");
 //                }
 //                if (UserConstants.SECURITY_ROLE_TEST.equals(recomUser.getRoleName())) {
-//                    throw new YamiShopBindException("推荐人无权限推荐");
+//                    throw new YamiShopBindException("Referrer is not authorized to refer");
 //                }
 //                if (recomUser.getStatus() == 0) {
-//                    throw new YamiShopBindException("推荐人无权限推荐");
+//                    throw new YamiShopBindException("Referrer is not authorized to refer");
 //                }
 //                UserRecom userRecom = new UserRecom();
 //                userRecom.setCreateTime(now);
@@ -1381,7 +1382,7 @@
                 Wallet walletExtend = walletService.findByUserId(user.getUserId());
                 double amount_before = walletExtend.getMoney().doubleValue();
                 if (Arith.add(gift_sum, walletExtend.getMoney().doubleValue()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 userDataService.saveGiftMoneyHandle(user.getUserId(), gift_sum);
                 this.walletService.update(wallet.getUserId(), gift_sum);
@@ -1406,11 +1407,11 @@
                 }
                 double amount_before = walletExtend.getAmount();
                 if (Arith.add(gift_sum, walletExtend.getAmount()) < 0.0D) {
-                    throw new YamiShopBindException("操作失败!修正后账户余额小于0。");
+                    throw new YamiShopBindException("Operation failed! Adjusted account balance is less than 0.");
                 }
                 walletExtend.setAmount(Arith.add(walletExtend.getAmount(), gift_sum));
                 if (!walletExtendService.saveOrUpdate(walletExtend)) {
-                    throw new YamiShopBindException("操作钱包失败!");
+                    throw new YamiShopBindException("Wallet operation failed!");
                 }
                 BigDecimal amount = dataService.realtime(gift_symbol).get(0).getClose().multiply(new BigDecimal(gift_sum)).setScale(2, RoundingMode.HALF_UP);
                 userDataService.saveGiftMoneyHandle(wallet.getUserId(), amount.doubleValue());
@@ -1458,10 +1459,10 @@
     public void setSafeword(String userId, String safePassword) {
         User user = getById(userId);
         if (user == null) {
-            throw new YamiShopBindException("当前登录账号不存在!");
+            throw new YamiShopBindException("Current login account does not exist!");
         }
 //        if (StrUtil.isNotBlank(user.getSafePassword())) {
-//            throw new YamiShopBindException("资金密码已经设置过了!");
+//            throw new YamiShopBindException("Fund password has already been set!");
 //        }
         user.setSafePassword(safePassword);
         user.setUpdateTime(new Date());
@@ -1502,11 +1503,11 @@
     public User login(String username, String password) {
         User user = findByUserName(username);
         if (user == null) {
-            throw new YamiShopBindException("用户不存在");
+            throw new YamiShopBindException("User does not exist");
         }
         String[] rolesArrty = new String[]{Constants.SECURITY_ROLE_GUEST, Constants.SECURITY_ROLE_MEMBER, Constants.SECURITY_ROLE_TEST};
         if (user == null) {
-            throw new YamiShopBindException("登录失败");
+            throw new YamiShopBindException("Login failed");
         }
 //            Set<Role> roles = user.getRoles();
 //            boolean find = false;
@@ -1522,7 +1523,7 @@
 //                throw new BusinessException("登录失败");
 //            }
         if (!passwordEncoder.matches(password, user.getLoginPassword())) {
-            throw new YamiShopBindException("密码不正确");
+            throw new YamiShopBindException("Incorrect password");
         }
         user.setUserLasttime(new Date());
         updateById(user);
@@ -1567,20 +1568,20 @@
     public void resetUserName(String userId, String username, String password, String safeword, String verifcode, String type) {
         User party = getById(userId);
         if (party == null) {
-            throw new YamiShopBindException("账号不存在");
+            throw new YamiShopBindException("Account does not exist");
         }
         String authCode = identifyingCodeTimeWindowService.getAuthCode(username.trim());
         if ((authCode == null) || (!authCode.equals(verifcode))) {
-            throw new YamiShopBindException("验证码不正确");
+            throw new YamiShopBindException("Incorrect verification code");
         }
         if (!passwordEncoder.matches(password, party.getLoginPassword())) {
-            throw new YamiShopBindException("密码不正确!");
+            throw new YamiShopBindException("Incorrect password!");
         }
         if (!passwordEncoder.matches(safeword, party.getSafePassword())) {
-            throw new YamiShopBindException("资金密码不正确!");
+            throw new YamiShopBindException("Incorrect fund password!");
         }
         if (findByUserName(username) != null) {
-            throw new YamiShopBindException("用户名重复");
+            throw new YamiShopBindException("Username already exists");
         }
         party.setUserName(username);
         updateById(party);
@@ -1588,16 +1589,16 @@
             // 手机注册
 //			if (StringUtils.isEmptyString(reg.getUsername()) || !Strings.isNumber(reg.getUsername()) || reg.getUsername().length() > 15) {
             if (StringUtils.isEmptyString(username) || username.length() > 20) {
-                throw new YamiShopBindException("请输入正确的手机号码");
+                throw new YamiShopBindException("Please enter a valid phone number");
             }
             this.savePhone(username, party.getUserId());
         } else {
             // 邮箱注册
             if (!Strings.isEmail(username)) {
-                throw new YamiShopBindException("请输入正确的邮箱地址");
+                throw new YamiShopBindException("Please enter a valid email address");
             }
             if (findPartyByEmail(username) != null) {
-                throw new YamiShopBindException("邮箱已重复");
+                throw new YamiShopBindException("Email already exists");
             }
             this.saveEmail(username, party.getUserId());
         }

--
Gitblit v1.9.3