| @@ -47,6 +47,13 @@ | |||
| <version>5.2.4</version> | |||
| </dependency> | |||
| <!-- https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j --> | |||
| <dependency> | |||
| <groupId>net.sourceforge.tess4j</groupId> | |||
| <artifactId>tess4j</artifactId> | |||
| <version>4.5.2</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| @@ -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"); | |||
| @@ -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<String, String> 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); | |||
| @@ -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()); | |||
| } | |||
| @@ -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<WxCouponChannelVo> 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; | |||
| } | |||
| @@ -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())); | |||
| } | |||
| } | |||
| @@ -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<WxCouponChannelVo> page = couponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -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<WxCUserBasicInfo> 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") | |||
| @@ -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 | |||
| @@ -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 = 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; | |||
| @@ -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`; | |||
| IF done = -1 THEN | |||
| ROLLBACK; | |||
| ELSE | |||
| COMMIT; | |||
| END IF; | |||
| END | |||
| @@ -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 '标签定时扫描时间'; | |||
| @@ -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 | |||
| @@ -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`; | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -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; | |||
| } | |||
| @@ -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<WxCouponChannelVo> 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; | |||
| } | |||
| @@ -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<String,Object> generateFlowParams(EnumFlowKey flowType,EnumCouponAppType approvalType, WxCoupon wxCoupon,String remark,String phone) { | |||
| Map<String,Object> map = new HashMap<String,Object>(); | |||
| map.put("businessId", String.valueOf(wxCoupon.getId())); | |||
| map.put("businessType", flowType.getCode()); | |||
| map.put("remark", remark); | |||
| map.put("phone", phone); | |||
| List<Map> variablesList = new ArrayList<Map>(); | |||
| Map contractTypeMap = new HashMap<String,Object>(); | |||
| contractTypeMap.put("key","approvalType"); | |||
| contractTypeMap.put("value",String.valueOf(approvalType.getCode())); | |||
| variablesList.add(contractTypeMap); | |||
| Map couponNameMap = new HashMap<String,Object>(); | |||
| couponNameMap.put("key","couponName"); | |||
| couponNameMap.put("value",wxCoupon.getTitle()); | |||
| variablesList.add(couponNameMap); | |||
| Map couponTypeMap = new HashMap<String,Object>(); | |||
| couponTypeMap.put("key","couponType"); | |||
| couponTypeMap.put("value",wxCoupon.getType()); | |||
| variablesList.add(couponTypeMap); | |||
| map.put("variables", variablesList); | |||
| return map; | |||
| } | |||
| private boolean hasFlow(EnumFlowKey flowType,TenantEntity tenantEntity) { | |||
| WxFlowModel wxFlowModel = new WxFlowModel(); | |||
| wxFlowModel.setFlowType(flowType.getCode()); | |||
| wxFlowModel.updateTenantInfo(tenantEntity); | |||
| List<WxFlowModel> flows = wxFlowService.getModelBybusiness(wxFlowModel); | |||
| if (null != flows && flows.size() > 0) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| private boolean hasMerchantCouponFlow() { | |||
| return hasFlow(EnumFlowKey.B_COUPON_MERCHANT_CREATE,getTenantInfo()); | |||
| } | |||
| @ApiOperation("审批历史") | |||
| @GetMapping("flowHistory") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponId", value = "编号", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData flowHistory(Long couponId) { | |||
| WxFlowRecord record = new WxFlowRecord(); | |||
| record.setBusinessId(String.valueOf(couponId)); | |||
| return new ResultData(wxFlowService.listAsPage(record, 1, 100)); | |||
| } | |||
| @ApiOperation("提交审批") | |||
| @PostMapping("apply") | |||
| public ResultData apply(@RequestBody WxCoupon wxCoupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::add"); | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | |||
| if(coupon.getSourceType().intValue() != EnumCouponSourceType.COUPONSource_Bapi.getCode().intValue()){ | |||
| return new ResultData(Result.ERROR,"非B端券,不能进行此操作"); | |||
| } | |||
| if (!hasMerchantCouponFlow()) { | |||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | |||
| } | |||
| WxMerchantBUser buser = getUser(); | |||
| wxFlowService.start(generateFlowParams(EnumFlowKey.B_COUPON_MERCHANT_CREATE,EnumCouponAppType.PUT,coupon,wxCoupon.getRemark(), buser.getPhone()), getBuserId(), buser.getName(), coupon); | |||
| return new ResultData(Result.SUCCESS,"提交审批成功"); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCoupon wxCoupon) { | |||
| if (!hasMerchantCouponFlow()) { | |||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | |||
| } | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::add"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| wxCoupon.updateTenantInfo(tenantEntity); | |||
| @@ -98,6 +193,11 @@ public class WxCouponController extends BaseController { | |||
| if(null == wxCoupon.getSourceType()){ | |||
| wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode()); | |||
| } | |||
| List<WxMerchant> merchantList = new ArrayList<>(); | |||
| WxMerchant wxMerchant = wxMerchantService.getById(getUser().getMerchantId()); | |||
| merchantList.add(wxMerchant); | |||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); | |||
| if (resultData.code != 200) { | |||
| @@ -117,6 +217,9 @@ public class WxCouponController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCoupon wxCoupon) { | |||
| if (!hasMerchantCouponFlow()) { | |||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | |||
| } | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::update"); | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| @@ -132,32 +235,26 @@ public class WxCouponController extends BaseController { | |||
| } | |||
| } | |||
| List<WxMerchant> merchantList = new ArrayList<>(); | |||
| WxMerchant wxMerchant = wxMerchantService.getById(getUser().getMerchantId()); | |||
| merchantList.add(wxMerchant); | |||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | |||
| if (null == coupon) { | |||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | |||
| } | |||
| redisLock.setCouponStock(wxCoupon.getId(), coupon.getRemainInventory()); | |||
| //启动审批流 | |||
| if (wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() > 0) { | |||
| logger.info("------coupon.update().businessType:"+wxCoupon.getFlowParams().get("businessType")); | |||
| wxCoupon.getFlowParams().put("businessId",wxCoupon.getId()); | |||
| wxFlowService.start(wxCoupon.getFlowParams(), getBuserId(), getUser().getName(), getTenantInfo()); | |||
| //作废审批 | |||
| if (EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())) { | |||
| wxCoupon.setCancleApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | |||
| return new ResultData(wxCoupon); | |||
| } else { | |||
| //投放审批 | |||
| wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | |||
| } | |||
| } | |||
| return wxCouponService.saveOrUpdate(wxCoupon); | |||
| } | |||
| @ApiOperation("根据id更新库存及有效期接口") | |||
| @PostMapping("updateStokeAndValidDate") | |||
| public ResultData updateStokeAndValidDate(@RequestBody WxCoupon wxCoupon) { | |||
| if (!hasMerchantCouponFlow()) { | |||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | |||
| } | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::updateStokeAndValidDate"); | |||
| if (wxCoupon.getId() == null) { | |||
| logger.error("缺少id"); | |||
| @@ -219,58 +316,17 @@ public class WxCouponController extends BaseController { | |||
| return new ResultData(ErrorCode.COUPON_STOCK_ENDTIME_ERR); | |||
| } | |||
| } | |||
| //启动审批流 | |||
| if (wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() > 0) { | |||
| List<Map<String, Object>> variables = (List) wxCoupon.getFlowParams().get("variables"); | |||
| Map<String, Object> map = new HashedMap(); | |||
| map.put("key", "inventory"); | |||
| map.put("value", wxCoupon.getInventory()); | |||
| variables.add(map); | |||
| map = new HashedMap(); | |||
| map.put("key", "remainInventory"); | |||
| map.put("value", wxCoupon.getRemainInventory()); | |||
| variables.add(map); | |||
| map = new HashedMap(); | |||
| map.put("key", "type"); | |||
| map.put("value", wxCoupon.getType()); | |||
| variables.add(map); | |||
| map = new HashedMap(); | |||
| map.put("key", "validEndDate"); | |||
| map.put("value", wxCoupon.getValidEndDate()); | |||
| map = new HashedMap(); | |||
| map.put("key", "validStartDate"); | |||
| map.put("value", wxCoupon.getValidStartDate()); | |||
| map = new HashedMap(); | |||
| map.put("key", "validType"); | |||
| map.put("value", wxCoupon.getValidType()); | |||
| variables.add(map); | |||
| map = new HashedMap(); | |||
| map.put("key", "validDays"); | |||
| map.put("value", wxCoupon.getValidDays()); | |||
| variables.add(map); | |||
| wxCoupon.getFlowParams().put("businessId",wxCoupon.getId()); | |||
| wxFlowService.start(wxCoupon.getFlowParams(), getBuserId(), getUser().getName(), wxCoupon); | |||
| //更新状态 | |||
| WxCoupon updateCoupon = new WxCoupon(); | |||
| updateCoupon.updateTenantInfo(wxCoupon); | |||
| updateCoupon.setId(wxCoupon.getId()); | |||
| updateCoupon.setStockApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); | |||
| updateCoupon.setUpdateDate(new Date()); | |||
| wxCouponService.update(updateCoupon); | |||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | |||
| } else { | |||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | |||
| return wxCouponService.updateCouponStockAndEndTime(wxCoupon); | |||
| } | |||
| return new ResultData(); | |||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | |||
| return wxCouponService.updateCouponStockAndEndTime(wxCoupon); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| if (!hasMerchantCouponFlow()) { | |||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | |||
| } | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | |||
| wxCouponService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| @@ -140,9 +140,9 @@ public class WxInfoController extends BaseController { | |||
| session_key = session.getSessionKey(); | |||
| openId = session.getOpenid(); | |||
| unionId = session.getUnionid(); | |||
| if (StringUtils.isNotBlank(unionId)) { | |||
| boolHaveUnionId = true; | |||
| } | |||
| //if (StringUtils.isNotBlank(unionId)) { | |||
| // boolHaveUnionId = true; | |||
| //} | |||
| resultMap.put("openId", openId); | |||
| resultMap.put("session_key", session_key); | |||
| } catch (WxErrorException e) { | |||
| @@ -55,7 +55,7 @@ public class WxMerchantController extends BaseController { | |||
| public ResultData addAccount(@RequestBody WxMerchant wxMerchant) { | |||
| log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::addAccount"); | |||
| if (!hasPermission()) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),"当前微信绑定的手机号不是商户的联系方式手机号,不能操作"); | |||
| } | |||
| if (wxMerchant.getId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | |||
| @@ -82,7 +82,7 @@ public class WxMerchantController extends BaseController { | |||
| public ResultData deleteByReceiverId(@ModelAttribute WxProfitSharingReceiver receiver) { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::deleteByReceiverId"); | |||
| if (!hasPermission()) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),"当前微信绑定的手机号不是商户的联系方式手机号,不能操作"); | |||
| } | |||
| if (receiver.getId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户分账账户ID不能为空"); | |||
| @@ -117,14 +117,19 @@ public class WxMerchantController extends BaseController { | |||
| WxCUser cuUser = new WxCUser(); | |||
| cuUser.updateTenantInfo(getTenantInfo()); | |||
| cuUser.setPhone(phone); | |||
| WxCUser mUser = cUserService.getByObject(cuUser); | |||
| if (mUser != null) { | |||
| return new ResultData(mUser.getOpenId()); | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| try { | |||
| WxCUser mUser = cUserService.getByObject(cuUser); | |||
| if (mUser != null) { | |||
| return new ResultData(mUser.getOpenId()); | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),"请用绑定["+phone+"]的微信在C端完成授权手机号操作。"); | |||
| } | |||
| }catch(Exception e) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),phone+"匹配C端用户失败,该情况可能是未在C端授权手机号或者用户C端数据存在多个微信对应统一手机号异常数据。"); | |||
| } | |||
| }else { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),"当前微信["+buser.getOpenId()+"]在B端授权的手机号["+buser.getPhone()+"]不是商户的联系手机号,不能操作."); | |||
| } | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | |||
| } | |||
| public boolean hasPermission() { | |||
| @@ -110,6 +110,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_msg_validationcode_model".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_component_verify_ticket".equals(tableName)) { | |||
| return true; | |||
| } | |||
| // wx_profit_sharing_receiver | |||
| // wx_profit_sharing_result | |||
| return false; | |||
| @@ -177,6 +180,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("mem_coupon_from_dsp".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_component_verify_ticket".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -26,7 +26,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 | |||
| @@ -85,10 +85,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: / | |||
| @@ -140,7 +140,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -3,8 +3,10 @@ package com.iformall.aop; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.annotation.RedisCache; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.CUserTokenService; | |||
| import com.iformall.utils.HashUtil; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -65,6 +67,10 @@ public class RedisCacheAspect { | |||
| if (StringUtils.isBlank(token)) { | |||
| token = request.getParameter("token"); | |||
| } | |||
| if(StringUtils.isBlank(token) || "null".equals(token) || "undefined".equals(token)){ | |||
| token=""; | |||
| //throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY.getCode(),"token为空["+token+"]"); | |||
| } | |||
| log.info("token>>>>>>>>>>>>>>>"+token); | |||
| String tenantId; | |||
| BaseCUserEntity cUser = null ; | |||
| @@ -238,6 +238,10 @@ public class BaseController { | |||
| if(byId != null && !byId.getPhone().equals(basicInfo.getPhone())){ | |||
| return Long.valueOf(-1); | |||
| } | |||
| if(!basicInfo.getTenantId().contains(","+tenantEntity.getTenantId()+",")){ | |||
| basicInfo.setTenantId(basicInfo.getTenantId()+tenantEntity.getTenantId()+","); | |||
| wxCUserBasicInfoService.update(basicInfo); | |||
| } | |||
| // WxCUserBasicInfo basicInfo = list.get(0); | |||
| // 微信名称,统一成微信昵称 | |||
| // if (!Objects.equals(basicInfo.getNickName(), user.getNickName())) { | |||
| @@ -270,6 +274,7 @@ public class BaseController { | |||
| basicInfo = new WxCUserBasicInfo(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| basicInfo.setId(idWorker.nextId()); | |||
| basicInfo.setTenantId(","+tenantEntity.getTenantId()+","); | |||
| basicInfo.undateFinalTenantId(tenantEntity); | |||
| basicInfo.setPhone(userPhone); | |||
| basicInfo.setNickName(userName); | |||
| @@ -18,6 +18,7 @@ import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.impl.etcp.EtcpHelper; | |||
| import com.iformall.service.park.impl.util.ParkHelper; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.car.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -27,6 +28,8 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| @@ -78,6 +81,10 @@ public class WxCarController extends BaseController { | |||
| @Autowired | |||
| EtcpHelper etcpHelper; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| private WxPark getCurrentPark(TenantEntity tenantEntity) { | |||
| WxPark parkQ = new WxPark(); | |||
| @@ -161,7 +168,7 @@ public class WxCarController extends BaseController { | |||
| try { | |||
| vendorPersonId = parkFactory.getParkService(park.getVendorType()).bindCar(paramMap, park, member); | |||
| if(StringUtils.isBlank(vendorPersonId)) { | |||
| return new ResultData(Result.ERROR,"厂商会员ID未返回"); | |||
| return new ResultData(Result.ERROR,"厂商绑定车牌会员ID未返回"); | |||
| } | |||
| return parkHelper.bindCar(paramMap, park, member.getId(),vendorPersonId); | |||
| } catch (Exception e) { | |||
| @@ -285,6 +292,7 @@ public class WxCarController extends BaseController { | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId为空"); | |||
| } | |||
| @@ -310,25 +318,45 @@ public class WxCarController extends BaseController { | |||
| userCarQ.setId(couponOrderId); | |||
| userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| List<WxCouponOrderCarCVo> list = wxCouponOrderService.carListCUserVo(userCarQ); | |||
| if (list.size() > 0) { | |||
| if (null != list && list.size() > 0) { | |||
| userCar = list.get(0); | |||
| } | |||
| EnumCarVendor vendor = EnumCarVendor.getEnum(park.getVendorType()); | |||
| if (null == vendor) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "广场停车场类型非法."); | |||
| } | |||
| Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return etcpHelper.getCoupon(paramMap, park, userCar,carNumber); | |||
| if (null != used && used.intValue() < 1) { | |||
| ResultData result = etcpHelper.getCoupon(paramMap, park, userCar,carNumber); | |||
| if (result.code == Result.SUCCESS) { | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| } | |||
| return result; | |||
| } | |||
| return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | |||
| } else { | |||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||
| if (coupon == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | |||
| } | |||
| try { | |||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||
| if (rs.code == Result.SUCCESS) { | |||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(rs.code,rs.message); | |||
| } | |||
| if (null != used && used.intValue() < 1) { | |||
| ResultData rs = parkFactory.getParkService(park.getVendorType()).useCoupon(paramMap, park, userCar, coupon, carNumber); | |||
| if (rs.code == Result.SUCCESS) { | |||
| etcpHelper.updateWxCouponOrderUsed(userCar, park); | |||
| ParkCacheUtils.setCarCouponUsedCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(rs.code,rs.message); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | |||
| } catch (Exception e) { | |||
| logger.error("park getCoupon error",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -4,6 +4,7 @@ import java.util.Date; | |||
| import java.util.Map; | |||
| 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; | |||
| @@ -55,7 +56,12 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | |||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||
| wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn()); | |||
| } | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | |||
| filterTimed(wxCouponChannel, page); | |||
| return new ResultData(page); | |||
| @@ -73,6 +79,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||
| Map<String,Object> map = new HashedMap(); | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listByMerchant(wxCouponChannel,pageNum,pageSize); | |||
| filterTimed(wxCouponChannel, page); | |||
| @@ -110,6 +117,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| return wxCouponChannelService.change(wxCouponChannel); | |||
| } | |||
| @@ -35,8 +35,11 @@ public class WxLiveController extends BaseController { | |||
| WxMaService wxMaService = getWeappService(appId); | |||
| resultData.data = wxMaService.getLiveService().getLiveInfo(start,limit); | |||
| } catch (WxErrorException e) { | |||
| logger.error("getLiveinfos error", e); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR); | |||
| logger.error("["+appId+"]getLiveinfos error", e); | |||
| //错误代码:9410000, 错误信息:empty room list ,不抛出异常 | |||
| if (e.getError().getErrorCode()!= 9410000) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"["+appId+"]getLiveinfos error"); | |||
| } | |||
| } | |||
| return resultData; | |||
| } | |||
| @@ -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,8 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| user.setVerifyCodePhone(phone); | |||
| user.setUpdateDate(new Date()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId()); | |||
| // wxCUserService.assureUserIdOnly(user.getId(),); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE,user); | |||
| cUserTokenService.removeTokenCache(user.getToken()); | |||
| @@ -193,7 +193,7 @@ public class WxPayOrderController extends BaseController { | |||
| //拼团的订单,如果查询到是拼团待付款的,则重新查询是否已经真的支付,其他的直接返回订单信息 | |||
| if (wxPayOrderService.isOrderGroupCoupon(payOrder, wxCoupon)) { | |||
| if (order.getOrderStatus()!=EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()) { | |||
| if (!order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode())) { | |||
| return new ResultData(Result.SUCCESS, "支付状态更新成功", order); | |||
| } | |||
| }else { | |||
| @@ -405,6 +405,11 @@ public class WxUserGrantController extends BaseController { | |||
| int score = wxCUserService.actionAfterLogin(newUser, null); | |||
| resultMap.put("score", score); | |||
| updateCacheCUser(token, newUser); | |||
| } | |||
| if (StringUtils.isBlank(token) || "null".equals(token) || "undefined".equals(token) ) { | |||
| return new ResultData(Result.ERROR,"token无效"+token); | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| @@ -681,6 +686,7 @@ public class WxUserGrantController extends BaseController { | |||
| user.setUserId(userBasicId); | |||
| } | |||
| wxCUserService.saveOrUpdate(user); | |||
| wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId()); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE, user); | |||
| } | |||
| @@ -54,8 +54,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||
| } | |||
| //token为空 | |||
| if(StringUtils.isBlank(token)){ | |||
| throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY); | |||
| if(StringUtils.isBlank(token) || "null".equals(token) || "undefined".equals(token)){ | |||
| throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY.getCode(),"token为空["+token+"]"); | |||
| } | |||
| // 查询token信息 | |||
| @@ -1,8 +1,10 @@ | |||
| package com.iformall.resolver; | |||
| import com.iformall.annotation.LoginUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.service.CUserTokenService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.utils.Constant; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.core.MethodParameter; | |||
| @@ -21,8 +23,9 @@ import org.springframework.web.method.support.ModelAndViewContainer; | |||
| */ | |||
| @Component | |||
| public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { | |||
| @Autowired | |||
| private CUserTokenService cUserTokenService; | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Override | |||
| public boolean supportsParameter(MethodParameter parameter) { | |||
| @@ -32,15 +35,13 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu | |||
| @Override | |||
| public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container, | |||
| NativeWebRequest request, WebDataBinderFactory factory) throws Exception { | |||
| //获取用户ID | |||
| Object object = request.getAttribute(Constant.LOGIN_USER_KEY, RequestAttributes.SCOPE_REQUEST); | |||
| //获取会员ID | |||
| Object object = request.getAttribute(Constant.LOGIN_MEMBER_KEY, RequestAttributes.SCOPE_REQUEST); | |||
| if(object == null){ | |||
| return null; | |||
| } | |||
| //获取用户信息 | |||
| BaseCUserEntity user = cUserTokenService.getByToken((String)object); | |||
| WxCUserBasicInfo user = wxCUserBasicInfoService.getById((Long) object); | |||
| return user; | |||
| } | |||
| } | |||
| @@ -110,6 +110,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_msg_validationcode_model".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_component_verify_ticket".equals(tableName)) { | |||
| return true; | |||
| } | |||
| // wx_profit_sharing_receiver | |||
| // wx_profit_sharing_result | |||
| return false; | |||
| @@ -183,6 +186,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("mem_coupon_from_dsp".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_component_verify_ticket".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -27,7 +27,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,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: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -0,0 +1,145 @@ | |||
| spring: | |||
| profiles: | |||
| include: aliyunRocketMQ | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowMultiQueries=true | |||
| username: mallone | |||
| password: m@l9oNEl20#@ | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| maxActive: 20 | |||
| initialSize: 1 | |||
| maxWait: 60000 | |||
| minIdle: 1 | |||
| timeBetweenEvictionRunsMillis: 28000 | |||
| minEvictableIdleTimeMillis: 28000 | |||
| validationQuery: select 'x' | |||
| testWhileIdle: true | |||
| testOnBorrow: false | |||
| testOnReturn: false | |||
| poolPreparedStatements: true | |||
| maxOpenPreparedStatements: 20 | |||
| connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000" | |||
| # REDIS | |||
| redis: | |||
| host: r-2zeaglwf13qqmnllj5pd.redis.rds.aliyuncs.com | |||
| port: 6379 | |||
| password: mallone:iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 20 | |||
| max-wait: -1 | |||
| min-idle: 0 | |||
| # SMS | |||
| aliyun: | |||
| sms: | |||
| accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V | |||
| accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry | |||
| product: Dysmsapi | |||
| domain: dysmsapi.aliyuncs.com | |||
| regionId: cn-hangzhou | |||
| dateFormat: yyyyMMdd | |||
| endpointName: cn-hangzhou | |||
| oss: | |||
| endpoint: oss-cn-beijing.aliyuncs.com | |||
| keyid: LTAI4G7ixY4AhvM35F8o3W3V | |||
| keysecret: VfWqGb83qIQrS9us45utskl8itd7ry | |||
| bucketname: formall | |||
| filehost: malinkadmin | |||
| filedomain: https://formall.oss-accelerate.aliyuncs.com | |||
| mail: | |||
| host: smtp.exmail.qq.com | |||
| username: zhengfangyuan@iformall.com | |||
| password: xnydCeUzofB2h8qp # 授权密码 | |||
| properties: | |||
| mail: | |||
| smtp: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| port: 5672 | |||
| username: admin | |||
| password: ibh2D9R3v2DEN3gk | |||
| #username: ENC(lRmLd6EzgeY1RT5ktcHv9g==) | |||
| #password: ENC(gBI8mCjr3OC0v57jcnSb660Ux7mW03K2oePgvohhg7w=) | |||
| publisher-confirms: true | |||
| publisher-returns: false | |||
| virtual-host: / | |||
| # | |||
| aliyunRocketmq: | |||
| accessKeyId: "LTAI4G7ixY4AhvM35F8o3W3V" | |||
| accessKeySecret: "VfWqGb83qIQrS9us45utskl8itd7ry" | |||
| groupId: "GID_P_1" | |||
| namesrvAddr: "http://MQ_INST_1796289517488555_Bcqaq2is.cn-beijing.mq-internal.aliyuncs.com:8080" | |||
| flyway: | |||
| enabled: false | |||
| aws: | |||
| clientRegion: cn-northwest-1 | |||
| bucketName: iformall-net | |||
| access: AKIAOEHX2MJVBURWTB3Q | |||
| secret: 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 | |||
| #access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | |||
| #secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | |||
| wechat: | |||
| web: | |||
| appId: "wx9cc4ca09eb20fe03" | |||
| secret: "af1d7f7a1268022a73cb4ce0b9cf0985" | |||
| url: "https://admin.malls.iformall.com" | |||
| open: | |||
| componentAppId: wx7f58f461ec1e2b4f | |||
| componentSecret: 7eb9b795606739b5526dd7f61d923f5a | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| #componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||
| #componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||
| #componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||
| #componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||
| redis: | |||
| host: r-2zeaglwf13qqmnllj5pd.redis.rds.aliyuncs.com | |||
| port: 6379 | |||
| password: mallone:iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 100 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 3 | |||
| open: true | |||
| upload_dir: /root/uploads/ | |||
| ueditor: | |||
| config: config.json | |||
| unified: true | |||
| upload-path: ./upload/ | |||
| url-prefix: "" | |||
| logging: | |||
| level: | |||
| com.iformall.mapper: debug | |||
| path: ./logs/admin | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -12,13 +12,17 @@ import com.iformall.enums.EnumCouponSendSendType; | |||
| import com.iformall.enums.EnumETCPCode; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -59,6 +63,10 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| @@ -79,7 +87,9 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| @PostMapping(value = "/etcpParkInCallback") | |||
| public Result etcpParkInCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("["+getIpAddr()+"] etcpParkInCallback: " + paramMap.toString()); | |||
| String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER); | |||
| ParkCacheUtils.removeCache(redisTemplate, "ETCP", carNumber); | |||
| ParkCacheUtils.setCarCouponUnUseCacheLock(redisTemplate, "ETCP", carNumber); | |||
| doEtcpParkIn(paramMap); | |||
| return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); | |||
| @@ -106,7 +116,8 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| @PostMapping(value = "/etcpParkOutCallback") | |||
| public Result etcpParkOutCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("["+getIpAddr()+"etcpParkOutCallback: " + paramMap.toString()); | |||
| String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER); | |||
| ParkCacheUtils.removeCache(redisTemplate, "ETCP", carNumber); | |||
| doEtcpParkOut(paramMap); | |||
| return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); | |||
| @@ -15,7 +15,9 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.park.ParkFactory; | |||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||
| import com.iformall.service.park.utils.ParkCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import com.iformall.utils.car.CYFUtil; | |||
| import com.iformall.utils.car.ETCPUtil; | |||
| import com.iformall.utils.car.TJDUtil; | |||
| @@ -25,6 +27,8 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -66,6 +70,10 @@ public class WxParkCallBackBaseController extends BaseController { | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @Autowired | |||
| ParkFactory parkFactory; | |||
| @@ -157,8 +165,12 @@ public class WxParkCallBackBaseController extends BaseController { | |||
| protected Result parkInCallBack(EnumCarVendor vendor,EnumCarCmd cmdType,Object sourceParam) { | |||
| ParkNotifyParam param = parkFactory.getParkCallbackService(vendor.getCode()).parseInNoticyParam(sourceParam); | |||
| String carNumber = param.getCarNumber(); | |||
| ParkCacheUtils.removeCache(redisTemplate, vendor.getMessage(), carNumber); | |||
| ParkCacheUtils.setCarCouponUnUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); | |||
| //添加wxCarCmdLog | |||
| WxCarCmdLog wxCarCmdLog = null; | |||
| try { | |||
| @@ -167,7 +179,7 @@ public class WxParkCallBackBaseController extends BaseController { | |||
| return new Result(Result.ERROR,e.getMessage()); | |||
| } | |||
| String carNumber = param.getCarNumber(); | |||
| String phoneStrs = ""; | |||
| // 停车发券 | |||
| if (!StringUtils.isBlank(carNumber)) { | |||
| @@ -205,6 +217,9 @@ public class WxParkCallBackBaseController extends BaseController { | |||
| protected Result parkOutCallBack(EnumCarVendor vendor,EnumCarCmd cmdType,Object sourceParam) { | |||
| ParkNotifyParam param = parkFactory.getParkCallbackService(vendor.getCode()).parseOutNoticyParam(sourceParam); | |||
| ParkCacheUtils.removeCache(redisTemplate, vendor.getMessage(), param.getCarNumber()); | |||
| WxCarCmdLog wxCarCmdLog = null; | |||
| try { | |||
| wxCarCmdLog = saveWxCarCmdLog(vendor, cmdType, sourceParam, param); | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=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 | |||
| @@ -86,10 +86,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: / | |||
| @@ -142,7 +142,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -28,7 +28,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-another-broker-when-not-store-ok: false | |||
| retry-times-when-send-failed: 2 | |||
| 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: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -26,7 +26,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 | |||
| @@ -85,10 +85,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: / | |||
| @@ -140,7 +140,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -56,6 +56,7 @@ public class ContractSchedule { | |||
| try { | |||
| //物业合同 | |||
| wxPropertyContractService.outDateContract(wxMall); | |||
| wxPropertyContractService.readyToNomal(wxMall); | |||
| }catch(Exception e) { | |||
| log.error("propertycontract outDate error.",e); | |||
| } | |||
| @@ -140,14 +140,26 @@ public class OrderExpiringSchedule { | |||
| // 拼团取消 | |||
| WxOrder order = new WxOrder(); | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | |||
| // order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| // wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | |||
| // try { | |||
| // proxy.orderGroupExpired((WxOrder) o,true,true,payWay); | |||
| // } catch (Exception e) { | |||
| // logger.error("拼团取消失败" + e.getMessage()); | |||
| // } | |||
| // }); | |||
| Date groupExpireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | |||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | |||
| dateMap.put("endDate", groupExpireDate); | |||
| List<WxOrder> orderGroups = wxOrderMapper.findListOfUnpaidGroupOrderByDate(dateMap); | |||
| orderGroups.stream().forEach( o -> { | |||
| try { | |||
| proxy.orderGroupExpired((WxOrder) o,true,true,payWay); | |||
| proxy.orderGroupExpired(o,true,true,payWay); | |||
| } catch (Exception e) { | |||
| logger.error("拼团取消失败" + e.getMessage()); | |||
| logger.error("砍价券支付过期失败" + e.getMessage()); | |||
| } | |||
| }); | |||
| //更新拼团过期状态 | |||
| wxOrderMapper.updateOrderStatusForGroup(); | |||
| @@ -192,8 +204,28 @@ public class OrderExpiringSchedule { | |||
| } | |||
| }); | |||
| //此处是拼团完成后,会将其他失效的订单置成该状态。需要查询是否已经付款,如果已经付款,则退款,退款回回滚库存。如果没付款,则主动回滚库存 | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); | |||
| wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | |||
| try { | |||
| proxy.expiredCheckAndReturnMoney((WxOrder) o,payWay); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败退款失败" + e.getMessage()); | |||
| } | |||
| }); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void expiredCheckAndReturnMoney(WxOrder wxOrder,EnumPayWay payWay) throws MallinkException, Exception { | |||
| if (wxPaySuccess(wxOrder, false, payWay)) { | |||
| orderGroupExpired(wxOrder,false,false,payWay); | |||
| returnMoney(wxOrder,payWay); | |||
| }else { | |||
| orderGroupExpired(wxOrder,false,true,payWay); | |||
| } | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void expiredAndReturnMoney(WxOrder wxOrder,boolean checkRealPay,EnumPayWay payWay) throws MallinkException, Exception { | |||
| orderGroupExpired(wxOrder,checkRealPay,false,payWay); | |||
| @@ -341,7 +373,7 @@ public class OrderExpiringSchedule { | |||
| payOrderQ.updateTenantInfo(order); | |||
| payOrderQ.setCUserId(order.getCUserId()); | |||
| payOrderQ.setOrderId(order.getId()); | |||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| //payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| WxPayOrder payOrder = null; | |||
| List<WxPayOrder> list = wxPayOrderMapper.findList(payOrderQ); | |||
| @@ -4,6 +4,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.WxProfitSharingOrder; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumProfitSharingOrderStatus; | |||
| import com.iformall.enums.EnumProfitSharingOrderType; | |||
| import com.iformall.mapper.WxPayOrderMapper; | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.schedule; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.WxProfitSharingOrder; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumProfitSharingOrderStatus; | |||
| import com.iformall.enums.EnumProfitSharingOrderType; | |||
| import com.iformall.mapper.WxPayOrderMapper; | |||
| import com.iformall.mapper.WxProfitSharingOrderMapper; | |||
| import com.iformall.service.WxProfitSharingOrderService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.List; | |||
| @Component | |||
| public class SharingOrderRedoScheduletttttttttttttttttttttttttt { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxProfitSharingOrderService wxProfitSharingOrderService; | |||
| @Autowired | |||
| private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | |||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨02:00分账重试 | |||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||
| public void sharingOrderResultSchedule() { | |||
| wxProfitSharingOrderService.updatetttttttttttttt(); | |||
| } | |||
| } | |||
| @@ -1,16 +1,24 @@ | |||
| package com.iformall.schedule; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMallService; | |||
| @Component | |||
| public class WxCUserTagsSchedule { | |||
| @@ -21,22 +29,46 @@ public class WxCUserTagsSchedule { | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| // TODO 先不执行打标签操作了, 数据量太大,导致数据库CPU 100% | |||
| //@Scheduled(cron = "0 0 0 25 * ?") // 每月25日凌晨01:00对会员列表扫描补录标签 | |||
| //@Scheduled(cron = "0 */5 * * * ?") // 测试1分钟一次 | |||
| @Scheduled(cron = "0 0 2 * * ?") // 测试1分钟一次 | |||
| public void wxCUserTagsSchedule() { | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| int pageIndex = 1; | |||
| final int pageSize = 1000; | |||
| PageInfo page; | |||
| do{ | |||
| page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageIndex++, pageSize); | |||
| page.getList().stream().forEach(cubi -> { | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_SCAN, cubi); | |||
| }); | |||
| } while ((page.isHasNextPage())); | |||
| WxMall wxMall = new WxMall(); | |||
| List<WxMall> malls = wxMallService.findList(wxMall); | |||
| for (WxMall mall : malls) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| if (StringUtils.isBlank(mall.getParentTenantId())) { | |||
| wxCUserBasicInfo.setFinalTenantId(mall.getTenantId()); | |||
| }else { | |||
| wxCUserBasicInfo.setFinalTenantId(mall.getParentTenantId()); | |||
| } | |||
| Date curDate = new Date(); | |||
| //活跃时间在10天内的 | |||
| Calendar startA = Calendar.getInstance(); | |||
| startA.setTime(curDate); | |||
| startA.add(Calendar.DAY_OF_YEAR, -10); | |||
| wxCUserBasicInfo.setActiveStartTime(startA.getTime()); | |||
| wxCUserBasicInfo.setActiveEndTime(curDate); | |||
| int pageIndex = 0; | |||
| final int pageSize = 5000; | |||
| PageInfo page; | |||
| do{ | |||
| page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageIndex++, pageSize); | |||
| page.getList().stream().forEach(cubi -> { | |||
| try { | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_SCAN, cubi); | |||
| }catch(Exception e) { | |||
| logger.error("wxCUserTagsSchedule error."+cubi.toString(),e); | |||
| } | |||
| }); | |||
| } while ((page.isHasNextPage())); | |||
| } | |||
| } | |||
| } | |||
| @@ -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 | |||
| url: jdbc:mysql://101.200.130.134:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: root | |||
| password: fm2020test | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -28,7 +28,7 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -85,10 +85,10 @@ spring: | |||
| retry-another-broker-when-not-store-ok: false | |||
| retry-times-when-send-failed: 2 | |||
| 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: / | |||
| @@ -136,7 +136,7 @@ wechat: | |||
| componentToken: formall2018 | |||
| componentAesKey: htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN | |||
| redis: | |||
| host: 202.165.179.86 | |||
| host: 101.200.130.134 | |||
| port: 6379 | |||
| password: iF0rm@2l2ol9 | |||
| timeout: 3600 | |||
| @@ -13,7 +13,7 @@ | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -24,7 +24,7 @@ | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -40,7 +40,7 @@ | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -57,7 +57,7 @@ | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -75,7 +75,7 @@ | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| <maxHistory>30</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -17,6 +17,8 @@ public class WxCouponChannelDto implements Serializable { | |||
| private Date beginTime; | |||
| private Date endTime; | |||
| private Date showBeginTime; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||
| private Map<String, Object> flowParams; | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.domain.dto; | |||
| import java.io.Serializable; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import lombok.Data; | |||
| @Data | |||
| public class WxProfitShareAppInoDto implements Serializable{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -8159673293532875743L; | |||
| private WxAppinfo appinfo; | |||
| private Integer payWay; | |||
| } | |||
| @@ -44,5 +44,4 @@ public class WxAppinfo extends BaseTenantEntity { | |||
| private Integer enable; | |||
| @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat") | |||
| private Integer plat; | |||
| } | |||
| @@ -22,7 +22,7 @@ import java.util.Objects; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUserBasicInfo extends BaseEntity { | |||
| public class WxCUserBasicInfo extends TenantEntity { | |||
| protected Long id; | |||
| @@ -73,6 +73,10 @@ public class WxCUserBasicInfo extends BaseEntity { | |||
| @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @TableField(exist = false) | |||
| private Date activeStartTime; | |||
| @TableField(exist = false) | |||
| private Date activeEndTime; | |||
| @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @@ -108,7 +112,7 @@ public class WxCUserBasicInfo extends BaseEntity { | |||
| private Integer status; | |||
| @TableField(exist = false) | |||
| //@Excel(name="标签",width = 50,orderNum = "10") | |||
| @Excel(name="标签",width = 50,orderNum = "10") | |||
| private String tagNames; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import lombok.Data; | |||
| @@ -16,10 +17,16 @@ public class WxCUserTags extends BaseTenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="userId") | |||
| private Long userId; | |||
| @TableField(exist = false) | |||
| private List<Long> userIdList; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tags") | |||
| private String tags; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @@ -145,6 +145,8 @@ public class WxCoupon extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private String merchantParams; | |||
| @TableField(exist = false) | |||
| private Long merchantId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd") | |||
| @@ -49,6 +49,8 @@ public class WxCouponChannel extends TenantEntity { | |||
| private Integer business; | |||
| @io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusiness") | |||
| private Integer subBusiness; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始显示时间",name="showBeginTime") | |||
| private Date showBeginTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="beginTime") | |||
| private Date beginTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") | |||
| @@ -41,5 +41,4 @@ public class WxProfitSharingOrder extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| } | |||
| @@ -134,9 +134,18 @@ public class BaseEntity implements Serializable { | |||
| Id_ASC("`id` ASC"), | |||
| Id_DESC("`id` DESC"), | |||
| CId_ASC("c.`id` ASC"), | |||
| CId_DESC("c.`id` DESC"), | |||
| CCId_ASC("cc.`id` ASC"), | |||
| CCId_DESC("cc.`id` DESC"), | |||
| CreateDate_ASC("`create_date` ASC"), | |||
| CreateDate_DESC("`create_date` DESC"), | |||
| CCreateDate_ASC("c.`create_date` ASC"), | |||
| CCreateDate_DESC("c.`create_date` DESC"), | |||
| SId_ASC("s.`id` ASC"), | |||
| SId_DESC("s.`id` DESC"), | |||
| @@ -146,6 +155,9 @@ public class BaseEntity implements Serializable { | |||
| UpdateDate_ASC("`update_date` ASC"), | |||
| UpdateDate_DESC("`update_date` DESC"), | |||
| CCUpdateDate_ASC("cc.`update_date` ASC"), | |||
| CCUpdateDate_DESC("cc.`update_date` DESC"), | |||
| Createtime_ASC("`createtime` ASC"), | |||
| Createtime_DESC("`createtime` DESC"), | |||
| @@ -158,6 +170,9 @@ public class BaseEntity implements Serializable { | |||
| ActiveTime_ASC("`active_time` ASC"), | |||
| ActiveTime_DESC("`active_time` DESC"), | |||
| wcubiActiveTime_ASC("wcubi.`active_time` ASC"), | |||
| wcubiActiveTime_DESC("wcubi.`active_time` DESC"), | |||
| TopTime_ASC("`top_time` ASC"), | |||
| TopTime_DESC("`top_time` DESC"), | |||
| @@ -72,6 +72,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="内容类型(0:小程序页面类型,1:富文本类型)",name="contentType") | |||
| private Integer contentType; | |||
| @TableField(exist = false) | |||
| private String detail; | |||
| @TableField(exist = false) | |||
| private String salePriceStr; | |||
| @@ -25,6 +25,7 @@ public class WxCouponOrderBVo extends WxCouponOrder { | |||
| protected Long id; | |||
| /** 基础购买到的券信息 */ | |||
| @Excel(name = "订单编号", width = 20, orderNum = "1", prefix = "`") | |||
| @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") | |||
| private Long orderId; | |||
| @@ -5,6 +5,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @JsonIgnoreProperties(value = {"handler"}) | |||
| @@ -91,4 +92,7 @@ public class WxMerchantVo extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "客服电话", name = "linkLinePhone") | |||
| private String linkLinePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime") | |||
| private Date topTime; | |||
| } | |||
| @@ -20,6 +20,8 @@ public enum EnumFlowKey { | |||
| NEW_CARD_UPLINE(10, "卡审批"), | |||
| NEW_GROUP_UPLINE(11, "拼团"), | |||
| NEW_PRESS_UPLINE(12, "砍价审批"), | |||
| B_COUPON_MERCHANT_CREATE(22,"B端创建券"), | |||
| NEW_PRO_CONTRACT(13, "商铺物业合同签约"), | |||
| NEW_PRO_END(14, "商铺物业合同终止"), | |||
| @@ -24,7 +24,9 @@ public enum EnumOrderStatus { | |||
| ORDER_STATUS_COOPERATING_FAILD(14, "参团失败"), | |||
| ORDER_STATUS_COOPERATING_UNPAID(15, "拼团待付款"),//占库存 | |||
| ORDER_STATUS_COOPERATING_BREAK(16, "拼团取消"), | |||
| ORDER_STATUS_COOPERATING_SCHEDU_REFUND(99,"订单定时状态-需要返款和回滚库存,无需再次查询真实支付状态") | |||
| ORDER_STATUS_COOPERATING_SCHEDU_REFUND(99,"订单定时状态-需要返款和回滚库存,无需再次查询真实支付状态"), | |||
| ORDER_STATUS_COOPERATING_COMPLETE_REFUND(98,"拼团完成会更新未支付的为此状态,未有效的订单统一置成该状态") | |||
| ; | |||
| public static EnumOrderStatus getEnum(Integer code) { | |||
| for (EnumOrderStatus value : values()) { | |||
| @@ -53,6 +53,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<Long> findVoIdsList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | |||
| Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| @@ -71,7 +73,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| * 查找wx_c_user中不存在的用户 | |||
| * @return | |||
| */ | |||
| List<WxCUserBasicInfo> selectNotCUserList(); | |||
| // List<WxCUserBasicInfo> selectNotCUserList(); | |||
| void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId); | |||
| @@ -8,6 +8,7 @@ import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| @@ -30,4 +31,6 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| List<Map<String, Object>> checkCountByTenantOpenId(); | |||
| void updateUserId(WxCUser user); | |||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| @@ -1,9 +1,15 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCardTransferInfo; | |||
| public interface WxCardTransferInfoMapper extends CommonMapper<WxCardTransferInfo, Long> { | |||
| void cardDefer(@Param("expiredTime")Date expiredTime,@Param("couponOrderIds")List<Long> couponOrderIds); | |||
| } | |||
| @@ -40,4 +40,6 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| void delByTopic(WxTopic wxTopic); | |||
| List<WxCouponChannel> findQrcodeEmptyList(); | |||
| void cardDefer(@Param("couponId")Long couponId,@Param("endTime")Date endTime); | |||
| } | |||
| @@ -82,4 +82,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| WxCoupon findCouponModel(WxCoupon wxCoupon); | |||
| Integer findCouponListCount(WxCoupon wxCoupon); | |||
| void updateValidEndDate(WxCoupon wxCoupon); | |||
| } | |||
| @@ -81,4 +81,9 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| /// POS接口 | |||
| List<WxCouponOrderCVo> findAvailCouponOrder(Map<String,Object> params); | |||
| //卡延期,将过期的状态变为使用中 | |||
| void cardDefer(@Param("couponId")Long couponId,@Param("expireTime")Date expireTime); | |||
| //查询待延期的idList | |||
| List<Long> cardDeferCouponOrderId(@Param("couponId")Long couponId); | |||
| } | |||
| @@ -4,8 +4,11 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, Long> { | |||
| List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword); | |||
| @@ -22,5 +25,7 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L | |||
| void updateStatus(List<WxCouponPassword> tempList); | |||
| void updatePostpone(WxCouponPassword wxCouponPassword); | |||
| void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime); | |||
| } | |||
| @@ -21,6 +21,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<WxOrder> findListOfUnpaidPressOrderByDate(Map dateMap); | |||
| List<WxOrder> findListOfCompleteUnPaidPressOrderByDate(Map dateMap); | |||
| List<WxOrder> findListOfUnpaidGroupOrderByDate(Map dateMap); | |||
| List<WxOrderCouponVo> findListOfCUser(WxOrder wxOrder); | |||
| List<WxOrderCouponVo> selectDetailOfCUser(WxOrder wxOrder); | |||
| @@ -139,4 +139,6 @@ public interface WxCUserService { | |||
| int addCredit(WxCUser wxCUser, EnumScoreType enumScoreType); | |||
| void updateUserId(WxCUser user); | |||
| void delForUserIdOnly(Long id, Long userId, String tenantId); | |||
| } | |||
| @@ -70,7 +70,7 @@ public interface WxCouponChannelService { | |||
| */ | |||
| ResultData saveOrUpdate(WxCouponChannel record); | |||
| ResultData addBatch(String[] ids, String[] channelId, TenantEntity tenantEntity, Date beginTime, Date endTime); | |||
| ResultData addBatch(String[] ids, String[] channelId, TenantEntity tenantEntity, Date showBeginTime, Date beginTime, Date endTime); | |||
| void updateStatusByCouponId(Long couponId,TenantEntity tenantEntity,int status); | |||
| @@ -224,5 +224,11 @@ public interface WxCouponService { | |||
| * @param remainInventory 当前库存 | |||
| */ | |||
| void backRemainInventory(Long id, Integer number, Integer remainInventory); | |||
| /** | |||
| * 卡延期 | |||
| * @param wxCoupon | |||
| * @return | |||
| */ | |||
| ResultData cardDefer(Long id,Date validEndDate); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.WxProfitSharingOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxProfitSharingOrderQueryVo; | |||
| import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import java.util.Map; | |||
| @@ -39,5 +40,8 @@ public interface WxProfitSharingOrderService { | |||
| Map<String,Object> queryOrderSummary(TenantEntity tenantEntity); | |||
| ResultData findOrderDetails(Long id); | |||
| void updatetttttttttttttt(); | |||
| } | |||
| @@ -68,7 +68,7 @@ public interface WxRentContractService { | |||
| ResultData updateFile(WxRentContract wxRentContract, Long userId,String userName,Date oldRentStartDate,boolean writeComplate); | |||
| ResultData updateRentContractStatus(Long id); | |||
| ResultData updateRentContractStatus(Long id,boolean buildPropertyBill); | |||
| List<Long> getShopIds(WxRentContract record) ; | |||
| @@ -946,6 +946,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| // } | |||
| if (oldUserBase != null) { | |||
| // if(!oldUserBase.getTenantId().contains(","+mallUserInfo.getTenantId()+",")){ | |||
| // oldUserBase.setTenantId(oldUserBase.getTenantId()+mallUserInfo.getTenantId()+","); | |||
| // } | |||
| oldUserBase.setName(userBase.getName()); | |||
| oldUserBase.setSex(userBase.getSex()); | |||
| oldUserBase.setNickName(userBase.getNickName()); | |||
| @@ -968,6 +971,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| } | |||
| } else { | |||
| userBase.setId(idWorker.nextId()); | |||
| // userBase.setTenantId(","+mallUserInfo.getTenantId()+","); | |||
| userBase.setUpdateDate(userBase.getUpdateDate() == null ? new Date() : userBase.getUpdateDate()); | |||
| userBase.setCreateDate(userBase.getCreateDate() == null ? new Date() : userBase.getCreateDate()); | |||
| //新增积分 | |||
| @@ -992,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) { | |||
| @@ -1216,21 +1220,48 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | |||
| Map params = (Map) queryParams; | |||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||
| List list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| basicInfo.setBegin((page-1)*10000); | |||
| basicInfo.setLimit(10000); | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| //直接查询本表 | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| } | |||
| return list; | |||
| Map params = (Map) queryParams; | |||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||
| List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| basicInfo.setBegin((page-1)*10000); | |||
| basicInfo.setLimit(10000); | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| } | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| if (null == list || list.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| List<Long> userIds = wxCUserBasicInfoMapper.findVoIdsList(basicInfo); | |||
| if (null != userIds && userIds.size() > 0 ) { | |||
| WxCUserTags tq = new WxCUserTags(); | |||
| tq.setUserIdList(userIds); | |||
| List<WxCUserTags> userTagList = wxCUserTagsMapper.findList(tq); | |||
| if (null != userTagList) { | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||
| Map<Long,String> userTagsMap = userTagList.stream().collect(Collectors.toMap(WxCUserTags::getUserId, WxCUserTags::getTags)); | |||
| list.stream().forEach(u->{ | |||
| List<Long> ids = JSONObject.parseArray(userTagsMap.get(u.getId()), Long.class); | |||
| if (null != ids) { | |||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||
| u.setTagNames(tagNames); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| if (null != list && list.size() > 0 ) { | |||
| List<Object> retList = new ArrayList<Object>(); | |||
| retList.addAll(list); | |||
| return retList; | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -73,12 +73,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| @Override | |||
| public WxCUser getByObject(WxCUser record) { | |||
| try { | |||
| return wxCUserMapper.selectOne(new QueryWrapper(record)); | |||
| } catch (Exception e) { | |||
| logger.error("NOT found: " + e.getMessage()); | |||
| } | |||
| return null; | |||
| return wxCUserMapper.selectOne(new QueryWrapper(record)); | |||
| } | |||
| @Override | |||
| @@ -299,7 +294,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| cUser.setActiveTime(new Date()); | |||
| saveOrUpdate(cUser); | |||
| } | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, wxCUserBasicInfo); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, wxCUser); | |||
| } | |||
| // 用户从unionId来的,可能会有重复 | |||
| if(findByUnionId != null) { | |||
| @@ -349,5 +344,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| wxCUserMapper.updateUserId(user); | |||
| } | |||
| @Override | |||
| public void delForUserIdOnly(Long id, Long userId, String tenantId) { | |||
| wxCUserMapper.delForUserIdOnly(id,userId,tenantId); | |||
| } | |||
| } | |||
| @@ -141,13 +141,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| @Override | |||
| public ResultData addBatch(String[] ids, String[] channelId, TenantEntity tenantEntity, Date beginTime, Date endTime) { | |||
| public ResultData addBatch(String[] ids, String[] channelId, TenantEntity tenantEntity, Date showBeginTime, Date beginTime, Date endTime) { | |||
| List<WxCouponChannelAddVo> errorList = new ArrayList<>(); | |||
| for (String targetIdstr:channelId) { | |||
| Integer targetId = Integer.parseInt(targetIdstr); | |||
| for (String couponidstr:ids) { | |||
| Long couponid = Long.parseLong(couponidstr); | |||
| WxCouponChannelAddVo vo = addCouponChannel(couponid,targetId,tenantEntity,beginTime,endTime); | |||
| WxCouponChannelAddVo vo = addCouponChannel(couponid,targetId,tenantEntity,showBeginTime,beginTime,endTime); | |||
| if(!vo.isSuc()){ | |||
| errorList.add(vo); | |||
| } | |||
| @@ -210,7 +210,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return false; | |||
| } | |||
| public WxCouponChannelAddVo addCouponChannel(Long couponid,Integer channelId, TenantEntity tenantEntity,Date beginTime,Date endTime){ | |||
| public WxCouponChannelAddVo addCouponChannel(Long couponid,Integer channelId, TenantEntity tenantEntity,Date showBeginTime,Date beginTime,Date endTime){ | |||
| WxCouponChannelAddVo vo = new WxCouponChannelAddVo(); | |||
| @@ -271,6 +271,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| if(showBeginTime == null){ | |||
| wxCouponChannel.setShowBeginTime(new Date()); | |||
| }else { | |||
| wxCouponChannel.setShowBeginTime(showBeginTime); | |||
| } | |||
| wxCouponChannel.setEndTime(endTime); | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setBeginTime(beginTime); | |||
| @@ -329,9 +334,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| logger.info("listPageCVo.chache.get:{}", pageInfo.getList()==null?0:pageInfo.getList().size()); | |||
| }else{ | |||
| pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoList(record)); | |||
| //插入缓存 | |||
| operations.set(key, pageInfo, 60, TimeUnit.SECONDS); | |||
| } | |||
| //插入缓存 | |||
| operations.set(key, pageInfo, 60, TimeUnit.SECONDS); | |||
| return pageInfo; | |||
| } | |||
| @@ -79,6 +79,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Autowired | |||
| WxProfitSharingOrderService wxProfitSharingOrderService; | |||
| @Autowired | |||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||
| @Autowired | |||
| WxPayOrderMapper wxPayOrderMapper; | |||
| @@ -343,6 +346,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); | |||
| } | |||
| private WxAppinfo getAppinfo(TenantEntity tenantEntity,Integer payWay) { | |||
| WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.getEnum(payWay)); | |||
| if (wxAppinfo == null) | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| return wxAppinfo; | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxCouponOrder verify(WxCouponOrder couponOrder, WxMerchantBUser bUser) { | |||
| @@ -381,6 +392,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| logger.error("券已被预核销: couponOrder-" + couponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_PRE_VERIFY); | |||
| } | |||
| //如果开启了分账,就必须要配置分账账号 | |||
| WxAppinfo appInfo = getAppinfo(couponOrder,couponOrder.getPayVendor()); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(payAccount); | |||
| psReceiverQ.setMerchantId(bUser.getMerchantId()); | |||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(couponOrder.getPayVendor()).getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if (null != payAccount.getShare() && EnumPayShare.YES.getCode().intValue() == payAccount.getShare().intValue() && psReceiverList.size() == 0) { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户分账账户未设置"); | |||
| } | |||
| int num = 0; | |||
| try { | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 | |||
| @@ -693,7 +719,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| try { | |||
| return wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.COUPON_VERIFY, wxOrder,EnumPayWay.PAY_WAY_NOT_UNPAY_VERRIFY); | |||
| } catch (Exception e) { | |||
| logger.error("核销发券: " + e.getMessage()); | |||
| logger.error("核销发券: " + e.getMessage(),e); | |||
| } | |||
| } | |||
| return false; | |||
| @@ -1353,7 +1379,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); | |||
| } | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(bUser,payWay); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| EnumPayShare isShare = EnumPayShare.NO; | |||
| if (payAccount.checkShare()) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| final Integer shareCode = isShare.getCode(); | |||
| // 添加payOrder | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long payOrderId = idWorker.nextId(); | |||
| @@ -1370,7 +1402,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| setPayOrderNo(String.valueOf(payOrderId)); | |||
| setIp(ipstr); | |||
| setAuthCode(authCode); | |||
| setPayAmount(microOrder.getPayment() - wxCoupon.getPrice()); | |||
| Integer payAmount = microOrder.getPayment() - wxCoupon.getPrice(); | |||
| setPayAmount(payAmount); | |||
| // if (microOrder.getPayment() > wxCoupon.getPrice()) { | |||
| // setPayAmount(wxCoupon.getPrice()); | |||
| // } else { | |||
| @@ -1378,7 +1411,20 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| // } | |||
| setPayVendor(payWay.getCode()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| setShare(shareCode); | |||
| if (shareCode.intValue() == EnumPayShare.YES.getCode().intValue()) { | |||
| // 分账金额 | |||
| int iChargeFee = PayUtils.getPayRate(payAmount, payAccount.getRate(), false); | |||
| Integer share_amount = payAmount - iChargeFee; | |||
| setShareAmount(share_amount); | |||
| if(payAccount.getRealRate() != null) { | |||
| int iRealChargeFee = PayUtils.getPayRate(payAmount, payAccount.getRealRate(), true); | |||
| setRateAmount(iRealChargeFee); | |||
| } | |||
| if (share_amount <= 0) { | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| } | |||
| } | |||
| setPayFrom(EnumPayFrom.INSIDE_B.getCode()); | |||
| setPosPayOrderId(couponOrder.getId()); | |||
| }}; | |||
| @@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCouponMerchantDto; | |||
| import com.iformall.domain.po.*; | |||
| @@ -77,6 +78,12 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Autowired | |||
| WxPayAccountMapper payAccountMapper; | |||
| @Autowired | |||
| WxCouponOrderMapper wxCouponOrderMapper; | |||
| @Autowired | |||
| WxCardTransferInfoMapper wxCardTransferInfoMapper; | |||
| @Autowired | |||
| @Qualifier("couponChannelRedisTemplate") | |||
| @@ -85,7 +92,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Override | |||
| public ResultData list(WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setSortColumns(BaseEntity.SortField.CreateDate_DESC, BaseEntity.SortField.Id_DESC); | |||
| wxCoupon.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC); | |||
| PageInfo<WxCoupon> page = null; | |||
| if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) | |||
| wxCoupon.setStatus(null); | |||
| @@ -742,4 +749,37 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData cardDefer(Long id,Date validEndDate) { | |||
| WxCoupon coupon = wxCouponMapper.selectById(id); | |||
| if (null == coupon) { | |||
| return new ResultData(Result.ERROR,id+"未查询到券信息."); | |||
| } | |||
| if (new Date().after(validEndDate)) { | |||
| return new ResultData(Result.ERROR,"有效期不能小于当前时间."); | |||
| } | |||
| //更新coupon信息 | |||
| coupon.setValidEndDate(validEndDate); | |||
| coupon.setUpdateDate(new Date()); | |||
| wxCouponMapper.updateValidEndDate(coupon); | |||
| //更新coupon_channel | |||
| wxCouponChannelMapper.cardDefer(id, validEndDate); | |||
| //更新coupon_order的状态,已过期的变为使用中 5-->4 | |||
| List<Long> couponOrderIds = wxCouponOrderMapper.cardDeferCouponOrderId(id); | |||
| wxCouponOrderMapper.cardDefer(id,validEndDate); | |||
| //更新coupon_passwd | |||
| couponPasswordMapper.updateExpiredTime(id, validEndDate); | |||
| //更新wx_card_transfer_info | |||
| if (null != couponOrderIds && couponOrderIds.size() > 0 ) { | |||
| wxCardTransferInfoMapper.cardDefer(validEndDate, couponOrderIds); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -116,6 +116,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| " ( '" + idWorker.nextId() + "', '" + id1 + "', '" + tenantId + "', '有价券审批', '9', '0', '" + nowTimestr + "', '" + nowTimestr + "', '1')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id1 + "', '" + tenantId + "', '卡审批', '10', '0', '" + nowTimestr + "', '" + nowTimestr + "', '2')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id1 + "', '" + tenantId + "', '砍价审批', '12', '0', '" + nowTimestr + "', '" + nowTimestr + "', '4')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id1 + "', '" + tenantId + "', 'B端创建券', '22', '0', '" + nowTimestr + "', '" + nowTimestr + "', '5')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id2 + "', '" + tenantId + "', '多经点位租金+物业合同签约', '19', '0', '" + nowTimestr + "', '" + nowTimestr + "', '11')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id2 + "', '" + tenantId + "', '商铺租金+物业合同终止', '18', '0', '" + nowTimestr + "', '" + nowTimestr + "', '10')," + | |||
| " ( '" + idWorker.nextId() + "', '" + id2 + "', '" + tenantId + "', '商铺物业合同签约', '13', '0', '" + nowTimestr + "', '" + nowTimestr + "', '5')," + | |||
| @@ -215,7 +216,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| //如果审批完成 | |||
| }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxRentContractService.updateRentContractStatus(bsId); | |||
| wxRentContractService.updateRentContractStatus(bsId,false); | |||
| if (isrentproperty) { | |||
| wxPropertyContractService.updatePropertyContractStatus(propetyId); | |||
| } | |||
| @@ -357,7 +358,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } else if (EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType) | |||
| || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType) | |||
| || EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType) | |||
| || EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)) { | |||
| || EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType) | |||
| || EnumFlowKey.B_COUPON_MERCHANT_CREATE.getCode().equals(flowType)) { | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| wxCoupon.setId(Long.parseLong(businessId)); | |||
| wxCoupon.setUpdateDate(new Date()); | |||
| @@ -409,7 +411,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxCouponMapper.updateById(wxCoupon); | |||
| //清除缓存 | |||
| clearCache(wxCoupon); | |||
| }else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){ | |||
| } else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){ | |||
| WxBillSettle wxBillSettle = new WxBillSettle(); | |||
| wxBillSettle.setId(Long.parseLong(businessId)); | |||
| wxBillSettle.setApplyStatus(applyStatus); | |||
| @@ -489,6 +492,14 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| return null; | |||
| } | |||
| private Map<String,Object> generatSimpleStarter(String userName,String phone) { | |||
| Map<String,Object> map = new HashMap<String,Object>(); | |||
| map.put("name", userName); | |||
| map.put("phone", phone); | |||
| map.put("email",""); | |||
| return map; | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) | |||
| public ResultData start(Map<String, Object> params,Long userId,String userName,TenantEntity tenantEntity) { | |||
| @@ -507,7 +518,12 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| // map info,设置发起人等信息 | |||
| Date startDate = new Date(); | |||
| MallUserInfo starterInfo = this.mallUserInfoService.getById(userId); | |||
| map.put("starter", mallUserInfoToMap(starterInfo)); | |||
| if (null != starterInfo) { | |||
| map.put("starter", mallUserInfoToMap(starterInfo)); | |||
| }else { | |||
| String phone = params.get("phone").toString(); | |||
| map.put("starter", generatSimpleStarter(userName,phone)); | |||
| } | |||
| map.put("startTime", startDate.getTime()); | |||
| map.put("startDate", startDate); | |||
| map.put("businessId",businessId+""); | |||
| @@ -545,7 +561,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| //给审批人发送代办通知短信 | |||
| List<MallUserInfo> mallUserInfoList = getUserByProcessInstanceId(processInstance.getId()); | |||
| for (MallUserInfo mallUserInfo:mallUserInfoList) { | |||
| sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), starterInfo.getName(), businessId, flowType, variables); | |||
| //sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), starterInfo.getName(), businessId, flowType, variables); | |||
| sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -108,7 +108,7 @@ public class WxMallServiceImpl implements WxMallService { | |||
| @Override | |||
| public int update(WxMall record) { | |||
| int ret = wxMallMapper.updateById(record); | |||
| this.deleteRedis(record.getTenantInfo()); | |||
| this.deleteRedis(this.getById(record.getId()).getTenantInfo()); | |||
| return ret; | |||
| } | |||
| @@ -540,7 +540,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver,payWay); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("db failed: 账户操作失败, e:" + e.getMessage()); | |||
| logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| @@ -71,33 +71,44 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| @Autowired | |||
| WxPayOrderMapper wxPayOrderMapper; | |||
| private int updateOrderGroup(WxOrderGroup wxOrderGroup,WxOrder order, WxCoupon wxCoupon) { | |||
| //锁住人数 | |||
| long time = System.currentTimeMillis() + RedisLock.LONG_TIMEOUT; | |||
| String timeStr = String.valueOf(time); | |||
| boolean grouppeopleLock = redisLock.lock("grouppeopleLock_"+order.getOrderGroupId(), timeStr); | |||
| if (!grouppeopleLock) { | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团锁定失败,请稍后再试。"); | |||
| } | |||
| //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算 | |||
| int ordercount = wxOrderService.countGroupOrder(order.getOrderGroupId(),true); | |||
| Integer remainPeople = wxCoupon.getPressLimitNum()-ordercount-1; | |||
| //Integer remainPeople = wxOrderGroup.getRemainPeople()-1; | |||
| wxOrderGroup.setStatus(remainPeople <= 0 ? EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode() : wxOrderGroup.getStatus()); | |||
| wxOrderGroup.setUpdateDate(new Date()); | |||
| wxOrderGroup.setRemainPeople(remainPeople); | |||
| logger.info("非首次拼团,更新拼团信息, 剩余人数-1"); | |||
| int row = wxOrderGroupMapper.updateOrderGroup(wxOrderGroup); | |||
| if (row != 1) { | |||
| //错误,更新状态,定时任务会发起退款,回滚库存 | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| wxOrderMapper.updateById(order); | |||
| redisLock.unlock("grouppeopleLock_"+order.getOrderGroupId(), timeStr); | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团失败,将稍后退款."); | |||
| }else { | |||
| redisLock.unlock("grouppeopleLock_"+order.getOrderGroupId(), timeStr); | |||
| } | |||
| return remainPeople; | |||
| public int updateOrderGroup(WxOrderGroup wxOrderGroup,WxOrder order, WxCoupon wxCoupon) { | |||
| if (null != order.getOrderGroupId() && (!order.getOrderGroupId().equals(0L))) { | |||
| //TODO 并发处理 锁住人数 | |||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | |||
| String timeStr = String.valueOf(time); | |||
| boolean stocksetlock = redisLock.lock("ordergroupLock:lock_"+order.getOrderGroupId(), timeStr); | |||
| while (!stocksetlock) { | |||
| stocksetlock = redisLock.lock("ordergroupLock:lock_"+order.getOrderGroupId(), timeStr); | |||
| } | |||
| if (stocksetlock) { | |||
| //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算. 提高拼团的成功率 | |||
| int ordercount = wxOrderService.countGroupOrder(order.getOrderGroupId(),true); | |||
| Integer remainPeople = wxCoupon.getPressLimitNum()-ordercount-1; | |||
| if (remainPeople < 0) { | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团失败,参团人数已满,将稍后退款."); | |||
| } | |||
| //Integer remainPeople = wxOrderGroup.getRemainPeople()-1; | |||
| wxOrderGroup.setStatus(remainPeople <= 0 ? EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode() : wxOrderGroup.getStatus()); | |||
| wxOrderGroup.setUpdateDate(new Date()); | |||
| wxOrderGroup.setRemainPeople(remainPeople); | |||
| logger.info("非首次拼团,更新拼团信息, 剩余人数-1"); | |||
| int row = wxOrderGroupMapper.updateOrderGroup(wxOrderGroup); | |||
| if (row != 1) { | |||
| //错误,更新状态,定时任务会发起退款,回滚库存 | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| wxOrderMapper.updateById(order); | |||
| redisLock.unlock("ordergroupLock:lock_"+order.getOrderGroupId(), timeStr); | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团失败,将稍后退款."); | |||
| } | |||
| redisLock.unlock("ordergroupLock:lock_"+order.getOrderGroupId(), timeStr); | |||
| return remainPeople; | |||
| }else { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"参团错误,ordergroupLock:lock未获取到."); | |||
| } | |||
| }else { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"参团错误,非参团订单."); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -124,9 +135,11 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| //此处不要抛出异常,会导致事务回滚,状态写不上 | |||
| return; | |||
| }else { | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); | |||
| wxOrderMapper.updateById(order); | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团人数已满,将稍后退款。"); | |||
| //此处不要抛出异常,会导致事务回滚,状态写不上 | |||
| //throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团人数已满,将稍后退款。"); | |||
| return; | |||
| } | |||
| } | |||
| @@ -142,6 +155,8 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| logger.error("更新订单信息失败", e); | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD); | |||
| } | |||
| //此时会出现临界情况,remainPeople是已支付的数量 | |||
| //此时如果最后的位置,同时多个人点了,去支付,最先支付的会把后面的取消掉。 | |||
| if (remainPeople == 0) { | |||
| actionAfterOrderGroupSuccess(order, orderGroupId); | |||
| } | |||
| @@ -191,6 +206,13 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| * @param orderGroupId | |||
| */ | |||
| private void actionAfterOrderGroupSuccess(WxOrder order, Long orderGroupId) { | |||
| //拼团完成,只能执行一次。 | |||
| boolean isFirstSet = redisLock.setOrderGroupComplateLock(orderGroupId); | |||
| //如果没有设置成功,则不是第一次处理,后续的忽略,防止并发 | |||
| if (!isFirstSet) { | |||
| return; | |||
| } | |||
| // 拼团完成 | |||
| // 得到所有拼团的order | |||
| WxOrder wxOrder = new WxOrder(); | |||
| @@ -224,7 +246,10 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| //去库存 | |||
| wxOrderService.updateOrderStatus(temp); | |||
| //拼团取消 | |||
| temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | |||
| //temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()); | |||
| //拼团取消。定时会处理退款 | |||
| temp.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); | |||
| wxOrderMapper.updateById(temp); | |||
| } | |||
| } | |||
| @@ -305,8 +330,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| orderList = orderList.parallelStream().filter(o -> { | |||
| return o.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()) || | |||
| o.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()) || | |||
| o.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()) || | |||
| o.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); | |||
| o.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()); | |||
| }).sorted(Comparator.comparing(order -> order.getId())).collect(Collectors.toList()); | |||
| if (!orderList.isEmpty()) { | |||
| List<WxCUserBasicInfo> userList = new ArrayList<>(); | |||
| @@ -23,19 +23,19 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { | |||
| @Override | |||
| public WxPayAccount wxPayAccountInit(String tenantId, WxProjectConfig wxProjectConfig) { | |||
| WxPayAccount wxPayAccount = new WxPayAccount(); | |||
| wxPayAccount.setTenantId(tenantId); | |||
| wxPayAccount.setMchId(wxProjectConfig.getMchId()); | |||
| wxPayAccount.setSubMchId(wxProjectConfig.getSubMchId()); | |||
| wxPayAccount.setApiKey(wxProjectConfig.getApiKey()); | |||
| //默认------------------------------------------------------------- | |||
| wxPayAccount.setNotifyUrl("https://admin.malls.iformall.com/wxPay/notify"); | |||
| wxPayAccount.setCertPath("/opt/iformall/service/apiclient_cert.p12"); | |||
| //---------------------------------------------------------------- | |||
| wxPayAccount.setType(1);//0:普通商户模式, 1:服务商模式(默认服务商模式) | |||
| wxPayAccount.setShare(0);//0: 未分账,1:分账(默认不分账) | |||
| wxPayAccount.setRate(wxProjectConfig.getRate()); | |||
| wxPayAccount.setRealRate(wxProjectConfig.getRealRate()); | |||
| wxPayAccountMapper.insert(wxPayAccount); | |||
| // wxPayAccount.setTenantId(tenantId); | |||
| // wxPayAccount.setMchId(wxProjectConfig.getMchId()); | |||
| // wxPayAccount.setSubMchId(wxProjectConfig.getSubMchId()); | |||
| // wxPayAccount.setApiKey(wxProjectConfig.getApiKey()); | |||
| // //默认------------------------------------------------------------- | |||
| // wxPayAccount.setNotifyUrl("https://admin.malls.iformall.com/wxPay/notify"); | |||
| // wxPayAccount.setCertPath("/opt/iformall/service/apiclient_cert.p12"); | |||
| // //---------------------------------------------------------------- | |||
| // wxPayAccount.setType(1);//0:普通商户模式, 1:服务商模式(默认服务商模式) | |||
| // wxPayAccount.setShare(0);//0: 未分账,1:分账(默认不分账) | |||
| // wxPayAccount.setRate(wxProjectConfig.getRate()); | |||
| // wxPayAccount.setRealRate(wxProjectConfig.getRealRate()); | |||
| // wxPayAccountMapper.insert(wxPayAccount); | |||
| return wxPayAccount; | |||
| } | |||
| @@ -137,7 +137,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| try { | |||
| wxOrderGroupService.createOrderGroup(order, wxCoupon,isScheduleTask); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败" + e.getMessage()); | |||
| logger.error("参团失败" + e.getMessage(),e); | |||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_FAILD.getCode()); | |||
| order.setUpdateDate(new Date()); | |||
| wxOrderMapper.updateById(order); | |||
| @@ -148,7 +148,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| try { | |||
| wxOrderService.couponOrderSuccess(order); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| logger.error(e.getMessage(),e); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "订单更新"); | |||
| } | |||
| @@ -156,7 +156,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| try { | |||
| wxOrderService.sendOrderSuccessActionMsg(order); | |||
| } catch (Exception e) { | |||
| logger.error("内部消息发送失败: " + e.getMessage()); | |||
| logger.error("内部消息发送失败: " + e.getMessage(),e); | |||
| throw new MallinkException(ErrorCode.MSG_INSIDE_ERROR); | |||
| } | |||
| } | |||
| @@ -230,6 +230,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| WxOrder orderParams = new WxOrder(); | |||
| orderParams.setOrderGroupId(order.getOrderGroupId()); | |||
| orderParams.setCUserId(user.getId()); | |||
| List<Integer> orderstatuslist = new ArrayList<Integer>(); | |||
| orderstatuslist.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | |||
| orderstatuslist.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||
| orderParams.setStatusS(orderstatuslist); | |||
| List<WxOrder> olist = wxOrderMapper.findList(orderParams); | |||
| if (olist == null || olist.size() <=0 ) { | |||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"未查询到参团订单[user:"+user.getId()+",groupId:"+order.getOrderGroupId()+"]"); | |||
| @@ -9,6 +9,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxProfitShareAppInoDto; | |||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -21,6 +22,7 @@ import com.iformall.mapper.*; | |||
| import com.iformall.pay.*; | |||
| import com.iformall.service.WxProfitSharingOrderService; | |||
| import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.share.entity.PayShareQueryResult; | |||
| import com.iformall.service.pay.service.share.entity.PayShareResult; | |||
| import com.iformall.utils.BeanUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -93,11 +95,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| "\"ORDERNOTEXIST\":{\"detail\":\"分账单不存在\",\"reason\":\"订单号错误或分账单号错误\",\"resolution\":\"请检查订单号或分账单号是否有错误\"}}"); | |||
| final JSONObject statusMap = JSON.parseObject( | |||
| "{\"ACCEPTED\":3," + | |||
| "\"PROCESSING\": 4," + | |||
| "\"FINISHED\": 5," + | |||
| "\"CLOSED\": 6}"); | |||
| final JSONObject resultStatusMap = JSON.parseObject( | |||
| "{\"PENDING\": 1," + | |||
| @@ -120,6 +118,32 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| return wxAppinfo; | |||
| } | |||
| private WxProfitShareAppInoDto getAppinfo(WxProfitSharingOrder wxProfitSharingOrder) { | |||
| WxAppinfo appinfo; | |||
| Integer payWay; | |||
| if (wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()) | |||
| ||wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode())){ | |||
| WxPayOrder wxPayOrder = wxPayOrderMapper.selectById(wxProfitSharingOrder.getOrderId()); | |||
| if (wxPayOrder == null) | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(),"wxProfitSharingOrder["+wxProfitSharingOrder.getId()+"] 没有payOrder信息."); | |||
| appinfo = getAppinfo(wxPayOrder.getTenantId(),wxPayOrder.getPayVendor()); | |||
| payWay = wxPayOrder.getPayVendor(); | |||
| } else if(wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode()) | |||
| ||wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI_FINISH.getCode())){ | |||
| WxCardSpend wxCardSpend = wxCardSpendMapper.selectById(wxProfitSharingOrder.getOrderId()); | |||
| if (wxCardSpend == null) | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(),"wxProfitSharingOrder["+wxProfitSharingOrder.getId()+"] 没有WxCardSpend信息."); | |||
| appinfo = getAppinfo(wxCardSpend.getTenantId(),EnumCardSpendFrom.getPayWay(wxCardSpend.getPayFrom()).getCode()); | |||
| payWay = EnumCardSpendFrom.getPayWay(wxCardSpend.getPayFrom()).getCode(); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_QUERY_UNKNOWN_TYPE); | |||
| } | |||
| WxProfitShareAppInoDto rt = new WxProfitShareAppInoDto(); | |||
| rt.setAppinfo(appinfo); | |||
| rt.setPayWay(payWay); | |||
| return rt; | |||
| } | |||
| @Override | |||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| @@ -131,8 +155,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| WxPayOrder payOrder = wxPayOrderMapper.selectById(sharingOrder.getOrderId()); | |||
| WxAppinfo appInfo = getAppinfo(payOrder.getTenantId(),payOrder.getPayVendor()); | |||
| WxProfitShareAppInoDto dto = getAppinfo(sharingOrder); | |||
| WxAppinfo appInfo = dto.getAppinfo(); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| List<JSONObject> receivers; | |||
| @@ -166,66 +190,18 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID); | |||
| } | |||
| //分账提交 | |||
| WxProfitSharingP psCmd = new WxProfitSharingP(); | |||
| psCmd.setMch_id(payAccount.getMchId()); | |||
| psCmd.setSub_mch_id(payAccount.getSubMchId()); | |||
| psCmd.setAppid(appInfo.getParentAppId()); | |||
| psCmd.setSub_appid(appInfo.getAppId()); | |||
| psCmd.setNonce_str(Utility.generate32UUID()); | |||
| psCmd.setTransaction_id(sharingOrder.getTransactionId()); | |||
| psCmd.setOut_order_no(sharingOrder.getId().toString()); | |||
| psCmd.setSign_type("HMAC-SHA256"); | |||
| psCmd.setReceivers(sharingOrder.getReceivers()); | |||
| String response; | |||
| try { | |||
| psCmd.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(psCmd), payAccount.getApiKey())); | |||
| logger.info("request:" + psCmd.toString()); | |||
| if(sharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode())) { | |||
| response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(psCmd), payAccount.getCertPath(), payAccount.getMchId()); | |||
| } else if(sharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode())) { | |||
| response = WxProfitSharing.pushMultiOrder(BeanUtils.toStringMap(psCmd), payAccount.getCertPath(), payAccount.getMchId()); | |||
| } else { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| } catch (Exception e) { | |||
| sharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||
| sharingOrder.setErrorMsg("REDO:"+ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateById(sharingOrder); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED); | |||
| } | |||
| logger.info("response: " + response); | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| sharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||
| sharingOrder.setErrorMsg("REDO:"+returnMap.get("return_msg")); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateById(sharingOrder); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap,payAccount.getApiKey())){ | |||
| sharingOrder.setErrorMsg("REDO:"+ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateById(sharingOrder); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getCode()); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| sharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| sharingOrder.setErrorMsg("REDO:"+returnMap.get("err_code_des")); | |||
| PayShareResult shareResult = payServiceFactory.getPayShareAdapterService(dto.getPayWay()).haveReciversShare(appInfo, payAccount, frecord, | |||
| sharingOrder.getTransactionId(), JSONArray.parseArray(JSON.toJSONString(receivers)), EnumProfitSharingOrderType.getEnum(sharingOrder.getType())); | |||
| if (!shareResult.isSuccess()) { | |||
| sharingOrder.setSharingStatus(shareResult.getCode()); | |||
| sharingOrder.setErrorMsg("REDO:"+shareResult.getMsg()); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateById(sharingOrder); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_APPLY_FAILED.getCode(), returnMap.get("err_code_des")); | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),sharingOrder.getErrorMsg()); | |||
| } | |||
| sharingOrder.setSharingOrderNo(returnMap.get("order_id")); | |||
| sharingOrder.setSharingOrderNo(shareResult.getShareOrderNo()); | |||
| sharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||
| sharingOrder.setErrorMsg("REDO:重试分账成功"); | |||
| sharingOrder.setUpdateTime(new Date()); | |||
| @@ -233,8 +209,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| for (WxProfitSharingResult result:resultList) { | |||
| wxProfitSharingResultMapper.insert(result); | |||
| } | |||
| return new ResultData(returnMap); | |||
| return new ResultData(shareResult.getData()); | |||
| } | |||
| @@ -380,22 +355,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||
| WxAppinfo appInfo; | |||
| if (wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()) | |||
| ||wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode())){ | |||
| WxPayOrder wxPayOrder = wxPayOrderMapper.selectById(wxProfitSharingOrder.getOrderId()); | |||
| if (wxPayOrder == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| appInfo = getAppinfo(wxPayOrder.getTenantId(),wxPayOrder.getPayVendor()); | |||
| } else if(wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode()) | |||
| ||wxProfitSharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI_FINISH.getCode())){ | |||
| WxCardSpend wxCardSpend = wxCardSpendMapper.selectById(wxProfitSharingOrder.getOrderId()); | |||
| if (wxCardSpend == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| appInfo = getAppinfo(wxCardSpend.getTenantId(),EnumCardSpendFrom.getPayWay(wxCardSpend.getPayFrom()).getCode()); | |||
| } else { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_UNKNOWN_TYPE); | |||
| } | |||
| WxProfitShareAppInoDto dto = getAppinfo(wxProfitSharingOrder); | |||
| WxAppinfo appInfo = dto.getAppinfo(); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| //是否已创建分账订单 | |||
| @@ -404,46 +365,16 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| if (record == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| //分账查询提交 | |||
| WxProfitSharingQueryP wxProfitSharingQueryP = new WxProfitSharingQueryP();; | |||
| wxProfitSharingQueryP.setMch_id(payAccount.getMchId()); | |||
| wxProfitSharingQueryP.setSub_mch_id(payAccount.getSubMchId()); | |||
| wxProfitSharingQueryP.setNonce_str(Utility.generate32UUID()); | |||
| wxProfitSharingQueryP.setTransaction_id(wxProfitSharingOrder.getTransactionId()); | |||
| wxProfitSharingQueryP.setOut_order_no(record.getId().toString()); | |||
| wxProfitSharingQueryP.setSign_type("HMAC-SHA256"); | |||
| String response; | |||
| try { | |||
| wxProfitSharingQueryP.setSign(WxPayment.createSignHMAC(BeanUtils.toStringMap(wxProfitSharingQueryP),payAccount.getApiKey())); | |||
| response = WxProfitSharing.queryOrder(BeanUtils.toStringMap(wxProfitSharingQueryP), payAccount.getCertPath(), payAccount.getMchId()); | |||
| }catch (Exception e){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getMessage()+e.getMessage()); | |||
| } | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap,payAccount.getApiKey())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_RETURN_INVALID); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_APPLY_FAILED.getCode(), returnMap.get("err_code_des")); | |||
| } | |||
| String out_order_no = returnMap.get("out_order_no"); | |||
| if (StringUtils.isBlank(out_order_no) || !out_order_no.equals(record.getId().toString())){ | |||
| return new ResultData(ErrorCode.PROFIT_SHARING_QUERY_RETURN_INVALID); | |||
| PayShareQueryResult shareResult = payServiceFactory.getPayShareAdapterService(dto.getPayWay()).shareQuery(appInfo, payAccount, record); | |||
| if (!shareResult.isSuccess()) { | |||
| throw new MallinkException(shareResult.getCode(),shareResult.getMsg()); | |||
| } | |||
| record.setSharingStatus((Integer) statusMap.get(returnMap.get("status"))); | |||
| record.setSharingStatus(shareResult.getCode()); | |||
| record.setUpdateTime(new Date()); | |||
| wxProfitSharingOrderMapper.updateById(record); | |||
| String receivers = returnMap.get("receivers"); | |||
| String receivers = shareResult.getReceivers(); | |||
| if (receivers != null) { | |||
| JSONArray jReceivers = JSONArray.parseArray(receivers); | |||
| @@ -509,7 +440,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(returnMap); | |||
| return new ResultData(shareResult.getData()); | |||
| } | |||
| // 分账完结 | |||
| @@ -685,5 +616,61 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| } | |||
| } | |||
| //更新以前分账用户绑定微信号的分账数据,微信已经停止了微信号分账 | |||
| @Override | |||
| @Deprecated | |||
| public void updatetttttttttttttt() { | |||
| WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | |||
| wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | |||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | |||
| List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | |||
| list.stream().forEach(sharingOrder->{ | |||
| if (!sharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode())) { | |||
| return; | |||
| } | |||
| WxProfitShareAppInoDto dto = getAppinfo(sharingOrder); | |||
| WxAppinfo appInfo = dto.getAppinfo(); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| List<JSONObject> receivers; | |||
| receivers = JSONArray.parseArray(sharingOrder.getReceivers(), JSONObject.class); | |||
| if (receivers.size() != 1 ) | |||
| return; | |||
| Integer amount = receivers.get(0).getInteger("amount"); | |||
| if (!EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getMessage().equals(receivers.get(0).getString("type"))) { | |||
| return; | |||
| } | |||
| //准备分账列表 | |||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | |||
| psReceiverQ.updateTenantInfo(payAccount); | |||
| psReceiverQ.setMerchantId(sharingOrder.getMerchantId()); | |||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(dto.getPayWay()).getProfitSharingType()); | |||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); | |||
| if (null == psReceiverList || psReceiverList.size() !=1 ) { | |||
| return ; | |||
| } | |||
| JSONArray realReceivers = new JSONArray(); | |||
| psReceiverList.stream().forEach(receiver->{ | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put("type",payServiceFactory.getPayShareAdapterService(dto.getPayWay()).getShareAccount(receiver.getReceiverType()).getMessage()); | |||
| jo.put("account",receiver.getReceiverAccount()); | |||
| jo.put("amount", amount); | |||
| //jo.put("description",receiver.getReceiverComments()); //改为存ID, | |||
| jo.put("description",receiver.getId().toString()); //为重试做准备 | |||
| realReceivers.add(jo); | |||
| }); | |||
| sharingOrder.setReceivers(JSON.toJSONString(realReceivers)); | |||
| wxProfitSharingOrderMapper.updateById(sharingOrder); | |||
| }); | |||
| } | |||
| } | |||
| @@ -71,62 +71,62 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| @Override | |||
| @Transactional | |||
| public void initProjectConfig(Long id) { | |||
| WxProjectConfig wxProjectConfig = wxProjectConfigMapper.selectById(id); | |||
| if(wxProjectConfig!=null && wxProjectConfig.getDelType()<10000){ | |||
| // 1. wx_mall 商场 | |||
| String tenantId = wxMallService.wxMallInit(wxProjectConfig); | |||
| // 2. wx_coupon_send_config | |||
| wxCouponSendConfigService.wxCouponSendConfigInit(tenantId); | |||
| // 3. wx_mall_building 商场楼座 | |||
| wxMallBuildingService.wxMallBuildingInit(tenantId,wxProjectConfig.getMallBuilding()); | |||
| //# --- 特殊商户号开通后,填写此数据 | |||
| //# 5. wx_pay_account | |||
| WxPayAccount wxPayAccount = wxPayAccountService.wxPayAccountInit(tenantId,wxProjectConfig); | |||
| //# --- 特殊商户号开通后,填写此数据 | |||
| //# 6. wx_pay_account_bill | |||
| Long payBillId = wxPayAccountBillService.wxPayAccountInit(wxPayAccount); | |||
| //# --- 小程序开通后,填写此数据,并设置域名及业务域名等 | |||
| //# 7. wx_appinfo | |||
| wxAppinfoService.wxAppinfoInit(tenantId,wxPayAccount.getId(),payBillId,wxProjectConfig); | |||
| wxAuthorizerInfoService.wxAuthorizerInfoInit(tenantId,wxProjectConfig); | |||
| wxAuthorizerInfoService.wxWeappExtSetInit(wxProjectConfig); | |||
| // 9. mall_user_info | |||
| // 10. mall_role | |||
| // 11. mall_role_permission | |||
| //# 12. mall_user_role | |||
| Long mallUserInfoId = mallUserInfoService.MallUserInfoInit(tenantId, wxProjectConfig); | |||
| //# 13. wx_msg_config | |||
| wxMsgConfigService.WxMsgConfigInit(tenantId, wxProjectConfig); | |||
| //# ETCP 设置完后再填写此数据 | |||
| //# 14. wx_park | |||
| wxParkService.wxParkInit(tenantId, wxProjectConfig); | |||
| //# 积分成长值设置wx_score_rules | |||
| wxScoreRulesService.wxScoreRulesInit(tenantId); | |||
| //# 17. wx_template_msg | |||
| //# 设置核销成功通知,核销失败通知 | |||
| wxTemplateMsgService.wxTemplateMsgInit(tenantId); | |||
| //# 18. wx_wiwide_info -- 迈外迪 服务商后台设置商户(点击获取商户bid),再找迈外迪初始化,收到激活邮件激活后,再在数据库中插入此数据 | |||
| //# 数据格式如下 | |||
| //# szld1086@iformall | |||
| //# 1391054397 | |||
| //# wuguoqiang@iformall.com | |||
| // # 19. wx_question | |||
| wxQuestionService.wxQuestionInit(tenantId); | |||
| //# 20. wx_msg_validationcode_model, 数据重新一下 | |||
| wxMsgValidationcodeModelService.wxMsgValidationcodeModelInit(tenantId, wxProjectConfig.getName(), wxProjectConfig.getImgUrlH()); | |||
| //wx_flow_config | |||
| wxFlowService.wxFlowConfigInit(tenantId); | |||
| //初始化成功 删除标记 | |||
| wxProjectConfig.setDelType(10000); | |||
| wxProjectConfigMapper.updateById(wxProjectConfig); | |||
| }else { | |||
| logger.info("------数据已初始化"); | |||
| } | |||
| // WxProjectConfig wxProjectConfig = wxProjectConfigMapper.selectById(id); | |||
| // if(wxProjectConfig!=null && wxProjectConfig.getDelType()<10000){ | |||
| // // 1. wx_mall 商场 | |||
| // String tenantId = wxMallService.wxMallInit(wxProjectConfig); | |||
| // // 2. wx_coupon_send_config | |||
| // wxCouponSendConfigService.wxCouponSendConfigInit(tenantId); | |||
| // // 3. wx_mall_building 商场楼座 | |||
| // wxMallBuildingService.wxMallBuildingInit(tenantId,wxProjectConfig.getMallBuilding()); | |||
| // //# --- 特殊商户号开通后,填写此数据 | |||
| // //# 5. wx_pay_account | |||
| // WxPayAccount wxPayAccount = wxPayAccountService.wxPayAccountInit(tenantId,wxProjectConfig); | |||
| // //# --- 特殊商户号开通后,填写此数据 | |||
| // //# 6. wx_pay_account_bill | |||
| // Long payBillId = wxPayAccountBillService.wxPayAccountInit(wxPayAccount); | |||
| // //# --- 小程序开通后,填写此数据,并设置域名及业务域名等 | |||
| // //# 7. wx_appinfo | |||
| // wxAppinfoService.wxAppinfoInit(tenantId,wxPayAccount.getId(),payBillId,wxProjectConfig); | |||
| // | |||
| // wxAuthorizerInfoService.wxAuthorizerInfoInit(tenantId,wxProjectConfig); | |||
| // | |||
| // wxAuthorizerInfoService.wxWeappExtSetInit(wxProjectConfig); | |||
| // // 9. mall_user_info | |||
| // // 10. mall_role | |||
| // // 11. mall_role_permission | |||
| // //# 12. mall_user_role | |||
| // Long mallUserInfoId = mallUserInfoService.MallUserInfoInit(tenantId, wxProjectConfig); | |||
| // //# 13. wx_msg_config | |||
| // wxMsgConfigService.WxMsgConfigInit(tenantId, wxProjectConfig); | |||
| // //# ETCP 设置完后再填写此数据 | |||
| // //# 14. wx_park | |||
| // wxParkService.wxParkInit(tenantId, wxProjectConfig); | |||
| // //# 积分成长值设置wx_score_rules | |||
| // wxScoreRulesService.wxScoreRulesInit(tenantId); | |||
| // //# 17. wx_template_msg | |||
| // //# 设置核销成功通知,核销失败通知 | |||
| // wxTemplateMsgService.wxTemplateMsgInit(tenantId); | |||
| // //# 18. wx_wiwide_info -- 迈外迪 服务商后台设置商户(点击获取商户bid),再找迈外迪初始化,收到激活邮件激活后,再在数据库中插入此数据 | |||
| // //# 数据格式如下 | |||
| // //# szld1086@iformall | |||
| // //# 1391054397 | |||
| // //# wuguoqiang@iformall.com | |||
| // | |||
| // // # 19. wx_question | |||
| // wxQuestionService.wxQuestionInit(tenantId); | |||
| // | |||
| // //# 20. wx_msg_validationcode_model, 数据重新一下 | |||
| // wxMsgValidationcodeModelService.wxMsgValidationcodeModelInit(tenantId, wxProjectConfig.getName(), wxProjectConfig.getImgUrlH()); | |||
| // //wx_flow_config | |||
| // wxFlowService.wxFlowConfigInit(tenantId); | |||
| // //初始化成功 删除标记 | |||
| // wxProjectConfig.setDelType(10000); | |||
| // wxProjectConfigMapper.updateById(wxProjectConfig); | |||
| // | |||
| // }else { | |||
| // logger.info("------数据已初始化"); | |||
| // } | |||
| } | |||
| @@ -159,15 +159,15 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| @Override | |||
| @Transactional | |||
| public void initBuilding(List<WxMallBuilding> wxMallBuildings) { | |||
| wxMallBuildingService.deleteByTenantId(wxMallBuildings.get(0).getTenantId()); | |||
| wxMallFloorService.deleteByTenantId(wxMallBuildings.get(0).getTenantId()); | |||
| for (WxMallBuilding wxMallBuilding:wxMallBuildings) { | |||
| wxMallBuildingService.deleteByTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallBuilding.setId(null); | |||
| wxMallBuilding.setMallId(Long.parseLong(wxMallBuilding.getTenantId())); | |||
| if(wxMallBuilding.getFloors() != null && wxMallBuilding.getFloors().size() > 0){ | |||
| wxMallBuilding.setFloorNumber(wxMallBuilding.getFloors().size()); | |||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||
| for (WxMallFloor wxMallFloor:wxMallBuilding.getFloors()) { | |||
| wxMallFloorService.deleteByTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallFloor.setId(null); | |||
| wxMallFloor.setTenantId(wxMallBuilding.getTenantId()); | |||
| wxMallFloor.setParentTenantId(wxMallBuilding.getParentTenantId()); | |||
| @@ -197,7 +197,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| wxPayAccountBill.setMchId(wxPayAccount.getMchId()); | |||
| wxPayAccountBill.setSubMchId(wxPayAccount.getSubMchId()); | |||
| wxPayAccountBill.setApiKey(wxPayAccount.getApiKey()); | |||
| wxPayAccountBill.setNotifyUrl(wxPayAccount.getNotifyUrl()); | |||
| wxPayAccountBill.setNotifyUrl(wxPayAccount.getNotifyUrl().replaceAll("/wxPay/","/wxPayBill/")); | |||
| wxPayAccountBill.setCertPath(wxPayAccount.getCertPath()); | |||
| wxPayAccountBill.setType(wxPayAccount.getType()); | |||
| wxPayAccountBill.setShare(!(wxPayAccount.getShare() == 0)); | |||
| @@ -216,6 +216,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional | |||
| public void initUserInfo(MallUserInfo userInfo) { | |||
| @@ -599,7 +599,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| payOrderQ.updateTenantInfo(wxOrder); | |||
| payOrderQ.setCUserId(wxOrder.getCUserId()); | |||
| payOrderQ.setOrderId(wxOrder.getId()); | |||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| //payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| WxPayOrder payOrder = null; | |||
| List<WxPayOrder> list = wxPayOrderMapper.findList(payOrderQ); | |||
| @@ -1635,7 +1635,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| @Override | |||
| public ResultData updateRentContractStatus(Long id) { | |||
| public ResultData updateRentContractStatus(Long id,boolean buildProperyBill) { | |||
| if (id == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| @@ -1678,7 +1678,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //押金 | |||
| buildDeposit( null, id); | |||
| } | |||
| updatePropertyPreviewBill(record); | |||
| //一起建立物业账单 | |||
| if (buildProperyBill) { | |||
| updatePropertyPreviewBill(record); | |||
| } | |||
| //作废合同 | |||
| //updateInvalidContract(id); | |||
| } | |||
| @@ -2513,6 +2516,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public void outDateContract(WxMall wxMall) { | |||
| //查询有计租合同的商户 | |||
| WxRentContract wr = new WxRentContract(); | |||
| @@ -2547,8 +2551,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (shopIdList.size() > 0 ) { | |||
| WxRentContract wrcq = new WxRentContract(); | |||
| wrcq.setMerchantId(mid); | |||
| wrcq.setStatus(EnumRentContractStatus.PAING.getCode()); | |||
| List<WxRentContract> contractList0 = wxRentContractMapper.findList(wrc); | |||
| wrcq.setStatuss(EnumRentContractStatus.getValidStatus()); | |||
| List<WxRentContract> contractList0 = wxRentContractMapper.findList(wrcq); | |||
| for (WxRentContract w : contractList0) { | |||
| List<Long> shopids0 = w.shopIdsByRentInfo(); | |||
| if (null != shopids0) { | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service.park.impl.cyf; | |||
| import java.text.ParseException; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -67,14 +68,20 @@ public class CYFParkCallbackService extends BaseParkService implements ParkCallB | |||
| @Override | |||
| public ParkNotifyParam parseUnbindNoticyParam(Object param) { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| @Override | |||
| public ParkNotifyParam parsePaidNoticyParam(Object param) { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| Map vo = (Map) param; | |||
| ParkNotifyParam p = new ParkNotifyParam(); | |||
| p.setCarNumber((String) vo.get("plate")); | |||
| p.setParkId(String.valueOf(vo.get("parkId"))); | |||
| p.setParkOrderId((String) vo.get("orderNo")); | |||
| p.setSynId((String) vo.get("orderNo")); | |||
| p.setFee(vo.get("fee").toString()); | |||
| p.setPayTime((Date) vo.get("payTime")); | |||
| return p; | |||
| } | |||
| @@ -19,6 +19,7 @@ import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponUnit; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.park.ParkAdapterService; | |||
| import com.iformall.service.park.impl.BaseParkService; | |||
| @@ -66,8 +67,7 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| String ret = cyf.registerCar(token,park.getNumber(),feeGroupId,park.getParkingId(),carNumber,null,member.getNickName()); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| //TODO 返回vendorPersonId | |||
| return null; | |||
| return retObj.get("localPersonId").toString(); | |||
| }else { | |||
| logger.error("cyfBindCar error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| @@ -128,9 +128,45 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||
| } | |||
| } | |||
| /** | |||
| * 优惠券支付流程:(1):调取openapi/getFee路径获取当前停车费,入参:plate,parkingId,token | |||
| (2):调用地址:http://wechat.cheyifu2016.com/fm-pay/#/transit?encodeURIComponent('orderNo=123&couponFee=2&actualFee=20') | |||
| 注: 详细参考接口文档参数 | |||
| * @param token | |||
| * @param orderNo | |||
| * @param couponFee | |||
| * @param actualFee | |||
| * @return | |||
| */ | |||
| @Override | |||
| public ResultData useCoupon(Map<String, String> paramMap, WxPark park, WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception{ | |||
| return new ResultData(); | |||
| String params = park.getVendorParams(); | |||
| JSONObject objParams = JSON.parseObject(params); | |||
| String token = objParams.getString("token"); | |||
| //先获取停车费,然后再提交停车费 | |||
| String ret = cyf.getCarStopFee(token,park.getParkingId(),carNumber); | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("result") == 1){ | |||
| String orderId = retObj.getString("orderId"); | |||
| if (StringUtils.isBlank(orderId)) { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "车易付停车费查询未返回订单编号:"+orderId); | |||
| } | |||
| if (!coupon.getUnit().equals(EnumCouponUnit.MONEY.getCode())) { | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "车易付只能支持金额券,不能使用小时券:"+orderId); | |||
| } | |||
| int fee = retObj.getInteger("fee"); | |||
| int amount = Integer.parseInt(coupon.getPriceStr()); | |||
| Map retmap = new HashMap(); | |||
| retmap.put("orderNo", orderId); | |||
| retmap.put("couponFee", amount); | |||
| retmap.put("actualFee", fee-amount); | |||
| return new ResultData(); | |||
| }else { | |||
| logger.error("cyfCarStopFee error. paramMap: {} . cyfResult: {}",JSON.toJSONString(paramMap),ret); | |||
| String msg = retObj.getString("strError"); | |||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service.park.impl.etcp; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -136,29 +137,33 @@ public class EtcpHelper { | |||
| WxCUserCar queryUserCar = new WxCUserCar(); | |||
| queryUserCar.setCUserId(cUserId); | |||
| List<WxCUserCar> uclist = wxCUserCarService.getList(queryUserCar); | |||
| // 删除ETCP不存在 | |||
| for (WxCUserCar userCar : uclist) { | |||
| boolean bExist = isExistInArray(arr, userCar.getCarNumber()); | |||
| if (!bExist) { | |||
| wxCUserCarService.deleteById(userCar.getId()); | |||
| uclist.remove(userCar); | |||
| } | |||
| } | |||
| // 添加ETCP的 | |||
| for (int i = 0; i < arr.size(); i++) { | |||
| String _carNum = arr.getString(i); | |||
| boolean bExist = isExistInList(uclist, _carNum); | |||
| if (!bExist) { | |||
| Date curr = new Date(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setCUserId(cUserId); | |||
| userCar.updateTenantInfo(tenantEntity); | |||
| userCar.setCarNumber(_carNum); | |||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| userCar.setCreateDate(curr); | |||
| userCar.setUpdateDate(curr); | |||
| wxCUserCarService.saveOrUpdate(userCar); | |||
| } | |||
| if(null != uclist ) { | |||
| List<WxCUserCar> ucclist = new ArrayList<WxCUserCar>(); | |||
| ucclist.addAll(uclist); | |||
| // 删除ETCP不存在 | |||
| for (WxCUserCar userCar : uclist) { | |||
| boolean bExist = isExistInArray(arr, userCar.getCarNumber()); | |||
| if (!bExist) { | |||
| wxCUserCarService.deleteById(userCar.getId()); | |||
| ucclist.remove(userCar); | |||
| } | |||
| } | |||
| // 添加ETCP的 | |||
| for (int i = 0; i < arr.size(); i++) { | |||
| String _carNum = arr.getString(i); | |||
| boolean bExist = isExistInList(ucclist, _carNum); | |||
| if (!bExist) { | |||
| Date curr = new Date(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setCUserId(cUserId); | |||
| userCar.updateTenantInfo(tenantEntity); | |||
| userCar.setCarNumber(_carNum); | |||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| userCar.setCreateDate(curr); | |||
| userCar.setUpdateDate(curr); | |||
| wxCUserCarService.saveOrUpdate(userCar); | |||
| } | |||
| } | |||
| } | |||
| return dataObj1; | |||
| } | |||
| @@ -350,7 +355,7 @@ public class EtcpHelper { | |||
| String businessId = ""; | |||
| // 获取merchantId | |||
| WxMerchantVo merchantVo = null; | |||
| if (userCar.getMerchantVoList().size() > 0) { | |||
| if (null != userCar.getMerchantVoList() && userCar.getMerchantVoList().size() > 0) { | |||
| merchantVo = userCar.getMerchantVoList().get(0); | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.iformall.service.park.utils; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| public class ParkCacheUtils { | |||
| public static void removeCache(RedisTemplate<String, Object> template,String parkVendor,String carNumber) { | |||
| String key = "carStop:"+parkVendor+":"+carNumber; | |||
| RedisCacheUtils.removeCache(template, key); | |||
| } | |||
| public static void setCarCouponUnUseCacheLock(RedisTemplate<String, Object> template,String parkVendor,String carNumber) { | |||
| String key = "carStop:"+parkVendor+":"+carNumber; | |||
| RedisCacheUtils.cache(template, key, 0, 24*3600); | |||
| } | |||
| public static void setCarCouponUsedCacheLock(RedisTemplate<String, Object> template,String parkVendor,String carNumber) { | |||
| String key = "carStop:"+parkVendor+":"+carNumber; | |||
| RedisCacheUtils.cache(template, key, 1, 24*3600); | |||
| } | |||
| public static Integer getCarCouponUseCacheLock(RedisTemplate<String, Object> template,String parkVendor,String carNumber) { | |||
| String key = "carStop:"+parkVendor+":"+carNumber; | |||
| return RedisCacheUtils.getCacheInteger(template, key); | |||
| } | |||
| } | |||