libo 4 år sedan
förälder
incheckning
1cc09ab321

+ 1 - 3
src/main/java/com/tdba/cxb/ares/api/ApplicationStartup.java

@@ -1,5 +1,6 @@
1 1
 package com.tdba.cxb.ares.api;
2 2
 
3
+import org.springframework.boot.Banner;
3 4
 import org.springframework.boot.CommandLineRunner;
4 5
 import org.springframework.boot.SpringApplication;
5 6
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -23,9 +24,6 @@ public class ApplicationStartup implements CommandLineRunner {
23 24
         SpringApplication.run(ApplicationStartup.class, args);
24 25
     }
25 26
 
26
-    @Resource
27
-    private ApplicationContext context;
28
-
29 27
     @Override
30 28
     public void run(String... args) throws Exception {
31 29
     }

+ 1 - 1
src/main/java/com/tdba/cxb/ares/api/controller/UserController.java

@@ -98,7 +98,7 @@ public class UserController {
98 98
     @PostMapping("bind_remove")
99 99
     public TDBAResponse bind_remove(@RequestBody @Validated BindUserRemove param, BaseUser baseUser){
100 100
         Objects.requireNonNull(baseUser, "请登录后操作");
101
-//        userService.teamAdd(param, baseUser);
101
+        userService.teamRemove(param, baseUser);
102 102
         return buildSuccess("");
103 103
     }
104 104
 

+ 2 - 1
src/main/java/com/tdba/cxb/ares/api/model/BindUserRemove.java

@@ -1,6 +1,7 @@
1 1
 package com.tdba.cxb.ares.api.model;
2 2
 
3 3
 import javax.validation.constraints.NotEmpty;
4
+import javax.validation.constraints.NotNull;
4 5
 
5 6
 /**
6 7
  * @program: order-web
@@ -10,7 +11,7 @@ import javax.validation.constraints.NotEmpty;
10 11
  */
11 12
 public class BindUserRemove {
12 13
 
13
-    @NotEmpty(message = "团队成员ID不能为空")
14
+    @NotNull(message = "团队成员ID不能为空")
14 15
     private Integer id;
15 16
 
16 17
     public Integer getId() {

+ 6 - 4
src/main/java/com/tdba/cxb/ares/api/service/UserService.java

@@ -443,10 +443,12 @@ public class UserService {
443 443
      */
444 444
     public void teamRemove(BindUserRemove param, BaseUser baseUser){
445 445
 
446
-//        UserBind userBind = userBindMapper.selectById(param, );
447
-        if(userBindMapper.selectUid(baseUser.getId()).stream().noneMatch(row -> row.equals(param.getId()))){
448
-            throw new TDBAException("运营商未关联该用户");
449
-        }
446
+        UserBind userBind = userBindMapper.selectById(baseUser.getId(), param.getId());
447
+        Objects.requireNonNull(userBind, "运营商未关联该用户");
448
+        userBindMapper.updateByPrimaryKeySelective(UserBind.UserBindBuilder.anUserBind()
449
+                .withId(userBind.getId())
450
+                .withDel_flag(1)
451
+                .build());
450 452
     }
451 453
 
452 454
     /**

+ 26 - 0
src/main/java/com/tdba/cxb/ares/api/util/UserTask.java

@@ -0,0 +1,26 @@
1
+package com.tdba.cxb.ares.api.util;
2
+
3
+import com.tdba.cxb.ares.api.service.UserService;
4
+import org.springframework.scheduling.annotation.Scheduled;
5
+import org.springframework.stereotype.Service;
6
+
7
+import javax.annotation.Resource;
8
+import java.time.LocalDate;
9
+
10
+/**
11
+ * @program: order-web
12
+ * @description:
13
+ * @author: libo
14
+ * @create: 2022-06-14 17:30:30
15
+ */
16
+@Service
17
+public class UserTask {
18
+
19
+    @Resource
20
+    private UserService userService;
21
+
22
+    @Scheduled(cron = "0 0 1 * * *")
23
+    public void createRelate(){
24
+        userService.createSpreadInfo(LocalDate.now().minusDays(1));
25
+    }
26
+}

+ 3 - 4
src/main/resources/application-dev.yml

@@ -1,15 +1,14 @@
1 1
 spring:
2 2
   datasource:
3
-    url: jdbc:mysql://10.28.5.47:3306/renrenxiang?autoReconnect=true&failOverReadOnly=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
3
+    url: jdbc:mysql://10.28.5.46:3306/renrenxiang?autoReconnect=true&failOverReadOnly=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
4 4
     driver-class-name: com.mysql.cj.jdbc.Driver
5
-    password: bjtdba.com
6
-    username: readonly
5
+    password: Zm#T2ZW4#IwENBY
6
+    username: root
7 7
     hikari:
8 8
       maximum-pool-size: 16
9 9
       minimum-idle: 2
10 10
       idle-timeout: 10000
11 11
 
12
-
13 12
   redis:
14 13
     host: 10.28.5.46
15 14
     port: 6379

+ 1 - 1
src/main/resources/mapper/UserMapper.xml

@@ -201,7 +201,7 @@
201 201
             del_flag = 0
202 202
             and uid in (
203 203
                 select
204
-                    uid
204
+                    uiu
205 205
                     from
206 206
                         user_bind ub
207 207
                     where