2 Komitmen 12ee9bd962 ... 8fb41e9d7e

Pembuat SHA1 Pesan Tanggal
  huodongdong 8fb41e9d7e fix 6 tahun lalu
  huodongdong 33dfe9086d fix white user search 6 tahun lalu

+ 2 - 0
rankin-data-api/src/main/java/cn/rankin/data/api/user/dto/WhiteUserDTO.java

@@ -15,6 +15,8 @@ public class WhiteUserDTO implements Serializable{
 
     private String userId;
 
+    private String code;
+
     private String merchantId;
 
     private Date startTime;

+ 1 - 1
rankin-data-api/src/main/java/cn/rankin/data/api/user/entity/WhiteUser.java

@@ -45,7 +45,7 @@ public class WhiteUser implements Serializable {
     @Temporal(TemporalType.TIMESTAMP)
     private Date gmtModified;
 
-    @Transient
+    @Column(nullable = false, unique = true)
     private String code;
 
     @Transient

+ 12 - 11
rankin-user-service/src/main/java/cn/rankin/userservice/controller/WhiteUserController.java

@@ -51,6 +51,7 @@ public class WhiteUserController {
             return APIResult.error(UserServiceAPICode.NOT_EXISTS);
         }
         whiteUserDTO.setMerchantId(terminalUser.getMerchantId());
+        whiteUserDTO.setCode(terminalUser.getCode());
 
         WhiteUser whiteUser = whiteUserService.addUser(whiteUserDTO);
         if (whiteUser != null) {
@@ -106,11 +107,11 @@ public class WhiteUserController {
             return;
         }
         String userId = whiteUser.getUserId();
-        TerminalUser terminalUser = terminalUserService.find(userId);
+//        TerminalUser terminalUser = terminalUserService.find(userId);
+//        if (terminalUser != null) {
+//            whiteUser.setCode(terminalUser.getCode());
+//        }
         Merchant merchant = merchantService.findOne(whiteUser.getMerchantId());
-        if (terminalUser != null) {
-            whiteUser.setCode(terminalUser.getCode());
-        }
         if (merchant != null) {
             whiteUser.setMerchantName(merchant.getName());
         }
@@ -131,16 +132,16 @@ public class WhiteUserController {
             }
         }
 
-        List<TerminalUser> terminalUserList = terminalUserService.findByIds(userIdList);
-        Map<String, TerminalUser> terminalUserMap = ListUtil.convert(terminalUserList, "id", TerminalUser.class);
+//        List<TerminalUser> terminalUserList = terminalUserService.findByIds(userIdList);
+//        Map<String, TerminalUser> terminalUserMap = ListUtil.convert(terminalUserList, "id", TerminalUser.class);
         Map<String, Merchant> merchantMap = merchantService.getMerchantMap(merchantIdList);
 
         for (WhiteUser whiteUser : whiteUserList) {
-            String userId = whiteUser.getUserId();
-            TerminalUser terminalUser = terminalUserMap.get(userId);
-            if (terminalUser != null) {
-                whiteUser.setCode(terminalUser.getCode());
-            }
+//            String userId = whiteUser.getUserId();
+//            TerminalUser terminalUser = terminalUserMap.get(userId);
+//            if (terminalUser != null) {
+//                whiteUser.setCode(terminalUser.getCode());
+//            }
             String merchantId = whiteUser.getMerchantId();
             Merchant merchant = merchantMap.get(merchantId);
             if (merchant != null) {