diff --git a/mallinkAdmin/pom.xml b/mallinkAdmin/pom.xml
index 607df26a9..b4e69011d 100644
--- a/mallinkAdmin/pom.xml
+++ b/mallinkAdmin/pom.xml
@@ -47,6 +47,13 @@
5.2.4
+
+
+ net.sourceforge.tess4j
+ tess4j
+ 4.5.2
+
+
diff --git a/mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java b/mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java
index 83d21c743..43c9e2138 100644
--- a/mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java
+++ b/mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java
@@ -153,7 +153,7 @@ public class ShiroConfig {
//配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap.put("/logout", "authc");
-// filterChainDefinitionMap.put("/**", "corsFilter,token,authc");
+ filterChainDefinitionMap.put("/**", "corsFilter,token,authc");
// filterChainDefinitionMap.put("/**", "anon");
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
index 251e252c9..8e13ceee7 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
@@ -5,6 +5,7 @@ import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
+import com.iformall.config.WechatWebProperties;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
@@ -92,26 +93,29 @@ public class WxProjectConfigController extends BaseController {
@Autowired
MallUserInfoService mallUserInfoService;
+ @Autowired
+ private WechatWebProperties wechatWebProperties;
+
@Autowired
@Qualifier("openRedisTemplate")
RedisTemplate openRedisTemplate;
- @ApiOperation("添加商场基础数据")
- @GetMapping(value = "/init/{id}")
- @SystemControllerLog(description = "商场基础数据")
- @TenantIgnore
- public ResultData init(@PathVariable Long id) {
- logger.debug("[" + getIpAddr() + "] WxProjectConfigController::init");
- try {
- wxProjectConfigService.initProjectConfig(id);
- return new ResultData();
- }catch (Exception e){
- logger.error(e.getMessage(),e);
- return new ResultData(ErrorCode.SYS_SERVER_ERROR);
- }
-
- }
+// @ApiOperation("添加商场基础数据")
+// @GetMapping(value = "/init/{id}")
+// @SystemControllerLog(description = "商场基础数据")
+// @TenantIgnore
+// public ResultData init(@PathVariable Long id) {
+// logger.debug("[" + getIpAddr() + "] WxProjectConfigController::init");
+// try {
+// wxProjectConfigService.initProjectConfig(id);
+// return new ResultData();
+// }catch (Exception e){
+// logger.error(e.getMessage(),e);
+// return new ResultData(ErrorCode.SYS_SERVER_ERROR);
+// }
+//
+// }
@ApiOperation("查询商场集团列表")
@@ -241,7 +245,7 @@ public class WxProjectConfigController extends BaseController {
}
if(StringUtils.isBlank(wxPayAccount.getNotifyUrl())){
- wxPayAccount.setNotifyUrl("https://admin.malls.iformall.com/wxPay/notify");
+ wxPayAccount.setNotifyUrl(wechatWebProperties.getUrl()+"/wxPay/notify");
}
if(StringUtils.isBlank(wxPayAccount.getCertPath())){
wxPayAccount.setCertPath("/opt/iformall/service/apiclient_cert.p12");
@@ -285,30 +289,34 @@ public class WxProjectConfigController extends BaseController {
wxAppinfoService.saveOrUpdate(wxAppinfo);
- WxAuthorizerInfo wxAuthorizerInfo = new WxAuthorizerInfo();
+ WxAuthorizerInfo wxAuthorizerInfo = wxAuthorizerInfoService.getByAppId(wxAppinfo.getAppId());
+ if(wxAuthorizerInfo == null){
+ wxAuthorizerInfo = new WxAuthorizerInfo();
+ }
wxAuthorizerInfo.updateTenantInfo(wxAppinfo);
wxAuthorizerInfo.setType(wxAppinfo.getType());
wxAuthorizerInfo.setAuthorizerAppid(wxAppinfo.getAppId());
- if(wxAppinfo.getId() == null && wxAuthorizerInfo.getAuthorizationStatus() == null){
+
+ if(wxAuthorizerInfo.getAuthorizationStatus() == null){
wxAuthorizerInfo.setAuthorizationStatus(0);//授权状态,0为已授权,1为已取消授权
wxAuthorizerInfo.setAuthTime(new Date());
}
- if(wxAppinfo.getId() == null && wxAuthorizerInfo.getBaseStatus() == null){
+ if(wxAuthorizerInfo.getBaseStatus() == null){
wxAuthorizerInfo.setBaseStatus(0);//微信基础版本设置状态,0为已设置,1为设置失败
wxAuthorizerInfo.setBaseTime(new Date());
}
- if(wxAppinfo.getId() == null && wxAuthorizerInfo.getDomainStatus() == null){
+ if(wxAuthorizerInfo.getDomainStatus() == null){
wxAuthorizerInfo.setDomainStatus(0);//服务器域名设置状态,0为已设置,1为设置失败
wxAuthorizerInfo.setDomainTime(new Date());
}
- if(wxAppinfo.getId() == null && wxAuthorizerInfo.getWebdomainStatus() == null){
+ if(wxAuthorizerInfo.getWebdomainStatus() == null){
wxAuthorizerInfo.setWebdomainStatus(0);//服务器业务域名设置状态,0为已设置,1为设置失败
wxAuthorizerInfo.setWebdomainTime(new Date());
}
- if(wxAppinfo.getId() == null && StringUtils.isBlank(wxAuthorizerInfo.getRefreshToken())){
+ if(StringUtils.isBlank(wxAuthorizerInfo.getRefreshToken())){
wxAuthorizerInfo.setRefreshToken("");
}
- if(wxAppinfo.getId() == null && StringUtils.isBlank(wxAuthorizerInfo.getAccessToken())){
+ if(StringUtils.isBlank(wxAuthorizerInfo.getAccessToken())){
wxAuthorizerInfo.setAccessToken("");
}
wxAuthorizerInfoService.saveOrUpdate(wxAuthorizerInfo);
@@ -370,6 +378,8 @@ public class WxProjectConfigController extends BaseController {
if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) {
PasswordHelper passwordHelper = new PasswordHelper();
passwordHelper.encryptPassword(userInfo);
+ }else{
+ userInfo.setPassword(null);
}
userInfo.setIsAdmin(EnumUserAdmin.ADMIN.getCode());
userInfoService.saveOrUpdate(userInfo);
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
index a8b66e0dc..6ce6554cf 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
@@ -553,7 +553,7 @@ public class WxRentContractController extends WxContractBaseController {
return new ResultData(Result.ERROR,e.getMessage());
}
- wxRentContractService.updateRentContractStatus(wxRentContract.getId());
+ wxRentContractService.updateRentContractStatus(wxRentContract.getId(),false);
if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) {
wxPropertyContractService.updatePropertyContractStatus(wxRentContract.getPropertyId());
}
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
index 7ecc5d660..c88671ccd 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
@@ -10,6 +10,7 @@ import com.iformall.controller.base.BaseController;
import com.iformall.domain.dto.WxCouponChannelDto;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCouponChannelVo;
+import com.iformall.enums.EnumCouponSourceType;
import com.iformall.enums.EnumPayWay;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.vo.WxCouponChannelVo;
@@ -23,6 +24,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,7 +67,15 @@ public class WxCouponChannelController extends BaseController {
wxCouponChannel.setStatus(null);
}
wxCouponChannel.updateTenantInfo(getTenantInfo());
- wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
+ wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC);
+
+ if(null == wxCouponChannel.getSourceType()){
+ wxCouponChannel.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode());
+ }
+
+ if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){
+ wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn());
+ }
final PageInfo page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize);
return new ResultData(page);
}
@@ -114,7 +124,7 @@ public class WxCouponChannelController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch");
String[] ids = wxCouponChannelDto.getCouponIds().split(",");
String[] channelId = wxCouponChannelDto.getChannelId().split(",");
- ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantInfo(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime());
+ ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantInfo(),wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime());
return resultData;
}
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
index 9fc6a9493..e1109293e 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
@@ -25,6 +25,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -68,6 +69,9 @@ public class WxCouponController extends BaseController {
if(null == wxCoupon.getSourceType()){
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode());
}
+ if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){
+ wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn());
+ }
return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表
}
@@ -91,6 +95,9 @@ public class WxCouponController extends BaseController {
EnumCouponType.COUPON_PRESS.getCode()};
wxCoupon.setTypes(Arrays.asList(typeArray));
+ if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){
+ wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn());
+ }
return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表
}
@@ -390,5 +397,19 @@ public class WxCouponController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById");
return new ResultData(wxCouponService.getHtmlById(id));
}
+
+ @ApiOperation("卡延期")
+ @PostMapping("/cardDefer")
+ @SystemControllerLog(description = "卡延期")
+ public ResultData cardDefer(@RequestBody WxCoupon wxCoupon) {
+ if (wxCoupon.getId() == null) {
+ return new ResultData(ResultData.ERROR, "缺少id");
+ }
+ if (wxCoupon.getValidEndDate() == null) {
+ return new ResultData(ResultData.ERROR, "缺少validEndDate");
+ }
+
+ return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),wxCoupon.getValidEndDate()));
+ }
}
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java
index 9a5d1f970..d2df602d6 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java
@@ -54,7 +54,11 @@ public class MemCouponController extends BaseController {
wxCouponChannel.updateTenantInfo(getTenantInfo());
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_H5.getCode());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
- wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
+ wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC);
+
+ if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){
+ wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn());
+ }
final PageInfo page = couponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize);
return new ResultData(page);
}
diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
index 8af83d537..359736dc3 100644
--- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
+++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
@@ -148,7 +148,7 @@ public class WxCUserBasicInfoController extends BaseController {
}
}
wxCUserBasicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
-// wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.ActiveTime_DESC);
+ wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.wcubiActiveTime_DESC);
PageInfo page = wxCUserBasicInfoService.listAsPage(ifParentUpdateTenantInfo(),wxCUserBasicInfo, pageNum, pageSize);
if (page.getSize() > 0) {
@@ -338,7 +338,6 @@ public class WxCUserBasicInfoController extends BaseController {
basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
wxCUserBasicInfoService.exportData(ifParentUpdateTenantInfo(),basicInfo, request, response);
-
}
@RequestMapping("/exportTemplate")
diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml
index 69ba4d0ff..ede46d98e 100644
--- a/mallinkAdmin/src/main/resources/application-dev.yml
+++ b/mallinkAdmin/src/main/resources/application-dev.yml
@@ -4,7 +4,7 @@ spring:
include: rabbitMQ
# JDBC
datasource:
- url: jdbc:mysql://202.165.179.86:3306/mallink_share?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true
+ url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true
username: root
password: fm2020test
type: com.alibaba.druid.pool.DruidDataSource
@@ -27,7 +27,7 @@ spring:
#date-format: yyyy-MM-dd HH:mm:ss
# REDIS
redis:
- host: 202.165.179.86
+ host: 101.200.130.134
port: 6379
password: iF0rm@2l2ol9
timeout: 3600
@@ -87,10 +87,10 @@ spring:
retry-times-when-send-failed: 2
# RABBITMQ
rabbitmq:
- host: 202.165.179.86
+ host: 101.200.130.134
port: 5672
username: fumao
- password: f9l98&*%%u7flt33
+ password: f9l98
publisher-confirms: true
publisher-returns: false
virtual-host: /
@@ -144,7 +144,7 @@ wechat:
componentToken: formall2018
componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN
redis:
- host: 202.165.179.86
+ host: 101.200.130.134
port: 6379
password: iF0rm@2l2ol9
timeout: 3600
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql b/mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql
index b8684007b..5352bdee7 100644
--- a/mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql
+++ b/mallinkAdmin/src/main/resources/db/migration/V202007311142__GROUP__ADD_002.sql
@@ -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;
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql b/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
index f17f300af..f9ad847a9 100644
--- a/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
+++ b/mallinkAdmin/src/main/resources/db/migration/V202007311200__FOR_MEMBER_ONLY_001.sql
@@ -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 = 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;
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql
index 3d37497e9..82cf7c0b9 100644
--- a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql
+++ b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql
@@ -1,17 +1,89 @@
-INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (646, '商户建券 ', 602, 'Y', NULL, 1, NULL, NULL, 'commercialPreferential', NULL, 0, 646);
+--加商户发卷菜单
+INSERT INTO `mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (646, '商户建券 ', 602, 'Y', NULL, 1, NULL, NULL, 'commercialPreferential', NULL, 0, 646);
+--销售类型加权限
update mall_sale_type set menus = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 211, 212, 221, 222, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004]' where id=1;
update mall_sale_type set menus = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 961]' where id=2;
update mall_sale_type set menus = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932]' where id=3;
+--所有广场管理员角色加权限
+INSERT INTO `mall_role_permission`(`id`, `tenant_id`, `parent_tenant_id`, `permission_id`, `role_id`)
+ select CEILING(RAND()*90000000000+10000000000) ,mui.tenant_id,mui.parent_tenant_id,646,mur.role_id
+from mall_user_info mui
+left join mall_user_role mur on mui.id = mur.uid
+where mui.is_admin = 1 and mur.role_id is not null GROUP BY mur.role_id
+ALTER TABLE `wx_coupon`
+ADD COLUMN `source_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:A端发卷,2:B端发卷' AFTER `password_support`;
-
-
+--用户
ALTER TABLE `wx_c_user_basic_info`
MODIFY COLUMN `tenant_id` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID' AFTER `id`;
+update wx_c_user_basic_info set tenant_id = concat(",",final_tenant_id,",");
+
+
+
+ALTER TABLE `wx_c_user`
+MODIFY COLUMN `tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID' AFTER `id`,
+MODIFY COLUMN `parent_tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`,
+MODIFY COLUMN `open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信openId' AFTER `parent_tenant_id`,
+MODIFY COLUMN `union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信unionId' AFTER `open_id`,
+MODIFY COLUMN `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID' AFTER `active_time`;
+
+
+
+CREATE DEFINER=`root`@`%` PROCEDURE `move_after_group`(IN tenantIds VARCHAR(125),IN groupTenantId VARCHAR(125))
+BEGIN
+
+ DECLARE done INT DEFAULT 0;
+ DECLARE phonestr VARCHAR(50);
+ DECLARE phones CURSOR FOR SELECT phone FROM `wx_c_user_basic_info` WHERE FIND_IN_SET(final_tenant_id,tenantIds) GROUP BY phone HAVING count(1) > 1;
+
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET done = -1;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
+
+ START TRANSACTION;
+ OPEN phones;
+ FETCH phones INTO phonestr;
+ while done<>1 DO
+ BEGIN
+ DECLARE done2 int DEFAULT 0;
+ DECLARE userid BIGINT;
+ DECLARE num INT DEFAULT 0;
+ 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 CONTINUE HANDLER FOR NOT FOUND SET done2 = 1;
+
+ OPEN users;
+ FETCH users INTO userid;
+ WHILE done2 <> 1 DO
+ if num = 0 THEN
+ SET oldCuserId =userid;
+ ELSE
+ SET newCuserId =userid;
+ 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);
-ALTER TABLE `mallink`.`wx_coupon`
-ADD COLUMN `source_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:A端发卷,2:B端发卷' AFTER `password_support`;
\ No newline at end of file
+ IF done = -1 THEN
+ ROLLBACK;
+ ELSE
+ COMMIT;
+ END IF;
+END
\ No newline at end of file
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009161600__ppsRegulator.sql b/mallinkAdmin/src/main/resources/db/migration/V202009161600__ppsRegulator.sql
new file mode 100644
index 000000000..c22544882
--- /dev/null
+++ b/mallinkAdmin/src/main/resources/db/migration/V202009161600__ppsRegulator.sql
@@ -0,0 +1,18 @@
+--加POS交易菜单
+INSERT INTO `mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (418, 'POS交易', 416, 'Y', NULL, 1, NULL, NULL, 'ppsRegulator', NULL, 0, 418);
+
+--销售类型加权限
+update mall_sale_type set menus = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 211, 212, 221, 222, 251, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004]' where id=1;
+update mall_sale_type set menus = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 418, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 961]' where id=2;
+update mall_sale_type set menus = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 418, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932]' where id=3;
+
+--所有广场管理员角色加权限
+INSERT INTO `mall_role_permission`(`id`, `tenant_id`, `parent_tenant_id`, `permission_id`, `role_id`)
+ select CEILING(RAND()*90000000000+10000000000) ,mui.tenant_id,mui.parent_tenant_id,418,mur.role_id
+from mall_user_info mui
+left join mall_user_role mur on mui.id = mur.uid
+where mui.is_admin = 1 and mur.role_id is not null GROUP BY mur.role_id;
+
+ALTER TABLE `wx_c_user_basic_info`
+ADD COLUMN `tag_scan_time` DATETIME COMMENT '标签定时扫描时间';
+
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009211000__集团版数据处理.sql b/mallinkAdmin/src/main/resources/db/migration/V202009211000__集团版数据处理.sql
new file mode 100644
index 000000000..2d51db685
--- /dev/null
+++ b/mallinkAdmin/src/main/resources/db/migration/V202009211000__集团版数据处理.sql
@@ -0,0 +1,655 @@
+--groupTenantId 集团tenantId
+--tenantIds--子广场, 拼接
+
+--备份关键表数据,
+call back_up_and_move(varchar tenantIds,varchar groupTenantId);
+
+--所有数据改成集团的数据
+--tenantId 集团tenantId
+--subTenantIds 子广场,拼接
+--el: call init_after_group('1025', '1008,1020');
+call init_after_group(varchar tenantId,varchar subTenantIds);
+
+--合并子广场重复会员 清缓存
+--tenantIds 子广场,拼接
+--el: call move_after_group('1008,1020');
+--call move_after_group(tenantIds);
+
+
+
+--单独处理 wx_c_user_basic_info,wx_c_user_tags 归属集团
+--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);
+
+
+
+
+
+
+CREATE DEFINER=`root`@`%` PROCEDURE `back_up_and_move`(IN tenantIds VARCHAR(125),IN groupTenantId VARCHAR(125))
+BEGIN
+
+ select concat('_',date_format(now(),'%Y%m%d'),'_',REPLACE(tenantIds,',','_')) into @backUpSuffix;
+ select concat(@backUpSuffix,'_merge') into @mergeSuffix;
+
+
+ set @backUpSql1_0 = concat('create table wx_c_user_basic_info',@backUpSuffix,' like wx_c_user_basic_info;');
+ PREPARE back_up_sql1_0 FROM @backUpSql1_0;
+ EXECUTE back_up_sql1_0;
+ DEALLOCATE PREPARE back_up_sql1_0;
+ set @backUpSql2_0 = concat('insert into wx_c_user_basic_info',@backUpSuffix,' select * from wx_c_user_basic_info where FIND_IN_SET(final_tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql2_0 FROM @backUpSql2_0;
+ EXECUTE back_up_sql2_0;
+ DEALLOCATE PREPARE back_up_sql2_0;
+
+ set @backUpSql1_1 = concat('create table wx_c_user_basic_info',@mergeSuffix,' like wx_c_user_basic_info;');
+ PREPARE back_up_sql1_1 FROM @backUpSql1_1;
+ EXECUTE back_up_sql1_1;
+ DEALLOCATE PREPARE back_up_sql1_1;
+ set @backUpSql2_1 = concat('insert into wx_c_user_basic_info',@mergeSuffix,' select * from wx_c_user_basic_info',@backUpSuffix,' where phone in (SELECT phone FROM wx_c_user_basic_info',@backUpSuffix,' GROUP BY phone HAVING COUNT(1) > 1);');
+ PREPARE back_up_sql2_1 FROM @backUpSql2_1;
+ EXECUTE back_up_sql2_1;
+ DEALLOCATE PREPARE back_up_sql2_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_basic_info表备份处理数据成功',null);
+
+ set @backUpSql3_0 = concat('create table wx_c_user',@backUpSuffix,' like wx_c_user;');
+ PREPARE back_up_sql3_0 FROM @backUpSql3_0;
+ EXECUTE back_up_sql3_0;
+ DEALLOCATE PREPARE back_up_sql3_0;
+ set @backUpSql4_0 = concat('insert into wx_c_user',@backUpSuffix,' select * from wx_c_user where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql4_0 FROM @backUpSql4_0;
+ EXECUTE back_up_sql4_0;
+ DEALLOCATE PREPARE back_up_sql4_0;
+
+ set @backUpSql3_1 = concat('create table wx_c_user',@mergeSuffix,' like wx_c_user;');
+ PREPARE back_up_sql3_1 FROM @backUpSql3_1;
+ EXECUTE back_up_sql3_1;
+ DEALLOCATE PREPARE back_up_sql3_1;
+ set @backUpSql4_1 = concat('insert into wx_c_user',@mergeSuffix,' select * from wx_c_user',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql4_1 FROM @backUpSql4_1;
+ EXECUTE back_up_sql4_1;
+ DEALLOCATE PREPARE back_up_sql4_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user表备份、处理数据成功',null);
+
+ set @backUpSql5_0 = concat('create table wx_order',@backUpSuffix,' like wx_order;');
+ PREPARE back_up_sql5_0 FROM @backUpSql5_0;
+ EXECUTE back_up_sql5_0;
+ DEALLOCATE PREPARE back_up_sql5_0;
+ set @backUpSql6_0 = concat('insert into wx_order',@backUpSuffix,' select * from wx_order where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql6_0 FROM @backUpSql6_0;
+ EXECUTE back_up_sql6_0;
+ DEALLOCATE PREPARE back_up_sql6_0;
+
+ set @backUpSql5_1 = concat('create table wx_order',@mergeSuffix,' like wx_order;');
+ PREPARE back_up_sql5_1 FROM @backUpSql5_1;
+ EXECUTE back_up_sql5_1;
+ DEALLOCATE PREPARE back_up_sql5_1;
+ set @backUpSql6_1 = concat('insert into wx_order',@mergeSuffix,' select * from wx_order',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql6_1 FROM @backUpSql6_1;
+ EXECUTE back_up_sql6_1;
+ DEALLOCATE PREPARE back_up_sql6_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order表备份、处理数据成功',null);
+
+ set @backUpSql7_0 = concat('create table wx_coupon_order',@backUpSuffix,' like wx_coupon_order;');
+ PREPARE back_up_sql7_0 FROM @backUpSql7_0;
+ EXECUTE back_up_sql7_0;
+ DEALLOCATE PREPARE back_up_sql7_0;
+ set @backUpSql8_0 = concat('insert into wx_coupon_order',@backUpSuffix,' select * from wx_coupon_order where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql8_0 FROM @backUpSql8_0;
+ EXECUTE back_up_sql8_0;
+ DEALLOCATE PREPARE back_up_sql8_0;
+
+ set @backUpSql7_1 = concat('create table wx_coupon_order',@mergeSuffix,' like wx_coupon_order;');
+ PREPARE back_up_sql7_1 FROM @backUpSql7_1;
+ EXECUTE back_up_sql7_1;
+ DEALLOCATE PREPARE back_up_sql7_1;
+ set @backUpSql8_1 = concat('insert into wx_coupon_order',@mergeSuffix,' select * from wx_coupon_order',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,') or owner_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql8_1 FROM @backUpSql8_1;
+ EXECUTE back_up_sql8_1;
+ DEALLOCATE PREPARE back_up_sql8_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_coupon_order表备份、处理数据成功',null);
+
+ set @backUpSql9_0 = concat('create table wx_pay_order',@backUpSuffix,' like wx_pay_order;');
+ PREPARE back_up_sql9_0 FROM @backUpSql9_0;
+ EXECUTE back_up_sql9_0;
+ DEALLOCATE PREPARE back_up_sql9_0;
+ set @backUpSql10_0 = concat('insert into wx_pay_order',@backUpSuffix,' select * from wx_pay_order where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql10_0 FROM @backUpSql10_0;
+ EXECUTE back_up_sql10_0;
+ DEALLOCATE PREPARE back_up_sql10_0;
+
+ set @backUpSql9_1 = concat('create table wx_pay_order',@mergeSuffix,' like wx_pay_order;');
+ PREPARE back_up_sql9_1 FROM @backUpSql9_1;
+ EXECUTE back_up_sql9_1;
+ DEALLOCATE PREPARE back_up_sql9_1;
+ set @backUpSql10_1 = concat('insert into wx_pay_order',@mergeSuffix,' select * from wx_pay_order',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql10_1 FROM @backUpSql10_1;
+ EXECUTE back_up_sql10_1;
+ DEALLOCATE PREPARE back_up_sql10_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_pay_order表备份、处理数据成功',null);
+
+ set @backUpSql11_0 = concat('create table wx_refund_order',@backUpSuffix,' like wx_refund_order;');
+ PREPARE back_up_sql11_0 FROM @backUpSql11_0;
+ EXECUTE back_up_sql11_0;
+ DEALLOCATE PREPARE back_up_sql11_0;
+ set @backUpSql12_0 = concat('insert into wx_refund_order',@backUpSuffix,' select * from wx_refund_order where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql12_0 FROM @backUpSql12_0;
+ EXECUTE back_up_sql12_0;
+ DEALLOCATE PREPARE back_up_sql12_0;
+
+ set @backUpSql11_1 = concat('create table wx_refund_order',@mergeSuffix,' like wx_refund_order;');
+ PREPARE back_up_sql11_1 FROM @backUpSql11_1;
+ EXECUTE back_up_sql11_1;
+ DEALLOCATE PREPARE back_up_sql11_1;
+ set @backUpSql12_1 = concat('insert into wx_refund_order',@mergeSuffix,' select * from wx_refund_order',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql12_1 FROM @backUpSql12_1;
+ EXECUTE back_up_sql12_1;
+ DEALLOCATE PREPARE back_up_sql12_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_refund_order表备份、处理数据成功',null);
+
+ set @backUpSql13_0 = concat('create table wx_order_group',@backUpSuffix,' like wx_order_group;');
+ PREPARE back_up_sql13_0 FROM @backUpSql13_0;
+ EXECUTE back_up_sql13_0;
+ DEALLOCATE PREPARE back_up_sql13_0;
+ set @backUpSql14_0 = concat('insert into wx_order_group',@backUpSuffix,' select * from wx_order_group where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql14_0 FROM @backUpSql14_0;
+ EXECUTE back_up_sql14_0;
+ DEALLOCATE PREPARE back_up_sql14_0;
+
+ set @backUpSql13_1 = concat('create table wx_order_group',@mergeSuffix,' like wx_order_group;');
+ PREPARE back_up_sql13_1 FROM @backUpSql13_1;
+ EXECUTE back_up_sql13_1;
+ DEALLOCATE PREPARE back_up_sql13_1;
+ set @backUpSql14_1 = concat('insert into wx_order_group',@mergeSuffix,' select * from wx_order_group',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql14_1 FROM @backUpSql14_1;
+ EXECUTE back_up_sql14_1;
+ DEALLOCATE PREPARE back_up_sql14_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order_group表备份、处理数据成功',null);
+
+ set @backUpSql15_0 = concat('create table wx_order_press',@backUpSuffix,' like wx_order_press;');
+ PREPARE back_up_sql15_0 FROM @backUpSql15_0;
+ EXECUTE back_up_sql15_0;
+ DEALLOCATE PREPARE back_up_sql15_0;
+ set @backUpSql16_0 = concat('insert into wx_order_press',@backUpSuffix,' select * from wx_order_press where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql16_0 FROM @backUpSql16_0;
+ EXECUTE back_up_sql16_0;
+ DEALLOCATE PREPARE back_up_sql16_0;
+
+ set @backUpSql15_1 = concat('create table wx_order_press',@mergeSuffix,' like wx_order_press;');
+ PREPARE back_up_sql15_1 FROM @backUpSql15_1;
+ EXECUTE back_up_sql15_1;
+ DEALLOCATE PREPARE back_up_sql15_1;
+ set @backUpSql16_1 = concat('insert into wx_order_press',@mergeSuffix,' select * from wx_order_press',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql16_1 FROM @backUpSql16_1;
+ EXECUTE back_up_sql16_1;
+ DEALLOCATE PREPARE back_up_sql16_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order_press表备份、处理数据成功',null);
+
+ set @backUpSql17_0 = concat('create table wx_c_user_from_b',@backUpSuffix,' like wx_c_user_from_b;');
+ PREPARE back_up_sql17_0 FROM @backUpSql17_0;
+ EXECUTE back_up_sql17_0;
+ DEALLOCATE PREPARE back_up_sql17_0;
+ set @backUpSql18_0 = concat('insert into wx_c_user_from_b',@backUpSuffix,' select * from wx_c_user_from_b where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql18_0 FROM @backUpSql18_0;
+ EXECUTE back_up_sql18_0;
+ DEALLOCATE PREPARE back_up_sql18_0;
+
+ set @backUpSql17_1 = concat('create table wx_c_user_from_b',@mergeSuffix,' like wx_c_user_from_b;');
+ PREPARE back_up_sql17_1 FROM @backUpSql17_1;
+ EXECUTE back_up_sql17_1;
+ DEALLOCATE PREPARE back_up_sql17_1;
+ set @backUpSql18_1 = concat('insert into wx_c_user_from_b',@mergeSuffix,' select * from wx_c_user_from_b',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql18_1 FROM @backUpSql18_1;
+ EXECUTE back_up_sql18_1;
+ DEALLOCATE PREPARE back_up_sql18_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_from_b表备份、处理数据成功',null);
+
+ set @backUpSql19_0 = concat('create table wx_activity_join',@backUpSuffix,' like wx_activity_join;');
+ PREPARE back_up_sql19_0 FROM @backUpSql19_0;
+ EXECUTE back_up_sql19_0;
+ DEALLOCATE PREPARE back_up_sql19_0;
+ set @backUpSql20_0 = concat('insert into wx_activity_join',@backUpSuffix,' select * from wx_activity_join where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql20_0 FROM @backUpSql20_0;
+ EXECUTE back_up_sql20_0;
+ DEALLOCATE PREPARE back_up_sql20_0;
+
+ set @backUpSql19_1 = concat('create table wx_activity_join',@mergeSuffix,' like wx_activity_join;');
+ PREPARE back_up_sql19_1 FROM @backUpSql19_1;
+ EXECUTE back_up_sql19_1;
+ DEALLOCATE PREPARE back_up_sql19_1;
+ set @backUpSql20_1 = concat('insert into wx_activity_join',@mergeSuffix,' select * from wx_activity_join',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql20_1 FROM @backUpSql20_1;
+ EXECUTE back_up_sql20_1;
+ DEALLOCATE PREPARE back_up_sql20_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_activity_join表备份、处理数据成功',null);
+
+ set @backUpSql21_0 = concat('create table wx_question_log',@backUpSuffix,' like wx_question_log;');
+ PREPARE back_up_sql21_0 FROM @backUpSql21_0;
+ EXECUTE back_up_sql21_0;
+ DEALLOCATE PREPARE back_up_sql21_0;
+ set @backUpSql22_0 = concat('insert into wx_question_log',@backUpSuffix,' select * from wx_question_log where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql22_0 FROM @backUpSql22_0;
+ EXECUTE back_up_sql22_0;
+ DEALLOCATE PREPARE back_up_sql22_0;
+
+ set @backUpSql21_1 = concat('create table wx_question_log',@mergeSuffix,' like wx_question_log;');
+ PREPARE back_up_sql21_1 FROM @backUpSql21_1;
+ EXECUTE back_up_sql21_1;
+ DEALLOCATE PREPARE back_up_sql21_1;
+ set @backUpSql22_1 = concat('insert into wx_question_log',@mergeSuffix,' select * from wx_question_log',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql22_1 FROM @backUpSql22_1;
+ EXECUTE back_up_sql22_1;
+ DEALLOCATE PREPARE back_up_sql22_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_question_log表备份、处理数据成功',null);
+
+ set @backUpSql23_0 = concat('create table wx_game_action_log',@backUpSuffix,' like wx_game_action_log;');
+ PREPARE back_up_sql23_0 FROM @backUpSql23_0;
+ EXECUTE back_up_sql23_0;
+ DEALLOCATE PREPARE back_up_sql23_0;
+ set @backUpSql24_0 = concat('insert into wx_game_action_log',@backUpSuffix,' select * from wx_game_action_log where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql24_0 FROM @backUpSql24_0;
+ EXECUTE back_up_sql24_0;
+ DEALLOCATE PREPARE back_up_sql24_0;
+
+ set @backUpSql23_1 = concat('create table wx_game_action_log',@mergeSuffix,' like wx_game_action_log;');
+ PREPARE back_up_sql23_1 FROM @backUpSql23_1;
+ EXECUTE back_up_sql23_1;
+ DEALLOCATE PREPARE back_up_sql23_1;
+ set @backUpSql24_1 = concat('insert into wx_game_action_log',@mergeSuffix,' select * from wx_game_action_log',@backUpSuffix,' where user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql24_1 FROM @backUpSql24_1;
+ EXECUTE back_up_sql24_1;
+ DEALLOCATE PREPARE back_up_sql24_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_game_action_log表备份、处理数据成功',null);
+
+ set @backUpSql25_0 = concat('create table wx_credit_history',@backUpSuffix,' like wx_credit_history;');
+ PREPARE back_up_sql25_0 FROM @backUpSql25_0;
+ EXECUTE back_up_sql25_0;
+ DEALLOCATE PREPARE back_up_sql25_0;
+ set @backUpSql26_0 = concat('insert into wx_credit_history',@backUpSuffix,' select * from wx_credit_history where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql26_0 FROM @backUpSql26_0;
+ EXECUTE back_up_sql26_0;
+ DEALLOCATE PREPARE back_up_sql26_0;
+
+ set @backUpSql25_0 = concat('create table wx_credit_history',@mergeSuffix,' like wx_credit_history;');
+ PREPARE back_up_sql25_0 FROM @backUpSql25_0;
+ EXECUTE back_up_sql25_0;
+ DEALLOCATE PREPARE back_up_sql25_0;
+ set @backUpSql26_0 = concat('insert into wx_credit_history',@mergeSuffix,' select * from wx_credit_history',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,') or operator_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql26_0 FROM @backUpSql26_0;
+ EXECUTE back_up_sql26_0;
+ DEALLOCATE PREPARE back_up_sql26_0;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_credit_history表备份、处理数据成功',null);
+
+ set @backUpSql27_0 = concat('create table wx_score_history',@backUpSuffix,' like wx_score_history;');
+ PREPARE back_up_sql27_0 FROM @backUpSql27_0;
+ EXECUTE back_up_sql27_0;
+ DEALLOCATE PREPARE back_up_sql27_0;
+ set @backUpSql28_0 = concat('insert into wx_score_history',@backUpSuffix,' select * from wx_score_history where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql28_0 FROM @backUpSql28_0;
+ EXECUTE back_up_sql28_0;
+ DEALLOCATE PREPARE back_up_sql28_0;
+
+ set @backUpSql27_1 = concat('create table wx_score_history',@mergeSuffix,' like wx_score_history;');
+ PREPARE back_up_sql27_1 FROM @backUpSql27_1;
+ EXECUTE back_up_sql27_1;
+ DEALLOCATE PREPARE back_up_sql27_1;
+ set @backUpSql28_1 = concat('insert into wx_score_history',@mergeSuffix,' select * from wx_score_history',@backUpSuffix,' where c_user_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql28_1 FROM @backUpSql28_1;
+ EXECUTE back_up_sql28_1;
+ DEALLOCATE PREPARE back_up_sql28_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_score_history表备份、处理数据成功',null);
+
+ set @backUpSql29_0 = concat('create table wx_card_spend',@backUpSuffix,' like wx_card_spend;');
+ PREPARE back_up_sql29_0 FROM @backUpSql29_0;
+ EXECUTE back_up_sql29_0;
+ DEALLOCATE PREPARE back_up_sql29_0;
+ set @backUpSql30_0 = concat('insert into wx_card_spend',@backUpSuffix,' select * from wx_card_spend where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql30_0 FROM @backUpSql30_0;
+ EXECUTE back_up_sql30_0;
+ DEALLOCATE PREPARE back_up_sql30_0;
+
+ set @backUpSql29_1 = concat('create table wx_card_spend',@mergeSuffix,' like wx_card_spend;');
+ PREPARE back_up_sql29_1 FROM @backUpSql29_1;
+ EXECUTE back_up_sql29_1;
+ DEALLOCATE PREPARE back_up_sql29_1;
+ set @backUpSql30_1 = concat('insert into wx_card_spend',@mergeSuffix,' select * from wx_card_spend',@backUpSuffix,' where owner_id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql30_1 FROM @backUpSql30_1;
+ EXECUTE back_up_sql30_1;
+ DEALLOCATE PREPARE back_up_sql30_1;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_card_spend表备份、处理数据成功',null);
+
+ set @backUpSql31_0 = concat('create table wx_c_user_tags',@backUpSuffix,' like wx_c_user_tags;');
+ PREPARE back_up_sql31_0 FROM @backUpSql31_0;
+ EXECUTE back_up_sql31_0;
+ DEALLOCATE PREPARE back_up_sql31_0;
+ set @backUpSql32_0 = concat('insert into wx_c_user_tags',@backUpSuffix,' select * from wx_c_user_tags where FIND_IN_SET(tenant_id,\'',tenantIds,'\');');
+ PREPARE back_up_sql32_0 FROM @backUpSql32_0;
+ EXECUTE back_up_sql32_0;
+ DEALLOCATE PREPARE back_up_sql32_0;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_tags表备份、处理数据成功','无关键SQL操作');
+
+ set @handleSql_00 = concat('CREATE TABLE `wx_c_user_basic_info_middle',@mergeSuffix,'` (
+ `new_user_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `old_user_id` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `phone` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `tenant_ids` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `user_ids` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `sum_poins` int(11) DEFAULT NULL,
+ `sum_credit` int(11) DEFAULT NULL,
+ `sum_login_count` int(11) DEFAULT NULL,
+ UNIQUE INDEX `new_user_id`(`new_user_id`) USING BTREE,
+ UNIQUE INDEX `old_user_id`(`old_user_id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;');
+ PREPARE handle_sql_00 FROM @handleSql_00;
+ EXECUTE handle_sql_00;
+ DEALLOCATE PREPARE handle_sql_00;
+
+ set @handleSql_01 = concat('insert into wx_c_user_basic_info_middle',@mergeSuffix,' (phone,tenant_ids,user_ids,sum_poins,sum_credit,sum_login_count) select phone,CONCAT(\',\',GROUP_CONCAT(final_tenant_id),\',\'),GROUP_CONCAT(id),SUM(poins),SUM(credit),SUM(login_count) from wx_c_user_basic_info',@mergeSuffix,' GROUP BY phone;');
+ PREPARE handle_sql_01 FROM @handleSql_01;
+ EXECUTE handle_sql_01;
+ DEALLOCATE PREPARE handle_sql_01;
+
+ set @handleSql_02 = concat('UPDATE wx_c_user_basic_info_middle',@mergeSuffix,' SET new_user_id = SUBSTRING_INDEX(user_ids,\',\',1);');
+ PREPARE handle_sql_02 FROM @handleSql_02;
+ EXECUTE handle_sql_02;
+ DEALLOCATE PREPARE handle_sql_02;
+
+ set @handleSql_03 = concat('UPDATE wx_c_user_basic_info_middle',@mergeSuffix,' SET old_user_id = SUBSTRING_INDEX(user_ids,CONCAT(new_user_id,\',\'),-1);');
+ PREPARE handle_sql_03 FROM @handleSql_03;
+ EXECUTE handle_sql_03;
+ DEALLOCATE PREPARE handle_sql_03;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_basic_info_middle所有会员重复数据整理成功','无关键SQL操作');
+
+ set @handleSql_10 = concat('UPDATE wx_c_user',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id) SET a.token = null,a.expire_time=now(),a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_10 FROM @handleSql_10;
+ EXECUTE handle_sql_10;
+ DEALLOCATE PREPARE handle_sql_10;
+
+ set @backUpSql3 = concat('delete from wx_c_user where id in (select id from wx_c_user',@mergeSuffix,');');
+ PREPARE back_up_sql3 FROM @backUpSql3;
+ EXECUTE back_up_sql3;
+ DEALLOCATE PREPARE back_up_sql3;
+ set @handleSql_11 = concat('insert into wx_c_user select * from wx_c_user',@mergeSuffix,';');
+ PREPARE handle_sql_11 FROM @handleSql_11;
+ EXECUTE handle_sql_11;
+ DEALLOCATE PREPARE handle_sql_11;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user表所有会员重复关联数据处理成功',concat(@backUpSql3,@handleSql_11));
+
+ set @handleSql_20 = concat('UPDATE wx_order',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_20 FROM @handleSql_20;
+ EXECUTE handle_sql_20;
+ DEALLOCATE PREPARE handle_sql_20;
+
+ set @backUpSql5 = concat('delete from wx_order where id in (select id from wx_order',@mergeSuffix,');');
+ PREPARE back_up_sql5 FROM @backUpSql5;
+ EXECUTE back_up_sql5;
+ DEALLOCATE PREPARE back_up_sql5;
+ set @handleSql_21 = concat('insert into wx_order select * from wx_order',@mergeSuffix,';');
+ PREPARE handle_sql_21 FROM @handleSql_21;
+ EXECUTE handle_sql_21;
+ DEALLOCATE PREPARE handle_sql_21;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order表所有会员重复关联数据处理成功',concat(@backUpSql5,@handleSql_21));
+
+ set @handleSql_30 = concat('UPDATE wx_coupon_order',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_30 FROM @handleSql_30;
+ EXECUTE handle_sql_30;
+ DEALLOCATE PREPARE handle_sql_30;
+ set @handleSql_31 = concat('UPDATE wx_coupon_order',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.owner_id,b.old_user_id)
+ SET a.owner_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_31 FROM @handleSql_31;
+ EXECUTE handle_sql_31;
+ DEALLOCATE PREPARE handle_sql_31;
+
+ set @backUpSql7 = concat('delete from wx_coupon_order where id in (select id from wx_coupon_order',@mergeSuffix,');');
+ PREPARE back_up_sql7 FROM @backUpSql7;
+ EXECUTE back_up_sql7;
+ DEALLOCATE PREPARE back_up_sql7;
+ set @handleSql_32 = concat('insert into wx_coupon_order select * from wx_coupon_order',@mergeSuffix,';');
+ PREPARE handle_sql_32 FROM @handleSql_32;
+ EXECUTE handle_sql_32;
+ DEALLOCATE PREPARE handle_sql_32;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_coupon_order表所有会员重复关联数据处理成功',concat(@backUpSql7,@handleSql_32));
+
+ set @handleSql_40 = concat('UPDATE wx_pay_order',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_40 FROM @handleSql_40;
+ EXECUTE handle_sql_40;
+ DEALLOCATE PREPARE handle_sql_40;
+
+ set @backUpSql9 = concat('delete from wx_pay_order where id in (select id from wx_pay_order',@mergeSuffix,');');
+ PREPARE back_up_sql9 FROM @backUpSql9;
+ EXECUTE back_up_sql9;
+ DEALLOCATE PREPARE back_up_sql9;
+ set @handleSql_41 = concat('insert into wx_pay_order select * from wx_pay_order',@mergeSuffix,';');
+ PREPARE handle_sql_41 FROM @handleSql_41;
+ EXECUTE handle_sql_41;
+ DEALLOCATE PREPARE handle_sql_41;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_pay_order表所有会员重复关联数据处理成功',concat(@backUpSql9,@handleSql_41));
+
+ set @handleSql_50 = concat('UPDATE wx_refund_order',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_50 FROM @handleSql_50;
+ EXECUTE handle_sql_50;
+ DEALLOCATE PREPARE handle_sql_50;
+
+ set @backUpSql11 = concat('delete from wx_refund_order where id in (select id from wx_refund_order',@mergeSuffix,');');
+ PREPARE back_up_sql11 FROM @backUpSql11;
+ EXECUTE back_up_sql11;
+ DEALLOCATE PREPARE back_up_sql11;
+ set @handleSql_51 = concat('insert into wx_refund_order select * from wx_refund_order',@mergeSuffix,';');
+ PREPARE handle_sql_51 FROM @handleSql_51;
+ EXECUTE handle_sql_51;
+ DEALLOCATE PREPARE handle_sql_51;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_refund_order表所有会员重复关联数据处理成功',concat(@backUpSql11,@handleSql_51));
+
+ set @handleSql_60 = concat('UPDATE wx_order_group',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id)
+ SET a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_60 FROM @handleSql_60;
+ EXECUTE handle_sql_60;
+ DEALLOCATE PREPARE handle_sql_60;
+
+ set @backUpSql13 = concat('delete from wx_order_group where id in (select id from wx_order_group',@mergeSuffix,');');
+ PREPARE back_up_sql13 FROM @backUpSql13;
+ EXECUTE back_up_sql13;
+ DEALLOCATE PREPARE back_up_sql13;
+ set @handleSql_61 = concat('insert into wx_order_group select * from wx_order_group',@mergeSuffix,';');
+ PREPARE handle_sql_61 FROM @handleSql_61;
+ EXECUTE handle_sql_61;
+ DEALLOCATE PREPARE handle_sql_61;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order_group表所有会员重复关联数据处理成功',concat(@backUpSql13,@handleSql_61));
+
+ set @handleSql_70 = concat('UPDATE wx_order_press',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id)
+ SET a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_70 FROM @handleSql_70;
+ EXECUTE handle_sql_70;
+ DEALLOCATE PREPARE handle_sql_70;
+
+ set @backUpSql15 = concat('delete from wx_order_press where id in (select id from wx_order_press',@mergeSuffix,');');
+ PREPARE back_up_sql15 FROM @backUpSql15;
+ EXECUTE back_up_sql15;
+ DEALLOCATE PREPARE back_up_sql15;
+ set @handleSql_71 = concat('insert into wx_order_press select * from wx_order_press',@mergeSuffix,';');
+ PREPARE handle_sql_71 FROM @handleSql_71;
+ EXECUTE handle_sql_71;
+ DEALLOCATE PREPARE handle_sql_71;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_order_press表所有会员重复关联数据处理成功',concat(@backUpSql15,@handleSql_71));
+
+ set @handleSql_80 = concat('UPDATE wx_c_user_from_b',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_80 FROM @handleSql_80;
+ EXECUTE handle_sql_80;
+ DEALLOCATE PREPARE handle_sql_80;
+
+ set @backUpSql17 = concat('delete from wx_c_user_from_b where id in (select id from wx_c_user_from_b',@mergeSuffix,');');
+ PREPARE back_up_sql17 FROM @backUpSql17;
+ EXECUTE back_up_sql17;
+ DEALLOCATE PREPARE back_up_sql17;
+ set @handleSql_81 = concat('insert into wx_c_user_from_b select * from wx_c_user_from_b',@mergeSuffix,';');
+ PREPARE handle_sql_81 FROM @handleSql_81;
+ EXECUTE handle_sql_81;
+ DEALLOCATE PREPARE handle_sql_81;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_from_b表所有会员重复关联数据处理成功',concat(@backUpSql17,@handleSql_81));
+
+ set @handleSql_90 = concat('UPDATE wx_activity_join',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id)
+ SET a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_90 FROM @handleSql_90;
+ EXECUTE handle_sql_90;
+ DEALLOCATE PREPARE handle_sql_90;
+
+ set @backUpSql19 = concat('delete from wx_activity_join where id in (select id from wx_activity_join',@mergeSuffix,');');
+ PREPARE back_up_sql19 FROM @backUpSql19;
+ EXECUTE back_up_sql19;
+ DEALLOCATE PREPARE back_up_sql19;
+ set @handleSql_91 = concat('insert into wx_activity_join select * from wx_activity_join',@mergeSuffix,';');
+ PREPARE handle_sql_91 FROM @handleSql_91;
+ EXECUTE handle_sql_91;
+ DEALLOCATE PREPARE handle_sql_91;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_activity_join表所有会员重复关联数据处理成功',concat(@backUpSql19,@handleSql_91));
+
+ set @handleSql_100 = concat('UPDATE wx_question_log',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id)
+ SET a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_100 FROM @handleSql_100;
+ EXECUTE handle_sql_100;
+ DEALLOCATE PREPARE handle_sql_100;
+
+ set @backUpSql21 = concat('delete from wx_question_log where id in (select id from wx_question_log',@mergeSuffix,');');
+ PREPARE back_up_sql21 FROM @backUpSql21;
+ EXECUTE back_up_sql21;
+ DEALLOCATE PREPARE back_up_sql21;
+ set @handleSql_101 = concat('insert into wx_question_log select * from wx_question_log',@mergeSuffix,';');
+ PREPARE handle_sql_101 FROM @handleSql_101;
+ EXECUTE handle_sql_101;
+ DEALLOCATE PREPARE handle_sql_101;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_question_log表所有会员重复关联数据处理成功',concat(@backUpSql21,@handleSql_101));
+
+ set @handleSql_110 = concat('UPDATE wx_game_action_log',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.user_id,b.old_user_id)
+ SET a.user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_110 FROM @handleSql_110;
+ EXECUTE handle_sql_110;
+ DEALLOCATE PREPARE handle_sql_110;
+
+ set @backUpSql23 = concat('delete from wx_game_action_log where id in (select id from wx_game_action_log',@mergeSuffix,');');
+ PREPARE back_up_sql23 FROM @backUpSql23;
+ EXECUTE back_up_sql23;
+ DEALLOCATE PREPARE back_up_sql23;
+ set @handleSql_111 = concat('insert into wx_game_action_log select * from wx_game_action_log',@mergeSuffix,';');
+ PREPARE handle_sql_111 FROM @handleSql_111;
+ EXECUTE handle_sql_111;
+ DEALLOCATE PREPARE handle_sql_111;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_game_action_log表所有会员重复关联数据处理成功',concat(@backUpSql23,@handleSql_111));
+
+ set @handleSql_120 = concat('UPDATE wx_credit_history',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_120 FROM @handleSql_120;
+ EXECUTE handle_sql_120;
+ DEALLOCATE PREPARE handle_sql_120;
+ set @handleSql_121 = concat('UPDATE wx_credit_history',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.operator_id,b.old_user_id)
+ SET a.operator_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_121 FROM @handleSql_121;
+ EXECUTE handle_sql_121;
+ DEALLOCATE PREPARE handle_sql_121;
+
+ set @backUpSql25 = concat('delete from wx_credit_history where id in (select id from wx_credit_history',@mergeSuffix,');');
+ PREPARE back_up_sql25 FROM @backUpSql25;
+ EXECUTE back_up_sql25;
+ DEALLOCATE PREPARE back_up_sql25;
+ set @handleSql_122 = concat('insert into wx_credit_history select * from wx_credit_history',@mergeSuffix,';');
+ PREPARE handle_sql_122 FROM @handleSql_122;
+ EXECUTE handle_sql_122;
+ DEALLOCATE PREPARE handle_sql_122;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_credit_history表所有会员重复关联数据处理成功',concat(@backUpSql25,@handleSql_122));
+
+ set @handleSql_130 = concat('UPDATE wx_score_history',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.c_user_id,b.old_user_id)
+ SET a.c_user_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_130 FROM @handleSql_130;
+ EXECUTE handle_sql_130;
+ DEALLOCATE PREPARE handle_sql_130;
+
+ set @backUpSql27 = concat('delete from wx_score_history where id in (select id from wx_score_history',@mergeSuffix,');');
+ PREPARE back_up_sql27 FROM @backUpSql27;
+ EXECUTE back_up_sql27;
+ DEALLOCATE PREPARE back_up_sql27;
+ set @handleSql_131 = concat('insert into wx_score_history select * from wx_score_history',@mergeSuffix,';');
+ PREPARE handle_sql_131 FROM @handleSql_131;
+ EXECUTE handle_sql_131;
+ DEALLOCATE PREPARE handle_sql_131;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_score_history表所有会员重复关联数据处理成功',concat(@backUpSql27,@handleSql_131));
+
+ set @handleSql_140 = concat('UPDATE wx_card_spend',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.owner_id,b.old_user_id)
+ SET a.owner_id = b.new_user_id WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_140 FROM @handleSql_140;
+ EXECUTE handle_sql_140;
+ DEALLOCATE PREPARE handle_sql_140;
+
+ set @backUpSql29 = concat('delete from wx_card_spend where id in (select id from wx_card_spend',@mergeSuffix,');');
+ PREPARE back_up_sql29 FROM @backUpSql29;
+ EXECUTE back_up_sql29;
+ DEALLOCATE PREPARE back_up_sql29;
+ set @handleSql_141 = concat('insert into wx_card_spend select * from wx_card_spend',@mergeSuffix,';');
+ PREPARE handle_sql_141 FROM @handleSql_141;
+ EXECUTE handle_sql_141;
+ DEALLOCATE PREPARE handle_sql_141;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_card_spend表所有会员重复关联数据处理成功',concat(@backUpSql29,@handleSql_141));
+
+ set @handleSql_150 = concat('UPDATE wx_c_user_basic_info',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on a.id = b.new_user_id SET a.tenant_id = b.tenant_ids,a.poins = b.sum_poins,a.credit = b.sum_credit,a.login_count = b.sum_login_count WHERE b.new_user_id is not null;');
+ PREPARE handle_sql_150 FROM @handleSql_150;
+ EXECUTE handle_sql_150;
+ DEALLOCATE PREPARE handle_sql_150;
+ set @handleSql_151 = concat('UPDATE wx_c_user_basic_info',@mergeSuffix,' a LEFT JOIN wx_c_user_basic_info_middle',@mergeSuffix,' b on FIND_IN_SET(a.id,b.old_user_id) SET a.phone = concat(a.phone,\'_del_\',date_format(now(),\'%Y%m%d%H%m%s\')),a.`status` = 1 WHERE b.old_user_id is not null;');
+ PREPARE handle_sql_151 FROM @handleSql_151;
+ EXECUTE handle_sql_151;
+ DEALLOCATE PREPARE handle_sql_151;
+
+ set @backUpSql1 = concat('delete from wx_c_user_basic_info where id in (select id from wx_c_user_basic_info',@mergeSuffix,');');
+ PREPARE back_up_sql1 FROM @backUpSql1;
+ EXECUTE back_up_sql1;
+ DEALLOCATE PREPARE back_up_sql1;
+ set @handleSql_152 = concat('insert into wx_c_user_basic_info select * from wx_c_user_basic_info',@mergeSuffix,';');
+ PREPARE handle_sql_152 FROM @handleSql_152;
+ EXECUTE handle_sql_152;
+ DEALLOCATE PREPARE handle_sql_152;
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_basic_info表所有会员重复关联数据处理成功',concat(@backUpSql1,@handleSql_152));
+
+ 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);
+
+ INSERT into zz_process_log VALUES(NOW(),'back_up()','wx_c_user_basic_info表会员归属集团修改成功',concat('UPDATE wx_c_user_basic_info SET final_tenant_id = ',groupTenantId,' WHERE FIND_IN_SET(final_tenant_id,',tenantIds,');'));
+
+ SELECT * from zz_process_log;
+
+END
+
diff --git a/mallinkAdmin/src/main/resources/db/migration/V202010100001__couponchannel_show_begin.sql b/mallinkAdmin/src/main/resources/db/migration/V202010100001__couponchannel_show_begin.sql
new file mode 100644
index 000000000..d40465868
--- /dev/null
+++ b/mallinkAdmin/src/main/resources/db/migration/V202010100001__couponchannel_show_begin.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `mallink`.`wx_coupon_channel`
+ADD COLUMN `show_begin_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `sub_business`;
\ No newline at end of file
diff --git a/mallinkAdmin/src/main/resources/logback-spring.xml b/mallinkAdmin/src/main/resources/logback-spring.xml
index 2525413f1..3a54d117d 100644
--- a/mallinkAdmin/src/main/resources/logback-spring.xml
+++ b/mallinkAdmin/src/main/resources/logback-spring.xml
@@ -13,7 +13,7 @@
${logPath}/trace.log
${logPath}/daily/trace.%d{yyyy-MM-dd}.log
- 180
+ 30
[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n
@@ -24,7 +24,7 @@
${logPath}/info.log
${logPath}/daily/info.%d{yyyy-MM-dd}.log
- 180
+ 30
[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n
@@ -40,7 +40,7 @@
${logPath}/debug.log
${logPath}/daily/debug.%d{yyyy-MM-dd}.log
- 180
+ 30
[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n
@@ -57,7 +57,7 @@
${logPath}/warn.log
${logPath}/daily/warn.%d{yyyy-MM-dd}.log
- 180
+ 30
[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n
@@ -75,7 +75,7 @@
${logPath}/error.log
${logPath}/daily/error.%d{yyyy-MM-dd}.log
- 180
+ 30
[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n
diff --git a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java
index ac1bceb9a..6a4184022 100644
--- a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java
+++ b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java
@@ -76,10 +76,11 @@ public class BaseController {
}
public WxMerchantBUser getUser() {
- Long userId = getBuser().getUserId();
+ WxBuser buser = getBuser();
+ Long userId = buser.getUserId();
WxMerchantBUser user = wxMerchantBUserService.getById(userId);
if (user == null) {
- throw new MallinkException(ErrorCode.USER_IS_EMPTY);
+ throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"BUser[id:"+buser.getId()+",userId:"+userId+"]未查询到WxMerchantBUser。请联系管理员或者重新登陆.");
}
return user;
}
@@ -88,7 +89,7 @@ public class BaseController {
Long id = getBuserId();
WxBuser user = wxBuserService.getById(id);
if (user == null) {
- throw new MallinkException(ErrorCode.USER_IS_EMPTY);
+ throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"BUser[id:"+id+"]未查询到记录, 请重新登陆,并完全授权微信个人信息以及手机号授权.");
}
return user;
}
diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
index 16b5b73f4..00251e4e6 100644
--- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
+++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
@@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -57,8 +58,13 @@ public class WxCouponChannelController extends BaseController {
if (wxCouponChannel.getStatus() != null && wxCouponChannel.getStatus() == -1) {
wxCouponChannel.setStatus(null);
}
+ wxCouponChannel.setMerchantId(getUser().getMerchantId());
wxCouponChannel.updateTenantInfo(getTenantInfo());
- wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
+ wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC);
+
+ if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){
+ wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn());
+ }
final PageInfo page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize);
return new ResultData(page);
}
@@ -104,7 +110,7 @@ public class WxCouponChannelController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch");
String[] ids = wxCouponChannelDto.getCouponIds().split(",");
String[] channelId = wxCouponChannelDto.getChannelId().split(",");
- ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantInfo(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime());
+ ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantInfo(),wxCouponChannelDto.getShowBeginTime(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime());
return resultData;
}
diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java
index 9fb169707..89263d283 100644
--- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java
+++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java
@@ -1,5 +1,6 @@
package com.iformall.controller;
+import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
@@ -7,6 +8,10 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxCouponPassword;
+import com.iformall.domain.po.WxFlowModel;
+import com.iformall.domain.po.WxFlowRecord;
+import com.iformall.domain.po.WxMerchant;
+import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCouponStatisVo;
import com.iformall.enums.*;
@@ -14,6 +19,7 @@ import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.service.WxCouponPasswordService;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxFlowService;
+import com.iformall.service.WxMerchantService;
import com.iformall.utils.DateUtils;
import com.iformall.utils.RedisLock;
import io.swagger.annotations.Api;
@@ -22,6 +28,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,10 +36,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
@RestController
@RequestMapping("/api/coupon")
@@ -49,6 +53,8 @@ public class WxCouponController extends BaseController {
@Autowired
private WxFlowService wxFlowService;
@Autowired
+ private WxMerchantService wxMerchantService;
+ @Autowired
RedisLock redisLock;
@ApiOperation("分页列表接口")
@@ -63,6 +69,12 @@ public class WxCouponController extends BaseController {
if(null == wxCoupon.getSourceType()){
wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode());
}
+ wxCoupon.setMerchantId(getUser().getMerchantId());
+
+ if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){
+ wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn());
+ }
+
return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表
}
@@ -85,12 +97,95 @@ public class WxCouponController extends BaseController {
EnumCouponType.COUPON_PRESS.getCode()};
wxCoupon.setTypes(Arrays.asList(typeArray));
+ wxCoupon.setMerchantId(getUser().getMerchantId());
+ if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){
+ wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn());
+ }
return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表
}
+ private Map generateFlowParams(EnumFlowKey flowType,EnumCouponAppType approvalType, WxCoupon wxCoupon,String remark,String phone) {
+ Map map = new HashMap();
+ map.put("businessId", String.valueOf(wxCoupon.getId()));
+ map.put("businessType", flowType.getCode());
+ map.put("remark", remark);
+ map.put("phone", phone);
+ List