| @@ -26,7 +26,7 @@ BEGIN | |||
| EXECUTE stmt_new; | |||
| DEALLOCATE PREPARE stmt_new; | |||
| END IF; | |||
| END LOOP; | |||
| END LOOP; | |||
| CLOSE table_cursor; | |||
| IF err_flag THEN | |||
| ROLLBACK; | |||
| @@ -134,7 +134,6 @@ BEGIN | |||
| UPDATE wx_order_press SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_question_log SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_c_user_car SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_c_user_from_b SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_coupon_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_credit_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| @@ -148,12 +147,19 @@ BEGIN | |||
| UPDATE wx_credit_history SET operator_id = newCuserId WHERE operator_type in (1,2) and operator_id = oldCuserId ; | |||
| UPDATE wx_c_user_basic_info SET poins = (SELECT SUM(poins) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)), | |||
| select group_concat(tenantId) into @tenantIds from ( | |||
| SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(a.tenant_id,',',b.help_topic_id + 1),',',-1) as tenantId FROM | |||
| (SELECT DISTINCT tenant_id FROM wx_c_user_basic_info where id in (newCuserId,oldCuserId)) a | |||
| JOIN mysql.help_topic b ON b.help_topic_id < (LENGTH(a.tenant_id) - LENGTH(REPLACE(a.tenant_id,',','')) + 1) | |||
| ) c where tenantId != ""; | |||
| UPDATE wx_c_user_basic_info SET tenant_id = concat(',',@tenantIds,','), | |||
| poins = (SELECT SUM(poins) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)), | |||
| credit = (SELECT SUM(credit) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)), | |||
| login_count = (SELECT SUM(login_count) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)) | |||
| WHERE id = newCuserId ; | |||
| UPDATE wx_c_user_basic_info SET phone = concat(phone,'(作废)'),`status` = 1 WHERE id = oldCuserId ; | |||
| UPDATE wx_c_user_basic_info SET phone = concat(phone,'_del_',date_format(now(),'%Y%m%d%H%m%s')),`status` = 1 WHERE id = oldCuserId ; | |||
| IF err_flag THEN | |||
| ROLLBACK; | |||
| @@ -27,7 +27,7 @@ update wx_c_user_basic_info set tenant_id = concat(",",final_tenant_id,","); | |||
| CREATE DEFINER=`root`@`%` PROCEDURE `move_after_group`(IN tenantIds VARCHAR(125)) | |||
| CREATE DEFINER=`root`@`%` PROCEDURE `move_after_group`(IN tenantIds VARCHAR(125),IN groupTenantId VARCHAR(125)) | |||
| BEGIN | |||
| DECLARE done INT DEFAULT 0; | |||
| @@ -48,7 +48,7 @@ BEGIN | |||
| DECLARE oldCuserId BIGINT DEFAULT 0; | |||
| DECLARE newCuserId BIGINT DEFAULT 0; | |||
| DECLARE users CURSOR FOR SELECT id FROM `wx_c_user_basic_info` WHERE phone = phonestr and FIND_IN_SET(final_tenant_id,tenantIds) order by active_time DESC; | |||
| DECLARE users CURSOR FOR SELECT id FROM `wx_c_user_basic_info` WHERE phone = phonestr and FIND_IN_SET(final_tenant_id,tenantIds) order by active_time DESC; | |||
| DECLARE CONTINUE HANDLER FOR NOT FOUND SET done2 = 1; | |||
| OPEN users; | |||
| @@ -58,48 +58,23 @@ BEGIN | |||
| SET oldCuserId =userid; | |||
| ELSE | |||
| SET newCuserId =userid; | |||
| UPDATE wx_c_user SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_activity_join SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_game_action_log SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_order_group SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_order_press SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_question_log SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||
| UPDATE wx_c_user_car SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_c_user_from_b SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_coupon_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_credit_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_pay_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_refund_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_score_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||
| UPDATE wx_card_spend SET owner_id = newCuserId WHERE owner_id = oldCuserId ; | |||
| UPDATE wx_coupon_order SET owner_id = newCuserId WHERE owner_id = oldCuserId ; | |||
| UPDATE wx_credit_history SET operator_id = newCuserId WHERE operator_type in (1,2) and operator_id = oldCuserId ; | |||
| UPDATE wx_c_user_basic_info SET poins = (SELECT SUM(poins) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)), | |||
| credit = (SELECT SUM(credit) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)), | |||
| login_count = (SELECT SUM(login_count) FROM wx_c_user_basic_info WHERE id in (oldCuserId,newCuserId)) | |||
| WHERE id = newCuserId ; | |||
| UPDATE wx_c_user_basic_info SET phone = concat(phone,'(作废)',"--",num),`status` = 1 WHERE id = oldCuserId ; | |||
| CALL cuser_old_to_new(oldCuserId,newCuserId); | |||
| END IF; | |||
| SET num = num +1; | |||
| FETCH users INTO userid; | |||
| END WHILE; | |||
| CLOSE users; | |||
| END; | |||
| FETCH phones INTO phonestr; | |||
| END WHILE; | |||
| CLOSE phones; | |||
| UPDATE wx_c_user_basic_info SET final_tenant_id = groupTenantId WHERE FIND_IN_SET(final_tenant_id,tenantIds); | |||
| UPDATE wx_c_user_tags SET tenant_id = groupTenantId WHERE FIND_IN_SET(tenant_id,tenantIds); | |||
| CALL init_after_group(groupTenantId,tenantIds); | |||
| IF done = -1 THEN | |||
| ROLLBACK; | |||
| ELSE | |||
| @@ -76,11 +76,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| ResultData rd = wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode); | |||
| if (rd.code == Result.SUCCESS) { | |||
| // 更新到basicinfo | |||
| Long userId = user.getId(); | |||
| if (user.basicInfoIs()) { | |||
| userId = user.getUserId(); | |||
| } | |||
| Long basicUserId = saveToBasicInfoByCUser(phone, user.getNickName(), user.getAvatarUrl(), user.getGender(), userId); | |||
| Long basicUserId = saveToBasicInfoByCUser(phone, user.getNickName(), user.getAvatarUrl(), user.getGender(), user.getUserId()); | |||
| if (null != basicUserId) { | |||
| if(basicUserId.intValue() == -1){ | |||
| return rd; | |||
| @@ -91,6 +87,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| user.setVerifyCodePhone(phone); | |||
| user.setUpdateDate(new Date()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| // wxCUserService.assureUserIdOnly(user.getId(),); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE,user); | |||
| cUserTokenService.removeTokenCache(user.getToken()); | |||
| @@ -996,10 +996,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| // user.setCredit(credit); | |||
| // wxCUserMapper.updateById(user); | |||
| // } | |||
| if(user.getUserId() == null){ | |||
| user.setUserId(user.getId()); | |||
| wxCUserMapper.updateById(user); | |||
| } | |||
| // if(user.getUserId() == null){ | |||
| // user.setUserId(oldUserBase.getId()); | |||
| // wxCUserMapper.updateById(user); | |||
| // } | |||
| bHaveCUser = true; | |||
| if (oldUserBase != null) { | |||
| if(oldUserBase != null) { | |||