From 57399a1926fe4250e54cb1b0d009655f162cc6dc Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Wed, 04 Sep 2024 14:21:53 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserPendingorderServiceImpl.java |   42 +++++++++++++++++++++++++++---------------
 1 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserPendingorderServiceImpl.java b/src/main/java/com/nq/service/impl/UserPendingorderServiceImpl.java
index f5637cb..ef7c355 100644
--- a/src/main/java/com/nq/service/impl/UserPendingorderServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPendingorderServiceImpl.java
@@ -71,23 +71,29 @@
         User user = this.iUserService.getCurrentRefreshUser(request);
 
         if (user == null) {
-            return ServerResponse.createByErrorMsg("Please log in first");
+            return ServerResponse.createByErrorMsg("Please log in first",request);
         }
         SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
         if (buyNum.intValue() < siteSetting.getBuyMinNum().intValue()) {
             return ServerResponse.createByErrorMsg("The pending order failed, and the purchased quantity was less than" + siteSetting
-                    .getBuyMinNum() + "stocks");
+                    .getBuyMinNum() + "stocks",request);
         }
         if (buyNum.intValue() > siteSetting.getBuyMaxNum().intValue()) {
             return ServerResponse.createByErrorMsg("The pending order failed because the purchased quantity was greater than" + siteSetting
-                    .getBuyMaxNum() + "stocks");
+                    .getBuyMaxNum() + "stocks",request);
         }
-        UserPendingorder userPendingorder = userPendingorderMapper.selectOne(new QueryWrapper<UserPendingorder>().eq("user_id", user.getId()).eq("stock_id", stockId).eq("status", 0));
-        if (userPendingorder != null) {
-            return ServerResponse.createByErrorMsg("Please do not repeat the order");
-        }
+//        UserPendingorder userPendingorder = userPendingorderMapper.selectOne(new QueryWrapper<UserPendingorder>().eq("user_id", user.getId()).eq("stock_id", stockId).eq("status", 0));
+//        if (userPendingorder != null) {
+//            String lang = request.getHeader("lang");
+//            if(lang.equals("ja")){
+//                String msg = "繰り返しの送信はご遠慮ください";
+//                return ServerResponse.createByErrorMsg(msg);
+//            }else{
+//                return ServerResponse.createByErrorMsg("Please do not repeat the order",request);
+//            }
+//        }
 
-        userPendingorder = new UserPendingorder();
+        UserPendingorder userPendingorder = new UserPendingorder();
         userPendingorder.setUserId(user.getId());
         userPendingorder.setStockId(stockId);
         userPendingorder.setBuyNum(buyNum);
@@ -101,9 +107,15 @@
         userPendingorder.setStatus(0);
         int ret = userPendingorderMapper.insert(userPendingorder);
         if (ret > 0) {
-            return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met");
+            String lang = request.getHeader("lang");
+            if(lang.equals("ja")){
+                String msg = "注文が成功しました。取引時間内に自動的に約定されます。";
+                return ServerResponse.createBySuccessMsg(msg);
+            }else{
+                return ServerResponse.createBySuccessMsg("If the pending order is successfully added, the order will be automatically placed if the order conditions are met",request);
+            }
         }
-        return ServerResponse.createByErrorMsg("Add failure");
+        return ServerResponse.createByErrorMsg("Add failure",request);
 
     }
 
@@ -296,19 +308,19 @@
             User user = (User) JsonUtil.string2Obj(userJson, User.class);
             UserPendingorder userPendingorder = this.userPendingorderMapper.selectById(id);
             if (userPendingorder == null) {
-                return ServerResponse.createByErrorMsg("The pending order does not exist");
+                return ServerResponse.createByErrorMsg("The pending order does not exist",request);
             }
             if (user.getId().intValue() != userPendingorder.getUserId().intValue()) {
-                return ServerResponse.createByErrorMsg("The pending order does not belong to you");
+                return ServerResponse.createByErrorMsg("The pending order does not belong to you",request);
             }
             int delCount = this.userPendingorderMapper.deleteById(id);
             if (delCount > 0) {
-                return ServerResponse.createByErrorMsg("Successfully deleted");
+                return ServerResponse.createByErrorMsg("Successfully deleted",request);
             }
-            return ServerResponse.createByErrorMsg("Deletion failure");
+            return ServerResponse.createByErrorMsg("Deletion failure",request);
         }
 
-        return ServerResponse.createByErrorMsg("Please log in");
+        return ServerResponse.createByErrorMsg("Please log in",request);
     }
 
 

--
Gitblit v1.9.3