浏览代码

数据库迁移

魏超 5 年前
父节点
当前提交
8d35f2f253

+ 4
- 2
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java 查看文件

335
 		Integer status = isOn ? CommConstant.STATUS_NORMAL : CommConstant.STATUS_CLOSED;
335
 		Integer status = isOn ? CommConstant.STATUS_NORMAL : CommConstant.STATUS_CLOSED;
336
 		TaUser user = new TaUser();
336
 		TaUser user = new TaUser();
337
 		user.setStatus(status);
337
 		user.setStatus(status);
338
-		user.setUserId(id);
339
 
338
 
340
-		if (!this.updateById(user)) {
339
+		QueryWrapper<TaUser> taUserQueryWrapper = new QueryWrapper<>();
340
+		taUserQueryWrapper.eq("org_id", taUserMapper.selectById(id).getOrgId());
341
+
342
+		if (!this.update(user, taUserQueryWrapper)) {
341
 			throw new Exception("开启或禁用用户失败");
343
 			throw new Exception("开启或禁用用户失败");
342
 		}
344
 		}
343
 	}
345
 	}

+ 21
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

556
      * 登录中心端系统类型
556
      * 登录中心端系统类型
557
      */
557
      */
558
     public static final String LOGIN_TYPE_CENTER = "center";
558
     public static final String LOGIN_TYPE_CENTER = "center";
559
+
560
+    /**
561
+     * 查看分享者活动类型 h5
562
+     */
563
+    public static final String H5_SHARE = "h5_share";
564
+
565
+    /**
566
+     * 查看分享者活动类型 拼团
567
+     */
568
+    public static final String GROUP_SHARE = "group_share";
569
+
570
+    /**
571
+     * 查看分享者活动类型 助力
572
+     */
573
+    public static final String HELP_SHARE = "help_share";
574
+
575
+    /**
576
+     * 查看分享者活动类型 活动
577
+     */
578
+    public static final String DYNAMIC_SHARE = "dynamic_share";
579
+
559
 }
580
 }

+ 8
- 6
src/main/java/com/huiju/estateagents/service/impl/TaPersonVisitRecordServiceImpl.java 查看文件

132
 				e.setUserTel(personInfo.getPhone());
132
 				e.setUserTel(personInfo.getPhone());
133
 			}
133
 			}
134
 
134
 
135
-			TaPerson userShareInfo = taPersonMapper.selectById(e.getPersonId());
135
+			QueryWrapper<TaPerson> queryWrapper = new QueryWrapper<>();
136
+			queryWrapper.eq("user_id", e.getSharePersonId()).or().eq("person_id", e.getSharePersonId());
137
+			TaPerson userShareInfo = taPersonMapper.selectOne(queryWrapper);
136
 			if (userShareInfo != null) {
138
 			if (userShareInfo != null) {
137
 				e.setShareName(userShareInfo.getNickname());
139
 				e.setShareName(userShareInfo.getNickname());
138
 				e.setShareTel(userShareInfo.getPhone());
140
 				e.setShareTel(userShareInfo.getPhone());
139
 			}
141
 			}
140
 
142
 
141
-			if (CommConstant.EVENT_H5.equals(e.getEventType())) {
143
+			if (CommConstant.H5_SHARE.equals(e.getEventType())) {
142
 				e.setActivityName(e.getDrainageName());
144
 				e.setActivityName(e.getDrainageName());
143
 				continue;
145
 				continue;
144
 			}
146
 			}
145
-			if (CommConstant.POSTER_CONTENT_TYPE_BUILDING.equals(e.getEventType())) {
147
+			if (CommConstant.BUILDING_SHARE.equals(e.getEventType())) {
146
 				e.setActivityName(e.getBuildingName());
148
 				e.setActivityName(e.getBuildingName());
147
 				continue;
149
 				continue;
148
 			}
150
 			}
149
-			if (CommConstant.POSTER_CONTENT_TYPE_NEWS.equals(e.getEventType())) {
151
+			if (CommConstant.NEWS_SHARE.equals(e.getEventType())) {
150
 				e.setActivityName(e.getNewsName());
152
 				e.setActivityName(e.getNewsName());
151
 				continue;
153
 				continue;
152
 			}
154
 			}
153
-			if (CommConstant.POINTS_CHANGE_HELP.equals(e.getEventType())) {
155
+			if (CommConstant.HELP_SHARE.equals(e.getEventType())) {
154
 				e.setActivityName(e.getHelpActivityName());
156
 				e.setActivityName(e.getHelpActivityName());
155
 				continue;
157
 				continue;
156
 			}
158
 			}
157
-			if (CommConstant.POINTS_CHANGE_GROUP.equals(e.getEventType())) {
159
+			if (CommConstant.GROUP_SHARE.equals(e.getEventType())) {
158
 				e.setActivityName(e.getGroupActivityName());
160
 				e.setActivityName(e.getGroupActivityName());
159
 				continue;
161
 				continue;
160
 			}
162
 			}

+ 3
- 3
src/main/resources/application-blue.yml 查看文件

4
   application:
4
   application:
5
     name: estateagents
5
     name: estateagents
6
   datasource:
6
   datasource:
7
-    username: estateagents
8
-    password: estateagents
9
-    url: jdbc:mysql://47.101.36.130:3306/estateagents_3.5.1_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
7
+    username: root
8
+    password: LUfZGvh7j1^qA*2c
9
+    url: jdbc:mysql://123.57.65.31:3306/estateagents_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
     driver-class-name: com.mysql.cj.jdbc.Driver
10
     driver-class-name: com.mysql.cj.jdbc.Driver
11
     initial-size: 10 # 初始化连接数
11
     initial-size: 10 # 初始化连接数
12
     max-active: 20 # 最大连接数
12
     max-active: 20 # 最大连接数

+ 3
- 3
src/main/resources/application-green.yml 查看文件

4
   application:
4
   application:
5
     name: estateagents
5
     name: estateagents
6
   datasource:
6
   datasource:
7
-    username: estateagents
8
-    password: estateagents
9
-    url: jdbc:mysql://47.101.36.130:3306/estateagents_3.5.1_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
7
+    username: root
8
+    password: LUfZGvh7j1^qA*2c
9
+    url: jdbc:mysql://123.57.65.31:3306/estateagents_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
     driver-class-name: com.mysql.cj.jdbc.Driver
10
     driver-class-name: com.mysql.cj.jdbc.Driver
11
     initial-size: 10 # 初始化连接数
11
     initial-size: 10 # 初始化连接数
12
     max-active: 20 # 最大连接数
12
     max-active: 20 # 最大连接数

+ 3
- 3
src/main/resources/application-prod-blue.yml 查看文件

4
   application:
4
   application:
5
     name: estateagents
5
     name: estateagents
6
   datasource:
6
   datasource:
7
-    username: estateagents
8
-    password: DQ@0lW##kBb2+-jPZ
9
-    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents3.5?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
7
+    username: root
8
+    password: HZjVK5O%zTdP0#8AhGcF@03!eZsGbqdO
9
+    url: jdbc:mysql://rm-2zez52se79qgg9649po.mysql.rds.aliyuncs.com:3306/estateagents3.5?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
     driver-class-name: com.mysql.cj.jdbc.Driver
10
     driver-class-name: com.mysql.cj.jdbc.Driver
11
     initial-size: 10 # 初始化连接数
11
     initial-size: 10 # 初始化连接数
12
     max-active: 20 # 最大连接数
12
     max-active: 20 # 最大连接数

+ 3
- 3
src/main/resources/application-prod-green.yml 查看文件

4
   application:
4
   application:
5
     name: estateagents
5
     name: estateagents
6
   datasource:
6
   datasource:
7
-    username: estateagents
8
-    password: DQ@0lW##kBb2+-jPZ
9
-    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents3.5?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
7
+    username: root
8
+    password: HZjVK5O%zTdP0#8AhGcF@03!eZsGbqdO
9
+    url: jdbc:mysql://rm-2zez52se79qgg9649po.mysql.rds.aliyuncs.com:3306/estateagents3.5?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10
     driver-class-name: com.mysql.cj.jdbc.Driver
10
     driver-class-name: com.mysql.cj.jdbc.Driver
11
     initial-size: 10 # 初始化连接数
11
     initial-size: 10 # 初始化连接数
12
     max-active: 20 # 最大连接数
12
     max-active: 20 # 最大连接数

+ 16
- 16
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

155
     <select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
155
     <select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
156
         select * from (
156
         select * from (
157
             select
157
             select
158
-<!--            <include refid="columnSql"></include>,-->
158
+            t.share_person as share_person_id,
159
             t.person_id,
159
             t.person_id,
160
             c.person_type,
160
             c.person_type,
161
             t.create_date as visit_time,
161
             t.create_date as visit_time,
162
-            t.tagert_type as event_type,
163
-            t.be_share as target_id,
162
+            t.target_type as event_type,
163
+            t.target_id as target_id,
164
             b.name as drainageName,
164
             b.name as drainageName,
165
             d.building_name as buildingName,
165
             d.building_name as buildingName,
166
             tn.news_name as newsName,
166
             tn.news_name as newsName,
168
             tsa.activity_name as groupActivityName,
168
             tsa.activity_name as groupActivityName,
169
             tbd.title as activityName,
169
             tbd.title as activityName,
170
             b.drainage_id
170
             b.drainage_id
171
-            from ta_share t
172
-            left join ta_drainage b on t.be_share = b.drainage_id
173
-            left join ta_building d on t.be_share = d.building_id
174
-            left join ta_news tn on t.be_share = tn.news_id
175
-            left join ta_help_activity tha on t.be_share = tha.help_activity_id
176
-            left join ta_share_activity tsa on t.be_share = tsa.group_activity_id
177
-            left join ta_building_dynamic tbd on t.be_share = tbd.dynamic_id
178
-            left join ta_person c on t.person_id = c.person_id
171
+            from ta_share_person_from t
172
+            left join ta_drainage b on t.target_id = b.drainage_id
173
+            left join ta_building d on t.target_id = d.building_id
174
+            left join ta_news tn on t.target_id = tn.news_id
175
+            left join ta_help_activity tha on t.target_id = tha.help_activity_id
176
+            left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
177
+            left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
178
+            left join ta_person c on (t.share_person = c.person_id or t.share_person = c.user_id)
179
             where 1=1
179
             where 1=1
180
-                and t.tagert_type != 'consultant'
180
+            and t.target_type in ('h5_share','group_share','help_share','news_share','dynamic_share','building_share')
181
             <if test="orgId != null and orgId != ''">
181
             <if test="orgId != null and orgId != ''">
182
                 and c.org_id = #{orgId}
182
                 and c.org_id = #{orgId}
183
             </if>
183
             </if>
184
             <if test="eventType !=null and eventType != ''">
184
             <if test="eventType !=null and eventType != ''">
185
-                and t.tagert_type = #{eventType}
185
+                and t.target_type = #{eventType}
186
             </if>
186
             </if>
187
             <if test="activityName !=null and activityName != ''">
187
             <if test="activityName !=null and activityName != ''">
188
                 and (
188
                 and (
189
-                (b.name like concat('%',#{activityName},'%') and t.tagert_type = 'h5')or (d.name like concat('%',#{activityName},'%') and t.tagert_type = 'building') or (tn.news_name like concat('%',#{activityName},'%') and t.tagert_type = 'news')
190
-                or (tha.title like concat( '%', #{activityName}, '%' ) and t.tagert_type = 'help')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.tagert_type = 'group') or (tbd.title like concat('%',#{activityName},'%') and t.tagert_type = 'activity')
189
+                (b.name like concat('%',#{activityName},'%') and t.target_type = 'h5_share')or (d.name like concat('%',#{activityName},'%') and t.target_type = 'building_share') or (tn.news_name like concat('%',#{activityName},'%') and t.target_type = 'news_share')
190
+                or (tha.title like concat( '%', #{activityName}, '%' ) and t.target_type = 'help_share')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.target_type = 'group_share') or (tbd.title like concat('%',#{activityName},'%') and t.target_type = 'dynamic_share')
191
                 )
191
                 )
192
             </if>
192
             </if>
193
             <if test="shareName !=null and shareName != ''">
193
             <if test="shareName !=null and shareName != ''">
213
             </if>
213
             </if>
214
             order by t.create_date desc
214
             order by t.create_date desc
215
         ) t
215
         ) t
216
-        group by t.person_id, t.target_id,t.event_type
216
+        group by t.person_id, t.target_id,t.event_type, t.share_person_id
217
         order by t.visit_time desc
217
         order by t.visit_time desc
218
     </select>
218
     </select>
219
 
219