diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java index 020cd0bf9..98598c72a 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java @@ -7,9 +7,13 @@ import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.TtPoiTakeRate; +import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.base.BaseEntity; +import com.iformall.enums.EnumCpsPlanContentType; +import com.iformall.enums.EnumCpsPlanStatus; import com.iformall.enums.EnumCpsPlanType; import com.iformall.service.TtCouponGoodsService; +import com.iformall.service.WxCouponService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -20,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** @@ -34,8 +40,46 @@ public class TtPoiPlanController extends BaseController { @Autowired private TtCouponGoodsService ttCouponGoodsService; -// @TenantIgnore + @Autowired + private WxCouponService wxCouponService; + @ApiOperation("分页列表接口") + @GetMapping("takeRateList") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + @SystemControllerLog(description = "列表") + public ResultData takeRateList(@ModelAttribute TtPoiTakeRate record, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::list"); + if (null == record) record = new TtPoiTakeRate(); + record.updateTenantInfo(getTenantInfo()); + record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); + final PageInfo page = ttCouponGoodsService.takeRateListAsPage(record, pageNum, pageSize); + if(page.getList() != null && !page.getList().isEmpty()){ + List couponIds = page.getList().stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); + Map couponMap = wxCouponService.getCouponMap(couponIds, getTenantInfo()); + for (TtPoiTakeRate takeRate:page.getList()) { + takeRate.setCoupon(couponMap.get(takeRate.getCouponId())); + } + } + return new ResultData(page); + } + + @ApiOperation("通过id获取") + @GetMapping("getTakeRate") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + @SystemControllerLog(description = "列表") + public ResultData getTakeRate(Long id) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::getTakeRate"); + if(id == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + TtPoiTakeRate takeRateById = ttCouponGoodsService.getTakeRateById(getTenantInfo(), id); + return new ResultData(takeRateById); + } + +// @TenantIgnore + @ApiOperation("通用计划分页列表接口") @GetMapping("list") @ApiImplicitParams({}) @SystemControllerLog(description = "列表") @@ -53,110 +97,132 @@ public class TtPoiPlanController extends BaseController { return ttCouponGoodsService.poiPlanList(getTenantInfo(),couponId,pageNum,pageSize); } + @ApiOperation("定向计划分页列表接口") + @GetMapping("orientedList") + @ApiImplicitParams({}) + @SystemControllerLog(description = "列表") + public ResultData orientedList(Long couponId,Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] TtPoiPlanController::orientedList"); + if(couponId == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + if(pageNum == null){ + pageNum = 1; + } + if(pageSize == null){ + pageSize = 100; + } + return ttCouponGoodsService.poiOrientedPlanList(getTenantInfo(),couponId,pageNum,pageSize); + } + @ApiOperation("发布修改通用佣金计划") @PostMapping("save") @SystemControllerLog(description = "更新") - public ResultData save(@RequestBody Map param) { + public ResultData save(@RequestBody TtPoiTakeRate record) { logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::save"); - Integer commissionRate = (Integer) param.get("commissionRate"); - if(commissionRate == null){ + if(record.getTakeRate() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率为空"); } - if(commissionRate.intValue() < 100 || commissionRate.intValue() > 2900){ + if(record.getTakeRate() < 100 || record.getTakeRate() > 2900){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率需在万分位100-2900之间"); } - Integer contentType = (Integer) param.get("contentType"); - if(contentType == null){ + + if(record.getContentType() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"带货场景为空"); } - if(contentType.intValue() < 1 || contentType.intValue() > 3){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"带货场景不合法"); - } - String planIdStr = (String) param.get("planId"); - Long planId = null; - if(StringUtils.isNotBlank(planIdStr)){ - planId = Long.parseLong(planIdStr); + if(record.getCouponId() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空"); } + record.updateTenantInfo(getTenantInfo()); + return ttCouponGoodsService.poiPlanSave(record); + } - String couponIdStr = (String) param.get("couponId"); - if(StringUtils.isBlank(couponIdStr)){ + @ApiOperation("发布修改定向佣金计划") + @PostMapping("saveOrientedPlan") + @SystemControllerLog(description = "更新") + public ResultData saveOrientedPlan(@RequestBody TtPoiTakeRate record) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::saveOrientedPlan"); + if(StringUtils.isBlank(record.getName())){//不可修改 + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划名称为空"); + } + if(StringUtils.isBlank(record.getMerchantPhone())){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划联系人为空"); + } + if(record.getDouyinIdList() == null || record.getDouyinIdList().isEmpty()){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"定向达人抖音号为空"); + } + if(record.getCouponId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空"); } - Long couponId = Long.parseLong(couponIdStr); - - return ttCouponGoodsService.poiPlanSave(getTenantInfo(),couponId,planId,contentType,commissionRate); + if(record.getContentType() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"带货场景为空"); + } + EnumCpsPlanContentType planType = EnumCpsPlanContentType.getEnum(record.getContentType()); + if(planType == null || (!planType.equals(EnumCpsPlanContentType.VIDEO) && !planType.equals(EnumCpsPlanContentType.LIVE))){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"带货场景错误"); + } + if(planType.equals(EnumCpsPlanContentType.VIDEO)){ + if(record.getStartTime() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划开始时间为空"); + } + if(record.getEndTime() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划结束时间为空"); + } + if(record.getCommissionDuration() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"佣金有效期为空"); + } + } + if(record.getTakeRate() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率为空"); + } + if(record.getTakeRate() <= 0 || record.getTakeRate() > 2900){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品的抽佣率需在万分位0-2900之间"); + } + record.updateTenantInfo(getTenantInfo()); + return ttCouponGoodsService.saveOrientedPlan(record); } @ApiOperation("修改通用佣金计划状态") @PostMapping("updateStatus") @SystemControllerLog(description = "更新") - public ResultData updateStatus(@RequestBody Map param) { + public ResultData updateStatus(@RequestBody TtPoiTakeRate record) { logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateStatus"); - String planIdStr = (String) param.get("planId"); - if(StringUtils.isBlank(planIdStr)){ + if(record.getId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划ID为空"); } - Long planId = Long.parseLong(planIdStr); - Integer status = (Integer) param.get("status"); - if(status == null){ + if(record.getStatus() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态值为空"); } - if(status.intValue() < 1 || status.intValue() > 3){ + EnumCpsPlanStatus planStatus = EnumCpsPlanStatus.getEnum(record.getStatus()); + if(planStatus == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态不合法"); } - - return ttCouponGoodsService.poiPlanUpdateStatus(getTenantInfo(),planId,status); - } - - @ApiOperation("分页列表接口") - @GetMapping("takeRateList") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - @SystemControllerLog(description = "列表") - public ResultData takeRateList(@ModelAttribute TtPoiTakeRate record, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::list"); - if (null == record) record = new TtPoiTakeRate(); record.updateTenantInfo(getTenantInfo()); - record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); - final PageInfo page = ttCouponGoodsService.takeRateListAsPage(record, pageNum, pageSize); - return new ResultData(page); + + return ttCouponGoodsService.poiPlanUpdateStatus(record); } - @ApiOperation("商品达人分佣配置") - @PostMapping("takeRate") + @ApiOperation("修改定向佣金计划状态") + @PostMapping("updateOrientedStatus") @SystemControllerLog(description = "更新") - public ResultData takeRate(@RequestBody Map param) { - logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::takeRate"); - Integer status = (Integer) param.get("status"); - if(status == null){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态为空"); - } - if(status.intValue() != 1 && status.intValue() != 2){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态不规范"); - } - Integer takeRate = (Integer) param.get("takeRate"); - - if(takeRate == null){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抽佣率为空"); + public ResultData updateOrientedStatus(@RequestBody TtPoiTakeRate record) { + logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateOrientedStatus"); + if(record.getId() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"计划ID为空"); } -// if(takeRate.intValue() < 100 || takeRate.intValue() > 2900){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抽佣率需在万分位100-2900之间"); -// } - String douyinId = (String) param.get("douyinId"); - - if(StringUtils.isBlank(douyinId)){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"抖音号为空"); + if(record.getStatus() == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态值为空"); } - String couponIdStr = (String) param.get("couponId"); - if(StringUtils.isBlank(couponIdStr)){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品Id为空"); + EnumCpsPlanStatus planStatus = EnumCpsPlanStatus.getEnum(record.getStatus()); + if(!EnumCpsPlanStatus.OFF.equals(planStatus)){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"状态不合法"); } - Long couponId = Long.parseLong(couponIdStr); + record.updateTenantInfo(getTenantInfo()); - return ttCouponGoodsService.poiTakeRate(getTenantInfo(),couponId,douyinId,takeRate,status); + return ttCouponGoodsService.poiOrientedPlanUpdateStatus(record); } + @ApiOperation("获取佣金范围") @PostMapping("getRateScope") @SystemControllerLog(description = "获取") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index a8c43a580..c19975d8d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -371,15 +371,7 @@ public class WxMerchantController extends BaseController { if(merchant == null){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); - if(appInfo == null) { - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); - if(payAcount == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - return wxProfitSharingReceiverService.updateTtReceiver(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.updateTtReceiver(merchant); } @@ -400,19 +392,10 @@ public class WxMerchantController extends BaseController { if(anEnum == null){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } - - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); - if(appInfo == null) { - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); - if(payAcount == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ - return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ - return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); }else{ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } @@ -436,7 +419,7 @@ public class WxMerchantController extends BaseController { if(payAcount == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } - return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java index aabd2912f..b94a8ed31 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java @@ -3,6 +3,7 @@ package com.iformall.controller.market; import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; @@ -11,6 +12,7 @@ import com.iformall.domain.po.*; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.enums.EnumCouponSourceType; import com.iformall.domain.po.base.BaseEntity; +import com.iformall.enums.EnumCouponStatus; import com.iformall.exception.MallinkException; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; @@ -87,7 +89,6 @@ public class WxCouponChannelController extends BaseController { public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); wxCouponChannel.updateTenantInfo(getTenantInfo()); - ResultData resultData = wxCouponChannelService.saveOrUpdate(wxCouponChannel); WxCouponChannel couponChannel = (WxCouponChannel)resultData.data; //生成二维码 diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 9269dc13f..c4065cc9d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -121,7 +121,7 @@ public class WxCouponController extends BaseController { Integer[] typeArray = { EnumCouponType.COUPON_MANJIAN.getCode(), EnumCouponType.COUPON_DAIJIN.getCode(), - EnumCouponType.COUPON_TUANGOU.getCode(), +// EnumCouponType.COUPON_TUANGOU.getCode(), EnumCouponType.COUPON_LIPIN.getCode(), EnumCouponType.COUPON_TINGCHE.getCode(), EnumCouponType.COUPON_MULTIMCH.getCode(), @@ -184,30 +184,22 @@ public class WxCouponController extends BaseController { if (wxCoupon.getId() == null) { return new ResultData(ResultData.ERROR, "缺少id"); } - wxCoupon.updateTenantInfo(getTenantInfo()); - if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ - WxCouponChannel query = new WxCouponChannel(); - query.updateTenantInfo(wxCoupon); - query.setCouponId(wxCoupon.getId()); - query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - if (CollectionUtils.isNotEmpty(wxCouponChannelService.findList(query))) { - return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); - } -// query.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); -// if (CollectionUtils.isNotEmpty(wxCouponChannelService.findList(query))) { -// TtCouponChannelPoi ttCouponChannelPoi = wxCouponService.getCouponChannelPoi(getTenantInfo(),wxCoupon.getId()); -// if(EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus())){ -// return new ResultData(ResultData.ERROR, "有活动正在预审核."); -// } -// } - } - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); if (null == coupon) { - return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); + return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); } - redisLock.setCouponStock(wxCoupon.getId(), coupon.getRemainInventory()); + + if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ + if(!EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(coupon.getStatus())){ + return new ResultData(ResultData.ERROR, "请先作废,再进行删除。"); + } + wxCouponService.deleteById(wxCoupon.getId(),wxCoupon.getTenantId()); + CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); + CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); + return new ResultData(); + } + //启动审批流 if (wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() > 0) { logger.info("------coupon.update().businessType:"+wxCoupon.getFlowParams().get("businessType")); @@ -222,8 +214,17 @@ public class WxCouponController extends BaseController { wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); } } - - ResultData result = wxCouponService.saveOrUpdate(wxCoupon); + + ResultData result = null; + if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ + result = wxCouponService.disable(wxCoupon, wxCoupon.getId()); + }else{ + result = wxCouponService.saveOrUpdate(wxCoupon); + if(wxCoupon.getRemainInventory() != null){ + redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); + } + } + CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); return result; @@ -242,16 +243,6 @@ public class WxCouponController extends BaseController { } wxCoupon.updateTenantInfo(getTenantInfo()); - if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ - WxCouponChannel query = new WxCouponChannel(); - query.updateTenantInfo(wxCoupon); - query.setCouponId(wxCoupon.getId()); - query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - if (CollectionUtils.isNotEmpty(wxCouponChannelService.findList(query))) { - return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); - } - } - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); if (null == coupon) { return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); @@ -339,10 +330,8 @@ public class WxCouponController extends BaseController { return new ResultData(ErrorCode.COUPON_STOCK_ENDTIME_ERR); } wxCoupon.setSalePrice(coupon.getSalePrice()); - if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType()) - && !wxCouponService.validCouponDate(wxCoupon)) { -// if(!wxCouponService.validCouponDate(wxCoupon)) { - return new ResultData(ResultData.ERROR,"券有效使用日期必须在30天以内。"); + if(!wxCouponService.validCouponDate(wxCoupon)) { + return new ResultData(ResultData.ERROR,"券有效结束日期必须在30天以内。"); } wxCoupon.setSalePrice(null); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java index 0f3b478f2..815155259 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -197,7 +197,7 @@ public class WxCUserBasicInfoController extends BaseController { updateLevelParam(wxCUserBasicInfo); } } - wxCUserBasicInfo.undateFinalTenantId(getTenantInfo()); + wxCUserBasicInfo.updateFinalTenantId(getTenantInfo()); wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.wcubiActiveTime_DESC); PageInfo page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java index 79cd217d7..ed204dd85 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java @@ -172,6 +172,16 @@ public class WxCreditHistoryController extends BaseController { return new ResultData(Result.SUCCESS); } + @ApiOperation("积分清零计划 刷新商圈积分") + @PostMapping("syncClearCredit") + @SystemControllerLog(description = "刷新商圈积分") + @TenantIgnore + public ResultData syncClearCredit() { + logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::syncClearCredit"); + wxCreditHistoryService.syncClearCredit(getTenantInfo()); + return new ResultData(Result.SUCCESS); + } + @ApiOperation("门店排行榜") @GetMapping("merchantCreditRanking") @ApiImplicitParams({ diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022092600001__add_coupon_channel.sql b/mallinkAdmin/src/main/resources/db/migration/V2022092600001__add_coupon_channel.sql new file mode 100644 index 000000000..b9299e51c --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022092600001__add_coupon_channel.sql @@ -0,0 +1,302 @@ +ALTER TABLE `mallink`.`wx_coupon_channel_0` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_1` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_2` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_3` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_4` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_5` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_6` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_7` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_8` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_9` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_10` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_11` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_12` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_13` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_14` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_15` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_16` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_17` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_18` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_19` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_20` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_21` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_22` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_23` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_24` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_25` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_26` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_27` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_28` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_29` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_30` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_31` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_32` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_33` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_34` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_35` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_36` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_37` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_38` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_39` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_40` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_41` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_42` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_43` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_44` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_45` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_46` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_47` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_48` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_49` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_50` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_51` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_52` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_53` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_54` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_55` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_56` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_57` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_58` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_59` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_60` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_61` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_62` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_63` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_64` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_65` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_66` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_67` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_68` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_69` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_70` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_71` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_72` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_73` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_74` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_75` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_76` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_77` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_78` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_79` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_80` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_81` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_82` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_83` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_84` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_85` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_86` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_87` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_88` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_89` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_90` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_91` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_92` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_93` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_94` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_95` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_96` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_97` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_98` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; +ALTER TABLE `mallink`.`wx_coupon_channel_99` +ADD COLUMN `make_merchant_id` bigint(20) NOT NULL DEFAULT 0 AFTER `coupon_id`; + + +update `wx_coupon_channel_0` wcc left join wx_coupon_0 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_1` wcc left join wx_coupon_1 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_2` wcc left join wx_coupon_2 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_3` wcc left join wx_coupon_3 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_4` wcc left join wx_coupon_4 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_5` wcc left join wx_coupon_5 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_6` wcc left join wx_coupon_6 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_7` wcc left join wx_coupon_7 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_8` wcc left join wx_coupon_8 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_9` wcc left join wx_coupon_9 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_10` wcc left join wx_coupon_10 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_11` wcc left join wx_coupon_11 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_12` wcc left join wx_coupon_12 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_13` wcc left join wx_coupon_13 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_14` wcc left join wx_coupon_14 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_15` wcc left join wx_coupon_15 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_16` wcc left join wx_coupon_16 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_17` wcc left join wx_coupon_17 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_18` wcc left join wx_coupon_18 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_19` wcc left join wx_coupon_19 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_20` wcc left join wx_coupon_20 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_21` wcc left join wx_coupon_21 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_22` wcc left join wx_coupon_22 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_23` wcc left join wx_coupon_23 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_24` wcc left join wx_coupon_24 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_25` wcc left join wx_coupon_25 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_26` wcc left join wx_coupon_26 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_27` wcc left join wx_coupon_27 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_28` wcc left join wx_coupon_28 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_29` wcc left join wx_coupon_29 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_30` wcc left join wx_coupon_30 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_31` wcc left join wx_coupon_31 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_32` wcc left join wx_coupon_32 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_33` wcc left join wx_coupon_33 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_34` wcc left join wx_coupon_34 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_35` wcc left join wx_coupon_35 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_36` wcc left join wx_coupon_36 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_37` wcc left join wx_coupon_37 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_38` wcc left join wx_coupon_38 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_39` wcc left join wx_coupon_39 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_40` wcc left join wx_coupon_40 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_41` wcc left join wx_coupon_41 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_42` wcc left join wx_coupon_42 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_43` wcc left join wx_coupon_43 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_44` wcc left join wx_coupon_44 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_45` wcc left join wx_coupon_45 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_46` wcc left join wx_coupon_46 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_47` wcc left join wx_coupon_47 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_48` wcc left join wx_coupon_48 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_49` wcc left join wx_coupon_49 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_50` wcc left join wx_coupon_50 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_51` wcc left join wx_coupon_51 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_52` wcc left join wx_coupon_52 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_53` wcc left join wx_coupon_53 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_54` wcc left join wx_coupon_54 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_55` wcc left join wx_coupon_55 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_56` wcc left join wx_coupon_56 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_57` wcc left join wx_coupon_57 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_58` wcc left join wx_coupon_58 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_59` wcc left join wx_coupon_59 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_60` wcc left join wx_coupon_60 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_61` wcc left join wx_coupon_61 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_62` wcc left join wx_coupon_62 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_63` wcc left join wx_coupon_63 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_64` wcc left join wx_coupon_64 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_65` wcc left join wx_coupon_65 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_66` wcc left join wx_coupon_66 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_67` wcc left join wx_coupon_67 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_68` wcc left join wx_coupon_68 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_69` wcc left join wx_coupon_69 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_70` wcc left join wx_coupon_70 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_71` wcc left join wx_coupon_71 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_72` wcc left join wx_coupon_72 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_73` wcc left join wx_coupon_73 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_74` wcc left join wx_coupon_74 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_75` wcc left join wx_coupon_75 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_76` wcc left join wx_coupon_76 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_77` wcc left join wx_coupon_77 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_78` wcc left join wx_coupon_78 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_79` wcc left join wx_coupon_79 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_80` wcc left join wx_coupon_80 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_81` wcc left join wx_coupon_81 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_82` wcc left join wx_coupon_82 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_83` wcc left join wx_coupon_83 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_84` wcc left join wx_coupon_84 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_85` wcc left join wx_coupon_85 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_86` wcc left join wx_coupon_86 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_87` wcc left join wx_coupon_87 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_88` wcc left join wx_coupon_88 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_89` wcc left join wx_coupon_89 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_90` wcc left join wx_coupon_90 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_91` wcc left join wx_coupon_91 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_92` wcc left join wx_coupon_92 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_93` wcc left join wx_coupon_93 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_94` wcc left join wx_coupon_94 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_95` wcc left join wx_coupon_95 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_96` wcc left join wx_coupon_96 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_97` wcc left join wx_coupon_97 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_98` wcc left join wx_coupon_98 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; +update `wx_coupon_channel_99` wcc left join wx_coupon_99 wc on wc.id = wcc.coupon_id set wcc.`make_merchant_id` = wc.`make_merchant_id` where wc.`make_merchant_id` is not null and wc.`make_merchant_id` != 0; diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022092800001__add_order.sql b/mallinkAdmin/src/main/resources/db/migration/V2022092800001__add_order.sql new file mode 100644 index 000000000..11dc92545 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022092800001__add_order.sql @@ -0,0 +1,300 @@ +ALTER TABLE `mallink`.`wx_order_0` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_1` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_2` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_3` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_4` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_5` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_6` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_7` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_8` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_9` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_10` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_11` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_12` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_13` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_14` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_15` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_16` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_17` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_18` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_19` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_20` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_21` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_22` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_23` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_24` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_25` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_26` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_27` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_28` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_29` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_30` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_31` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_32` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_33` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_34` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_35` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_36` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_37` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_38` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_39` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_40` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_41` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_42` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_43` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_44` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_45` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_46` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_47` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_48` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_49` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_50` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_51` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_52` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_53` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_54` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_55` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_56` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_57` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_58` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_59` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_60` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_61` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_62` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_63` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_64` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_65` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_66` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_67` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_68` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_69` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_70` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_71` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_72` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_73` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_74` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_75` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_76` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_77` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_78` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_79` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_80` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_81` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_82` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_83` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_84` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_85` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_86` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_87` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_88` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_89` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_90` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_91` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_92` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_93` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_94` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_95` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_96` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_97` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_98` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; +ALTER TABLE `mallink`.`wx_order_99` +ADD COLUMN `product_name` varchar(255) AFTER `product_id`, +ADD COLUMN `make_merchant_id` bigint(20) DEFAULT 0 AFTER `pay_version`; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022092800002__add_coupon.sql b/mallinkAdmin/src/main/resources/db/migration/V2022092800002__add_coupon.sql new file mode 100644 index 000000000..95ee3cbc1 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022092800002__add_coupon.sql @@ -0,0 +1,202 @@ +ALTER TABLE `mallink`.`wx_coupon_0` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_1` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_2` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_3` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_4` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_5` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_6` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_7` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_8` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_9` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_10` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_11` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_12` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_13` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_14` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_15` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_16` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_17` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_18` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_19` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_20` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_21` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_22` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_23` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_24` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_25` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_26` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_27` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_28` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_29` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_30` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_31` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_32` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_33` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_34` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_35` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_36` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_37` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_38` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_39` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_40` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_41` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_42` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_43` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_44` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_45` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_46` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_47` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_48` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_49` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_50` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_51` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_52` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_53` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_54` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_55` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_56` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_57` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_58` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_59` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_60` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_61` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_62` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_63` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_64` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_65` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_66` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_67` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_68` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_69` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_70` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_71` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_72` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_73` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_74` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_75` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_76` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_77` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_78` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_79` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_80` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_81` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_82` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_83` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_84` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_85` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_86` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_87` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_88` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_89` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_90` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_91` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_92` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_93` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_94` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_95` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_96` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_97` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_98` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; +ALTER TABLE `mallink`.`wx_coupon_99` ADD COLUMN `goods_id` varchar(50) COMMENT '第三方商品Id'; + + +update `wx_coupon_0` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_1` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_2` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_3` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_4` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_5` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_6` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_7` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_8` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_9` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_10` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_11` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_12` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_13` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_14` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_15` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_16` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_17` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_18` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_19` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_20` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_21` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_22` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_23` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_24` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_25` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_26` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_27` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_28` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_29` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_30` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_31` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_32` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_33` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_34` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_35` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_36` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_37` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_38` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_39` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_40` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_41` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_42` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_43` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_44` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_45` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_46` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_47` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_48` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_49` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_50` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_51` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_52` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_53` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_54` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_55` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_56` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_57` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_58` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_59` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_60` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_61` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_62` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_63` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_64` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_65` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_66` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_67` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_68` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_69` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_70` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_71` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_72` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_73` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_74` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_75` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_76` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_77` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_78` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_79` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_80` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_81` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_82` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_83` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_84` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_85` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_86` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_87` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_88` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_89` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_90` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_91` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_92` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_93` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_94` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_95` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_96` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_97` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_98` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; +update `wx_coupon_99` wc left join tt_coupon_channel_poi ccp on wc.id = ccp.id set wc.`goods_id` = ccp.`spu_id` where ccp.`spu_id` is not null; diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022101100001__add_pay_account.sql b/mallinkAdmin/src/main/resources/db/migration/V2022101100001__add_pay_account.sql new file mode 100644 index 000000000..b944144f9 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022101100001__add_pay_account.sql @@ -0,0 +1,23 @@ +ALTER TABLE `mallink`.`wx_pay_account` +ADD COLUMN `business_type` smallint(2) COMMENT '商圈版本' AFTER `merchant_cert_pem_path`, +ADD COLUMN `brandid` varchar(50) COMMENT '商圈品牌ID' AFTER `business_type`, +ADD COLUMN `card_id` varchar(50) COMMENT '商圈会员卡ID' AFTER `brandid`; + +ALTER TABLE `mallink`.`wx_pay_account` +ADD COLUMN `merchant_cert_serial_no` varchar(100) AFTER `cert_serial_no`; + + +update `mallink`.`wx_pay_account` set merchant_key_path = private_key_path,merchant_cert_serial_no = cert_serial_no,merchant_apiv3_key = api_v3_key +where type = 0; + +update `mallink`.`wx_pay_account` set private_key_path = null,cert_serial_no = null,api_v3_key = null +where type = 0; + + +update `mallink`.`wx_pay_account` set merchant_api_key = api_key +where type = 0; + +update `mallink`.`wx_pay_account` set api_key = null +where type = 0; + +--清缓存,重启项目 \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022101100002__add_sale_type.sql b/mallinkAdmin/src/main/resources/db/migration/V2022101100002__add_sale_type.sql new file mode 100644 index 000000000..675e70fe5 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022101100002__add_sale_type.sql @@ -0,0 +1,19 @@ + +INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (103500103610, '金茂合同全能版+抖音', 10, 12, '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5310, 5320, 6611, 60701, 60702]'); +INSERT INTO `mallink`.`mall_sale_type`(`id`, `name`, `type`, `period`, `menus`) VALUES (12, '尊享全能版+抖音', 12, 12, '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 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, 420, 421, 422, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5310, 5320, 6611, 60701, 60702]'); + + +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (615, '抖音CPS佣金', 6, 'Y', NULL, 0, NULL, NULL, NULL, 'icon-jifen', 0, 602); +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (61501, '通用佣金', 615, 'Y', NULL, 1, NULL, NULL, 'commonPlan', NULL, 0, 61501); +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (61502, '定向佣金', 615, 'Y', NULL, 1, NULL, NULL, 'orientedPlan', NULL, 0, 61502); + + + +UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 508, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 615, 622, 647, 676, 680, 711, 901, 902, 904, 907, 5310, 5320, 61501, 61502]' WHERE `id` = 11; +UPDATE `mallink`.`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, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 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, 420, 421, 422, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5310, 5320, 6611, 60701, 60702, 61501, 61502]' WHERE `id` = 12; +UPDATE `mallink`.`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, 109, 110, 201, 202, 203, 204, 205, 206, 209, 211, 212, 221, 222, 223, 251, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 712, 713, 714, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5310, 5320, 6611, 60701, 60702, 61501, 61502]' WHERE `id` = 103500103610; + + + + + diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022101100003__add_wxcuser.sql b/mallinkAdmin/src/main/resources/db/migration/V2022101100003__add_wxcuser.sql new file mode 100644 index 000000000..ef3858d57 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022101100003__add_wxcuser.sql @@ -0,0 +1,400 @@ +ALTER TABLE `mallink`.`wx_c_user_0` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_1` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_2` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_3` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_4` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_5` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_6` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_7` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_8` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_9` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_10` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_11` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_12` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_13` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_14` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_15` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_16` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_17` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_18` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_19` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_20` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_21` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_22` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_23` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_24` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_25` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_26` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_27` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_28` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_29` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_30` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_31` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_32` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_33` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_34` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_35` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_36` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_37` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_38` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_39` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_40` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_41` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_42` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_43` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_44` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_45` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_46` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_47` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_48` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_49` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_50` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_51` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_52` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_53` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_54` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_55` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_56` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_57` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_58` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_59` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_60` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_61` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_62` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_63` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_64` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_65` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_66` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_67` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_68` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_69` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_70` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_71` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_72` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_73` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_74` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_75` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_76` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_77` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_78` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_79` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_80` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_81` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_82` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_83` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_84` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_85` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_86` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_87` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_88` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_89` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_90` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_91` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_92` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_93` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_94` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_95` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_96` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_97` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_98` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; +ALTER TABLE `mallink`.`wx_c_user_99` +ADD COLUMN `authorize_state` smallint(2) DEFAULT 0 COMMENT '用户授权快速积分' AFTER `qr_code`, +ADD COLUMN `authorize_time` datetime(0) COMMENT '授权时间' AFTER `authorize_state`, +ADD COLUMN `deauthorize_time` datetime(0) COMMENT '取消授权时间' AFTER `authorize_time`; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022101200001__add_wxMemberCard.sql b/mallinkAdmin/src/main/resources/db/migration/V2022101200001__add_wxMemberCard.sql new file mode 100644 index 000000000..f94e9e8b0 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022101200001__add_wxMemberCard.sql @@ -0,0 +1,441 @@ +CREATE TABLE `wx_member_card` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID', + `parent_tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', + `final_tenant_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `card_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '会员卡ID', + `card_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '会员卡code', + `activate_scene` smallint(2) DEFAULT NULL COMMENT '开卡场景', + `outer_str` smallint(2) DEFAULT NULL COMMENT '自定义场景', + `open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信openId', + `union_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信unionId', + `membership_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '展示会员编号', + `level` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '会员等级', + `nickname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户昵称', + `head_image_url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像', + `background_picture_url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '会员卡背景', + `balance` int(11) DEFAULT NULL COMMENT '用户储值的最新余额,单位分', + `user_card_status` smallint(2) DEFAULT NULL COMMENT '用户会员卡状态', + `user_information` json COMMENT '用户开卡时填写的个人信息{}', + `bonus_value` int(11) DEFAULT NULL COMMENT '用户当前的积分值', + `service_modules` json COMMENT '用户当前的会员服务项内容[]', + `member_price_word` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户会员卡详情页会员优惠栏目中的会员专享价文案', + `fapiao_jump_word` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发票栏跳转小程序的引导文案', + `guide` json COMMENT '设置商家联系人员的名字、头像和联系方式[]', + `update_date` datetime(0) DEFAULT NULL COMMENT '更新时间', + `create_date` datetime(0) DEFAULT NULL COMMENT '创建时间', + `user_id` bigint(20) DEFAULT NULL COMMENT '会员Id', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `id_UNIQUE`(`id`) USING BTREE, + UNIQUE INDEX `card_code`(`card_id`, `card_code`) USING BTREE, + INDEX `open_id`(`open_id`) USING BTREE, + INDEX `user_id`(`user_id`) USING BTREE, + INDEX `tenant_id`(`final_tenant_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'c端用户授权信息' ROW_FORMAT = Dynamic; + + + +CREATE TABLE wx_member_card_0 LIKE wx_member_card; +CREATE TABLE wx_member_card_1 LIKE wx_member_card; +CREATE TABLE wx_member_card_2 LIKE wx_member_card; +CREATE TABLE wx_member_card_3 LIKE wx_member_card; +CREATE TABLE wx_member_card_4 LIKE wx_member_card; +CREATE TABLE wx_member_card_5 LIKE wx_member_card; +CREATE TABLE wx_member_card_6 LIKE wx_member_card; +CREATE TABLE wx_member_card_7 LIKE wx_member_card; +CREATE TABLE wx_member_card_8 LIKE wx_member_card; +CREATE TABLE wx_member_card_9 LIKE wx_member_card; +CREATE TABLE wx_member_card_10 LIKE wx_member_card; +CREATE TABLE wx_member_card_11 LIKE wx_member_card; +CREATE TABLE wx_member_card_12 LIKE wx_member_card; +CREATE TABLE wx_member_card_13 LIKE wx_member_card; +CREATE TABLE wx_member_card_14 LIKE wx_member_card; +CREATE TABLE wx_member_card_15 LIKE wx_member_card; +CREATE TABLE wx_member_card_16 LIKE wx_member_card; +CREATE TABLE wx_member_card_17 LIKE wx_member_card; +CREATE TABLE wx_member_card_18 LIKE wx_member_card; +CREATE TABLE wx_member_card_19 LIKE wx_member_card; +CREATE TABLE wx_member_card_20 LIKE wx_member_card; +CREATE TABLE wx_member_card_21 LIKE wx_member_card; +CREATE TABLE wx_member_card_22 LIKE wx_member_card; +CREATE TABLE wx_member_card_23 LIKE wx_member_card; +CREATE TABLE wx_member_card_24 LIKE wx_member_card; +CREATE TABLE wx_member_card_25 LIKE wx_member_card; +CREATE TABLE wx_member_card_26 LIKE wx_member_card; +CREATE TABLE wx_member_card_27 LIKE wx_member_card; +CREATE TABLE wx_member_card_28 LIKE wx_member_card; +CREATE TABLE wx_member_card_29 LIKE wx_member_card; +CREATE TABLE wx_member_card_30 LIKE wx_member_card; +CREATE TABLE wx_member_card_31 LIKE wx_member_card; +CREATE TABLE wx_member_card_32 LIKE wx_member_card; +CREATE TABLE wx_member_card_33 LIKE wx_member_card; +CREATE TABLE wx_member_card_34 LIKE wx_member_card; +CREATE TABLE wx_member_card_35 LIKE wx_member_card; +CREATE TABLE wx_member_card_36 LIKE wx_member_card; +CREATE TABLE wx_member_card_37 LIKE wx_member_card; +CREATE TABLE wx_member_card_38 LIKE wx_member_card; +CREATE TABLE wx_member_card_39 LIKE wx_member_card; +CREATE TABLE wx_member_card_40 LIKE wx_member_card; +CREATE TABLE wx_member_card_41 LIKE wx_member_card; +CREATE TABLE wx_member_card_42 LIKE wx_member_card; +CREATE TABLE wx_member_card_43 LIKE wx_member_card; +CREATE TABLE wx_member_card_44 LIKE wx_member_card; +CREATE TABLE wx_member_card_45 LIKE wx_member_card; +CREATE TABLE wx_member_card_46 LIKE wx_member_card; +CREATE TABLE wx_member_card_47 LIKE wx_member_card; +CREATE TABLE wx_member_card_48 LIKE wx_member_card; +CREATE TABLE wx_member_card_49 LIKE wx_member_card; +CREATE TABLE wx_member_card_50 LIKE wx_member_card; +CREATE TABLE wx_member_card_51 LIKE wx_member_card; +CREATE TABLE wx_member_card_52 LIKE wx_member_card; +CREATE TABLE wx_member_card_53 LIKE wx_member_card; +CREATE TABLE wx_member_card_54 LIKE wx_member_card; +CREATE TABLE wx_member_card_55 LIKE wx_member_card; +CREATE TABLE wx_member_card_56 LIKE wx_member_card; +CREATE TABLE wx_member_card_57 LIKE wx_member_card; +CREATE TABLE wx_member_card_58 LIKE wx_member_card; +CREATE TABLE wx_member_card_59 LIKE wx_member_card; +CREATE TABLE wx_member_card_60 LIKE wx_member_card; +CREATE TABLE wx_member_card_61 LIKE wx_member_card; +CREATE TABLE wx_member_card_62 LIKE wx_member_card; +CREATE TABLE wx_member_card_63 LIKE wx_member_card; +CREATE TABLE wx_member_card_64 LIKE wx_member_card; +CREATE TABLE wx_member_card_65 LIKE wx_member_card; +CREATE TABLE wx_member_card_66 LIKE wx_member_card; +CREATE TABLE wx_member_card_67 LIKE wx_member_card; +CREATE TABLE wx_member_card_68 LIKE wx_member_card; +CREATE TABLE wx_member_card_69 LIKE wx_member_card; +CREATE TABLE wx_member_card_70 LIKE wx_member_card; +CREATE TABLE wx_member_card_71 LIKE wx_member_card; +CREATE TABLE wx_member_card_72 LIKE wx_member_card; +CREATE TABLE wx_member_card_73 LIKE wx_member_card; +CREATE TABLE wx_member_card_74 LIKE wx_member_card; +CREATE TABLE wx_member_card_75 LIKE wx_member_card; +CREATE TABLE wx_member_card_76 LIKE wx_member_card; +CREATE TABLE wx_member_card_77 LIKE wx_member_card; +CREATE TABLE wx_member_card_78 LIKE wx_member_card; +CREATE TABLE wx_member_card_79 LIKE wx_member_card; +CREATE TABLE wx_member_card_80 LIKE wx_member_card; +CREATE TABLE wx_member_card_81 LIKE wx_member_card; +CREATE TABLE wx_member_card_82 LIKE wx_member_card; +CREATE TABLE wx_member_card_83 LIKE wx_member_card; +CREATE TABLE wx_member_card_84 LIKE wx_member_card; +CREATE TABLE wx_member_card_85 LIKE wx_member_card; +CREATE TABLE wx_member_card_86 LIKE wx_member_card; +CREATE TABLE wx_member_card_87 LIKE wx_member_card; +CREATE TABLE wx_member_card_88 LIKE wx_member_card; +CREATE TABLE wx_member_card_89 LIKE wx_member_card; +CREATE TABLE wx_member_card_90 LIKE wx_member_card; +CREATE TABLE wx_member_card_91 LIKE wx_member_card; +CREATE TABLE wx_member_card_92 LIKE wx_member_card; +CREATE TABLE wx_member_card_93 LIKE wx_member_card; +CREATE TABLE wx_member_card_94 LIKE wx_member_card; +CREATE TABLE wx_member_card_95 LIKE wx_member_card; +CREATE TABLE wx_member_card_96 LIKE wx_member_card; +CREATE TABLE wx_member_card_97 LIKE wx_member_card; +CREATE TABLE wx_member_card_98 LIKE wx_member_card; +CREATE TABLE wx_member_card_99 LIKE wx_member_card; + +ALTER TABLE `mallink`.`wx_member_card` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_0` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_1` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_2` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_3` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_4` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_5` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_6` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_7` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_8` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_9` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_10` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_11` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_12` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_13` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_14` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_15` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_16` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_17` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_18` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_19` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_20` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_21` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_22` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_23` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_24` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_25` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_26` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_27` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_28` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_29` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_30` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_31` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_32` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_33` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_34` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_35` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_36` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_37` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_38` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_39` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_40` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_41` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_42` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_43` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_44` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_45` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_46` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_47` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_48` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_49` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_50` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_51` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_52` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_53` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_54` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_55` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_56` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_57` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_58` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_59` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_60` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_61` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_62` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_63` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_64` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_65` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_66` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_67` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_68` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_69` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_70` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_71` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_72` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_73` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_74` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_75` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_76` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_77` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_78` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_79` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_80` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_81` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_82` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_83` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_84` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_85` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_86` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_87` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_88` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_89` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_90` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_91` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_92` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_93` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_94` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_95` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_96` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_97` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_98` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); +ALTER TABLE `mallink`.`wx_member_card_99` +ADD COLUMN `cuser_id` bigint(20) AFTER `user_id`, +ADD INDEX `cuser_id`(`cuser_id`); diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022101700001__add_tt_poi_take_rate.sql b/mallinkAdmin/src/main/resources/db/migration/V2022101700001__add_tt_poi_take_rate.sql new file mode 100644 index 000000000..6e2af7229 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022101700001__add_tt_poi_take_rate.sql @@ -0,0 +1,803 @@ +UPDATE `tt_poi_take_rate_0` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_1` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_2` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_3` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_4` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_5` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_6` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_7` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_8` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_9` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_10` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_11` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_12` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_13` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_14` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_15` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_16` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_17` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_18` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_19` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_20` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_21` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_22` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_23` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_24` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_25` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_26` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_27` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_28` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_29` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_30` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_31` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_32` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_33` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_34` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_35` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_36` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_37` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_38` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_39` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_40` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_41` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_42` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_43` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_44` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_45` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_46` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_47` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_48` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_49` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_50` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_51` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_52` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_53` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_54` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_55` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_56` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_57` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_58` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_59` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_60` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_61` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_62` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_63` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_64` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_65` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_66` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_67` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_68` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_69` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_70` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_71` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_72` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_73` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_74` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_75` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_76` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_77` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_78` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_79` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_80` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_81` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_82` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_83` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_84` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_85` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_86` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_87` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_88` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_89` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_90` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_91` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_92` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_93` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_94` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_95` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_96` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_97` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_98` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; +UPDATE `tt_poi_take_rate_99` SET `douyin_id` = CONCAT('["',douyin_id,'"]') WHERE `douyin_id` is not null; + + + +ALTER TABLE `mallink`.`tt_poi_take_rate_0` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_1` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_2` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_3` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_4` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_5` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_6` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_7` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_8` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_9` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_10` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_11` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_12` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_13` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_14` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_15` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_16` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_17` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_18` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_19` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_20` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_21` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_22` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_23` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_24` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_25` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_26` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_27` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_28` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_29` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_30` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_31` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_32` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_33` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_34` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_35` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_36` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_37` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_38` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_39` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_40` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_41` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_42` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_43` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_44` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_45` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_46` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_47` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_48` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_49` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_50` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_51` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_52` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_53` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_54` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_55` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_56` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_57` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_58` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_59` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_60` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_61` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_62` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_63` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_64` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_65` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_66` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_67` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_68` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_69` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_70` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_71` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_72` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_73` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_74` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_75` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_76` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_77` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_78` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_79` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_80` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_81` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_82` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_83` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_84` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_85` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_86` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_87` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_88` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_89` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_90` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_91` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_92` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_93` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_94` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_95` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_96` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_97` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_98` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; +ALTER TABLE `mallink`.`tt_poi_take_rate_99` +ADD COLUMN `merchant_phone` varchar(20) COMMENT '计划联系人手机号' AFTER `name`, +MODIFY COLUMN `douyin_id` json COMMENT '抖音号' AFTER `content_type`, +ADD COLUMN `douyin_id_status` json COMMENT '达人履约状态' AFTER `douyin_id`, +ADD COLUMN `commission_duration` bigint(20) COMMENT '佣金有效期,单位是秒' AFTER `end_time`, +DROP INDEX `tcd_unique`, +ADD INDEX `tcd_unique`(`tenant_id`, `coupon_id`) USING BTREE; \ No newline at end of file diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 08f36c65a..d5d2384cf 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -2,13 +2,17 @@ package com.iformall.controller; import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.dto.WxCouponChannelDto; +import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.vo.WxCouponChannelVo; +import com.iformall.enums.EnumCouponStatus; import com.iformall.service.WxCouponChannelService; +import com.iformall.service.WxCouponService; import com.iformall.service.util.CouponCacheUtils; import io.swagger.annotations.Api; @@ -36,6 +40,9 @@ public class WxCouponChannelController extends BaseController { @Autowired private WxCouponChannelService wxCouponChannelService; + + @Autowired + private WxCouponService wxCouponService; @Autowired @Qualifier("objectCommonRedisTemplate") diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java index c2cbf80cc..722a28b44 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -98,7 +98,7 @@ public class WxCouponController extends BaseController { Integer[] typeArray = { EnumCouponType.COUPON_MANJIAN.getCode(), EnumCouponType.COUPON_DAIJIN.getCode(), - EnumCouponType.COUPON_TUANGOU.getCode(), +// EnumCouponType.COUPON_TUANGOU.getCode(), EnumCouponType.COUPON_LIPIN.getCode(), EnumCouponType.COUPON_TINGCHE.getCode(), EnumCouponType.COUPON_MULTIMCH.getCode(), @@ -230,36 +230,62 @@ 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"); } + WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); + if (null == coupon) { + return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); + } wxCoupon.updateTenantInfo(getTenantInfo()); if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ - WxCouponChannel query = new WxCouponChannel(); - query.updateTenantInfo(wxCoupon); - query.setCouponId(wxCoupon.getId()); - query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - if (CollectionUtils.isNotEmpty(wxCouponChannelService.findList(query))) { - return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); + if(!EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(coupon.getStatus())){ + return new ResultData(ResultData.ERROR, "请先作废,再进行删除。"); } + wxCouponService.deleteById(wxCoupon.getId(),wxCoupon.getTenantId()); + CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); + CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); + return new ResultData(); } - List merchantList = new ArrayList<>(); - WxMerchant wxMerchant = wxMerchantService.getById(getLoginBUser().getMerchantId()); - merchantList.add(wxMerchant); + if (!hasMerchantCouponFlow()) { + return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); + } - wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); + //启动审批流 + WxMerchantBUser buser = getLoginBUser(); + 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(), buser.getId(), buser.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()); + } + } - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); - if (null == coupon) { - return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); + ResultData result = null; + if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ + result = wxCouponService.disable(wxCoupon, wxCoupon.getId()); + }else{ + List merchantList = new ArrayList<>(); + WxMerchant wxMerchant = wxMerchantService.selectById(getLoginBUser().getMerchantId()); + merchantList.add(wxMerchant); + + wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); + + result = wxCouponService.saveOrUpdate(wxCoupon); + if(wxCoupon.getRemainInventory() != null){ + redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); + } } - redisLock.setCouponStock(wxCoupon.getId(), coupon.getRemainInventory()); - ResultData result = wxCouponService.saveOrUpdate(wxCoupon); + CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); return result; diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java index d09ae37a9..cae3f5243 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java @@ -184,18 +184,10 @@ public class WxMerchantController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); - if(appInfo == null) { - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); - if(payAcount == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ - return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ - return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); }else{ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java index e3ba510e5..b8baa4700 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java @@ -146,11 +146,11 @@ public class BaseController { throw new MallinkException(ErrorCode.USER_APPINFO_NOT_EXIST); } - WxPayAccount payAccount = RedisCacheUtils.getCacheObject(objectCommonRedisTemplate, "payAccount:"+appinfo.getPayId(), WxPayAccount.class); + WxPayAccount payAccount = RedisCacheUtils.getCacheObject(objectCommonRedisTemplate, Constant.payaccountPrev+appinfo.getPayId(), WxPayAccount.class); if (null == payAccount) { payAccount = wxPayAccountService.getById(appinfo.getPayId()); if (null != payAccount) { - RedisCacheUtils.cache(objectCommonRedisTemplate, "payAccount:"+appinfo.getPayId(), payAccount, 24*60*60); + RedisCacheUtils.cache(objectCommonRedisTemplate, Constant.payaccountPrev+appinfo.getPayId(), payAccount, 24*60*60); } } if (null == payAccount) { @@ -245,7 +245,7 @@ public class BaseController { } public WxAppinfo getAppInfo(String appId) { - return wxAppinfoService.getByAppId(appId); + return wxAppinfoService.getByAppIdFromRedis(appId); } public WxMaService getWeappService(String appId) { diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxBusinessCircleController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxBusinessCircleController.java new file mode 100644 index 000000000..1c7515761 --- /dev/null +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxBusinessCircleController.java @@ -0,0 +1,74 @@ +package com.iformall.controller; + +import com.iformall.annotation.RedisCache; +import com.iformall.common.ErrorCode; +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumBusinessCircleAuthorizeState; +import com.iformall.service.*; +import com.iformall.utils.Constant; +import com.iformall.utils.RedisCacheUtils; +import io.swagger.annotations.Api; +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; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping("/api/circle") +@Api(description = "业态查询接口") +public class WxBusinessCircleController extends BaseController { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxBusinessCircleOrderService wxBusinessCircleOrderService; + + @Autowired + @Qualifier("objectCommonRedisTemplate") + RedisTemplate objectCommonRedisTemplate; + + @ApiOperation("获取商圈授权状态") + @GetMapping("/getAuthorizeState") + public ResultData getAuthorizeState() { + logger.debug("[" + getIpAddr() + "] WxBusinessCircleController::getAuthorizeState"); + CUser user = getCUser(); + if(!EnumAppPlat.WX.equals(user.getAppPlat())){ + return new ResultData(ErrorCode.SYS_METHOD_NOT_SUPPORT.getCode(),"平台不支持此请求"); + } + String key = Constant.wx_user_authorize_state + user.getOpenId(); + EnumBusinessCircleAuthorizeState cacheObject = RedisCacheUtils.getCacheObject(objectCommonRedisTemplate, key, EnumBusinessCircleAuthorizeState.class); + if(cacheObject != null){ + return new ResultData(cacheObject); + } + + ResultData resultData = wxBusinessCircleOrderService.syncauthorizeState(getTenantInfo(), user.getOpenId()); + if(Result.SUCCESS == resultData.code){ + EnumBusinessCircleAuthorizeState data = (EnumBusinessCircleAuthorizeState) resultData.data; + if(EnumBusinessCircleAuthorizeState.AUTHORIZED.equals(data)){ + RedisCacheUtils.cache(objectCommonRedisTemplate,key,data,3600*24*3); + } + } + return resultData; + } + + @ApiOperation("获取商圈有未提交的积分") + @GetMapping("/getPointsCommitStatus") + public ResultData getPointsCommitStatus() { + logger.debug("[" + getIpAddr() + "] WxBusinessCircleController::getPointsCommitStatus"); + CUser user = getCUser(); + if(!EnumAppPlat.WX.equals(user.getAppPlat())){ + return new ResultData(ErrorCode.SYS_METHOD_NOT_SUPPORT.getCode(),"平台不支持此请求"); + } + return wxBusinessCircleOrderService.getPointsCommitStatus(getTenantInfo(), user.getOpenId()); + } + +} diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index 456dae195..04e579b20 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -206,14 +206,14 @@ public class WxOrderController extends BaseController { } //验证app - WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); + WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(app_id); if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) || !EnumAppType.C.getCode().equals(appinfo.getType())){ map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); return map; } - WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if(payAccount == null){ map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); map.put("err_tips","未找到支付配置"); @@ -255,23 +255,6 @@ public class WxOrderController extends BaseController { data.put("order_goods_info",order.getExtParam()); } - -// List> goodsValid = new ArrayList<>(); -// for (Long couponChannelId:order.getCouponChannelMap().keySet()) { -// Map goodsValidMap = new HashMap<>(); -// WxCouponChannel couponChannel = order.getCouponChannelMap().get(couponChannelId); -// goodsValidMap.put("goods_id",couponChannel.getTtSpuId()); -// WxCoupon wxCoupon = order.getCouponMap().get(couponChannel.getCouponId()); -// if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(wxCoupon.getValidType())){ -// goodsValidMap.put("valid_start_time",wxCoupon.getValidStartDate().getTime()); -// goodsValidMap.put("valid_end_time",wxCoupon.getValidEndDate().getTime()); -// }else{ -// goodsValidMap.put("valid_duration",(long)wxCoupon.getValidDays()*24*3600*1000); -// } -// goodsValid.add(goodsValidMap); -// } -// data.put("order_valid_time",goodsValid); - map.put("data",data); map.put("err_no",0); map.put("err_tips",resultData.message); @@ -296,209 +279,6 @@ public class WxOrderController extends BaseController { } } -// @AuthIgnore -// @ApiOperation(value = "抖音支付2.0与下单回调推送订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") -// @PostMapping("douyinPushOrder") -// public Map douyinPushOrder(HttpServletRequest request) { -// -// Map map = new HashMap(); -// -// SignatureHeader header = new SignatureHeader(); -// header.setTimeStamp(request.getHeader("Byte-Timestamp")); -// header.setNonce(request.getHeader("Byte-Nonce-Str")); -// header.setSigned(request.getHeader("Byte-Signature")); -// -// logger.info("支付2.0预下单回调---header{}"+header.toString()); -// -// String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); -// logger.info("支付2.0预下单回调---body{}"+body); -// try { -// JSONObject jsonObject = JSONObject.parseObject(body); -// String msg = jsonObject.getString("msg"); -// -// JSONObject msgObject = JSONObject.parseObject(msg); -// String app_id = msgObject.getString("app_id"); -// String open_id = msgObject.getString("open_id"); -// //透传字段 -// Map couponMap = new HashMap<>(); -// try{ -// String cp_extra = msgObject.getString("cp_extra"); -// if(StringUtils.isBlank(cp_extra)){ -// map.put("err_no",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode()); -// map.put("err_tips","缺少透传字段"); -// return map; -// } -// couponMap = JSONObject.parseObject(cp_extra, Map.class); -// }catch(Exception e){ -// } -// if(couponMap.isEmpty()){ -// map.put("err_no",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode()); -// map.put("err_tips","透传字段格式不正确"); -// return map; -// } -// -// //验证app -// WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); -// if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) -// || !EnumAppType.C.getCode().equals(appinfo.getType())){ -// map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); -// map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); -// return map; -// } -// WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); -// if(payAccount == null){ -// map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); -// map.put("err_tips","未找到支付配置"); -// return map; -// } -// TenantEntity tenantEntity = new TenantEntity(); -// tenantEntity.updateTenantInfo(appinfo); -// //验证用户 -// Long memberId = null; -// TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId()); -// if(cuser != null && cuser.getUserId() != null){ -// memberId = cuser.getUserId(); -// } -// if(memberId == null){ -// map.put("err_no",ErrorCode.USER_NOT_MEMBER.getCode()); -// map.put("err_tips",ErrorCode.USER_NOT_MEMBER.getMessage()); -// return map; -// } -// -// -// TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); -// CreateOrderCallback createOrderCallback = ttPayService.parseOrderNotifyV2Result(body, header); -// JSONObject allExtParam = new JSONObject(); -// allExtParam.put("order_id",createOrderCallback.getOrderId()); -// allExtParam.put("total_amount",createOrderCallback.getTotalAmount()); -// allExtParam.put("discount",createOrderCallback.getDiscount()); -// allExtParam.put("open_id",createOrderCallback.getOpenId()); -// -// List list = new ArrayList<>(); -// for (CreateOrderCallback.Good good:createOrderCallback.getGoods()) { -// PlatPushOrderSaveDto dto = new PlatPushOrderSaveDto(); -// dto.setCouponChannelId(Long.parseLong(couponMap.get(good.getGoodsId()))); -// dto.setCount(good.getQuantity()); -// dto.setExtParam(JSON.toJSONString(good.getItemOrderInfoList())); -// list.add(dto); -// } -// -// ResultData resultData = wxOrderService.platPushSaveOrder(true, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH, allExtParam.toJSONString(), list, memberId, EnumPayWay.PAY_WAY_TT, tenantEntity); -// logger.info("resultData{}"+JSON.toJSONString(resultData)); -// if(resultData.code == 200){ -// WxComposeOrder order = (WxComposeOrder) resultData.data; -// Map data = new HashMap<>(); -// data.put("out_order_no",order.getMainOrderId().toString()); -// data.put("pay_expire_seconds",15*60); -// data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(order.getMainOrderId())); -//// List> goodsValid = new ArrayList<>(); -//// for (Long couponChannelId:order.getCouponChannelMap().keySet()) { -//// Map goodsValidMap = new HashMap<>(); -//// WxCouponChannel couponChannel = order.getCouponChannelMap().get(couponChannelId); -//// goodsValidMap.put("goods_id",couponChannel.getTtSpuId()); -//// WxCoupon wxCoupon = order.getCouponMap().get(couponChannel.getCouponId()); -//// if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(wxCoupon.getValidType())){ -//// goodsValidMap.put("valid_start_time",wxCoupon.getValidStartDate().getTime()); -//// goodsValidMap.put("valid_end_time",wxCoupon.getValidEndDate().getTime()); -//// }else{ -//// goodsValidMap.put("valid_duration",(long)wxCoupon.getValidDays()*24*3600*1000); -//// } -//// goodsValid.add(goodsValidMap); -//// } -//// data.put("order_valid_time",goodsValid); -// -// map.put("data",data); -// map.put("err_no",0); -// map.put("err_tips",resultData.message); -// logger.info("resultData{}"+JSON.toJSONString(map)); -// return map; -// }else{ -// map.put("err_no",resultData.code); -// map.put("err_tips",resultData.message); -// return map; -// } -// -// } catch (TtPayException e) { -// logger.error(e.getMessage()); -// map.put("err_no",ErrorCode.SYS_BEAN_EMPTY_PROPERTY_ERROR.getCode()); -// map.put("err_tips",e.getMessage()); -// return map; -// } catch (Exception e){ -// logger.error(e.getMessage()); -// map.put("err_no",ErrorCode.SYS_SERVER_ERROR.getCode()); -// map.put("err_tips",e.getMessage()); -// return map; -// } -// } - -// @ApiOperation(value = "继续支付", notes = "{\"composeOrderId\":\"string\"}") -// @PostMapping("/continueToPay") -// public ResultData continueToPay(@RequestBody Map paramMap) { -// logger.info("/api/order/continueToPay" + paramMap.toString()); -// String orderIdStr = (String) paramMap.get("composeOrderId"); -// if (StringUtils.isBlank(orderIdStr)) { -// logger.info("orderId不能为空: " + paramMap.toString()); -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); -// } -// Long orderId = 0L; -// try { -// orderId = Long.valueOf(orderIdStr); -// } catch (NumberFormatException e) { -// logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); -// } -// -// WxBatchOrder batchOrder = wxOrderService.getWxBatchOrder(getTenantInfo(),orderId); -// if(batchOrder == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到订单"); -// } -// -// WxPayOrder payOrder = new WxPayOrder(); -// payOrder.setOrderId(orderId); -// payOrder.updateTenantInfo(getTenantInfo()); -// payOrder.setPayVendor(batchOrder.getPayVendor()); -// payOrder.setComposeOrder(batchOrder.getOrderType()); -// -// try { -// WxPayOrder byObj = wxPayOrderService.getByObj(payOrder); -// if(byObj == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到支付订单"); -// } -// if(EnumPayStatus.PAY_STATUS_WAIT.getCode().equals(byObj.getPayOrderStatus())){ -// WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(byObj.getComposeOrder()).getComposeOrder(byObj.getOrderId(), byObj.getTenantId()); -// -// WxAppinfo appInfo = wxAppinfoService.getCAppInfo(byObj, EnumPayWay.getEnum(byObj.getPayVendor()).getPlat()); -// //WxCUser user = getUser(); -// //WxAppinfo appInfo = getAppInfo(user.getAppId()); -// if (null == appInfo) { -// return new ResultData(ErrorCode.PAY_ORDER_ERROR, "当前支付类型["+byObj.getPayVendor()+"]找不到C端appInfo"); -// } -// WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); -// try { -// WxPayOrder wo = wxPayOrderService.handleWxOrderQuery(byObj, composeOrder,appInfo, payAccount, IdWorker.get(),false); -// if (null != wo) { -// Map map = new HashMap<>(); -// map.put("outOrderNo",orderId); -// return new ResultData(map); -// } -// }catch(MallinkException e) { -// //已经同步了微信的支付状态,表示已经更新 -// return new ResultData(e.getErrorCode(),e.getMessage()); -// } -// return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "查询微信订单支付状态失败,请稍后!"); -// }else{ -// return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "订单"+EnumPayStatus.getEnum(payOrder.getPayOrderStatus()).getMessage()); -// } -// } catch (MallinkException e) { -// logger.error("支付状态更新失败2: " + orderId + ", e:" + e.getMessage(),e); -// return new ResultData(e.getErrorCode(), e.getMessage()); -// } catch (Exception e) { -// logger.error("支付状态更新失败3: " + orderId + ", e:" + e.getMessage(),e); -// return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + orderId + ", e:" + e.getMessage()); -// } -// } - - @ApiOperation(value = "取消订单", notes = "{\"orderId\":\"string\"}") @PostMapping("cancel") @@ -583,104 +363,6 @@ public class WxOrderController extends BaseController { return new ResultData(); } -// @ApiOperation("分页订单列表接口") -// @GetMapping("list") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), -// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), -// }) -// public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { -// // c端用户应该只能看到自己的订单 -// if (wxOrder == null){ -// wxOrder = new WxOrder(); -// } -// Long memberId; -// try { -// memberId = getMemberId(); -// } catch (Exception e) { -// return new ResultData(Result.ERROR,e.getMessage()); -// } -// wxOrder.setCUserId(memberId); -// wxOrder.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); -// wxOrder.updateTenantInfo(getTenantInfo()); -// final PageInfo page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize,false); -// -// Date now = new Date(); -// page.getList().stream().forEach(oc->{ -// if (oc.getValidStartDate() != null && oc.getValidEndDate() != null ) { -// if (oc.getValidStartDate().getTime() > now.getTime()) { -// oc.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); -// } else if (oc.getValidEndDate().getTime() < now.getTime()) { -// oc.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); -// } else { -// oc.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); -// } -// } -// }); -// -// -// return new ResultData(page); -// } - -// @ApiOperation("订单详情接口") -// @GetMapping("detail") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) -// }) -// public ResultData detail(String orderId) { -// if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); -// } -// // c端用户应该只能看到自己的订单细节 -// WxOrder wxOrder = new WxOrder(); -// Long id = 0L; -// try { -// id = Long.valueOf(orderId); -// } catch (NumberFormatException e) { -// logger.error("parse orderId failed"); -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); -// } -// wxOrder.setId(id); -// Long memberId; -// try { -// memberId = getMemberId(); -// } catch (Exception e) { -// return new ResultData(Result.ERROR,e.getMessage()); -// } -// wxOrder.setCUserId(memberId); -// wxOrder.updateTenantInfo(getTenantInfo()); -// WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); -// if (wxOrderCVo == null) -// return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); -// -// Date now = new Date(); -// -// if (wxOrderCVo.getValidStartDate() != null && wxOrderCVo.getValidEndDate() != null -// && !wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { -// if (wxOrderCVo.getValidStartDate().getTime() > now.getTime()) { -// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); -// } else if (wxOrderCVo.getValidEndDate().getTime() < now.getTime()) { -// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); -// } else { -// wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); -// } -// } -// if(wxOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode()) -// && wxOrderCVo.getPickStartDate() != null && wxOrderCVo.getPickEndDate() != null){ -//// wxOrderCVo.setValidStartDate(wxOrderCVo.getPickStartDate()); -//// wxOrderCVo.setValidEndDate(wxOrderCVo.getPickEndDate()); -// if (wxOrderCVo.getPickStartDate().getTime() > now.getTime()) { -// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.PREPARED.getCode()); -// } else if (wxOrderCVo.getPickEndDate().getTime() < now.getTime()) { -// wxOrderCVo.setValidStatus(EnumCouponOrderValidStatus.ENDED.getCode()); -// } else { -// wxOrderCVo.setValidStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); -// } -// } -// -// return new ResultData(wxOrderCVo); -// } - @ApiOperation("订单详情接口") @GetMapping("detail_v1") @ApiImplicitParams({ @@ -761,35 +443,6 @@ public class WxOrderController extends BaseController { } } -// @ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") -// @GetMapping("/findById") -// @ApiImplicitParams({ -// @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) -// }) -// public ResultData findById(String orderId) { -// if (orderId == null || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); -// } -// Long id = 0L; -// try { -// id = Long.valueOf(orderId); -// } catch (NumberFormatException e) { -// logger.error("parse orderId failed"); -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常:"+orderId); -// } -// WxOrder order = null; -// try { -// order = wxOrderService.getById(id,getTenantInfo().getTenantId()); -// if (order != null) { -// return new ResultData(Result.SUCCESS, "查询成功", order); -// } else { -// return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); -// } -// } catch (Exception e) { -// logger.error("parse orderId failed"); -// return new ResultData(ErrorCode.DB_FAIL.getCode(), "订单查询未成功,e:" + e.getMessage()); -// } -// } @ApiOperation(value = "获取未支付订单", notes = "{\"couponId\":\"string\"}") @GetMapping("getUnPaidOrder") diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 7474ec3c9..986c58407 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -677,14 +677,18 @@ public class WxUserGrantController extends BaseController { return new ResultData(Result.ERROR,e.getMessage()); } - if (wxCUserBasicInfo.getName() != null || - wxCUserBasicInfo.getBirthdate() != null || - wxCUserBasicInfo.getSex() != null || - wxCUserBasicInfo.getAddress() != null) { + if (StringUtils.isNotBlank(wxCUserBasicInfo.getNickName()) + || StringUtils.isNotBlank(wxCUserBasicInfo.getAvatarUrl()) + || StringUtils.isNotBlank(wxCUserBasicInfo.getName()) + || wxCUserBasicInfo.getBirthdate() != null + || wxCUserBasicInfo.getSex() != null + || StringUtils.isNotBlank(wxCUserBasicInfo.getAddress())) { + WxCUserBasicInfo record = new WxCUserBasicInfo(); record.setId(memberId); - record.setName(wxCUserBasicInfo.getName()); + record.setNickName(wxCUserBasicInfo.getNickName()); record.setAvatarUrl(wxCUserBasicInfo.getAvatarUrl()); + record.setName(wxCUserBasicInfo.getName()); record.setBirthdate(wxCUserBasicInfo.getBirthdate()); record.setSex(wxCUserBasicInfo.getSex()); record.setWeight(wxCUserBasicInfo.getWeight()); @@ -703,7 +707,6 @@ public class WxUserGrantController extends BaseController { logger.error("发送同步会员消息异常"); } - wxScoreRulesService.addScore(tenantEntity,EnumScoreType.COMPLETE_INFO, record); //增加积分 WxCreditHistory wxCreditHistory = new WxCreditHistory(); diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/WxBusinessOrderController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxBusinessOrderController.java index c053d41b2..e7f183808 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/WxBusinessOrderController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxBusinessOrderController.java @@ -1,24 +1,21 @@ package com.iformall.controller.callback; import com.github.binarywang.wxpay.bean.businesscircle.BusinessCircleNotifyData; +import com.github.binarywang.wxpay.bean.businesscircle.MemberCardAuthorizeNotifyResult; import com.github.binarywang.wxpay.bean.businesscircle.PaidResult; import com.github.binarywang.wxpay.bean.businesscircle.RefundResult; import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxBusinessCircleOrder; +import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumThirdPartyConfigType; +import com.iformall.enums.*; import com.iformall.exception.MallinkException; -import com.iformall.interceptor.BodyReaderHttpServletRequestWrapper; import com.iformall.pay.WxPayConstant; -import com.iformall.service.WxBusinessCircleOrderService; -import com.iformall.service.WxMallService; -import com.iformall.service.WxPayAccountService; +import com.iformall.service.*; import com.iformall.utils.MaUtil; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.web.servlet.ShiroHttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -31,6 +28,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -46,12 +44,128 @@ public class WxBusinessOrderController extends BaseController { @Autowired WxMallService wxMallService; + @Autowired + WxAppinfoService wxAppinfoService; + @Autowired WxPayAccountService wxPayAccountService; @Autowired WxBusinessCircleOrderService wxBusinessCircleOrderService; + @Autowired + WxMemberCardService wxMemberCardService; + + @Autowired + WxCUserService wxCUserService; + + @Autowired + MaUtil maUtil; + + /** + * + * @return 商圈授权通知 + */ + @PostMapping(value = "/membercard/{tenantId}") + @ResponseBody + public Map notify(@PathVariable String tenantId, HttpServletRequest request){ + logger.info("[" +getIpAddr() + "]商圈授权通知-----"+tenantId); + Map resultMap = new HashMap<>(); + if(StringUtils.isBlank(tenantId)){ + logger.error("tenantId为空"); + resultMap.put("code","FAIL"); + return resultMap; + } + + TenantEntity tenantEntity = wxMallService.getByTenantId(tenantId); + if(tenantEntity == null){ + logger.error("获取tenantEntity为null"); + resultMap.put("code","FAIL"); + return resultMap; + } + + SignatureHeader header = new SignatureHeader(); + header.setSerialNo(request.getHeader("Wechatpay-Serial")); + header.setTimeStamp(request.getHeader("Wechatpay-Timestamp")); + header.setNonce(request.getHeader("Wechatpay-Nonce")); + header.setSigned(request.getHeader("Wechatpay-Signature")); + + logger.info("商圈授权通知---header{}"+header.toString()); + + try { + String body = this.getBody(request); + logger.info("商圈授权通知---body{}"+body); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantId, EnumAppPlat.WX); + if(cAppInfo == null){ + resultMap.put("code","FAIL"); + return resultMap; + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + resultMap.put("code","FAIL"); + return resultMap; + } + WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); + + //----------------签名验证----------- +// BusinessCircleNotifyData notifyData = verifySignature(request,wxPayService); + BusinessCircleNotifyData notifyData = wxPayService.getBusinessCircleService().parseNotifyData(body, header); + logger.info("商圈授权通知---回调通知对象{}"+notifyData.toString()); + + MemberCardAuthorizeNotifyResult result = wxPayService.getBusinessCircleService().decryptMemberCardAuthorizeNotifyDataResource(notifyData); + logger.info("商圈授权通知---解密结果{}"+result.toString()); + + WxMemberCard memberCard = new WxMemberCard(); + memberCard.setTenantId(tenantEntity.getTenantId()); + memberCard.setParentTenantId(tenantEntity.getParentTenantId()); + memberCard.updateFinalTenantId(tenantEntity); + memberCard.setCardId(payAccount.getCardId()); + memberCard.setCardCode(result.getCode()); + + if(WxPayConstant.REGISTERED_MODE.equals(result.getAuthType())){ +// memberCard.setUserCardStatus(EnumMemberCardStatus.EFFECTIVE.getCode()); +// wxMemberCardService.saveorupdateByCode(memberCard); +// +// wxMemberCardService.sendSyncMemberCardMsg(tenantEntity,memberCard.getCardId(),memberCard.getCardCode()); + resultMap.put("code","SUCCESS"); + return resultMap; + }else if(WxPayConstant.REGISTERED_AND_AUTHORIZATION_MODE.equals(result.getAuthType())){ + WxCUser cuser = new WxCUser(); + cuser.updateTenantInfo(tenantEntity); + cuser.setOpenId(result.getOpenid()); + WxCUser byOpenId = wxCUserService.getByOpenId(cuser); + + memberCard.setCuserId(byOpenId.getId()); + memberCard.setUserCardStatus(EnumMemberCardStatus.EFFECTIVE.getCode()); + wxMemberCardService.saveorupdateByCode(memberCard); + + cuser.setAuthorizeState(EnumBusinessCircleAuthorizeState.AUTHORIZED.getCode()); + cuser.setAuthorizeTime(new Date()); + wxCUserService.updateAuthorizeStateByOpenId(cuser); + + wxMemberCardService.sendSyncMemberCardMsg(tenantEntity,memberCard.getCardId(),memberCard.getCardCode()); + resultMap.put("code","SUCCESS"); + return resultMap; + } + resultMap.put("code","FAIL"); + return resultMap; + } catch (WxPayException e) { + e.printStackTrace(); + logger.error("商圈授权通知---"+e.getCustomErrorMsg()); + resultMap.put("code","FAIL"); + return resultMap; + } catch(MallinkException e){ + logger.error("商圈授权通知---"+e.getMessage()); + resultMap.put("code","FAIL"); + return resultMap; + }catch (Exception e){ + e.printStackTrace(); + logger.error("商圈授权通知---其他异常"); + resultMap.put("code","FAIL"); + return resultMap; + } + } + /** * * @return 微信商圈支付通知 diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMemberCardController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMemberCardController.java new file mode 100644 index 000000000..97ff7357b --- /dev/null +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMemberCardController.java @@ -0,0 +1,301 @@ +package com.iformall.controller.callback; + +import com.github.binarywang.wxpay.bean.businesscircle.BusinessCircleNotifyData; +import com.github.binarywang.wxpay.bean.businesscircle.PaidResult; +import com.github.binarywang.wxpay.bean.businesscircle.RefundResult; +import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader; +import com.github.binarywang.wxpay.bean.membercard.MemberCardActivateResult; +import com.github.binarywang.wxpay.bean.membercard.MemberCardNotifyData; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.WxAppinfo; +import com.iformall.domain.po.WxBusinessCircleOrder; +import com.iformall.domain.po.WxMemberCard; +import com.iformall.domain.po.WxPayAccount; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumMemberCardActivateScene; +import com.iformall.enums.EnumMemberCardStatus; +import com.iformall.exception.MallinkException; +import com.iformall.pay.WxPayConstant; +import com.iformall.service.*; +import com.iformall.utils.MaUtil; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +@RestController +@RequestMapping("/member/card") +public class WxMemberCardController extends BaseController { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'+'mm:ss", Locale.CHINA); + + @Autowired + WxMallService wxMallService; + + @Autowired + WxAppinfoService wxAppinfoService; + + @Autowired + WxPayAccountService wxPayAccountService; + + @Autowired + WxMemberCardService wxMemberCardService; + + @Autowired + MaUtil maUtil; + + /** + * + * @return 微信会员卡通知 + */ + @PostMapping(value = "/notify/{tenantId}") + @ResponseBody + public Map notify(@PathVariable String tenantId, HttpServletRequest request){ + logger.info("[" +getIpAddr() + "]微信会员卡通知-----"+tenantId); + Map resultMap = new HashMap<>(); + if(StringUtils.isBlank(tenantId)){ + logger.error("tenantId为空"); + resultMap.put("code","FAIL"); + return resultMap; + } + + TenantEntity tenantEntity = wxMallService.getByTenantId(tenantId); + if(tenantEntity == null){ + logger.error("获取tenantEntity为null"); + resultMap.put("code","FAIL"); + return resultMap; + } + + SignatureHeader header = new SignatureHeader(); + header.setSerialNo(request.getHeader("Wechatpay-Serial")); + header.setTimeStamp(request.getHeader("Wechatpay-Timestamp")); + header.setNonce(request.getHeader("Wechatpay-Nonce")); + header.setSigned(request.getHeader("Wechatpay-Signature")); + + logger.info("微信会员卡通知---header{}"+header.toString()); + + try { + String body = this.getBody(request); + logger.info("微信会员卡通知---body{}"+body); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantId, EnumAppPlat.WX); + if(cAppInfo == null){ + resultMap.put("code","FAIL"); + return resultMap; + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + resultMap.put("code","FAIL"); + return resultMap; + } + WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); + //----------------签名验证----------- +// BusinessCircleNotifyData notifyData = verifySignature(request,wxPayService); + MemberCardNotifyData notifyData = wxPayService.getMemberCardService().parseNotifyData(body, header); + logger.info("微信会员卡通知---回调通知对象{}"+notifyData.toString()); + + MemberCardActivateResult result = wxPayService.getMemberCardService().decryptActivateNotifyDataResource(notifyData); + logger.info("微信会员卡通知---解密结果{}"+result.toString()); + + WxMemberCard memberCard = new WxMemberCard(); + memberCard.setTenantId(tenantEntity.getTenantId()); + memberCard.setParentTenantId(tenantEntity.getParentTenantId()); + memberCard.updateFinalTenantId(tenantEntity); + memberCard.setCardId(result.getCardId()); + memberCard.setCardCode(result.getCode()); + memberCard.setOpenId(result.getOpenid()); + memberCard.setUnionId(result.getUnionid()); + if(WxPayConstant.MEMBER_CARD_ACTIVATE.equals(result.getEventType())){ + memberCard.setUserCardStatus(EnumMemberCardStatus.EFFECTIVE.getCode()); + memberCard.setCreateDate(sdf.parse(result.getEventTime())); + memberCard.setActivateScene(EnumMemberCardActivateScene.getEnum(result.getActivateScene()).getCode()); +// memberCard.setOuterStr(result.getOuterStr()); + wxMemberCardService.saveorupdateByCode(memberCard); + + wxMemberCardService.sendSyncMemberCardMsg(tenantEntity,memberCard.getCardId(),memberCard.getCardCode()); + resultMap.put("code","SUCCESS"); + return resultMap; + }else if(WxPayConstant.USER_VIEW_MEMBERCARD.equals(result.getEventType())){ + resultMap.put("code","SUCCESS"); + return resultMap; + }else if(WxPayConstant.USER_DELETE_MEMBERCARD.equals(result.getEventType())){ + memberCard.setUpdateDate(sdf.parse(result.getEventTime())); + memberCard.setUserCardStatus(EnumMemberCardStatus.DELETE.getCode()); + wxMemberCardService.delUserCardStatusByCode(memberCard); + + wxMemberCardService.sendSyncMemberCardMsg(tenantEntity,memberCard.getCardId(),memberCard.getCardCode()); + resultMap.put("code","SUCCESS"); + return resultMap; + }else if(WxPayConstant.USER_MODIFY_INFORMATION.equals(result.getEventType())){ + + wxMemberCardService.sendSyncMemberCardMsg(tenantEntity,memberCard.getCardId(),memberCard.getCardCode()); + resultMap.put("code","SUCCESS"); + return resultMap; + } + resultMap.put("code","FAIL"); + return resultMap; + } catch (WxPayException e) { + e.printStackTrace(); + logger.error("微信会员卡通知---"+e.getCustomErrorMsg()); + resultMap.put("code","FAIL"); + return resultMap; + } catch (ParseException e) { + e.printStackTrace(); + logger.error("微信会员卡通知---时间转换异常"); + resultMap.put("code","FAIL"); + return resultMap; + } catch(MallinkException e){ + logger.error("微信会员卡通知---"+e.getMessage()); + resultMap.put("code","FAIL"); + return resultMap; + }catch (Exception e){ + e.printStackTrace(); + logger.error("微信会员卡通知---其他异常"); + resultMap.put("code","FAIL"); + return resultMap; + } + } + + + private String getBody(HttpServletRequest request) throws IOException { + StringBuilder stringBuilder = new StringBuilder(); + BufferedReader bufferedReader = null; + try { + InputStream inputStream = request.getInputStream(); + if (inputStream != null) { + bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"utf-8")); + char[] charBuffer = new char[1024]; + int bytesRead = -1; + while ((bytesRead = bufferedReader.read(charBuffer)) > 0) { + stringBuilder.append(charBuffer, 0, bytesRead); + } + } else { + stringBuilder.append(""); + } + } catch ( + IOException ex) { + throw ex; + } finally { + if (bufferedReader != null) { + try { + bufferedReader.close(); + } catch (IOException ex) { + throw ex; + } + } + } + return stringBuilder.toString(); + } + + +// @PostMapping(value = "/test") +// @ResponseBody +// public void createOrdertests(){ +// +//// SignatureHeader(timeStamp=1627973486, nonce=pKGTNqxLaljN9jB5DprFagpmggWIhyBA, signed=gDmv1WDCGdlIyyW9bGDJuztWNritufRsiYt5bPfudpwvPA9hHWM47eFeZYzHpgxttnxyAL10XYbPK8SngtCHSeOghS4gXHuAQoWv3RlEkTHhIcf1eg+uD4zd4PsNqJ35YlW6RyYkjv/Y8didERnkvXZPvDrzP5DKsurLXvMJBs7mzVzt6QIgZa2DuVjnhmSk4aC3wPs7lqm8ElWsEblCr8k9RSrP92PFGSTnU5owAUrTMTL1kqfwzavzwVJxafAGkXxrHbybpP5qZ5DjttAhDkRI3L2xQfPvHAFyibnwk2N9KYC9H6AOuZIuku/9eRlan+ZMDln63gaPFfvl1OB7hg==, serialNo=76EEF0C28D079D9CED85C67237F173FF825CFAE7) +// +// SignatureHeader header = new SignatureHeader(); +// header.setSerialNo("76EEF0C28D079D9CED85C67237F173FF825CFAE7"); +// header.setTimeStamp("1627973486"); +// header.setNonce("pKGTNqxLaljN9jB5DprFagpmggWIhyBA"); +// header.setSigned("gDmv1WDCGdlIyyW9bGDJuztWNritufRsiYt5bPfudpwvPA9hHWM47eFeZYzHpgxttnxyAL10XYbPK8SngtCHSeOghS4gXHuAQoWv3RlEkTHhIcf1eg+uD4zd4PsNqJ35YlW6RyYkjv/Y8didERnkvXZPvDrzP5DKsurLXvMJBs7mzVzt6QIgZa2DuVjnhmSk4aC3wPs7lqm8ElWsEblCr8k9RSrP92PFGSTnU5owAUrTMTL1kqfwzavzwVJxafAGkXxrHbybpP5qZ5DjttAhDkRI3L2xQfPvHAFyibnwk2N9KYC9H6AOuZIuku/9eRlan+ZMDln63gaPFfvl1OB7hg=="); +// +// +// logger.info("微信商圈支付通知---header{}"+header.toString()); +// String tenantId = "1019"; +// TenantEntity tenantEntity = wxMallService.getByTenantId(tenantId); +// +// try { +// // {"id":"fe9f7590-89d3-588a-a5a3-f3ca5cb6e806","create_time":"2021-08-03T14:51:23+08:00","resource_type":"encrypt-resource","event_type":"MALL_TRANSACTION.SUCCESS","summary":"支付成功","resource":{"original_type":"mall_transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"T9VctVJB+7Zs0dhZnejwXNOvxHM/CfPt4S4C4cAtvSYsO2++8eVMN3dZky1/TLVg/mJtFBVHU4IiPavZMV+tULw3yKBs/JomTBHblb8De8GKU2/m03/wD3rxufdYejTnxXQWsdAEaWduM/zWCCtNIblayVE8Bz6p0cZtutk6jknYaDQk13sNGh1U12lpcElGf3i8LxLG0jWp+DBp2seOizBsjB8Cky/xEMjmd9OzbtrCd7K22ZtGv7gyA2C/9NY5gFT9tlcGFaD+BvOx69o7Sw1uHZ5IaXHTpI9SQlHCWCs8tGZtMZrlzgFLa/DI+TFkh//WYNcZRomhBydAbE4xQJqSWB5/81Rqa4gYT85YJPhgXRKGl+F0S/6jCYuL5cJpqUCojNz+g16znI8=","associated_data":"mall_transaction","nonce":"0GqZRhyTkcHG"}} +// +// String body = "{\"id\":\"fe9f7590-89d3-588a-a5a3-f3ca5cb6e806\",\"create_time\":\"2021-08-03T14:51:23+08:00\",\"resource_type\":\"encrypt-resource\",\"event_type\":\"MALL_TRANSACTION.SUCCESS\",\"summary\":\"支付成功\",\"resource\":{\"original_type\":\"mall_transaction\",\"algorithm\":\"AEAD_AES_256_GCM\",\"ciphertext\":\"T9VctVJB+7Zs0dhZnejwXNOvxHM/CfPt4S4C4cAtvSYsO2++8eVMN3dZky1/TLVg/mJtFBVHU4IiPavZMV+tULw3yKBs/JomTBHblb8De8GKU2/m03/wD3rxufdYejTnxXQWsdAEaWduM/zWCCtNIblayVE8Bz6p0cZtutk6jknYaDQk13sNGh1U12lpcElGf3i8LxLG0jWp+DBp2seOizBsjB8Cky/xEMjmd9OzbtrCd7K22ZtGv7gyA2C/9NY5gFT9tlcGFaD+BvOx69o7Sw1uHZ5IaXHTpI9SQlHCWCs8tGZtMZrlzgFLa/DI+TFkh//WYNcZRomhBydAbE4xQJqSWB5/81Rqa4gYT85YJPhgXRKGl+F0S/6jCYuL5cJpqUCojNz+g16znI8=\",\"associated_data\":\"mall_transaction\",\"nonce\":\"0GqZRhyTkcHG\"}}"; +// logger.info("微信商圈支付通知---body{}"+body); +// WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantId); +// +// //----------------签名验证----------- +//// BusinessCircleNotifyData notifyData = verifySignature(request,wxPayService); +// BusinessCircleNotifyData notifyData = wxPayService.getBusinessCircleService().parseNotifyData(body, header); +// logger.info("微信商圈通知---回调通知对象{}"+notifyData.toString()); +// +// WxBusinessCircleOrder wxBusinessCircleOrder = new WxBusinessCircleOrder(); +// wxBusinessCircleOrder.updateTenantInfo(tenantEntity); +// wxBusinessCircleOrder.setNoticeId(notifyData.getId()); +// wxBusinessCircleOrder.setNoticeCreateTime(sdf.parse(notifyData.getCreateTime())); +// wxBusinessCircleOrder.setNoticeEventType(notifyData.getEventType()); +// wxBusinessCircleOrder.setSummary(notifyData.getSummary()); +// +// //解密 +// if(WxPayConstant.NOTICE_EVENT_TYPE.equals(notifyData.getEventType())){ +// PaidResult result = wxPayService.getBusinessCircleService().decryptPaidNotifyDataResource(notifyData); +// logger.info("微信商圈支付成功通知---解密结果{}"+result.toString()); +// +// wxBusinessCircleOrder.setWxMchid(result.getMchid()); +// wxBusinessCircleOrder.setWxMerchantName(result.getMerchantName()); +// wxBusinessCircleOrder.setWxShopName(result.getShopName()); +// wxBusinessCircleOrder.setWxShopNumber(result.getShopNumber()); +// wxBusinessCircleOrder.setAppid(result.getAppid()); +// wxBusinessCircleOrder.setOpenid(result.getOpenid()); +// wxBusinessCircleOrder.setTimeEnd(sdf.parse(result.getTimeEnd())); +// wxBusinessCircleOrder.setAmount(result.getAmount()); +// wxBusinessCircleOrder.setPayAmount(result.getAmount()); +// wxBusinessCircleOrder.setTransactionId(result.getTransactionId()); +// wxBusinessCircleOrder.setCommitTag(result.getCommitTag()); +// +// +// +// }else if(WxPayConstant.REFUND_EVENT_TYPE.equals(notifyData.getEventType())){ +// RefundResult result = wxPayService.getBusinessCircleService().decryptRefundNotifyDataResource(notifyData); +// logger.info("微信商圈退款成功通知---解密结果{}"+result.toString()); +// +// wxBusinessCircleOrder.setWxMchid(result.getMchid()); +// wxBusinessCircleOrder.setWxMerchantName(result.getMerchantName()); +// wxBusinessCircleOrder.setWxShopName(result.getShopName()); +// wxBusinessCircleOrder.setWxShopNumber(result.getShopNumber()); +// wxBusinessCircleOrder.setAppid(result.getAppid()); +// wxBusinessCircleOrder.setOpenid(result.getOpenid()); +// wxBusinessCircleOrder.setTimeEnd(sdf.parse(result.getRefundTime())); +// wxBusinessCircleOrder.setAmount(result.getPayAmount()); +// wxBusinessCircleOrder.setPayAmount(result.getPayAmount()); +// wxBusinessCircleOrder.setTransactionId(result.getTransactionId()); +// +// wxBusinessCircleOrder.setRefundAmount(result.getRefundAmount()); +// wxBusinessCircleOrder.setRefundId(result.getRefundId()); +// +// +// } +// +// } catch (WxPayException e) { +// e.printStackTrace(); +// logger.error("微信商圈通知---"+e.getCustomErrorMsg()); +// +// } catch (ParseException e) { +// e.printStackTrace(); +// logger.error("微信商圈通知---时间转换异常"); +// +// } catch(MallinkException e){ +// logger.error("微信商圈通知---"+e.getMessage()); +// +// }catch (Exception e){ +// e.printStackTrace(); +// logger.error("微信商圈通知---其他异常"); +// +// } +// } + +} diff --git a/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java b/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java index c4b7fe85f..156e212ab 100644 --- a/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java +++ b/mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java @@ -31,6 +31,16 @@ public class MqBaseConsumer { @Autowired private SendWeappUniformMsgServiceImpl sendWeappUniformMsgService; @Autowired + private AfterAddCreditMsgServiceImpl afterAddCreditMsgService; + @Autowired + private AfterAddScoreMsgServiceImpl afterAddScoreMsgService; + @Autowired + private AfterCarInOutMsgServiceImpl afterCarInOutMsgService; + @Autowired + private AfterBusinessCreditMsgServiceImpl afterBusinessCreditMsgService; + @Autowired + private SyncMemberCardMsgServiceImpl syncMemberCardMsgService; + @Autowired private FmInsideOrderSuccessMsgServiceImpl fmInsideOrderSuccessMsgService; @Autowired private FmInsideCouponVerifyMsgServiceImpl fmInsideCouponVerifyMsgService; @@ -79,40 +89,74 @@ public class MqBaseConsumer { //短信 WxMsgRecord msg = (WxMsgRecord)JsonUtil.readValue(message,WxMsgRecord.class); sendSmsService.send(msg); - } else if(EnumMsgRecordType.SMS_CALLBACK.getCode().equals(baseMsg.getMsgType())){ + } + else if(EnumMsgRecordType.SMS_CALLBACK.getCode().equals(baseMsg.getMsgType())){ //业务短信 WxMsg msg = (WxMsg)JsonUtil.readValue(message,WxMsg.class); sendCallBackSmsService.send(msg); - } else if(EnumMsgRecordType.EMAIL.getCode().equals(baseMsg.getMsgType())){ + } + else if(EnumMsgRecordType.EMAIL.getCode().equals(baseMsg.getMsgType())){ //邮件 MailMsg msg = (MailMsg)JsonUtil.readValue(message,MailMsg.class); sendEmailService.send(msg); // } else if(EnumMsgRecordType.SMART_APP.getCode().equals(baseMsg.getMsgType())){ - } else if(EnumMsgRecordType.SMART_APP_TO.getCode().equals(baseMsg.getMsgType())){ + } + else if(EnumMsgRecordType.SMART_APP_TO.getCode().equals(baseMsg.getMsgType())){ //微信小程序-订阅消息 SmartAppMsg msg = (SmartAppMsg)JsonUtil.readValue(message,SmartAppMsg.class); sendSmartAppMsgService.send(msg); - } else if(EnumMsgRecordType.PUBLIC.getCode().equals(baseMsg.getMsgType())) { + } + else if(EnumMsgRecordType.PUBLIC.getCode().equals(baseMsg.getMsgType())) { //公众号-模板消息 MpAppMsg msg = (MpAppMsg)JsonUtil.readValue(message,MpAppMsg.class); sendMpMsgService.send(msg); - } else if(EnumMsgRecordType.SMART_APP_UNIFORM.getCode().equals(baseMsg.getMsgType())) { + } + else if(EnumMsgRecordType.SMART_APP_UNIFORM.getCode().equals(baseMsg.getMsgType())) { //微信小程序-统一消息 AppUniformMsg msg = (AppUniformMsg)JsonUtil.readValue(message,AppUniformMsg.class); sendWeappUniformMsgService.send(msg); - } else if(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode().equals(baseMsg.getMsgType())) { + } + else if(EnumMsgRecordType.SYNC_MEMBER_CARD.getCode().equals(baseMsg.getMsgType())) { + //微信商圈同步会员 + SyncMemberCardMsg msg = (SyncMemberCardMsg)JsonUtil.readValue(message,SyncMemberCardMsg.class); + syncMemberCardMsgService.send(msg); + } + else if(EnumMsgRecordType.AFTER_ADD_CREDIT.getCode().equals(baseMsg.getMsgType())) { + //积分变更后 + AfterAddCreditMsg msg = (AfterAddCreditMsg)JsonUtil.readValue(message,AfterAddCreditMsg.class); + afterAddCreditMsgService.send(msg); + } + else if(EnumMsgRecordType.AFTER_ADD_SCORE.getCode().equals(baseMsg.getMsgType())) { + //成长值变更后 + AfterAddScoreMsg msg = (AfterAddScoreMsg)JsonUtil.readValue(message,AfterAddScoreMsg.class); + afterAddScoreMsgService.send(msg); + } + else if(EnumMsgRecordType.AFTER_CAR_IN_OR_OUT.getCode().equals(baseMsg.getMsgType())) { + //车辆入场,出场后 + AfterCarInOutMsg msg = (AfterCarInOutMsg)JsonUtil.readValue(message,AfterCarInOutMsg.class); + afterCarInOutMsgService.send(msg); + } + else if(EnumMsgRecordType.AFTER_BUSINESS_CREDIT.getCode().equals(baseMsg.getMsgType())) { + //商圈积分后 + AfterBusinessCreditMsg msg = (AfterBusinessCreditMsg)JsonUtil.readValue(message,AfterBusinessCreditMsg.class); + afterBusinessCreditMsgService.send(msg); + } + else if(EnumMsgRecordType.INSIDE_ORDER_SUCCESS.getCode().equals(baseMsg.getMsgType())) { // 内部消息 - 下订单成功 FmInsideOrderSuccessMsg msg = (FmInsideOrderSuccessMsg)JsonUtil.readValue(message,FmInsideOrderSuccessMsg.class); fmInsideOrderSuccessMsgService.send(msg); - } else if(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode().equals(baseMsg.getMsgType())) { + } + else if(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode().equals(baseMsg.getMsgType())) { // 内部消息 - 券核销 FmInsideCouponVerifyMsg msg = (FmInsideCouponVerifyMsg)JsonUtil.readValue(message,FmInsideCouponVerifyMsg.class); fmInsideCouponVerifyMsgService.send(msg); - } else if(EnumMsgRecordType.INSIDE_ORDER_REFUND.getCode().equals(baseMsg.getMsgType())){ + } + else if(EnumMsgRecordType.INSIDE_ORDER_REFUND.getCode().equals(baseMsg.getMsgType())){ //内部消息 - 退款申请成功 FmInsideOrderRefundMsg msg = (FmInsideOrderRefundMsg) JsonUtil.readValue(message,FmInsideOrderRefundMsg.class); fmInsideOrderRefundMsgService.send(msg); - } else if(EnumMsgRecordType.INSIDE_C_LOGIN.getCode().equals(baseMsg.getMsgType())) { + } + else if(EnumMsgRecordType.INSIDE_C_LOGIN.getCode().equals(baseMsg.getMsgType())) { // 内部消息 - c端登录 FmInsideCLoginMsg msg = (FmInsideCLoginMsg)JsonUtil.readValue(message,FmInsideCLoginMsg.class); fmInsideCLoginMsgService.send(msg); diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 6d922dee5..5e52e8687 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -2467,6 +2467,7 @@ public class PosServiceImpl implements PosService { order.setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); order.setPayVersion(EnumPayVersion.NEU_POS_V1.getCode()); order.setProductId(merchantBUser.getId()); + order.setProductName(EnumOrderType.POSPAY.getMessage()); order.setCUserId(memId); order.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); order.setPayment(posAmount); diff --git a/mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java b/mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java index 39a71a576..96109704d 100644 --- a/mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java +++ b/mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java @@ -68,7 +68,7 @@ public class UserBasicInfoController extends BaseController { TenantEntity tenantEntity = getTenantInfo(); - WxCUserBasicInfo userBasicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone,nickName,sex,avatarUrl); + WxCUserBasicInfo userBasicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone,nickName,null,sex,avatarUrl); this.setLevel(userBasicInfo,tenantEntity); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java index be1d7bf80..3e36eddfb 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java @@ -45,33 +45,15 @@ public class TtMerchantReciverSchedule { @Scheduled(cron = "0 */30 * * * ?") // @Scheduled(cron = "0 */5 * * * *?") //测试五分钟执行 public void updateMerchantReciverSchedule() { - WxMall mallQ = new WxMall(); - mallQ.setSaleType(EnumSaleType.TT_ALL_ROUND.getCode()); - List mallList = wxMallService.findList(mallQ); - if(mallList == null || mallList.isEmpty()){ - return; - } - List tenantIds = mallList.stream().map(m -> m.getTenantId()).collect(Collectors.toList()); + List ttAppInfos = getTTAppInfos(); + + List tenantIds = ttAppInfos.stream().map(appinfo -> appinfo.getTenantId()).collect(Collectors.toList()); List merchants = wxMerchantMapper.findByTenantIds(tenantIds); if(merchants == null || merchants.isEmpty()){ return; } - Map appIdMap = new HashMap<>(); - Map payAccountKeyMap = new HashMap<>(); - WxAppinfo appQ = new WxAppinfo(); - appQ.setType(EnumAppType.C.getCode()); - appQ.setPlat(EnumPayWay.PAY_WAY_TT.getPlat().getCode()); - List wxAppinfoList = wxAppinfoService.getList(appQ); - for (WxAppinfo wxAppinfo:wxAppinfoList) { - appIdMap.put(wxAppinfo.getTenantId(),wxAppinfo.getAppId()); - WxPayAccount wxPayAccount = payAccountService.getById(wxAppinfo.getPayId()); - if(wxPayAccount != null){ - payAccountKeyMap.put(wxAppinfo.getTenantId(),wxPayAccount.getApiKey()); - } - } - for (WxMerchant m:merchants) { // try { // wxProfitSharingReceiverService.updateTtReceiver(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId())); @@ -80,7 +62,7 @@ public class TtMerchantReciverSchedule { // logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); // } try { - wxProfitSharingReceiverService.updateTtReceiverIsUse(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId())); + wxProfitSharingReceiverService.updateTtReceiverIsUse(m); } catch (Exception e) { e.printStackTrace(); logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); @@ -88,4 +70,12 @@ public class TtMerchantReciverSchedule { } } + private List getTTAppInfos() { + WxAppinfo appinfo =new WxAppinfo(); + appinfo.setPlat(EnumAppPlat.TOUTIAO.getCode()); + appinfo.setType(EnumAppType.C.getCode()); + appinfo.setEnable(EnumEnableType.Enable.getCode()); + return wxAppinfoService.getList(appinfo); + } + } \ No newline at end of file diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/TtOrderQueryCpsSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/TtOrderQueryCpsSchedule.java index 2fb3a5b63..db839623e 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/TtOrderQueryCpsSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/TtOrderQueryCpsSchedule.java @@ -46,10 +46,8 @@ public class TtOrderQueryCpsSchedule { @Scheduled(cron = "0 5 */1 * * ?") // @Scheduled(cron = "0 0/5 * * * ?") public void OrderPushErrorTaskSchedule() { - WxAppinfo appQ = new WxAppinfo(); - appQ.setType(EnumAppType.C.getCode()); - appQ.setPlat(EnumPayWay.PAY_WAY_TT.getPlat().getCode()); - List wxAppinfoList = wxAppinfoService.getList(appQ); + List wxAppinfoList = this.getTTAppInfos(); + for (WxAppinfo appinfo:wxAppinfoList) { try{ WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); @@ -117,4 +115,12 @@ public class TtOrderQueryCpsSchedule { } + private List getTTAppInfos() { + WxAppinfo appinfo =new WxAppinfo(); + appinfo.setPlat(EnumAppPlat.TOUTIAO.getCode()); + appinfo.setType(EnumAppType.C.getCode()); + appinfo.setEnable(EnumEnableType.Enable.getCode()); + return wxAppinfoService.getList(appinfo); + } + } \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java index 1f6881f30..edf813cbd 100644 --- a/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java +++ b/mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java @@ -88,6 +88,13 @@ public class BaseMyBatisConfiguration { ttCUserSharding.setCount(100); ttCUserSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(ttCUserSharding); + + ShardingSphere wxMemberCardSharding = new ShardingSphere(); + wxMemberCardSharding.setColumn("final_tenant_id"); + wxMemberCardSharding.setTableName("wx_member_card"); + wxMemberCardSharding.setCount(100); + wxMemberCardSharding.setRule(EnumShardingRule.HASH.getCode()); + shardingList.add(wxMemberCardSharding); ShardingSphere basicInfoSharding = new ShardingSphere(); basicInfoSharding.setColumn("final_tenant_id"); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java b/mallinkService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java index f485fa082..a0f3efece 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java @@ -104,7 +104,7 @@ public class BusinessCircleBase extends TenantEntity { private Integer increasedPoints; @Excel(name = "积分更新时间", width = 20, orderNum = "15", format = "yyyy-MM-dd HH:mm:ss") - @io.swagger.annotations.ApiModelProperty(value="积分更新时间(新增)",name="increasedPoints") + @io.swagger.annotations.ApiModelProperty(value="积分更新时间(新增)",name="pointsUpdateTime") private Date pointsUpdateTime; @Excel(name = "是否退款", width = 20, orderNum = "6", replace = {"退款订单_1", "付款订单_0"}) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java index 23d4898e8..809377ba9 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java @@ -19,7 +19,7 @@ public class TtMerchantPoi extends TenantEntity { protected Long id;//merchant_id - @io.swagger.annotations.ApiModelProperty(value=" merchant_id",name="supplierExtId") + @io.swagger.annotations.ApiModelProperty(value=" 暂定merchant_id",name="supplierExtId") private String supplierExtId; @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/TtPoiTakeRate.java b/mallinkService/src/main/java/com/iformall/domain/po/TtPoiTakeRate.java index c1f26127e..8793ab707 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/TtPoiTakeRate.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/TtPoiTakeRate.java @@ -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.TenantEntity; import lombok.Data; @@ -7,6 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import java.util.Date; +import java.util.List; @TableName(value = "tt_poi_take_rate") @Data @@ -25,12 +27,18 @@ public class TtPoiTakeRate extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="",name="name") private String name; + @io.swagger.annotations.ApiModelProperty(value="计划联系人手机号",name="merchantPhone") + private String merchantPhone; + @io.swagger.annotations.ApiModelProperty(value="EnumCpsPlanContentType 场景",name="contentType") private Integer contentType; @io.swagger.annotations.ApiModelProperty(value="抖音ID",name="douyinId") private String douyinId; + @io.swagger.annotations.ApiModelProperty(value="达人履约状态",name="douyinIdStatus") + private String douyinIdStatus; + @io.swagger.annotations.ApiModelProperty(value="分佣率",name="takeRate") private Integer takeRate; @@ -39,10 +47,18 @@ public class TtPoiTakeRate extends TenantEntity { private Date startTime; private Date endTime; + @io.swagger.annotations.ApiModelProperty(value="佣金有效期,单位是秒",name="commissionDuration") + private Long commissionDuration; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; + @TableField(exist = false) + private List douyinIdList; + + @TableField(exist = false) + private WxCoupon coupon; + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxActivityJoin.java b/mallinkService/src/main/java/com/iformall/domain/po/WxActivityJoin.java index 4fdd980c7..85a79360f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxActivityJoin.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxActivityJoin.java @@ -1,12 +1,15 @@ package com.iformall.domain.po; import cn.afterturn.easypoi.excel.annotation.Excel; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.iformall.domain.po.base.TenantEntity; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import org.apache.commons.lang3.StringUtils; import java.util.Date; @@ -26,11 +29,11 @@ public class WxActivityJoin extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "活动ID", name = "activityId") private Long activityId; - @Excel(name = "姓名", width = 10, orderNum = "1") + @Excel(name = "姓名", width = 15, orderNum = "1") @io.swagger.annotations.ApiModelProperty(value = "姓名", name = "name") private String name; - @Excel(name = "电话号码", width = 10, orderNum = "2") + @Excel(name = "电话号码", width = 20, orderNum = "2") @io.swagger.annotations.ApiModelProperty(value = "手机", name = "phone") private String phone; @@ -46,35 +49,52 @@ public class WxActivityJoin extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "性别0保密1男2女", name = "sex") private Integer sex; - @Excel(name = "生日", format = "yyyy-MM-dd", width = 10, orderNum = "6") + @Excel(name = "生日", format = "yyyy-MM-dd", width = 20, orderNum = "6") @io.swagger.annotations.ApiModelProperty(value = "生日", name = "birthday") private Date birthday; - @Excel(name = "微信昵称", width = 10, orderNum = "7") + @Excel(name = "微信昵称", width = 15, orderNum = "7") @io.swagger.annotations.ApiModelProperty(value = "昵称", name = "nickName") private String nickName; - @Excel(name = "报名时间", format = "yyyy-MM-dd HH:mm:ss", width = 10, orderNum = "8") + @Excel(name = "报名时间", format = "yyyy-MM-dd HH:mm:ss", width = 30, orderNum = "9") @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createTime") private Date createTime; - @Excel(name = "活动签到", replace = {"未签到_0", "已签到_1"}, width = 10, orderNum = "9") + @Excel(name = "活动签到", replace = {"未签到_0", "已签到_1"}, width = 10, orderNum = "10") @io.swagger.annotations.ApiModelProperty(value = "签到状态1签到0未签到", name = "signIn") private Integer signIn; - @Excel(name = "报名状态", replace = {"未确认_0", "已确认_1", "报名失败_2", "活动过期_3"}, width = 10, orderNum = "10") + @Excel(name = "报名状态", replace = {"未确认_0", "已确认_1", "报名失败_2", "活动过期_3"}, width = 11, orderNum = "10") @io.swagger.annotations.ApiModelProperty(value = "状态0未确认-报名中1确认-报名成功2取消-报名失败3过期", name = "status") private Integer status; - @Excel(name = "调查问券", width = 10, orderNum = "11") + @Excel(name = "调查问券", width = 50, orderNum = "12") @io.swagger.annotations.ApiModelProperty(value = "调查问券", name = "answer") private String answer; - @io.swagger.annotations.ApiModelProperty(value = "地址", name = "address") private String address; + @TableField(exist = false) + @Excel(name = "地址", width = 20, orderNum = "8") + @io.swagger.annotations.ApiModelProperty(value = "地址", name = "addressStr") + private String addressStr; + + public String getAddressStr(){ + if(StringUtils.isNotBlank(this.address)){ + try{ + JSONObject addressObject = JSON.parseObject(this.address); + if(addressObject != null && !addressObject.isEmpty()){ + String string = addressObject.getString("address"); + this.addressStr = string; + } + }catch(Exception e){} + } + return this.addressStr; + } + @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateTime") private Date updateTime; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java index 7e95e5271..95b7a9a0f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUser.java @@ -25,6 +25,15 @@ public class WxCUser extends CUser { appPlat = EnumAppPlat.WX; } + @io.swagger.annotations.ApiModelProperty(value="EnumBusinessCircleAuthorizeState 授权商圈快速积分状态",name="authorizeState") + private Integer authorizeState; + + @io.swagger.annotations.ApiModelProperty(value="授权时间",name="authorizeTime") + private Date authorizeTime; + + @io.swagger.annotations.ApiModelProperty(value="取消授权时间",name="deauthorizeTime") + private Date deauthorizeTime; + public String createToken(Date currentDate,String tenantId) { if(StringUtils.isBlank(tenantId)){ tenantId = "1"; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 2229f94c6..5b79df666 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -237,7 +237,7 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { return Objects.hash(this.phone); } - public void undateFinalTenantId(TenantEntity tenantEntity){ + public void updateFinalTenantId(TenantEntity tenantEntity){ // setTenantId(tenantEntity.getTenantId()); // setParentTenantId(tenantEntity.getParentTenantId()); setFinalTenantId(tenantEntity.getTenantId()); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 76dd7bc43..0e380a147 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -252,6 +252,9 @@ public class WxCoupon extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="直连收款门店",name="makeMerchantId") private Long makeMerchantId; + @io.swagger.annotations.ApiModelProperty(value="第三方商品Id",name="goodsId") + private String goodsId; + @io.swagger.annotations.ApiModelProperty(value="EnumTtProductType",name="productType") private Integer productType; @@ -448,94 +451,6 @@ public class WxCoupon extends TenantEntity { return false; } - public boolean validDate(boolean isShare,Date curr) { - if(this.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ - return true; - } - if(isShare && this.getSalePrice() > 0 && !this.checkIsCard()){ - Date valid_date = getOuterRealValidDate(curr); - Date limit_date = DateUtils.getTimeAfterDays(Constant.WX_LIMIT_DAYS, curr); - - if (valid_date.after(limit_date)) { - return false; - } - } - return true; - - -// Map retMap = calcuteValidDate(isShare, hasShareAmount, curr); -// int success = (int) retMap.get("success"); -// if (success > 0) { -// return true; -// }else { -// return false; -// } - } - - public Date getRealValidDate(Date curr) { - //券都上架卖出去了还判断个什么有效期 -// Map retMap = calcuteValidDate(isShare,hasShareAmount,curr); -// return (Date) retMap.get("realDate"); - return getOuterRealValidDate(curr); - } - -// private Map calcuteValidDate(boolean isShare,boolean hasShareAmount,Date curr) { -// if(this.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ -// Map retMap = new HashMap(); -// retMap.put("success", 1); -// retMap.put("realDate", getOuterRealValidDate(new Date())); -// return retMap; -// } -// int limit_days = Constant.WX_LIMIT_DAYS; -// int success = 1; -// Date valid_date = null; -// if (this.getValidType().equals(EnumValidStatus.VALID_RANGE.getCode()) || -// this.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { -// -// if( this.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){ -// valid_date = this.getPickEndDate(); -// }else{ -// valid_date = this.getValidEndDate(); -// } -// if (this.getSalePrice() > 0 && !this.checkIsCard()) { -// if (hasShareAmount) { -// if (isShare) { -// // 分账有价券核销有效期不能大于分账过期时间 -// Date limit_date = DateUtils.getTimeAfterDays(limit_days, curr); -// if (valid_date.after(limit_date)) { -// valid_date = limit_date; -// success = 0; -// } -// } -// } -// } -// } else { -// if (this.getSalePrice() > 0 && !this.checkIsCard()) { -// if (hasShareAmount) { -// // 分账有价券核销有效期不能大于分账过期时间 -// if (isShare) { -// if (this.getValidDays() < Constant.WX_LIMIT_DAYS) { -// limit_days = this.getValidDays(); -// }else { -// success = 0; -// } -// }else { -// limit_days = this.getValidDays(); -// } -// }else{ -// limit_days = this.getValidDays(); -// } -// } else { -// limit_days = this.getValidDays(); -// } -// valid_date = DateUtils.getTimeAfterDays(limit_days, curr); -// } -// Map retMap = new HashMap(); -// retMap.put("success", success); -// retMap.put("realDate", valid_date); -// return retMap; -// } - public Date getOuterRealValidDate(Date curr) { Date valid_date = null; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java index 14fa50fd6..ea03dff38 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java @@ -41,6 +41,8 @@ public class WxCouponChannel extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="卡券id",name="couponId") private Long couponId; + @io.swagger.annotations.ApiModelProperty(value="直连收款门店",name="makeMerchantId") + private Long makeMerchantId; @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") private Integer type; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMemberCard.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMemberCard.java new file mode 100644 index 000000000..0f9c54c85 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMemberCard.java @@ -0,0 +1,100 @@ +package com.iformall.domain.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.base.TenantEntityWithoutFinalTenantId; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; + +@TableName(value = "wx_member_card") +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class WxMemberCard extends TenantEntityWithoutFinalTenantId { + + @io.swagger.annotations.ApiModelProperty(value="如果是集团版的,存集团版的tenantId,如果是商场,则存商场",name="sex") + private String finalTenantId; + + protected Long id; + + @io.swagger.annotations.ApiModelProperty(value="会员卡ID",name="cardId") + private String cardId; + + @io.swagger.annotations.ApiModelProperty(value="会员卡code",name="cardCode") + private String cardCode; + + @io.swagger.annotations.ApiModelProperty(value="EnumMemberCardActivateScene 开卡场景",name="activateScene") + private Integer activateScene; + + @io.swagger.annotations.ApiModelProperty(value="自定义场景",name="outerStr") + private Integer outerStr; + + @io.swagger.annotations.ApiModelProperty(value="",name="openId") + private String openId; + + @io.swagger.annotations.ApiModelProperty(value="",name="unionId") + private String unionId; + + @io.swagger.annotations.ApiModelProperty(value="展示会员编号",name="membershipNumber") + private String membershipNumber; + + @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") + private String level; + + @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickname") + private String nickname; + + @io.swagger.annotations.ApiModelProperty(value="头像",name="headImageUrl") + private String headImageUrl; + + @io.swagger.annotations.ApiModelProperty(value="会员卡背景",name="backgroundPictureUrl") + private String backgroundPictureUrl; + + @io.swagger.annotations.ApiModelProperty(value="用户储值的最新余额,单位分",name="balance") + private Integer balance; + + @io.swagger.annotations.ApiModelProperty(value="EnumMemberCardStatus 用户会员卡状态",name="userCardStatus") + private Integer userCardStatus; + + @io.swagger.annotations.ApiModelProperty(value="用户开卡时填写的个人信息{}",name="userInformation") + private String userInformation; + + @io.swagger.annotations.ApiModelProperty(value="用户当前的积分值",name="bonusValue") + private Integer bonusValue; + + @io.swagger.annotations.ApiModelProperty(value="用户当前的会员服务项内容[]",name="serviceModules") + private String serviceModules; + + @io.swagger.annotations.ApiModelProperty(value="用户会员卡详情页会员优惠栏目中的会员专享价文案",name="memberPriceWord") + private String memberPriceWord; + + @io.swagger.annotations.ApiModelProperty(value="发票栏跳转小程序的引导文案",name="fapiaoJumpWord") + private String fapiaoJumpWord; + + @io.swagger.annotations.ApiModelProperty(value="设置商家联系人员的名字、头像和联系方式[]",name="guide") + private String guide; + + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") + private Date updateDate; + + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") + private Date createDate; + + @io.swagger.annotations.ApiModelProperty(value="",name="cuserId") + private Long cuserId; + + @io.swagger.annotations.ApiModelProperty(value="",name="userId") + private Long userId; + + public void updateFinalTenantId(TenantEntity tenantEntity){ + setFinalTenantId(tenantEntity.getTenantId()); + if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ + setFinalTenantId(tenantEntity.getParentTenantId()); + } + } + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index 0b0553303..1b76d5037 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -7,13 +7,12 @@ import com.google.gson.JsonObject; import com.iformall.common.SortColumn; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxShopVo; -import com.iformall.enums.EnumBusiness; -import com.iformall.enums.EnumMerchantStatus; -import com.iformall.enums.EnumSubBusiness; +import com.iformall.enums.*; import com.iformall.utils.Constant; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; import java.util.Date; @@ -138,11 +137,15 @@ public class WxMerchant extends TenantEntity { @Excel(name = "管理员", width = 20, orderNum = "14") private String usersStr; - @Excel(name = "主谈人", width = 20, orderNum = "15") + @TableField(exist = false) + @Excel(name = "账户", width = 30, orderNum = "15") + private String receivers; + + @Excel(name = "主谈人", width = 20, orderNum = "16") @io.swagger.annotations.ApiModelProperty(value = "主谈人", name = "talkUserMain") private String talkUserMain; - @Excel(name = "辅谈人", width = 20, orderNum = "16") + @Excel(name = "辅谈人", width = 20, orderNum = "17") @io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux") private String talkUserAux; @@ -188,6 +191,39 @@ public class WxMerchant extends TenantEntity { } } + public String getReceivers() { + if (wxProfitSharingReceiver != null && wxProfitSharingReceiver.size() > 0) { + return String.join("\n", + wxProfitSharingReceiver.stream().map(r->{ + StringBuffer str = new StringBuffer(); + if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2.getCode().equals(r.getSharingType())){ + str.append("微信特约商户号:"); + }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode().equals(r.getSharingType())){ + str.append("抖音商户号:"); + }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_BANK.getCode().equals(r.getSharingType())){ + str.append("银行卡号:"); + }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode().equals(r.getSharingType())){ + if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode().equals(r.getReceiverType())){ + str.append("微信商户号:"); + }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().equals(r.getReceiverType())){ + str.append("个人微信号(微信已停用):"); + }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_OPENID.getCode().equals(r.getReceiverType())){ + str.append("OPENID:"); + } else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID.getCode().equals(r.getReceiverType())){ + str.append("OPENID:"); + } + } + str.append(r.getReceiverAccount()); + if(StringUtils.isNotBlank(r.getTrueName())){ + str.append("(").append(r.getTrueName()).append(")"); + } + return str.toString(); + }).collect(Collectors.toList())); + } else { + return null; + } + } + public String getBusinessName() { return EnumBusiness.getEnumMessage(businessId); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java b/mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java index a0e0675be..3eb694c87 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java @@ -57,6 +57,8 @@ public class WxOrder extends TenantEntity { private Long couponChannelId; @io.swagger.annotations.ApiModelProperty(value="产品ID(type-0:couponId, 1:buserId, 3:merchantId)",name="productId") private Long productId; + @io.swagger.annotations.ApiModelProperty(value="产品基本描述",name="productName") + private String productName; @io.swagger.annotations.ApiModelProperty(value="类型(0:券,1:B刷卡支付,2:C扫码支付,3:储值卡, 10:POS支付)",name="type") private Integer type; @io.swagger.annotations.ApiModelProperty(value = "支付渠道EnumPayWay", name = "payVendor") @@ -66,6 +68,9 @@ public class WxOrder extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType") private Integer paymentType; + @io.swagger.annotations.ApiModelProperty(value="直连收款门店",name="makeMerchantId") + private Long makeMerchantId; + @io.swagger.annotations.ApiModelProperty(value="支付金额(分):允许有负数,退款时为负值。",name="payment") private Integer payment; @io.swagger.annotations.ApiModelProperty(value="支付时间",name="paymentTime") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java index 4a2e21415..9d18c0054 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java @@ -22,26 +22,39 @@ public class WxPayAccount extends TenantEntity { private String subMchId; @io.swagger.annotations.ApiModelProperty(value="服务商模式下的子商户公众账号ID",name="subAppId") private String subAppId; + @io.swagger.annotations.ApiModelProperty(value="支付密钥",name="apiKey") private String apiKey; + @io.swagger.annotations.ApiModelProperty(value="平台证书本地存放位置",name="certPath") + private String certPath; @io.swagger.annotations.ApiModelProperty(value="商户支付密钥",name="merchantApiKey") private String merchantApiKey; + @io.swagger.annotations.ApiModelProperty(value="商户自己的证书",name="merchantCertPath") + private String merchantCertPath; + @io.swagger.annotations.ApiModelProperty(value="微信回调,支持3种回调,(1.url/pay 2.url/refund3.url/separate)",name="notifyUrl") private String notifyUrl; @io.swagger.annotations.ApiModelProperty(value="tt回调token",name="notifyToken") private String notifyToken; - @io.swagger.annotations.ApiModelProperty(value="平台证书本地存放位置",name="certPath") - private String certPath; - @io.swagger.annotations.ApiModelProperty(value="商户自己的证书",name="merchantCertPath") - private String merchantCertPath; - @io.swagger.annotations.ApiModelProperty(value="商户自己的证书密钥文件",name="merchantCertPemPath") - private String merchantCertPemPath; - @io.swagger.annotations.ApiModelProperty(value="商户自己的密钥文件",name="merchantKeyPath") - private String merchantKeyPath; + + @io.swagger.annotations.ApiModelProperty(value="平台apiV3秘钥",name="apiV3Key") + private String apiV3Key; + @io.swagger.annotations.ApiModelProperty(value="平台证书序列号",name="certSerialNo") + private String certSerialNo; + @io.swagger.annotations.ApiModelProperty(value="平台私钥文件",name="privateKeyPath") + private String privateKeyPath; + @io.swagger.annotations.ApiModelProperty(value="平台证书密钥文件",name="privateCertPemPath") + private String privateCertPemPath; + @io.swagger.annotations.ApiModelProperty(value="商户自己的apiv3密钥",name="merchantApiv3Key") private String merchantApiv3Key; - - + @io.swagger.annotations.ApiModelProperty(value="商户自己的平台证书序列号",name="merchantCertSerialNo") + private String merchantCertSerialNo; + @io.swagger.annotations.ApiModelProperty(value="商户自己的密钥文件",name="merchantKeyPath") + private String merchantKeyPath; + @io.swagger.annotations.ApiModelProperty(value="商户自己的证书密钥文件",name="merchantCertPemPath") + private String merchantCertPemPath; + @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") private Integer type; @io.swagger.annotations.ApiModelProperty(value="EnumPayMchType 0:总分1:直连",name="mchType") @@ -56,6 +69,7 @@ public class WxPayAccount extends TenantEntity { private Integer rate; @io.swagger.annotations.ApiModelProperty(value="实际手续费(万分之几,默认60)",name="realRate") private Integer realRate; + @io.swagger.annotations.ApiModelProperty(value="是否抽成",name="isCommission") private Integer isCommission; @io.swagger.annotations.ApiModelProperty(value="系统提点",name="systemRate") @@ -88,14 +102,15 @@ public class WxPayAccount extends TenantEntity { private String serviceId; @io.swagger.annotations.ApiModelProperty(value="微信支付分回调地址",name="payScoreNotifyUrl") private String payScoreNotifyUrl; - @io.swagger.annotations.ApiModelProperty(value="平台apiV3秘钥",name="apiV3Key") - private String apiV3Key; - @io.swagger.annotations.ApiModelProperty(value="平台证书序列号",name="certSerialNo") - private String certSerialNo; - @io.swagger.annotations.ApiModelProperty(value="平台私钥文件",name="privateKeyPath") - private String privateKeyPath; - @io.swagger.annotations.ApiModelProperty(value="平台证书密钥文件",name="privateCertPemPath") - private String privateCertPemPath; + + + @io.swagger.annotations.ApiModelProperty(value="商圈版本",name="businessType") + private Integer businessType; + @io.swagger.annotations.ApiModelProperty(value="品牌ID",name="brandid") + private String brandid; + @io.swagger.annotations.ApiModelProperty(value="商圈会员卡ID",name="cardId") + private String cardId; + // @io.swagger.annotations.ApiModelProperty(value="app平台 EnumAppPlat ",name="plat") // private Integer plat; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddCreditMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddCreditMsg.java new file mode 100644 index 000000000..c8ca841bd --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddCreditMsg.java @@ -0,0 +1,25 @@ +package com.iformall.domain.po.msg; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.List; + +/** + * + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class AfterAddCreditMsg extends BaseMsg { + + private static final long serialVersionUID = -1l; + + @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cserId") + private Long cuserId; + @io.swagger.annotations.ApiModelProperty(value="会员ID",name="basicUserId") + private Long basicUserId; + @io.swagger.annotations.ApiModelProperty(value="积分变动ID",name="creditHistoryId") + private Long creditHistoryId; +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddScoreMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddScoreMsg.java new file mode 100644 index 000000000..aefa086c7 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterAddScoreMsg.java @@ -0,0 +1,21 @@ +package com.iformall.domain.po.msg; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class AfterAddScoreMsg extends BaseMsg { + + private static final long serialVersionUID = -1l; + + @io.swagger.annotations.ApiModelProperty(value="会员ID",name="basicUserId") + private Long basicUserId; + @io.swagger.annotations.ApiModelProperty(value="成长值变动ID",name="scoreHistoryId") + private Long scoreHistoryId; +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java new file mode 100644 index 000000000..0e2bbd037 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java @@ -0,0 +1,20 @@ +package com.iformall.domain.po.msg; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class AfterBusinessCreditMsg extends BaseMsg { + + private static final long serialVersionUID = -1l; + + @io.swagger.annotations.ApiModelProperty(value="商圈订单ID",name="businessCircleOrderId") + private Long businessCircleOrderId; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterCarInOutMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterCarInOutMsg.java new file mode 100644 index 000000000..d59419c56 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/AfterCarInOutMsg.java @@ -0,0 +1,19 @@ +package com.iformall.domain.po.msg; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class AfterCarInOutMsg extends BaseMsg { + + private static final long serialVersionUID = -1l; + + @io.swagger.annotations.ApiModelProperty(value="停车记录ID",name="carCmdLogId") + private Long carCmdLogId; +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/SyncMemberCardMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/SyncMemberCardMsg.java new file mode 100644 index 000000000..eb1770cb0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/SyncMemberCardMsg.java @@ -0,0 +1,22 @@ +package com.iformall.domain.po.msg; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class SyncMemberCardMsg extends BaseMsg { + + private static final long serialVersionUID = -1l; + + @io.swagger.annotations.ApiModelProperty(value="",name="cardId") + private String cardId; + @io.swagger.annotations.ApiModelProperty(value="",name="code") + private String code; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/MarkingSceneDataReportVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/MarkingSceneDataReportVo.java index ca6caa7e7..12bca30f4 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/MarkingSceneDataReportVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/MarkingSceneDataReportVo.java @@ -13,6 +13,7 @@ public class MarkingSceneDataReportVo { private int verifySendCount; // 核销发放 private int microPaySendCount; // B端刷卡支付发放 private int orderSendCount; // 购买发放数 + private int merchantSendCount; // 商户发放数 private int parkCount; // 停车核销数 private int verifyCount; // 核销核销数 private int microPayCount; // 核销核销数 diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayExpVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayExpVo.java index cb5a3f68f..a33fbdb06 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayExpVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayExpVo.java @@ -91,10 +91,12 @@ public class WxOrderPayExpVo extends WxOrder { this.setCUserId(o.getCUserId()); this.setCouponChannelId(o.getCouponChannelId()); this.setProductId(o.getProductId()); + this.setProductName(o.getProductName()); this.setType(o.getType()); this.setPayVendor(o.getPayVendor()); this.setPayVersion(o.getPayVersion()); this.setPaymentType(o.getPaymentType()); + this.setMakeMerchantId(o.getMakeMerchantId()); this.setPayment(o.getPayment()); this.setPaymentTime(o.getPaymentTime()); this.setFreightPrice(o.getFreightPrice()); diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayVo.java index 25be6358a..d81bb0f69 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxOrderPayVo.java @@ -110,10 +110,12 @@ public class WxOrderPayVo extends WxOrder { this.setCUserId(o.getCUserId()); this.setCouponChannelId(o.getCouponChannelId()); this.setProductId(o.getProductId()); + this.setProductName(o.getProductName()); this.setType(o.getType()); this.setPayVendor(o.getPayVendor()); this.setPayVersion(o.getPayVersion()); this.setPaymentType(o.getPaymentType()); + this.setMakeMerchantId(o.getMakeMerchantId()); this.setPayment(o.getPayment()); this.setPaymentTime(o.getPaymentTime()); this.setFreightPrice(o.getFreightPrice()); diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java index 88ddfdd1e..10306b853 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPoiPlanService.java @@ -43,8 +43,39 @@ public interface TtWebPoiPlanService { String POI_COMMON_PLAN_TALENT_MEDIA_LIST = "https://open.douyin.com/poi/common/plan/talent/media/list/"; + /** + * 发布/修改直播间定向佣金计划 + */ + String POI_ORIENTED_PLAN_LIVE_SAVE = "https://open.douyin.com/poi/oriented/plan/live/save/"; + /** + * 发布/修改短视频定向佣金计划 + */ + String POI_ORIENTED_PLAN_VIDEO_SAVE = "https://open.douyin.com/poi/oriented/plan/video/save/"; + /** + * 修改定向计划状态 + */ + String POI_ORIENTED_PLAN_UPDATE_STATUS = "https://open.douyin.com/poi/oriented/plan/update/status/"; + /** + * 取消定向佣金计划指定的达人 + */ + String POI_ORIENTED_PLAN_DELETE_TALENT = "https://open.douyin.com/poi/oriented/plan/delete/talent/"; + /** + * 查询达人的定向佣金计划带货数据 + */ + String POI_ORIENTED_PLAN_TALENT_DETAIL = "https://open.douyin.com/poi/oriented/plan/talent/detail/"; + /** + * 通过商品 ID 查询定向佣金计划 + */ + String POI_ORIENTED_PLAN_LIST = "https://open.douyin.com/poi/oriented/plan/list/"; + /** + * 查询定向佣金计划带货汇总数据 + */ + String POI_ORIENTED_PLAN_DETAIL = "https://open.douyin.com/poi/oriented/plan/detail/"; + + /** * 商品达人分佣配置 + * 淘汰 */ String POI_TAKE_RATE = "https://open.douyin.com/poi/v2/spu/take_rate/sync/"; @@ -53,11 +84,26 @@ public interface TtWebPoiPlanService { */ PoiPlanPage poiPlanList(Long spuId,Integer pageNo,Integer pageSize) throws WxErrorException; + /** + * 通过商品 ID 查询定向佣金计划 + */ + PoiOrientedPlanPage poiOrientedPlanList(Long spuId,Integer pageNo,Integer pageSize) throws WxErrorException; + /** * 发布/修改通用佣金计划 */ Long poiPlanSave(PoiPlan poiPlan) throws WxErrorException ; + /** + * 发布/修改直播间定向佣金计划 + */ + Long poiOrientedPlanLiveSave(PoiOrientedPlan poiPlan) throws WxErrorException ; + + /** + * 发布/修改短视频定向佣金计划 + */ + Long poiOrientedPlanVideoSave(PoiOrientedPlan poiPlan) throws WxErrorException ; + /** * 修改通用佣金计划状态 * status @@ -67,8 +113,25 @@ public interface TtWebPoiPlanService { */ boolean poiPlanUpdateStatus(Long planId,Integer status) throws WxErrorException ; + /** + * 修改定向佣金计划状态 + * status + * 1:设置为进行中 + * 2:设置为暂停中 + * 3:设置为已关闭 + */ + boolean poiOrientedPlanUpdateStatus(Long planId,Integer status) throws WxErrorException ; + + /** + * 取消定向佣金计划指定的达人ORIENTED_PLAN_DELETE_TALENT + */ + boolean poiOrientedPlanDeleteTalent(Long planId,String douyinId) throws WxErrorException ; + + + /** * 商品达人分佣配置(定向分佣) + * 淘汰 */ String poiTakeRate(PoiTakeRate poiTakeRate) throws WxErrorException ; @@ -77,6 +140,11 @@ public interface TtWebPoiPlanService { */ PoiPlanDetail poiPlanDetail(List plan_id_list) throws WxErrorException ; + /** + * 查询定向佣金计划带货汇总数据 + */ + PoiOrientedPlanDetail poiOrientedPlanDetail(List plan_id_list) throws WxErrorException ; + /** * 通用佣金计划查询带货达人列表 */ @@ -87,6 +155,11 @@ public interface TtWebPoiPlanService { */ PoiPlanTalentDetail poiPlanTalentDetail(Long plan_id,List douyin_id_list) throws WxErrorException ; + /** + * 查询达人的定向佣金计划带货数据 + */ + PoiOrientedPlanTalentDetail poiOrientedPlanTalentDetail(Long plan_id,List douyin_id_list) throws WxErrorException ; + /** * 通用佣金计划查询达人带货详情 * diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java index c8ee458a5..a7e43298e 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebPoiPlanServiceImpl.java @@ -35,6 +35,17 @@ public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { return GSON.fromJson(result, PoiPlanPage.class); } + @Override + public PoiOrientedPlanPage poiOrientedPlanList(Long spuId, Integer pageNo, Integer pageSize) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + List spu_id_list = new ArrayList<>(); + spu_id_list.add(spuId); + map.put("spu_id_list",spu_id_list); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_LIST, GSON.toJson(map)); + return GSON.fromJson(result, PoiOrientedPlanPage.class); + } + @Override public Long poiPlanSave(PoiPlan poiPlan) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); @@ -43,6 +54,22 @@ public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { return jsonObject.getLong("plan_id"); } + @Override + public Long poiOrientedPlanLiveSave(PoiOrientedPlan poiPlan) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_LIVE_SAVE, GSON.toJson(poiPlan)); + JSONObject jsonObject = JSONObject.parseObject(result); + return jsonObject.getLong("plan_id"); + } + + @Override + public Long poiOrientedPlanVideoSave(PoiOrientedPlan poiPlan) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_VIDEO_SAVE, GSON.toJson(poiPlan)); + JSONObject jsonObject = JSONObject.parseObject(result); + return jsonObject.getLong("plan_id"); + } + @Override public boolean poiPlanUpdateStatus(Long planId, Integer status) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); @@ -62,6 +89,35 @@ public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { return true; } + @Override + public boolean poiOrientedPlanUpdateStatus(Long planId, Integer status) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + List> updateList = new ArrayList<>(); + Map updateMap = new HashMap<>(); + updateMap.put("plan_id",planId); + updateMap.put("status",status); + updateList.add(updateMap); + map.put("plan_update_list",updateList); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_UPDATE_STATUS, GSON.toJson(map)); + JSONObject jsonObject = JSONObject.parseObject(result); + JSONArray fail_plan_id_list = jsonObject.getJSONArray("fail_plan_id_list"); + if(fail_plan_id_list != null && fail_plan_id_list.size() > 0){ + return false; + } + return true; + } + + @Override + public boolean poiOrientedPlanDeleteTalent(Long planId, String douyinId) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id",planId); + map.put("douyin_id",douyinId); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_DELETE_TALENT, GSON.toJson(map)); + return true; + } + @Override public String poiTakeRate(PoiTakeRate poiTakeRate) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); @@ -79,6 +135,15 @@ public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { return GSON.fromJson(result, PoiPlanDetail.class); } + @Override + public PoiOrientedPlanDetail poiOrientedPlanDetail(List plan_id_list) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id_list",plan_id_list); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_DETAIL, GSON.toJson(map)); + return GSON.fromJson(result, PoiOrientedPlanDetail.class); + } + @Override public PoiPlanTalentPage poiPlanTalentList(Long plan_id, Integer pageNo, Integer pageSize) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); @@ -100,6 +165,16 @@ public class TtWebPoiPlanServiceImpl implements TtWebPoiPlanService { return GSON.fromJson(result, PoiPlanTalentDetail.class); } + @Override + public PoiOrientedPlanTalentDetail poiOrientedPlanTalentDetail(Long plan_id, List douyin_id_list) throws WxErrorException { + final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); + Map map = new HashMap<>(); + map.put("plan_id",plan_id); + map.put("douyin_id_list",douyin_id_list); + String result = this.service.execute(executor, this.POI_ORIENTED_PLAN_TALENT_DETAIL, GSON.toJson(map)); + return GSON.fromJson(result, PoiOrientedPlanTalentDetail.class); + } + @Override public PoiPlanTalentMediaPage poiPlanTalentMediaList(Long plan_id, Integer pageNo, Integer pageSize, String douyin_id, Integer content_type) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlan.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlan.java new file mode 100644 index 000000000..af2332bd5 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlan.java @@ -0,0 +1,128 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 计划. + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiOrientedPlan implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 计划ID + */ + @SerializedName(value = "plan_id") + private Long planId; + + /** + * 计划名称 + */ + @SerializedName(value = "plan_name") + private String planName; + + /** + * 计划开始时间,直播间场景下的计划此字段为0 + * 秒级时间戳 + */ + @SerializedName(value = "start_time") + private Long startTime; + + /** + * 计划结束时间,直播间场景下的计划此字段为0 + * 秒级时间戳 + */ + @SerializedName(value = "end_time") + private Long endTime; + + /** + * 佣金有效期,直播间场景下的计划此字段为0 + */ + @SerializedName(value = "commission_duration") + private Long commissionDuration; + + /** + * 联系电话 + */ + @SerializedName(value = "merchant_phone") + private String merchantPhone; + + /** + * 可选值: + * 1:进行中 + * 2:已完成 + * 3:已取消 + */ + @SerializedName(value = "status") + private Integer status; + + /** + * 达人抖音号列表 + */ + @SerializedName(value = "douyin_id_list") + private List douyinIdList; + + /** + * 达人履约状态: + * 1:进行中 + * 2:已完成 + * 3:已取消 + */ + @SerializedName(value = "talent_status_map") + private Map talentStatusMap; + + /** + * 计划指定的商品配置列表 + */ + @SerializedName(value = "product_list") + private List productList; + + /** + * 计划创建时间 + */ + @SerializedName(value = "create_time") + private String createTime; + + /** + * 计划创建时间 + */ + @SerializedName(value = "update_time") + private String updateTime; + + /** + * 计划支持的带货场景,可选以下的值: + * + * 1:仅短视频 + * 2:仅直播间 + */ + @SerializedName(value = "content_type") + private Integer contentType; + + @Data + @NoArgsConstructor + public static class ProductRate implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 商品ID + */ + @SerializedName(value = "product_id") + private Long productId; + /** + * 商品定向分佣比例,万分位 + */ + @SerializedName(value = "commission_rate") + private Integer commissionRate; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanDetail.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanDetail.java new file mode 100644 index 000000000..98565fed8 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanDetail.java @@ -0,0 +1,61 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * 商品. + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiOrientedPlanDetail implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 数据产出日期 + */ + @SerializedName(value = "date") + private String date; + + /** + * 计划带货信息详情,以计划ID为key,带货数据为value + */ + @SerializedName(value = "data") + private Map data; + + @Data + @NoArgsConstructor + public static class OrientedPlanGMV implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + /** + * 计划关联的短视频播放量和直播间观看人数总和 + */ + @SerializedName(value = "media_cnt") + private Integer mediaCnt; + /** + * 已核销GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + /** + * 计划信息 + */ + @SerializedName(value = "plan_info") + private PoiOrientedPlan planInfo; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanPage.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanPage.java new file mode 100644 index 000000000..61f81e8f0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanPage.java @@ -0,0 +1,39 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiOrientedPlanPage implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 总页数 + */ + @SerializedName(value = "page_count") + private Integer pageCount; + + /** + * 总计划数 + */ + @SerializedName(value = "total") + private Integer total; + + /** + * 计划 + */ + @SerializedName(value = "data") + private List data; + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanTalentDetail.java b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanTalentDetail.java new file mode 100644 index 000000000..ce59c86be --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/bean/PoiOrientedPlanTalentDetail.java @@ -0,0 +1,101 @@ +package com.iformall.douyin.web.bean; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * + * + * @author thinsstar + */ +@Data +@NoArgsConstructor +public class PoiOrientedPlanTalentDetail implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 数据产出日期 + */ + @SerializedName(value = "date") + private String date; + + /** + * 达人带货数据,以达人抖音号为key,带货数据为value + */ + @SerializedName(value = "data") + private Map data; + + @Data + @NoArgsConstructor + public static class PlanGMVDatail implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 达人所有短视频&直播间的总带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + /** + * 达人所有短视频&直播间的总播放量&观看量 + */ + @SerializedName(value = "play_cnt") + private Integer playCnt; + /** + * + * 达人所有短视频&直播间的总带货佣金 + */ + @SerializedName(value = "talent_commission") + private Integer talentCommission; + /** + * 达人所有短视频&直播间的已核销GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + /** + * 每个短视频/直播间的带货数据列表 + */ + @SerializedName(value = "media_sell_info") + private List mediaSellInfo; + + } + + @Data + @NoArgsConstructor + public static class MediaSellInfo implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 该直播间/短视频的唯一标识 + */ + @SerializedName(value = "content_open_id") + private String contentOpenId; + /** + * 达人该直播间/短视频的带货GMV + */ + @SerializedName(value = "gmv") + private Integer gmv; + /** + * 达人该直播间/短视频的观看人数/播放量 + */ + @SerializedName(value = "play_cnt") + private Integer playCnt; + /** + * + * 达人该直播间/短视频的带货佣金 + */ + @SerializedName(value = "talent_commission") + private Integer talentCommission; + /** + * 达人该直播间/短视频的已核销GMV + */ + @SerializedName(value = "used_gmv") + private Integer usedGmv; + + } + +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java b/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java index f6e11e6e2..ca3938c4b 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumAppPlat.java @@ -1,5 +1,8 @@ package com.iformall.enums; +import com.iformall.common.ErrorCode; +import com.iformall.exception.MallinkException; + /** * app平台 * @author alascor @@ -35,4 +38,15 @@ public enum EnumAppPlat { } return null; } + + public static EnumPayWay getPayWay(EnumAppPlat plat){ + if(WX.equals(plat)){ + return EnumPayWay.PAY_WAY_WECHAT; + }else if(ALI.equals(plat)){ + return EnumPayWay.PAY_WAY_ALIPAY; + }else if(TOUTIAO.equals(plat)){ + return EnumPayWay.PAY_WAY_TT; + } + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到对应支付"); + } } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java b/mallinkService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java new file mode 100644 index 000000000..b262c7b3f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java @@ -0,0 +1,48 @@ +package com.iformall.enums; + +/** + * . + */ +public enum EnumBusinessCircleAuthorizeState { + + //UNAUTHORIZED:未授权 + //AUTHORIZED:已授权 + //DEAUTHORIZED:已取消授权 + UNAUTHORIZED(0, "UNAUTHORIZED"), + AUTHORIZED(1, "AUTHORIZED"), + DEAUTHORIZED(2, "DEAUTHORIZED"), + ; + + public static EnumBusinessCircleAuthorizeState getEnum(Integer code) { + for (EnumBusinessCircleAuthorizeState value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + public static EnumBusinessCircleAuthorizeState getEnum(String message) { + for (EnumBusinessCircleAuthorizeState value : values()) { + if (value.getMessage().equals(message)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumBusinessCircleAuthorizeState(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumBusinessType.java b/mallinkService/src/main/java/com/iformall/enums/EnumBusinessType.java new file mode 100644 index 000000000..e775e446e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumBusinessType.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumBusinessType { + + BUSINESS_0(0, "暂未开通"), + BUSINESS_1(1, "1.0"), + BUSINESS_2(2, "2.0"), + BUSINESS_3(3, "3.0"); + + public static EnumBusinessType getEnum(Integer code) { + for (EnumBusinessType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumBusinessType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java index 708089701..7f6d64b8b 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java @@ -1,5 +1,8 @@ package com.iformall.enums; +import com.iformall.common.ErrorCode; +import com.iformall.exception.MallinkException; + import java.util.ArrayList; import java.util.List; @@ -12,13 +15,13 @@ public enum EnumCouponType { // 100.消费卡 COUPON_MANJIAN(1, "满减券"), COUPON_DAIJIN(2, "代金券"), - COUPON_TUANGOU(3, "团购券"),//没用 +// COUPON_TUANGOU(3, "团购券"),//弃用 COUPON_LIPIN(4, "礼品券"), COUPON_TINGCHE(5, "停车券"), COUPON_MULTIMCH(6, "通用券"), COUPON_DOUYIN(66, "抖音券"), COUPON_PRESS(8, "砍价券"), - COUPON_GROUP(9, "团购券"), + COUPON_GROUP(9, "拼团券"), COUPON_PREORDER(10, "预购商品"), COUPON_DISTRIBUTION(11, "可配送商品"), COUPON_GIFT(12, "券礼包"), @@ -64,6 +67,10 @@ public enum EnumCouponType { return message; } + /** + * 抖音平台的券 + * @return + */ public static List getDouYinType(){ List typeList = new ArrayList<>(); typeList.add(COUPON_DOUYIN.getCode()); @@ -71,4 +78,45 @@ public enum EnumCouponType { return typeList; } + /** + * 微信平台的券 + */ + public static List getWeiXinType(){ + List typeList = new ArrayList<>(); + typeList.add(COUPON_MANJIAN.getCode()); + typeList.add(COUPON_DAIJIN.getCode()); +// typeList.add(COUPON_TUANGOU.getCode()); + typeList.add(COUPON_LIPIN.getCode()); + typeList.add(COUPON_TINGCHE.getCode()); + typeList.add(COUPON_MULTIMCH.getCode()); + typeList.add(COUPON_PRESS.getCode()); + typeList.add(COUPON_GROUP.getCode()); + typeList.add(COUPON_PREORDER.getCode()); + typeList.add(COUPON_DISTRIBUTION.getCode()); + typeList.add(COUPON_GIFT.getCode()); + typeList.add(COUPON_CREDIT.getCode()); + typeList.add(COUPON_CREDIT_PARK.getCode()); + typeList.add(CARD_MULTIMCH.getCode()); + return typeList; + } + + /** + * 有价 并且永不分账的券类型 + */ + public static List getPlatType(){ + List typeList = new ArrayList<>(); + typeList.add(COUPON_GIFT.getCode()); + typeList.add(CARD_MULTIMCH.getCode()); + return typeList; + } + + public static EnumAppPlat getAppPlat(Integer couponType){ + if(getWeiXinType().contains(couponType)){ + return EnumAppPlat.WX; + }else if(getDouYinType().contains(couponType)){ + return EnumAppPlat.TOUTIAO; + } + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "券类型错误,未找到对应平台"); + } + } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCpsPlanStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumCpsPlanStatus.java index 7c7cfcf78..bcf07da4d 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumCpsPlanStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCpsPlanStatus.java @@ -7,9 +7,9 @@ public enum EnumCpsPlanStatus { // - ING(1, "进行中/在线"), - SUSPEND(2, "暂停/下线"), - OFF(3, "关闭"), + ING(1, "进行中"), + SUSPEND(2, "暂停中/已完成"), + OFF(3, "已关闭"), ; public static EnumCpsPlanStatus getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardActivateScene.java b/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardActivateScene.java new file mode 100644 index 000000000..166eb6f78 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardActivateScene.java @@ -0,0 +1,48 @@ +package com.iformall.enums; + +/** + * . + */ +public enum EnumMemberCardActivateScene { + + //NEW_ACTIVATE 新开卡激活 + //RECOVER 删卡后重新领取激活 + + NEW_ACTIVATE(0, "NEW_ACTIVATE"), + RECOVER(1, "RECOVER") + ; + + public static EnumMemberCardActivateScene getEnum(Integer code) { + for (EnumMemberCardActivateScene value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public static EnumMemberCardActivateScene getEnum(String message) { + for (EnumMemberCardActivateScene value : values()) { + if (value.getMessage().equals(message)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumMemberCardActivateScene(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardStatus.java new file mode 100644 index 000000000..5492083dd --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumMemberCardStatus.java @@ -0,0 +1,54 @@ +package com.iformall.enums; + +/** + * . + */ +public enum EnumMemberCardStatus { + + //NOT_ACTIVATE:未激活 + //EFFECTIVE:生效中 + //EXPIRE:已过期 + //UNAVAILABLE:已失效 + //DELETE:已删除 + //IMPORTED:已导入 + NOT_ACTIVATE(0, "NOT_ACTIVATE"), + EFFECTIVE(1, "EFFECTIVE"), + EXPIRE(2, "EFFECTIVE"), + UNAVAILABLE(3, "EFFECTIVE"), + DELETE(4, "EFFECTIVE"), + IMPORTED(5, "EFFECTIVE"), + ; + + public static EnumMemberCardStatus getEnum(Integer code) { + for (EnumMemberCardStatus value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + public static EnumMemberCardStatus getEnum(String message) { + for (EnumMemberCardStatus value : values()) { + if (value.getMessage().equals(message)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumMemberCardStatus(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java b/mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java index 712148feb..a9be86ba8 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java @@ -13,6 +13,13 @@ public enum EnumMsgRecordType { SYSTEM(6, "系统通知"), SMART_APP_UNIFORM(7, "小程序统一消息"), WEBSOCKET_APP(8, "小程序websocket"), + + SYNC_MEMBER_CARD(10,"微信商圈同步会员"), + AFTER_ADD_CREDIT(11,"积分变更后"), + AFTER_ADD_SCORE(12,"成长值变更后"), + AFTER_CAR_IN_OR_OUT(13,"车辆入场,出场后"), + AFTER_BUSINESS_CREDIT(14,"商圈积分后"), + INSIDE_ORDER_SUCCESS(100, "下订单成功"), INSIDE_COUPON_VERIFY(101, "券核销"), INSIDE_C_LOGIN(102, "C端用户登录"),//内部消息,加积分等 diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumOrderType.java b/mallinkService/src/main/java/com/iformall/enums/EnumOrderType.java index 3beed9124..c511e5a20 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumOrderType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumOrderType.java @@ -10,7 +10,7 @@ public enum EnumOrderType { COUPON(0,"券"), MICROPAY(1,"B收款码支付"), NATIVEPAY(2,"C扫码支付"), - PREPAIDCARD(3, "储值卡"), + PREPAIDCARD(3, "储值卡支付"), CREDIT(4,"积分支付"), POSPAY(10, "POS支付") ; diff --git a/mallinkService/src/main/java/com/iformall/mapper/TtPoiTakeRateMapper.java b/mallinkService/src/main/java/com/iformall/mapper/TtPoiTakeRateMapper.java index 60eb93469..2687f84f3 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/TtPoiTakeRateMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/TtPoiTakeRateMapper.java @@ -10,7 +10,7 @@ import java.util.List; public interface TtPoiTakeRateMapper extends CommonMapper { TtPoiTakeRate selectByCoupon(@Param("tenantId")String tenantId,@Param("couponId")Long couponId, - @Param("type") Integer type,@Param("douyinId")String douyinId); + @Param("type") Integer type); List findList(TtPoiTakeRate takeRate); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java index 29c8ef6d3..41d3a1c64 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java @@ -40,9 +40,13 @@ public interface WxCUserMapper extends CommonMapper { // void updateMsgCountDown(@Param("tenantId")String tenantId, @Param("openId")String openId); - List findOpenIdList(@Param("userId")Long userId, @Param("tenantId")String tenantId); + String findOpenId(@Param("userId")Long userId, @Param("tenantId")String tenantId); + + Long findCuserId(@Param("userId")Long userId, @Param("tenantId")String tenantId); List findTokenList(@Param("id")Long id,@Param("userId")Long userId, @Param("tenantId")String tenantId); List findCountData(WxCUserBasicInfoDto dto); + + void updateAuthorizeStateByOpenId(WxCUser updCuser); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index 33745f0ce..c613127dc 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -39,7 +39,7 @@ public interface WxCouponOrderMapper extends CommonMapper { int findProductCount(WxCouponOrder wxCouponOrder); List> getCouponCount(WxCouponOrder wxCouponOrder); //统一额度统计接口 - int queryPriceTotal(WxCouponOrder wxCouponOrder); + Integer queryPriceTotal(WxCouponOrder wxCouponOrder); List findCarListOfCUser(WxCouponOrder wxCouponOrder); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java index 94522dae2..c6a9437d4 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java @@ -12,7 +12,7 @@ import java.util.List; public interface WxCreditHistoryMapper extends CommonMapper{ - WxCreditHistory selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + WxCreditHistory selectById(@Param("id")Long id,@Param("tenantId")String finalTenantId); List findList(WxCreditHistory wxCreditHistory); @@ -51,4 +51,6 @@ public interface WxCreditHistoryMapper extends CommonMapper findAddList(WxCreditHistory chaddq); List findLesList(WxCreditHistory chlesq); + + List getIsMemberCarAndClearCredit(WxCreditHistory record); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxMemberCardMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxMemberCardMapper.java new file mode 100644 index 000000000..10fc3d62a --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxMemberCardMapper.java @@ -0,0 +1,19 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxMemberCard; + +import java.util.List; + +public interface WxMemberCardMapper extends CommonMapper { + + List findList(WxMemberCard record); + + int deleteByCode(WxMemberCard record); + + Long getIdByCode(WxMemberCard record); + + int updateByOpenId(WxMemberCard record); + + WxMemberCard getByCode(WxMemberCard record); +} diff --git a/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java b/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java index 02a4af249..76091746a 100644 --- a/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java +++ b/mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java @@ -5,6 +5,17 @@ public class WxPayConstant { public static final String NOTICE_EVENT_TYPE = "MALL_TRANSACTION.SUCCESS"; public static final String REFUND_EVENT_TYPE = "MALL_REFUND.SUCCESS"; + //微信会员卡 + public static final String MEMBER_CARD_ACTIVATE = "MEMBER_CARD_ACTIVATE";//激活会员卡 + public static final String USER_VIEW_MEMBERCARD = "USER_VIEW_MEMBERCARD";//用户查看会员卡详情 + public static final String USER_DELETE_MEMBERCARD = "USER_DELETE_MEMBERCARD";//用户删除会员卡 + public static final String USER_MODIFY_INFORMATION = "USER_MODIFY_INFORMATION";//用户修改个人信息 + + //微信商圈授权 + public static final String REGISTERED_MODE = "REGISTERED_MODE";//会员开卡(进卡包) + 未授权会员积分服务 + public static final String REGISTERED_AND_AUTHORIZATION_MODE = "REGISTERED_AND_AUTHORIZATION_MODE";//会员开卡(进卡包)+授权会员积分服务 + + public final static String REQ_KEY = "reqKey"; public final static String RES_KEY = "resKey"; @@ -167,4 +178,7 @@ public class WxPayConstant { public final static String NEU_ORDER_PAY = "0"; // 有效, 优惠券从预核销处理为核销, 卡从预支付->支付 public final static String NEU_ORDER_REFUND = "1"; // 取消 + public final static String CAR_IN = "IN"; // 入场,用户开车进入商圈 + public final static String CAR_OUT = "OUT"; // 离场,用户开车离开商圈 + } diff --git a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java index d41904ea2..47b71b95e 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java @@ -30,21 +30,28 @@ public interface TtCouponGoodsService { ResultData productFreeAudit(TenantEntity tenantInfo, Long id); + //cps 佣金 + PageInfo takeRateListAsPage(TtPoiTakeRate record, Integer pageNum, Integer pageSize); + TtPoiTakeRate getTakeRateById(TenantEntity tenantInfo, Long id); + + //根据商品id查询线上通用佣金情况 ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize); + //根据商品id查询线上定向佣金情况 + ResultData poiOrientedPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize); - ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate); + ResultData poiPlanSave(TtPoiTakeRate record); - ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status); + ResultData saveOrientedPlan(TtPoiTakeRate record); - ResultData poiTakeRate(TenantEntity tenantInfo, Long couponId, String douyinId, Integer takeRate, Integer status); + ResultData poiPlanUpdateStatus(TtPoiTakeRate record); - PageInfo takeRateListAsPage(TtPoiTakeRate record, Integer pageNum, Integer pageSize); + ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record); ResultData setUpAll(TenantEntity tenantInfo, Long couponId, Integer mallRate); - TtPoiTakeRate selectByCoupon(TenantEntity tenantInfo, Long couponId, Integer planType, String douyinId); + TtPoiTakeRate selectByCoupon(TenantEntity tenantInfo, Long couponId, Integer planType); ResultData getAll(TenantEntity tenantInfo, Long couponId); diff --git a/mallinkService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java index 5788bb0dc..cec38d631 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java @@ -51,14 +51,42 @@ public interface WxBusinessCircleOrderService { */ void updatePoints(WxBusinessCircleOrder record); + /** + * 同步积分状态 + * @param record + */ + void notifyPoints(WxBusinessCircleOrder record); + /** * 积分同步状态修改 */ void updateIsPointsNotify(WxBusinessCircleOrder record); + void sendsyncNotifyPointsMsg(TenantEntity tenantEntity, Long businessCircleOrderId); void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); Integer sumCirclePayment(BusinessCircleBase circleOrder); Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); + + /** + * 同步授权快速积分 + */ + ResultData syncauthorizeState(TenantEntity tenantEntity,String openid); + + /** + * 查询待积分状态 + */ + ResultData getPointsCommitStatus(TenantEntity tenantEntity,String openId); + + /** + * 商圈同步停车状态 + * state + * IN:入场,用户开车进入商圈 + * OUT:离场,用户开车离开商圈 + */ + ResultData syncParkings(TenantEntity tenantEntity,String openId,String plate_number,String state,Date time); + + void sendSyncParkingsMsg(TenantEntity tenantEntity,Long carCmdLogId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java index dc405c054..109e5c637 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java @@ -169,7 +169,7 @@ public interface WxCUserBasicInfoService { void cuserOldToNew(Long oldCuserId, Long newCuserId,TenantEntity tenantinfo); - WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName, Integer sex, String avatarUrl); + WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName,String name, Integer sex, String avatarUrl); int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType wechatPhone); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java index 94e22ba08..85b0ac4da 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java @@ -136,4 +136,6 @@ public interface WxCUserService { void delForUserIdOnly(Long id, Long userId, String tenantId); void updateMsgCount(WxCUser user); + + void updateAuthorizeStateByOpenId(WxCUser updCuser); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java b/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java deleted file mode 100644 index ec6566236..000000000 --- a/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.iformall.service; - -import com.iformall.domain.po.WxBusinessCircleOrder; -import org.springframework.scheduling.annotation.Async; - - -public interface WxCallBackService { - - /** - * - * @param record - */ - @Async - void notifyPoints(WxBusinessCircleOrder record); - -} diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 4fd278442..6411ad043 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -10,6 +10,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.TtCouponChannelPoi; import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxCoupon; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.TtCouponVo; import com.iformall.domain.vo.WxCouponCVo; @@ -267,6 +268,7 @@ public interface WxCouponService { boolean validCouponDate(WxCoupon wxCoupon); + ResultData validGiftCouponDate(WxCoupon wxCoupon); /** * 获取券商户map @@ -278,4 +280,11 @@ public interface WxCouponService { List getCouponMerchantList(TenantEntity tenantInfo, Long couponId); + /** + * 作废卷 + * @param tenantInfo + * @param couponId + * @return + */ + ResultData disable(TenantEntity tenantInfo, Long couponId); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java b/mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java index 8dd31fd48..794f90bc8 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java @@ -40,7 +40,7 @@ public interface WxCreditHistoryService { * @param id * @return */ - WxCreditHistory getById(Long id,String tenantId); + WxCreditHistory getById(Long id,String finalTenantId); /** * 添加积分时,需要校验用户以及手机号是否存在 @@ -76,6 +76,8 @@ public interface WxCreditHistoryService { void clearCreditByYear(WxCreditHistory wxCreditHistory); + void syncClearCredit(TenantEntity tenantInfo); + void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory); ResultData getCreditSummary(WxCreditHistory wxCreditHistory); @@ -89,4 +91,5 @@ public interface WxCreditHistoryService { long getIncrementCreditAmount(WxCreditHistory wxCreditHistory); PageInfo findListMorePage(WxCreditHistory wxCreditHistory,Integer pageIndex, Integer pageSize); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxMemberCardService.java b/mallinkService/src/main/java/com/iformall/service/WxMemberCardService.java new file mode 100644 index 000000000..ff654b318 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxMemberCardService.java @@ -0,0 +1,50 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxMemberCard; +import com.iformall.domain.po.base.TenantEntity; + +public interface WxMemberCardService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param pageIndex + * @param pageSize + * @return + */ + PageInfo listAsPage(WxMemberCard record, Integer pageIndex, Integer pageSize); + + ResultData saveorupdate(WxMemberCard record); + + ResultData saveorupdateByCode(WxMemberCard record); + + ResultData delUserCardStatusByCode(WxMemberCard record); + + /** + * 同步会员卡卡信息 + */ + ResultData syncMemberCard(TenantEntity tenantEntity,String card_id,String code); + + void sendSyncMemberCardMsg(TenantEntity tenantEntity,String card_id,String code); + + /** + * 同步会员卡等级 + * need_inform_level 是否发送等级变更通知 + */ + ResultData syncMemberCardLevel(TenantEntity tenantEntity,String card_id,String code,String markid, + String level,Boolean need_inform_level); + + void sendsyncMemberCardLevelMsg(TenantEntity tenantEntity,Long baseUserId,Long scoreHistoryId); + + /** + * 更新会员卡积分 + */ + ResultData syncMemberCardBonus(TenantEntity tenantEntity,String card_id,String code,String markid, + int before_bonus_value,int bonus_value,Boolean need_inform_bonus); + + void sendsyncMemberCardBonusMsg(TenantEntity tenantEntity,Long cuserId,Long baseUserId,Long creditHistoryId); + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxOrderService.java index d6b3a5e1e..ede0b39ee 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxOrderService.java @@ -250,10 +250,6 @@ public interface WxOrderService { ResultData composeSaveOrder(boolean allowUnPayOrder,EnumComposeOrder composeOrderType,List composeOrderSaveDto,Long cUserId,EnumPayWay payWay, TenantEntity tenantEntity,EnumPayVersion payVersion); - - //平台推送订单,如抖音支付2.0 - ResultData platPushSaveOrder(boolean allowUnPayOrder,EnumComposeOrder composeOrderType,String allExtParam,List platPushOrderList,Long cUserId, - EnumPayWay payWay,EnumPayVersion payVersion,TenantEntity tenantEntity); void sendInsideOrderPushMsg(TenantEntity tenantEntity,Long composeOrderId); diff --git a/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java b/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java index 94a71e4e3..d3ccf7f3b 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java @@ -2,6 +2,7 @@ package com.iformall.service; import com.github.binarywang.wxpay.service.WxPayService; import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.WxProjectConfig; import com.iformall.domain.po.base.TenantEntity; @@ -26,6 +27,7 @@ public interface WxPayAccountService { * @return */ WxPayAccount getById(Long id); + WxPayAccount getByIdFromRedis(Long id); /** * 保存或更新实体 diff --git a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java index 5a34eae62..654ca2ba5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java @@ -54,12 +54,12 @@ public interface WxProfitSharingReceiverService { void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); - ResultData updateTtReceiver(WxMerchant merchant, String appId, String payAccountKey); + ResultData updateTtReceiver(WxMerchant merchant); - ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey); + ResultData getTtReceiverImprotURL(WxMerchant merchant); - ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey); + ResultData getTtReceiverBalanceURL(WxMerchant merchant); - ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey); + ResultData updateTtReceiverIsUse(WxMerchant merchant); } diff --git a/mallinkService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java index dfd700384..38ef679eb 100644 --- a/mallinkService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @@ -28,6 +29,10 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private final List bank17= Arrays.asList("工商银行","交通银行","招商银行","民生银行","中信银行","浦发银行","兴业银行","光大银行","广发银行","平安银行","北京银行","华夏银行","农业银行","建设银行","邮政储蓄银行","中国银行","宁波银行"); + + private final String otherBank = "其他银行"; + @Autowired WxPayAccountService wxPayAccountService; @@ -55,6 +60,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); try { BankingResult bankingResult = wxPayService.getBankService().personalBanking(offset,limit); + this.handlBankingResult(bankingResult.getData()); return new ResultData(bankingResult.getData()); } catch (WxPayException e) { e.printStackTrace(); @@ -70,6 +76,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { int offset = 0, limit = 200; try { BankingResult bankingResult = wxPayService.getBankService().personalBanking(offset,limit); + this.handlBankingResult(bankingResult.getData()); bankInfoList.addAll(bankingResult.getData()); String key = prev+offset+"_"+limit; BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class); @@ -88,6 +95,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { if(nextBankingResult == null){ try{ nextBankingResult = wxPayService.getBankService().personalBanking(offset,limit); + this.handlBankingResult(nextBankingResult.getData()); if(nextBankingResult != null){ RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0); } @@ -112,6 +120,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); try { BankingResult bankingResult = wxPayService.getBankService().corporateBanking(offset,limit); + this.handlBankingResult(bankingResult.getData()); return new ResultData(bankingResult.getData()); } catch (WxPayException e) { e.printStackTrace(); @@ -127,6 +136,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { int offset = 0, limit = 200; try { BankingResult bankingResult = wxPayService.getBankService().corporateBanking(offset,limit); + this.handlBankingResult(bankingResult.getData()); bankInfoList.addAll(bankingResult.getData()); String key = prev+offset+"_"+limit; BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class); @@ -145,6 +155,7 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { if(nextBankingResult == null){ try{ nextBankingResult = wxPayService.getBankService().corporateBanking(offset,limit); + this.handlBankingResult(nextBankingResult.getData()); if(nextBankingResult != null){ RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0); } @@ -164,6 +175,24 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { return new ResultData(bankInfoList); } + /** + * 处理银行数据 + * 开户银行,传参规则如下: + * 1、17家直连银行,请根据开户银行对照表直接填写银行名 ; + * 2、非17家直连银行,该参数请填写为“其他银行”。 + */ + private void handlBankingResult(List list){ + if(list != null && !list.isEmpty()){ + for (BankInfo bank:list) { + if(!bank17.contains(bank.getBankAlias())){ + bank.setAccountBank(otherBank); + bank.setNeedBankBranch(true); + } + } + } + + } + @Override public ResultData areasProvinces(TenantEntity tenantInfo) { WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java index 89188ca04..e0a38158c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java @@ -149,7 +149,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder } }else if(record.getCUserPhone() != null) { - WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(), null, null, null); + WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(), null,null, null, null); if (byPhone != null) { record.setCUserId(byPhone.getId()); record.setCUserNickName(byPhone.getNickName()); @@ -162,7 +162,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder AliPayCUser aliUser = aliPayCUserService.getByAliPayUserId(userQ); if(aliUser != null){ // WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(aliUser, aliUser.getPhone()); - WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null); + WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null,null); if(infoByPhone != null ){ record.setCUserId(infoByPhone.getId()); record.setCUserNickName(infoByPhone.getNickName()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java index e9c45dbc6..d746c80b4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java @@ -188,7 +188,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { //处理数据 wxCouponActionLogService.updateCreateTimeMd(tenantEntity); - Map sceneMap = wxCouponActionLogService.getSceneDataMap(tenantEntity,addDay(-30),addDay(1)); + Map sceneMap = wxCouponActionLogService.getSceneDataMap(tenantEntity,addDay(-30),addDay(1));//2,3,4,5,7 String startdate = DateUtils.getTimeBefore(30, new Date()); String enddate = DateUtils.getTimeBefore(1,new Date()); @@ -206,12 +206,15 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { Integer count4 = sceneMap.get(tj + "_" + EnumCouponSendSendType.B_MICROPAY.getCode()); msdVo.setMicroPaySendCount(count4==null?0:count4); Integer count5 = sceneMap.get(tj + "_" + EnumCouponSendSendType.C_ORDER.getCode()); - msdVo.setMicroPaySendCount(count5==null?0:count5); + msdVo.setOrderSendCount(count5==null?0:count5); + Integer count6 = sceneMap.get(tj + "_" + EnumCouponSendSendType.MERCHANT.getCode()); + msdVo.setMerchantSendCount(count6==null?0:count6); msdVo.setTotal(msdVo.getParkSendCount() + msdVo.getVerifySendCount() + msdVo.getMicroPaySendCount() + - msdVo.getOrderSendCount()); + msdVo.getOrderSendCount() + + msdVo.getMerchantSendCount()); tempDatalist.add(msdVo); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index 13c3a21db..42ff20569 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -1,6 +1,7 @@ package com.iformall.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -11,11 +12,9 @@ import com.iformall.domain.po.*; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.*; +import com.iformall.douyin.web.api.TtWebPoiPlanService; import com.iformall.douyin.web.api.TtWebService; -import com.iformall.douyin.web.bean.PoiPlan; -import com.iformall.douyin.web.bean.PoiPlanPage; -import com.iformall.douyin.web.bean.PoiTakeRate; -import com.iformall.douyin.web.bean.Product; +import com.iformall.douyin.web.bean.*; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; @@ -202,6 +201,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { wxCouponChannel.setEndTime(coupon.getValidEndDate()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); wxCouponChannel.setCouponId(coupon.getId()); + wxCouponChannel.setMakeMerchantId(coupon.getMakeMerchantId()); wxCouponChannel.setType(coupon.getType()); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); wxCouponChannel.setBusiness(coupon.getBusiness()); @@ -250,12 +250,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { throw new Exception("未获取到抖音商品product_id"); } - WxCouponChannel updCC = new WxCouponChannel(); - updCC.setId(wxCouponChannel.getId()); - updCC.updateTenantInfo(wxCouponChannel); - wxCouponChannel.setTtSpuId(productId); - wxCouponChannelMapper.updateById(wxCouponChannel); - syncCouponChannelPoi(coupon,wxCouponChannel.getId(),productId); return new ResultData(); @@ -435,7 +429,20 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } } + private void syncCouponChannelPoi(WxCoupon coupon,Long couponChannelId,String productId){ + WxCoupon updC = new WxCoupon(); + updC.setId(coupon.getId()); + updC.updateTenantInfo(coupon); + updC.setGoodsId(productId); + wxCouponMapper.updateById(updC); + + WxCouponChannel updCC = new WxCouponChannel(); + updCC.setId(couponChannelId); + updCC.updateTenantInfo(coupon); + updCC.setTtSpuId(productId); + wxCouponChannelMapper.updateById(updCC); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId()); Date date = new Date(); if(ttCouponChannelPoi != null){ @@ -485,6 +492,24 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } + + + @Override + public PageInfo takeRateListAsPage(TtPoiTakeRate record, Integer pageNum, Integer pageSize) { + return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> ttPoiTakeRateMapper.findList(record)); + } + + @Override + public TtPoiTakeRate getTakeRateById(TenantEntity tenantInfo, Long id) { + TtPoiTakeRate takeRate = ttPoiTakeRateMapper.selectById(id, tenantInfo.getTenantId()); + if(takeRate != null){ + WxCoupon coupon = wxCouponMapper.selectById(takeRate.getCouponId(), tenantInfo.getTenantId()); + takeRate.setCoupon(coupon); + } + return takeRate; + } + + @Override public ResultData poiPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) { TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); @@ -502,45 +527,60 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public ResultData poiPlanSave(TenantEntity tenantInfo, Long couponId, Long planId, Integer contentType, Integer commissionRate) { - WxCoupon wxCoupon = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId()); + public ResultData poiOrientedPlanList(TenantEntity tenantInfo,Long couponId, Integer pageNum, Integer pageSize) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); + if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); + } + try { + Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); + PoiOrientedPlanPage poiOrientedPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiOrientedPlanList(spu_id, pageNum, pageSize); + return new ResultData(poiOrientedPlanPage); + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData poiPlanSave(TtPoiTakeRate record) { + WxCoupon wxCoupon = wxCouponMapper.selectById(record.getCouponId(), record.getTenantId()); if(wxCoupon == null){ return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); } - if(wxCoupon.getSalePrice() == 0 || wxCoupon.checkIsCard()){ + if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { int rateMin = getRateMin(); - if(commissionRate.intValue() < rateMin){ + if(record.getTakeRate() < rateMin){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率低于最小值("+rateMin+")"); } int rateMax = getRateMax(wxCoupon); - if(commissionRate.intValue() > rateMax){ + if(record.getTakeRate() > rateMax){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率超过最大值("+rateMax+")"); } Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); PoiPlan poiPlan = new PoiPlan(); - poiPlan.setPlanId(planId); + if(record.getId() != null){ + poiPlan.setPlanId(record.getId()); + } poiPlan.setSpuId(spu_id); - poiPlan.setContentType(contentType); - poiPlan.setCommissionRate(commissionRate); + poiPlan.setContentType(record.getContentType()); + poiPlan.setCommissionRate(record.getTakeRate()); - Long returnPlanId = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanSave(poiPlan); + Long returnPlanId = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanSave(poiPlan); if(returnPlanId != null){ - TtPoiTakeRate ttPoiTakeRate = new TtPoiTakeRate(); - ttPoiTakeRate.setId(returnPlanId); - ttPoiTakeRate.updateTenantInfo(tenantInfo); - ttPoiTakeRate.setCouponId(couponId); - ttPoiTakeRate.setType(EnumCpsPlanType.COMMON.getCode()); - ttPoiTakeRate.setContentType(contentType); - ttPoiTakeRate.setTakeRate(commissionRate); - this.saveorupdate(ttPoiTakeRate); + if(record.getId() == null){ + record.setId(returnPlanId); + } + record.setType(EnumCpsPlanType.COMMON.getCode()); + this.saveorupdate(record); return new ResultData(returnPlanId); }else{ return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未获取到计划ID"); @@ -554,68 +594,151 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public ResultData poiPlanUpdateStatus(TenantEntity tenantInfo, Long planId, Integer status) { - try { - boolean b = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanUpdateStatus(planId, status); - if(b){ - TtPoiTakeRate ttPoiTakeRate = new TtPoiTakeRate(); - ttPoiTakeRate.setId(planId); - ttPoiTakeRate.updateTenantInfo(tenantInfo); - ttPoiTakeRate.setType(EnumCpsPlanType.COMMON.getCode()); - ttPoiTakeRate.setStatus(status); - this.saveorupdate(ttPoiTakeRate); - return new ResultData(); - }else{ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); - } - } catch (WxErrorException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public ResultData poiTakeRate(TenantEntity tenantInfo, Long couponId, String douyinId, Integer takeRate, Integer status) { - WxCoupon wxCoupon = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId()); + public ResultData saveOrientedPlan(TtPoiTakeRate record) { + WxCoupon wxCoupon = wxCouponMapper.selectById(record.getCouponId(), record.getTenantId()); if(wxCoupon == null){ return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); } - if(wxCoupon.getSalePrice() == 0 || wxCoupon.checkIsCard()){ + if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); } try { int rateMin = getRateMin(); - if(takeRate.intValue() < rateMin){ + if(record.getTakeRate() < rateMin){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率低于最小值("+rateMin+")"); } int rateMax = getRateMax(wxCoupon); - if(takeRate.intValue() > rateMax){ + if(record.getTakeRate() > rateMax){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率超过最大值("+rateMax+")"); } + Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); + TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record); + Long returnPlanId = null; + PoiOrientedPlan poiPlan = new PoiOrientedPlan(); + if(record.getId() != null){ + poiPlan.setPlanId(record.getId()); + this.poiOrientedPlanDeleteTalent(ttWebService,record); + }else{ + record.setDouyinId(JSON.toJSONString(record.getDouyinIdList())); + poiPlan.setPlanName(record.getName()); + } + poiPlan.setMerchantPhone(record.getMerchantPhone()); + if(record.getDouyinIdList() != null && !record.getDouyinIdList().isEmpty()){ + poiPlan.setDouyinIdList(record.getDouyinIdList()); + } + List productList = new ArrayList<>(); + PoiOrientedPlan.ProductRate product = new PoiOrientedPlan.ProductRate(); + product.setProductId(spu_id); + product.setCommissionRate(record.getTakeRate()); + productList.add(product); + poiPlan.setProductList(productList); + + if(EnumCpsPlanContentType.LIVE.getCode().equals(record.getContentType())){ + returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan); + }else if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){ + poiPlan.setStartTime(record.getStartTime().getTime()/1000); + poiPlan.setEndTime(record.getEndTime().getTime()/1000); + if(poiPlan.getPlanId() == null){ + poiPlan.setCommissionDuration(record.getCommissionDuration()); + } + returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan); + }else{ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"带货场景错误"); + } + if(returnPlanId != null){ + if(record.getId() == null){ + record.setId(returnPlanId); + }else{ + record.setName(null); + record.setCommissionDuration(null); + } + record.setType(EnumCpsPlanType.DIRECTIONAL.getCode()); + this.saveorupdate(record); + return new ResultData(returnPlanId); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未获取到计划ID"); + } - PoiTakeRate poiTakeRate = new PoiTakeRate(); - poiTakeRate.setSpuExtId(couponId.toString()); - poiTakeRate.setDouyinId(douyinId); - poiTakeRate.setTakeRate(takeRate); - poiTakeRate.setStatus(status); - - String spu_id = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiTakeRate(poiTakeRate); - if(StringUtils.isNotBlank(spu_id) && spu_id.equals(ttCouponChannelPoi.getSpuId())){ - TtPoiTakeRate ttPoiTakeRate = new TtPoiTakeRate(); - ttPoiTakeRate.updateTenantInfo(tenantInfo); - ttPoiTakeRate.setCouponId(couponId); - ttPoiTakeRate.setType(EnumCpsPlanType.DIRECTIONAL.getCode()); - ttPoiTakeRate.setDouyinId(douyinId); - ttPoiTakeRate.setTakeRate(takeRate); - ttPoiTakeRate.setStatus(status); - this.saveorupdate(ttPoiTakeRate); + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + /** + * 删除定向计划里的达人,并处理达人数据 + * 只能一个个删除,有可能删除失败 + * @param ttWebService + * @param takeRate + * @return + */ + private void poiOrientedPlanDeleteTalent(TtWebService ttWebService,TtPoiTakeRate takeRate){ + if(takeRate == null || takeRate.getId() == null + || takeRate.getDouyinIdList() == null || takeRate.getDouyinIdList().isEmpty()){ + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); + } + TtPoiTakeRate oldTakeRate = ttPoiTakeRateMapper.selectById(takeRate.getId(), takeRate.getTenantId()); + if(oldTakeRate == null || StringUtils.isBlank(oldTakeRate.getDouyinId())){ + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); + } + List oldDouyinIdList = JSONObject.parseArray(oldTakeRate.getDouyinId(), String.class); + List newDouyinIdList = takeRate.getDouyinIdList(); + + List addDouyinIdList = new ArrayList<>(); + for (String douyinId:newDouyinIdList) { + if(!oldDouyinIdList.contains(douyinId)){ + addDouyinIdList.add(douyinId); + } + } + List delDouyinIdList = new ArrayList<>(); + for (String douyinId:oldDouyinIdList) { + if(!newDouyinIdList.contains(douyinId)){ + try { + boolean b = ttWebService.getPoiPlanService().poiOrientedPlanDeleteTalent(oldTakeRate.getId(), douyinId); + delDouyinIdList.add(douyinId); + } catch (WxErrorException e) { + e.printStackTrace(); + logger.error("定向计划删除达人失败"+oldTakeRate.getId()+"del--"+douyinId); + } + } + } + if(!delDouyinIdList.isEmpty()){ + oldDouyinIdList.removeAll(delDouyinIdList); + } + TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); + updTakeRate.updateTenantInfo(oldTakeRate); + updTakeRate.setId(oldTakeRate.getId()); + updTakeRate.setDouyinId(JSON.toJSONString(oldDouyinIdList)); + ttPoiTakeRateMapper.updateById(updTakeRate); + + if(!addDouyinIdList.isEmpty()){ + oldDouyinIdList.addAll(addDouyinIdList); + takeRate.setDouyinId(JSON.toJSONString(oldDouyinIdList)); + takeRate.setDouyinIdList(addDouyinIdList); + }else{ + takeRate.setDouyinIdList(null); + } + } + + @Override + public ResultData poiPlanUpdateStatus(TtPoiTakeRate record) { + try { + boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanUpdateStatus(record.getId(), record.getStatus()); + if(b){ + TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); + updTakeRate.setId(record.getId()); + updTakeRate.updateTenantInfo(record); + updTakeRate.setType(EnumCpsPlanType.COMMON.getCode()); + updTakeRate.setStatus(record.getStatus()); + updTakeRate.setUpdateDate(new Date()); + ttPoiTakeRateMapper.updateById(updTakeRate); return new ResultData(); }else{ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"设置达人分佣错误"); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); } } catch (WxErrorException e) { e.printStackTrace(); @@ -624,8 +747,24 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public PageInfo takeRateListAsPage(TtPoiTakeRate record, Integer pageNum, Integer pageSize) { - return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> ttPoiTakeRateMapper.findList(record)); + public ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record) { + try { + boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiOrientedPlanUpdateStatus(record.getId(), record.getStatus()); + if(b){ + TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); + updTakeRate.setId(record.getId()); + updTakeRate.updateTenantInfo(record); + updTakeRate.setStatus(record.getStatus()); + updTakeRate.setUpdateDate(new Date()); + ttPoiTakeRateMapper.updateById(updTakeRate); + return new ResultData(); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); + } + } catch (WxErrorException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } } @Override @@ -655,9 +794,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public TtPoiTakeRate selectByCoupon(TenantEntity tenantInfo, Long couponId,Integer planType, String douyinId) { - return ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId, - planType,douyinId); + public TtPoiTakeRate selectByCoupon(TenantEntity tenantInfo, Long couponId,Integer planType) { + return ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId, planType); } /** @@ -676,7 +814,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } - TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId,EnumCpsPlanType.ALL.getCode(),null); + TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantInfo.getTenantId(), couponId,EnumCpsPlanType.ALL.getCode()); Map map = new HashMap<>(); if(ttPoiTakeRate != null){ map.put("mallRate",ttPoiTakeRate.getTakeRate()); @@ -745,7 +883,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { if(wxCoupon.getSalePrice() == 0 || wxCoupon.checkIsCard()){ throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); } - TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(wxCoupon.getTenantId(), wxCoupon.getId(),EnumCpsPlanType.ALL.getCode(),null); + TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(wxCoupon.getTenantId(), wxCoupon.getId(),EnumCpsPlanType.ALL.getCode()); Integer takeRate = null; if(ttPoiTakeRate != null){ takeRate = ttPoiTakeRate.getTakeRate(); @@ -822,17 +960,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { private int saveorupdate(TtPoiTakeRate takeRate){ TtPoiTakeRate ttPoiTakeRate = null; - if(EnumCpsPlanType.DIRECTIONAL.getCode().equals(takeRate.getType())){ - ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(takeRate.getTenantId(), takeRate.getCouponId(), - takeRate.getType(),takeRate.getDouyinId()); - }else if(EnumCpsPlanType.COMMON.getCode().equals(takeRate.getType())){ + if(EnumCpsPlanType.COMMON.getCode().equals(takeRate.getType()) || EnumCpsPlanType.DIRECTIONAL.getCode().equals(takeRate.getType())){ ttPoiTakeRate = ttPoiTakeRateMapper.selectById(takeRate.getId(), takeRate.getTenantId()); if(ttPoiTakeRate == null){ takeRate.setStatus(EnumCpsPlanStatus.ING.getCode()); } }else if(EnumCpsPlanType.ALL.getCode().equals(takeRate.getType())){ - ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(takeRate.getTenantId(), takeRate.getCouponId(), - takeRate.getType(),null); + ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(takeRate.getTenantId(), takeRate.getCouponId(), takeRate.getType()); if(ttPoiTakeRate == null){ takeRate.setStatus(EnumCpsPlanStatus.ING.getCode()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 576015323..220df7b17 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -909,105 +909,109 @@ public class WxBillAllServiceImpl implements WxBillAllService { result.put("endtime", " "); } Integer filterHasPay = wxBillAll.getFilterHasPay(); - List list = list(wxBillAll); - if (!list.isEmpty()) { - //租金总额 - Long rentSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //物业总额 - Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //押金总额 - Long depositSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || - b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //水费 - Long waterSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //电费 - Long powerSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //空调费 - Long airConditioningSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //其他费用 - Long otherSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) - .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); - //押金明细 - StringBuffer depositDetail = new StringBuffer(); - list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || - b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) - .forEach(b -> { + + //租金 + wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); + List rentList = this.list(wxBillAll); + Long rentSum = 0l; + if(!rentList.isEmpty()){ + rentSum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + } + //物业 + wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); + List propertyList = this.list(wxBillAll); + Long propertySum = 0l; + if(!propertyList.isEmpty()){ + propertySum = propertyList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + } + //押金 + List depositList = new ArrayList<>(); + //租赁押金 + wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); + List rentDepositList = this.list(wxBillAll); + depositList.addAll(rentDepositList); + //物业押金 + wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); + List propertyDepositList = this.list(wxBillAll); + depositList.addAll(propertyDepositList); + //其他押金 + wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); + List otherDepositList = this.list(wxBillAll); + depositList.addAll(otherDepositList); + + Long depositSum = 0l; + StringBuffer depositDetail = new StringBuffer();//押金明细 + if(!depositList.isEmpty()){ + depositSum = depositList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + depositList.stream().forEach(b -> { BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); }); - - //其他费用明细 - StringBuffer otherDetail = new StringBuffer(); - list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) - .forEach(b -> { + } + //水电空调费 + wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); + List waterPowerAirList = this.list(wxBillAll); + Long waterSum = 0l, powerSum = 0l, airConditioningSum = 0l; + if (!waterPowerAirList.isEmpty()) { + waterSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + powerSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + airConditioningSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + } + //其他费用 + wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); + List otherList = this.list(wxBillAll); + Long otherSum = 0l; + StringBuffer otherDetail = new StringBuffer();//其他费用明细 + if(!otherList.isEmpty()){ + otherSum = otherList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); + otherList.stream().forEach(b -> { BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); }); - //总计 - Long summarySum = rentSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; - BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); - String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); - - result.put("rent", rent.toPlainString()); - result.put("property", property.toPlainString()); - result.put("deposit", deposit.toPlainString()); - result.put("water", water.toPlainString()); - result.put("power", power.toPlainString()); - result.put("airConditioning", airConditioning.toPlainString()); - result.put("other", other.toPlainString()); - result.put("summary", summary.toPlainString()); - result.put("summaryUpper", summaryUpper); - - result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); - result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); - - WxMerchantDto wxMerchantDto = new WxMerchantDto(); - wxMerchantDto.setId(wxBillAll.getMerchantId()); - wxMerchantDto.updateTenantInfo(wxMall); - PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); - List listCVo = pageInfo.getList(); - WxMerchantVo wxMerchantVo = listCVo.get(0); - result.put("merchant", wxMerchantVo.getMerchantName()); - WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() - .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); - if (wxShopVo != null) { - String linkPerson = wxShopVo.getLinkPerson(); - String linkPhone = wxShopVo.getLinkPhone(); - result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); - result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); - } else { - result.put("linkPerson", " "); - result.put("linkPhone", " "); - } - + } + //总计 + Long summarySum = rentSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; + BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); + + result.put("rent", rent.toPlainString()); + result.put("property", property.toPlainString()); + result.put("deposit", deposit.toPlainString()); + result.put("water", water.toPlainString()); + result.put("power", power.toPlainString()); + result.put("airConditioning", airConditioning.toPlainString()); + result.put("other", other.toPlainString()); + result.put("summary", summary.toPlainString()); + result.put("summaryUpper", summaryUpper); + + result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); + result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); + + WxMerchantDto wxMerchantDto = new WxMerchantDto(); + wxMerchantDto.setId(wxBillAll.getMerchantId()); + wxMerchantDto.updateTenantInfo(wxMall); + PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); + List listCVo = pageInfo.getList(); + WxMerchantVo wxMerchantVo = listCVo.get(0); + result.put("merchant", wxMerchantVo.getMerchantName()); + WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() + .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); + if (wxShopVo != null) { + String linkPerson = wxShopVo.getLinkPerson(); + String linkPhone = wxShopVo.getLinkPhone(); + result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); + result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); } else { - result.put("merchant", " "); - result.put("rent", " "); - result.put("property", " "); - result.put("deposit", " "); - result.put("water", " "); - result.put("power", " "); - result.put("airConditioning", " "); - result.put("other", " "); - result.put("summary", " "); - result.put("summaryUpper", " "); - - result.put("depositDetail", " "); - result.put("otherDetail", " "); - result.put("linkPerson", " "); result.put("linkPhone", " "); } @@ -1022,6 +1026,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); } + @Override public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java index 1999aaa9a..1b56257bf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java @@ -1,5 +1,11 @@ package com.iformall.service.impl; +import com.github.binarywang.wxpay.bean.businesscircle.MemberCardAuthorizeResult; +import com.github.binarywang.wxpay.bean.businesscircle.ParkingNotifyRequest; +import com.github.binarywang.wxpay.bean.businesscircle.PointsCommitStatusResult; +import com.github.binarywang.wxpay.bean.businesscircle.PointsNotifyRequest; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -7,10 +13,16 @@ import com.iformall.common.IdWorker; import com.iformall.common.ResultData; import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterAddCreditMsg; +import com.iformall.domain.po.msg.AfterBusinessCreditMsg; +import com.iformall.domain.po.msg.AfterCarInOutMsg; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBusinessCircleOrderMapper; +import com.iformall.mq.MqBaseProducer; import com.iformall.service.*; +import com.iformall.utils.DateUtils; +import com.iformall.utils.MaUtil; import com.iformall.utils.RedisLock; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -23,8 +35,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Locale; @Service public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderService { @@ -55,10 +69,19 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe WxCreditHistoryService creditHistoryService; @Autowired - WxCallBackService wxCallBackService; + WxCouponSendService wxCouponSendService; @Autowired - WxCouponSendService wxCouponSendService; + WxAppinfoService wxAppinfoService; + + @Autowired + WxPayAccountService wxPayAccountService; + + @Autowired + MqBaseProducer mqBaseProducer; + + @Autowired + MaUtil maUtil; @Override @@ -124,8 +147,11 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe WxBusinessCircleOrder byTransactionId = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); if(byTransactionId != null){ logger.error("--Wx商圈付款--订单消息已存在---byTransactionId="+byTransactionId.getTransactionId()); + //同步积分状态 + this.sendsyncNotifyPointsMsg(record,byTransactionId.getId()); redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); + return new ResultData(); +// throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); }else { Date now = new Date(); final IdWorker idWorker = IdWorker.get(); @@ -155,7 +181,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe } } if(record.getCUserId() == null){ - WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(),null,null,null); + WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(),null,null,null,null); if(byPhone != null){ record.setCUserNickName(byPhone.getNickName()); record.setCUserPhone(byPhone.getPhone()); @@ -213,10 +239,8 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe record.setPointsUpdateTime(creditHistory.getCreateDate()); this.updatePoints(record); - if(StringUtils.isNotBlank(record.getNoticeId())){ - //同步积分 - wxCallBackService.notifyPoints(record); - } + //同步积分 + this.sendsyncNotifyPointsMsg(record,record.getId()); } redisLock.unlock(lockKey, timeStr); return new ResultData(creditNum); @@ -366,6 +390,52 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe wxBusinessCircleOrderMapper.updatePoints(record); } + @Override + public void notifyPoints(WxBusinessCircleOrder record){ + if(EnumYesOrNo.YES.getCode().equals(record.getIsPointsNotify())){ + logger.info("该商圈订单已同步积分"+record.getId()); + return; + } + + WxPayService wxPayService = wxPayAccountService.getWxPayService(record.getTenantId()); + + PointsNotifyRequest request = new PointsNotifyRequest(); + request.setSubMchid(wxPayService.getConfig().getSubMchId()); + request.setTransactionId(record.getTransactionId()); + request.setAppid(wxPayService.getConfig().getAppId()); + request.setOpenid(record.getOpenid()); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'+'mm:ss", Locale.CHINA); + if(record.getIncreasedPoints() != null && record.getIncreasedPoints() > 0 ){ + request.setEarnPoints(true); + request.setIncreasedPoints(record.getIncreasedPoints()); + + request.setPointsUpdateTime(sdf.format(record.getPointsUpdateTime())); + }else{ + request.setEarnPoints(false); + request.setIncreasedPoints(0); + request.setPointsUpdateTime(sdf.format(new Date())); + request.setNoPointsRemarks("该订单不参与积分活动"); + } + try { + String result = wxPayService.getBusinessCircleService().notifyPoints(request); + logger.info("微信商圈同步积分请求结果----"+result); + record.setUpdateTime(new Date()); + this.updateIsPointsNotify(record); + } catch (WxPayException e) { + e.printStackTrace(); + } + } + + @Override + public void sendsyncNotifyPointsMsg(TenantEntity tenantEntity, Long businessCircleOrderId) { + AfterBusinessCreditMsg msg = new AfterBusinessCreditMsg(); + msg.updateTenantInfo(tenantEntity); + msg.setMsgType(EnumMsgRecordType.AFTER_BUSINESS_CREDIT.getCode()); + msg.setBusinessCircleOrderId(businessCircleOrderId); + mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); + } + @Override public void updateIsPointsNotify(WxBusinessCircleOrder record) { record.setUpdateTime(new Date()); @@ -390,5 +460,104 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe return sumCircleRefundAmount==null?0:sumCircleRefundAmount; } + @Override + public ResultData syncauthorizeState(TenantEntity tenantEntity, String openid) { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); + MemberCardAuthorizeResult authorizations = wxPayService.getBusinessCircleService().getAuthorizations(openid); + EnumBusinessCircleAuthorizeState authorizeState = EnumBusinessCircleAuthorizeState.getEnum(authorizations.getAuthorizeState()); + if(!EnumBusinessCircleAuthorizeState.UNAUTHORIZED.equals(authorizeState)){ + WxCUser updCuser = new WxCUser(); + updCuser.updateTenantInfo(tenantEntity); + updCuser.setOpenId(authorizations.getOpenid()); + updCuser.setAuthorizeState(authorizeState.getCode()); + String formaStr = "yyyy-MM-dd'T'HH:mm:ss'+'mm:ss"; + updCuser.setAuthorizeTime(DateUtils.stringToDate(authorizations.getAuthorizeTime(),formaStr)); + updCuser.setDeauthorizeTime(DateUtils.stringToDate(authorizations.getDeauthorizeTime(),formaStr)); + wxCUserService.updateAuthorizeStateByOpenId(updCuser); + } + return new ResultData(authorizeState); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData getPointsCommitStatus(TenantEntity tenantEntity, String openId) { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); + PointsCommitStatusResult pointsCommitStatus = wxPayService.getBusinessCircleService().getPointsCommitStatus(payAccount.getBrandid(), openId); + return new ResultData(pointsCommitStatus); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public ResultData syncParkings(TenantEntity tenantEntity, String openId, String plate_number, String state, Date time) { + + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); + ParkingNotifyRequest request = new ParkingNotifyRequest(); + request.setBrandid(payAccount.getBrandid()); + request.setOpenid(openId); + request.setPlateNumber(plate_number); + request.setState(state); + String formaStr = "yyyy-MM-dd'T'HH:mm:ss'+'mm:ss"; + request.setTime(DateUtils.date2String(time,formaStr)); + + wxPayService.getBusinessCircleService().notifyParkings(request); + return new ResultData(); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public void sendSyncParkingsMsg(TenantEntity tenantEntity, Long carCmdLogId) { + //停车出入场通知 todo +// AfterCarInOutMsg msg = new AfterCarInOutMsg(); +// msg.updateTenantInfo(tenantEntity); +// msg.setMsgType(EnumMsgRecordType.AFTER_ADD_CREDIT.getCode()); +// msg.setCarCmdLogId(carCmdLogId); +// mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index 6fa0aa893..c91bfc60a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -672,7 +672,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc @Override - public WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName, Integer sex, String avatarUrl) { + public WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName,String name, Integer sex, String avatarUrl) { if (StringUtils.isBlank(phone)) return null; @@ -682,6 +682,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc basicInfo.setTenantId("," + tenantEntity.getTenantId() + ","); basicInfo.setFinalTenantId(tenantEntity.getFinalTenantId()); basicInfo.setPhone(phone); + basicInfo.setName(name); basicInfo.setNickName(nickName); basicInfo.setSex(sex); basicInfo.setAvatarUrl(avatarUrl); @@ -690,6 +691,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); wxCUserBasicInfo.setId(basicInfo.getId()); wxCUserBasicInfo.setFinalTenantId(basicInfo.getFinalTenantId()); + wxCUserBasicInfo.setName(name); wxCUserBasicInfo.setNickName(nickName); wxCUserBasicInfo.setSex(sex); wxCUserBasicInfo.setAvatarUrl(avatarUrl); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java index 89353354b..6b9656e9c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java @@ -346,4 +346,9 @@ public class WxCUserServiceImpl implements WxCUserService { wxCUserMapper.updateMsgCount(user); } + @Override + public void updateAuthorizeStateByOpenId(WxCUser updCuser) { + wxCUserMapper.updateAuthorizeStateByOpenId(updCuser); + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCallBackServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCallBackServiceImpl.java deleted file mode 100644 index 9f1f0058f..000000000 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCallBackServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.iformall.service.impl; - -import com.github.binarywang.wxpay.bean.businesscircle.PointsNotifyRequest; -import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.WxPayService; -import com.iformall.domain.po.WxBusinessCircleOrder; -import com.iformall.mapper.WxBusinessCircleOrderMapper; -import com.iformall.service.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -@Service -public class WxCallBackServiceImpl implements WxCallBackService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'+'mm:ss", Locale.CHINA); - - @Autowired - WxPayAccountService wxPayAccountService; - - @Autowired - WxBusinessCircleOrderMapper wxBusinessCircleOrderMapper; - - /** - * - * @param record - */ - public void notifyPoints(WxBusinessCircleOrder record){ - - WxPayService wxPayService = wxPayAccountService.getWxPayService(record.getTenantId()); - - PointsNotifyRequest request = new PointsNotifyRequest(); - request.setSubMchid(wxPayService.getConfig().getSubMchId()); - request.setTransactionId(record.getTransactionId()); - request.setAppid(wxPayService.getConfig().getAppId()); - request.setOpenid(record.getOpenid()); - request.setEarnPoints(true); - request.setIncreasedPoints(record.getIncreasedPoints()); - request.setPointsUpdateTime(sdf.format(new Date())); - - try { - String result = wxPayService.getBusinessCircleService().notifyPoints(request); - logger.info("微信商圈同步积分请求结果----"+result); - record.setUpdateTime(new Date()); - wxBusinessCircleOrderMapper.updateIsPointsNotify(record); - } catch (WxPayException e) { - e.printStackTrace(); - } - } - -} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java index f59c6c914..a5edd7434 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java @@ -325,6 +325,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { wxCouponChannel.setEndTime(endTime); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponId(couponId); + wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setType(wxCoupon.getType()); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); wxCouponChannel.updateTenantInfo(wxCoupon); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java index 88e6d4c33..82baf1d27 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java @@ -4,8 +4,10 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.WxCarCmdLog; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.enums.EnumCarCmd; import com.iformall.mapper.WxCarCmdLogMapper; import com.iformall.mapper.WxMallMapper; +import com.iformall.service.WxBusinessCircleOrderService; import com.iformall.service.WxCarCmdLogService; import com.iformall.service.WxMallService; import org.apache.commons.lang3.StringUtils; @@ -31,6 +33,9 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { @Autowired WxMallService wxMallService; + @Autowired + WxBusinessCircleOrderService wxBusinessCircleOrderService; + @Override public PageInfo listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize) { @@ -49,11 +54,22 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); wxCarCmdLogMapper.insert(record); + this.afterCarInOrOut(record); } else { wxCarCmdLogMapper.updateById(record); } } + private void afterCarInOrOut(WxCarCmdLog record){ + if(StringUtils.isBlank(record.getPlateNumber())){ + return; + } + if(EnumCarCmd.getCarIn().contains(record.getCmdType()) + || EnumCarCmd.getCarOut().contains(record.getCmdType())){ + wxBusinessCircleOrderService.sendSyncParkingsMsg(record,record.getId()); + } + } + @Override public void deleteById(Long id,String tenantId) { wxCarCmdLogMapper.deleteById(id,tenantId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java index 582667727..7e0638615 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java @@ -54,7 +54,10 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { WxCouponMerchantMapper wxCouponMerchantMapper; @Autowired - WxPayAccountMapper payAccountMapper; + WxAppinfoService wxAppinfoService; + + @Autowired + WxPayAccountService wxPayAccountService; @Autowired WxOrderMapper wxOrderMapper; @@ -117,14 +120,13 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 3. get pay account - WxPayAccount payAccount = null; - WxPayAccount payAccountQ = new WxPayAccount(); - payAccountQ.updateTenantInfo(record); - try { - payAccount = payAccountMapper.selectOne(new QueryWrapper(payAccountQ)); - } catch (Exception e) { - logger.error("获取payAccount error: " + record.getTenantId()); - return new ResultData(ErrorCode.DB_FAIL.getCode(), "获取payAccount失败"); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cardInfo.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); } // 4. 扣减计算 @@ -651,14 +653,13 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 3. get pay account - WxPayAccount payAccount = null; - WxPayAccount payAccountQ = new WxPayAccount(); - payAccountQ.updateTenantInfo(record); - try { - payAccount = payAccountMapper.selectOne(new QueryWrapper(payAccountQ)); - } catch (Exception e) { - logger.error("获取payAccount error: " + record.getTenantId()); - throw new MallinkException(ErrorCode.SYS_MCH_NOT_FOUND); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cardInfo.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); } // 查询是否有已有的 @@ -748,14 +749,13 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 3. get pay account - WxPayAccount payAccount = null; - WxPayAccount payAccountQ = new WxPayAccount(); - payAccountQ.updateTenantInfo(record); - try { - payAccount = payAccountMapper.selectOne(new QueryWrapper(payAccountQ)); - } catch (Exception e) { - logger.error("获取payAccount error: " + record.getTenantId()); - throw new MallinkException(ErrorCode.SYS_MCH_NOT_FOUND); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cardInfo.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); } // 4. 增加计算 @@ -838,14 +838,13 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 3. get pay account - WxPayAccount payAccount = null; - WxPayAccount payAccountQ = new WxPayAccount(); - payAccountQ.updateTenantInfo(record); - try { - payAccount = payAccountMapper.selectOne(new QueryWrapper(payAccountQ)); - } catch (Exception e) { - logger.error("获取payAccount error: " + record.getTenantId()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "获取payAccount失败"); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cardInfo.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); } // 3. 补贴 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 17bf0851f..267d08bf5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -639,6 +639,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setBeginTime(beginTime); wxCouponChannel.setCouponId(couponid); + wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setType(wxCoupon.getType()); wxCouponChannel.setTargetAd(channelId); wxCouponChannel.updateTenantInfo(tenantEntity); @@ -826,7 +827,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { updChannel.setId(wxCouponChannel.getId()); updChannel.updateTenantInfo(wxCouponChannel); updChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - updChannel.setTtSpuId(ttCouponChannelPoi.getSpuId()); updChannel.setShowBeginTime(date); updChannel.setUpdateDate(date); wxCouponChannelMapper.updateById(updChannel); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index f8908a378..3c05afb9d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -1300,9 +1300,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL); } merchantId = bUser.getMerchantId(); - - //TODO 111111111查询核销商户的收款账户有没有配置 - //couponOrder.getm } if(merchantId != null){ @@ -2186,7 +2183,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { int price = 0; for (TenantEntity te:tenantEntitys) { wxCouponOrder.updateTenantInfo(te); - price += wxCouponOrderMapper.queryPriceTotal(wxCouponOrder); + Integer mallPrice = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder); + if(mallPrice != null){ + price += mallPrice; + } } wxCouponOrder.updateTenantInfo(tenantEntity); return price; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index da2c017df..1bd98f61c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -33,6 +33,8 @@ import com.iformall.service.excel.WxPressDataExporter; import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.service.share.PayShareAdapterService; +import com.iformall.utils.Constant; +import com.iformall.utils.DateUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -102,6 +104,9 @@ public class WxCouponServiceImpl implements WxCouponService { @Autowired WxPayAccountMapper payAccountMapper; + + @Autowired + WxPayAccountService payAccountService; @Autowired WxCouponOrderMapper wxCouponOrderMapper; @@ -131,6 +136,8 @@ public class WxCouponServiceImpl implements WxCouponService { @Autowired private TtGoodsCategoryService ttGoodsCategoryService; + @Autowired + private TtMerchantPoiService ttMerchantPoiService; @Autowired WxAppinfoService wxAppinfoService; @@ -353,7 +360,7 @@ public class WxCouponServiceImpl implements WxCouponService { @Override @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) public ResultData saveOrUpdate(WxCoupon record) { - + //金额处理 if (StringUtils.isNotEmpty(record.getSalePriceStr())) { record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); } @@ -375,16 +382,36 @@ public class WxCouponServiceImpl implements WxCouponService { if (StringUtils.isNotEmpty(record.getSubsidyNumStr())) { record.setSubsidyNum(new BigDecimal(record.getSubsidyNumStr()).multiply(new BigDecimal(100)).intValue()); } -// if (EnumCouponType.COUPON_DOUYIN.getCode().equals(record.getType())){ -// if(StringUtils.isBlank(record.getItemGroup())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"团购详情不能为"); -// } -// try{ -// JSON.parseArray(record.getItemGroup()); -// }catch(Exception e){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"团购详情格式不正确"); -// } -// } + //补贴处理 + if(record.getSubsidyType() == null){ + record.setSubsidyType(EnumCouponSubsidyType.NO_SUBSIDY.getCode()); + } + if(record.getSubsidyNum() == null || record.getSubsidyNum().intValue() == 0){ + record.setSubsidyType(EnumCouponSubsidyType.NO_SUBSIDY.getCode()); + record.setSubsidyNum(0); + } + if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(record.getSubsidyType())) { + // 微信 立减 + if (record.getSubsidyNum() > record.getSalePrice()) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); + } + } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(record.getSubsidyType())) { + // 线下补贴 + int subsidy_num = record.getPrice() - record.getSalePrice(); + if (record.getSubsidyNum() > subsidy_num) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); + } + } else if (EnumCouponSubsidyType.WECHAT_MCHPAY.getCode().equals(record.getSubsidyType())) { + // TODO 微信转账到银行卡 + + } + + if (EnumCouponContentType.HTML.getCode().equals(record.getContentType())) { + if (StringUtils.isEmpty(record.getHtml())) { + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写富文本内容"); + } + } + if (StringUtils.isBlank(record.getCoverPicture())) { List strList = new ArrayList(); if (StringUtils.isNotBlank(record.getCoverImg())) { @@ -405,108 +432,50 @@ public class WxCouponServiceImpl implements WxCouponService { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写有效时间类型"); } if(!this.validCouponDate(record)) { - return new ResultData(ResultData.ERROR,"券有效使用日期必须在30天以内。"); + return new ResultData(ResultData.ERROR,"券有效结束日期必须在30天以内。"); } } - if(EnumCouponType.COUPON_GIFT.getCode().equals(record.getType()) && EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(record.getValidType())){ - //券礼包时间判断 - WxCoupon couponQ = new WxCoupon(); - couponQ.updateTenantInfo(record); - List longs = JSON.parseArray(record.getGiftList(), Long.class); - if(longs != null && longs.size() > 0){ - couponQ.setIds(longs); - List list = wxCouponMapper.findList(couponQ); - if(list != null && list.size() > 0){ - for (WxCoupon wc:list) { - if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wc.getStatus())){ - return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF_GIFT); - } - if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(wc.getValidType()) && wc.getValidEndDate().before(record.getValidEndDate())){ - return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR_GIFT); - } - } - }else{ - return new ResultData(ErrorCode.COUPON_IS_EMPTY_GIFT); - } - }else{ - return new ResultData(ErrorCode.COUPON_IS_EMPTY_GIFT); - } + ResultData giftResult = this.validGiftCouponDate(record); + if(Result.SUCCESS != giftResult.code){ + return giftResult; } - if (EnumCouponContentType.HTML.getCode().equals(record.getContentType())) { - if (StringUtils.isEmpty(record.getHtml())) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写富文本内容"); - } + ResultData receiverResult = checkCouponMerchantReceiver(record); + if(Result.SUCCESS != receiverResult.code){ + return receiverResult; } + List merchantList = (List) receiverResult.data; - ResultData resultData = checkCouponMerchantReceiver(record); - if(resultData.code != 200){ - return resultData; + if(merchantList.size() > 1){ + record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); + }else{ + record.setBusiness(merchantList.get(0).getBusinessId()); + record.setSubBusiness(merchantList.get(0).getSubBusinessId()); } + List merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); final IdWorker idWorker = IdWorker.get(); if (record.getId() == null) { - - // check 卡券补贴设置 - Integer subsidyType = record.getSubsidyType(); - Integer subsidyNum = record.getSubsidyNum(); - if(subsidyType != null && subsidyNum != null) { - if (subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { - // 微信 立减 - if (subsidyNum > record.getSalePrice()) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); - } - } else if (subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { - // 线下补贴 - int subsidy_num = record.getPrice() - record.getSalePrice(); - if (subsidyNum > subsidy_num) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); - } - } else if (subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { - // TODO 微信转账到银行卡 - - } - } - record.setId(idWorker.nextId()); - if (merchantParamList != null && merchantParamList.size() > 0) { - List wxCouponMerchantDtoList = new ArrayList<>(); - merchantParamList.forEach(merchantParam -> { - WxCouponMerchant cm = new WxCouponMerchant(); - WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); - cm.setId(idWorker.nextId()); - cm.updateTenantInfo(record); - cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); - cm.setParameter(wxCouponMerchantDto.getParameter()); - cm.setProductId(record.getId()); - cm.setCreateDate(new Date()); - cm.setUpdateDate(new Date()); - cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - wxCouponMerchantDtoList.add(wxCouponMerchantDto); - wxCouponMerchantMapper.insert(cm); - }); - if (wxCouponMerchantDtoList.stream() - .mapToInt(WxCouponMerchantDto::getBusiness).distinct().count() > 1) { - record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); - } else if (wxCouponMerchantDtoList.size() > 1){ - record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness()); - } else { - record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness()); - record.setSubBusiness(wxCouponMerchantDtoList.get(0).getSubBusiness()); - } - - } else{ - if (!EnumCouponType.COUPON_GIFT.getCode().equals(record.getType())){ - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); - } - record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); - } + merchantParamList.forEach(merchantParam -> { + WxCouponMerchant cm = new WxCouponMerchant(); + WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); + cm.setId(idWorker.nextId()); + cm.updateTenantInfo(record); + cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); + cm.setParameter(wxCouponMerchantDto.getParameter()); + cm.setProductId(record.getId()); + cm.setCreateDate(new Date()); + cm.setUpdateDate(new Date()); + cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); + wxCouponMerchantMapper.insert(cm); + }); if (record.getPasswordSupport() != null && record.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) { - // 如果用户启用卡密,生成数据并保存 + // todo 生成卡密无法修改, 调整 couponPasswordService.mkPasswords(record, record.getId(), record.getInventory()); } @@ -515,23 +484,7 @@ public class WxCouponServiceImpl implements WxCouponService { wxCouponMapper.insert(record); } else { - if(EnumCouponSendType.GIFT.getCode().equals(record.getSendType())){ - //券礼包子券类型判断时间 - WxCoupon couponQ = new WxCoupon(); - couponQ.updateTenantInfo(record); - couponQ.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); - couponQ.setGiftList(Long.toString(record.getId())); - List couponList = wxCouponMapper.findCouponList(couponQ); - if(couponList != null && couponList.size() > 0){ - for (WxCoupon wc:couponList) { - if(EnumCouponType.COUPON_GIFT.getCode().equals(wc.getType()) - && EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(record.getValidType()) - && record.getValidEndDate().before(wc.getValidEndDate())){ - return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR_GIFT); - } - } - } - } + if(record.getInventory() != null && record.getRemainInventory() != null) { // 库存修改检查 WxCoupon oldCoupon = wxCouponMapper.selectById(record.getId(),record.getTenantId()); @@ -547,86 +500,44 @@ public class WxCouponServiceImpl implements WxCouponService { record.setInventory(oldCoupon.getInventory() + record.getRemainInventory() - oldCoupon.getRemainInventory()); } } - if (merchantParamList != null && merchantParamList.size() > 0) { - WxCouponMerchant cmParam = new WxCouponMerchant(); - cmParam.updateTenantInfo(record); - cmParam.setProductId(record.getId()); - List oldList = wxCouponMerchantMapper.findList(cmParam); - List wxCouponMerchantDtoList = new ArrayList<>(); - merchantParamList.stream().forEach(merchantParam -> { - WxCouponMerchant cm = new WxCouponMerchant(); - WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); - cm.updateTenantInfo(record); - cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); - cm.setProductId(record.getId()); - WxCouponMerchant rcm = wxCouponMerchantMapper.selectOne(new QueryWrapper<>(cm)); - if (rcm != null) { - rcm.setParameter(wxCouponMerchantDto.getParameter()); - rcm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - rcm.setUpdateDate(new Date()); - wxCouponMerchantMapper.updateById(rcm); - }else { - cm.setId(idWorker.nextId()); - cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - cm.setParameter(wxCouponMerchantDto.getParameter()); - cm.setCreateDate(new Date()); - cm.setUpdateDate(new Date()); - wxCouponMerchantMapper.insert(cm); - } - wxCouponMerchantDtoList.add(wxCouponMerchantDto); - oldList.removeIf( - old->old.getProductId().equals(record.getId()) && - old.getMerchantId().equals(wxCouponMerchantDto.getMerchantId())); - }); - - oldList.stream().forEach(old->{ - old.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_INVALID.getCode()); - old.setUpdateDate(new Date()); - wxCouponMerchantMapper.updateById(old); - }); - - if (wxCouponMerchantDtoList.stream() - .mapToInt(WxCouponMerchantDto::getBusiness).distinct().count() > 1) { - record.setBusiness(EnumBusiness.BUSINESS_ID6.getCode()); - } else if (wxCouponMerchantDtoList.size() > 1){ - record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness()); - } else { - record.setBusiness(wxCouponMerchantDtoList.get(0).getBusiness()); - record.setSubBusiness(wxCouponMerchantDtoList.get(0).getSubBusiness()); - } - } - if (record.getStatus() != null && - (record.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()))) { - - //下架所有投放频道 - wxCouponChannelService.updateStatusByCouponId(record.getId(), record, EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); - //下架所有场景投放 - wxCouponSendService.updateStatusByCouponId(record.getId(), record, EnumCouponSendStatus.INVALID.getCode()); - //下架所有已砍价券 - wxOrderService.updateStatusByPressCouponId(record.getId(), record, EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode()); - //下架所有相关广告 - wxScreenAdService.updateStatusByCouponId(record.getId(), record, EnumScreenAdStatus.INVALID.getCode()); - //下架拼团券 - wxOrderService.updateOrderGroupStatusByCouponId(record.getId(), record, EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); - // 卡下架后,转赠找不到卡相关信息,所以修改卡转赠状态为不可转赠 - wxCardInfoMapper.updateTransferStatusByCouponId(record.getId()); - // 卡券下架,未使用的卡密要下架 - couponPasswordMapper.disableByCouponId(record.getId()); + WxCouponMerchant cmParam = new WxCouponMerchant(); + cmParam.updateTenantInfo(record); + cmParam.setProductId(record.getId()); + List oldList = wxCouponMerchantMapper.findList(cmParam); + merchantParamList.stream().forEach(merchantParam -> { + WxCouponMerchant cm = new WxCouponMerchant(); + WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); + cm.updateTenantInfo(record); + cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); + cm.setProductId(record.getId()); + WxCouponMerchant rcm = wxCouponMerchantMapper.selectOne(new QueryWrapper<>(cm)); + if (rcm != null) { + rcm.setParameter(wxCouponMerchantDto.getParameter()); + rcm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); + rcm.setUpdateDate(new Date()); + wxCouponMerchantMapper.updateById(rcm); + }else { + cm.setId(idWorker.nextId()); + cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); + cm.setParameter(wxCouponMerchantDto.getParameter()); + cm.setCreateDate(new Date()); + cm.setUpdateDate(new Date()); + wxCouponMerchantMapper.insert(cm); + } + oldList.removeIf( + old->old.getProductId().equals(record.getId()) && + old.getMerchantId().equals(wxCouponMerchantDto.getMerchantId())); + }); + oldList.stream().forEach(old->{ + old.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_INVALID.getCode()); + old.setUpdateDate(new Date()); + wxCouponMerchantMapper.updateById(old); + }); - } record.setUpdateDate(new Date()); wxCouponMapper.updateById(record); - - try{ - if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(record.getStatus())){ - //同步抖音状态 - wxCouponChannelService.spuStatusSyncByCoupon(record,record.getId()); - } - }catch(Exception e){ - logger.error("send spuStatusSync error: " + e.getMessage()); - } } //清空缓存 @@ -636,101 +547,99 @@ public class WxCouponServiceImpl implements WxCouponService { private ResultData checkCouponMerchantReceiver(WxCoupon record){ List merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); -// if(EnumCouponType.COUPON_GIFT.getCode().equals(record.getType())){ -// return new ResultData(); -// } + if(merchantParamList == null || merchantParamList.isEmpty()){ - return new ResultData(); + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"所属商户为空"); + } + List merchantIds = new ArrayList<>(); + for (JSONObject o:merchantParamList) { + merchantIds.add(o.getLong("id")); + } + WxMerchant merchantQ = new WxMerchant(); + merchantQ.updateTenantInfo(record); + merchantQ.setIds(merchantIds); + List merchantList = wxMerchantService.findList(merchantQ); + if(merchantList.size() != merchantParamList.size()){ + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_EQUAL.getCode(),"所属商户信息异常"); + } + List badMerchant = merchantList.stream().filter(m -> !EnumMerchantStatus.VALID.getCode().equals(m.getStatus())).collect(toList()); + if(badMerchant != null && !badMerchant.isEmpty()){ + List badNames = badMerchant.stream().map(WxMerchant::getName).collect(toList()); + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),JSONArray.toJSONString(badNames)+"被停用"); } + if(record.getSalePrice() != null && record.getSalePrice() > 0) { - WxAppinfo cAppInfo = wxAppinfoService.getCouponAppInfo(record); + EnumAppPlat plat = EnumCouponType.getAppPlat(record.getType()); + EnumPayWay payWay = EnumAppPlat.getPayWay(plat); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(record,plat); if (cAppInfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } - EnumAppPlat plat = EnumAppPlat.WX; - EnumAppPlat platEnum = EnumAppPlat.getByCode(cAppInfo.getPlat()); - if (platEnum != null) { - plat = platEnum; - } - EnumPayWay payWay = EnumPayWay.PAY_WAY_WECHAT; - if(EnumAppPlat.TOUTIAO.equals(plat)){ - payWay = EnumPayWay.PAY_WAY_TT; - } - WxPayAccount payAccount = payAccountMapper.selectById(cAppInfo.getPayId()); if (payAccount == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } - EnumPayMchType payMchType = EnumPayMchType.TOTAL; - EnumPayShare isShare = EnumPayShare.NO; - EnumPayMchType payMchTypeEnum = EnumPayMchType.getEnum(payAccount.getMchType()); - if (payMchTypeEnum != null) { - payMchType = payMchTypeEnum; - } - if (EnumPayMchType.DIRECT.equals(payMchType)) { - isShare = EnumPayShare.NO; - } else { - EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); - if (paySHareEnum != null) { - isShare = paySHareEnum; + //判断商户是否匹配poi + if (EnumAppPlat.TOUTIAO.equals(plat)) { + List badPoiNames = new ArrayList(); + for (WxMerchant merchant:merchantList) { + TtMerchantPoi byId = ttMerchantPoiService.getById(merchant.getId()); + if(byId == null || !EnumSupplierMathStatus.match_success.getCode().equals(byId.getMatchStatus())){ + badPoiNames.add(merchant.getName()); + } + } + if(!badPoiNames.isEmpty()){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), JSONArray.toJSONString(badPoiNames)+"未匹配poi"); } } + EnumPayMchType payMchType = EnumPayMchType.getEnum(payAccount.getMchType()); + EnumPayShare isShare = EnumPayShare.getEnum(payAccount.getShare()); + PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); - List merchantIds = new ArrayList<>(); - for (JSONObject o:merchantParamList) { - merchantIds.add(o.getLong("id")); - } - WxMerchant merchantQ = new WxMerchant(); - merchantQ.updateTenantInfo(record); - merchantQ.setIds(merchantIds); - Map idAndNamesMap = wxMerchantService.getIdAndNamesMap(merchantQ); if (EnumPayMchType.DIRECT.equals(payMchType)) { - Long merchantId = null; - if (merchantIds.size() > 1) { - WxMerchant merchantQ2 = new WxMerchant(); - merchantQ2.updateTenantInfo(record); - merchantQ2.setIds(merchantIds); - merchantQ2.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode()); - merchantQ2.setStatus(EnumMerchantStatus.VALID.getCode()); - List list = wxMerchantMapper.findIdList(merchantQ2); - if(list == null || list.isEmpty()){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券需包含一个商管商户"); - }else if(list.size() > 1){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券只能包含一个商管商户"); + WxMerchant makeMerchant = null; + if(merchantList.size() == 1){ + record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode()); + makeMerchant = merchantList.get(0); + }else{ + List adminMerchant = merchantList.stream().filter(m -> EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(m.getIsAdmin())).collect(toList()); + if(adminMerchant == null || adminMerchant.isEmpty()){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "多门店券需包含一个商管商户"); + }else if(adminMerchant.size() > 1){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "多门店券只能包含一个商管商户"); } record.setMerchantType(EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode()); - merchantId = list.get(0); - }else{ - record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode()); - merchantId = merchantIds.get(0); + makeMerchant = adminMerchant.get(0); } - record.setMakeMerchantId(merchantId); - WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); + + record.setMakeMerchantId(makeMerchant.getId()); + WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, makeMerchant.getId(), null, payMchType.getCode()); if (receiver == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户"); + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "[\""+makeMerchant.getName()+"\"]未配置收款账户"); } if (EnumAppPlat.TOUTIAO.equals(plat)) { if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户"); + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "[\""+makeMerchant.getName()+"\"]未配置收款账户"); } } } else if (EnumPayShare.YES.equals(isShare)) { - List merchantNames = new ArrayList(); - for (Long merchantId:merchantIds) { - WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode()); + List badNames = new ArrayList(); + for (WxMerchant merchant:merchantList) { + WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant.getId(), null, payMchType.getCode()); + if (receiver == null) { - merchantNames.add(idAndNamesMap.get(merchantId)); + badNames.add(merchant.getName()); continue; -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件"); } if (EnumAppPlat.TOUTIAO.equals(plat)) { QueryMerchantResult openPayResult = payAccount.getOpenPayResult(); + if(!EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) && !EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) && !EnumYesOrNo.YES.getCode().equals(openPayResult.getHz())){ @@ -738,30 +647,27 @@ public class WxCouponServiceImpl implements WxCouponService { } if(EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){ - merchantNames.add(idAndNamesMap.get(merchantId)); + badNames.add(merchant.getName()); continue; -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件支付宝"); } if(EnumYesOrNo.YES.getCode().equals(openPayResult.getWx()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ - merchantNames.add(idAndNamesMap.get(merchantId)); + badNames.add(merchant.getName()); continue; -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件微信"); } if(EnumYesOrNo.YES.getCode().equals(openPayResult.getHz()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())){ - merchantNames.add(idAndNamesMap.get(merchantId)); + badNames.add(merchant.getName()); continue; -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件抖音"); } } } - if(!merchantNames.isEmpty()){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), JSONArray.toJSONString(merchantNames)+"未配置分账账户"); + if(!badNames.isEmpty()){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), JSONArray.toJSONString(badNames)+"未配置分账账户"); } } } - return new ResultData(); + return new ResultData(merchantList); } @Override @@ -1232,33 +1138,75 @@ public class WxCouponServiceImpl implements WxCouponService { return new ResultData(); } - //有价券开启了分账,必须在30天以内。,停车券,积分券,积分停车券,卡无次限制 + /** + * 1.有价券 + * 2.微信 + * 3.分账 (因微信支付线上分账30天限制) 需要限制有效期30天 + * @param wxCoupon + * @return boolean 有效期结束时间需要当前时间的30天限制 验证是否通过 + */ @Override public boolean validCouponDate(WxCoupon wxCoupon) { - if(wxCoupon.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ + if(wxCoupon.checkIsFree()){ return true; } - if(wxCoupon.getSalePrice() == 0){ + if(!EnumCouponType.getWeiXinType().contains(wxCoupon.getType())){ return true; } - if(wxCoupon.checkIsCard()){ + if(EnumCouponType.getPlatType().contains(wxCoupon.getType())){ return true; } - EnumPayShare isShare = EnumPayShare.NO; - WxAppinfo appinfo = wxAppinfoService.getCouponAppInfo(wxCoupon); - if (null == appinfo) { - throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "券未查询到appInfo"); + + WxPayAccount payAccount = payAccountService.getPayAccount(wxCoupon, EnumAppPlat.WX); + if(payAccount == null){ + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到支付配置"); } - WxPayAccount payAccount = payAccountMapper.selectById(appinfo.getPayId()); - EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); - if (paySHareEnum != null) { - isShare = paySHareEnum; + if(EnumPayShare.YES.getCode().equals(payAccount.getShare())){ + Date now = new Date(); + Date realValidDate = wxCoupon.getOuterRealValidDate(now); + Date limit_date = DateUtils.getTimeAfterDays(Constant.WX_LIMIT_DAYS, now); + if (realValidDate.after(limit_date)) { + return false; + } } - if (EnumPayShare.YES.equals(isShare)) { - return wxCoupon.validDate(true,new Date()); - }else{ - return wxCoupon.validDate(false,new Date()); + return true; + + } + + /** + * 礼包券判断子券有效期 + * @param wxCoupon + * @return + */ + @Override + public ResultData validGiftCouponDate(WxCoupon wxCoupon){ + if(!EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType())){ + return new ResultData(); + } + //获取子券 + List giftIds = JSON.parseArray(wxCoupon.getGiftList(), Long.class); + if(giftIds == null || giftIds.isEmpty()){ + return new ResultData(ErrorCode.COUPON_IS_EMPTY_GIFT.getCode(),"未添加子券"); + } + WxCoupon couponQ = new WxCoupon(); + couponQ.updateTenantInfo(wxCoupon); + couponQ.setIds(giftIds); + List giftList = wxCouponMapper.findList(couponQ); + if(giftList == null || giftList.isEmpty()){ + throw new MallinkException(ErrorCode.COUPON_IS_EMPTY_GIFT.getCode(), "未找到相应子券"); } + for (WxCoupon gift:giftList) { + if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(gift.getStatus())){ + return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF_GIFT.getCode(),"存在已作废的子券"); + } + if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(wxCoupon.getValidType()) + && EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(gift.getValidType()) + && gift.getValidEndDate().before(wxCoupon.getValidEndDate())){ + return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR_GIFT); + } + } + return new ResultData(); + } @Override @@ -1341,4 +1289,35 @@ public class WxCouponServiceImpl implements WxCouponService { return merchantList; } + @Override + @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) + public ResultData disable(TenantEntity tenantInfo, Long couponId) { + WxCoupon couponUpd = new WxCoupon(); + couponUpd.updateTenantInfo(tenantInfo); + couponUpd.setId(couponId); + couponUpd.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); + couponUpd.setUpdateDate(new Date()); + int upd = wxCouponMapper.updateById(couponUpd); + if(upd == 1){ + //下架所有投放频道 + wxCouponChannelService.updateStatusByCouponId(couponId, tenantInfo, EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); + //下架所有场景投放 + wxCouponSendService.updateStatusByCouponId(couponId, tenantInfo, EnumCouponSendStatus.INVALID.getCode()); + //下架所有已砍价券 + wxOrderService.updateStatusByPressCouponId(couponId, tenantInfo, EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode()); + //下架所有相关广告 + wxScreenAdService.updateStatusByCouponId(couponId, tenantInfo, EnumScreenAdStatus.INVALID.getCode()); + //下架拼团券 + wxOrderService.updateOrderGroupStatusByCouponId(couponId, tenantInfo, EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); + // 卡下架后,转赠找不到卡相关信息,所以修改卡转赠状态为不可转赠 + wxCardInfoMapper.updateTransferStatusByCouponId(couponId); + // 卡券下架,未使用的卡密要下架 + couponPasswordMapper.disableByCouponId(couponId); + + //同步抖音状态 + wxCouponChannelService.spuStatusSyncByCoupon(tenantInfo,couponId); + } + return new ResultData(); + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index 375d950e9..5e30dc9e6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -18,6 +18,7 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.*; import com.iformall.utils.CreditUtil; +import com.iformall.utils.DateUtils; import com.iformall.utils.RedisLock; import com.iformall.utils.UserUtil; import lombok.extern.slf4j.Slf4j; @@ -98,6 +99,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { @Autowired private WxTemplateMsgService wxTemplateMsgService; + @Autowired + private WxMemberCardService wxMemberCardService; + @Override public void clearCreditByYear() { WxScoreRules wxScoreRules = new WxScoreRules(); @@ -121,6 +125,20 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { } + @Override + public void syncClearCredit(TenantEntity tenantInfo) { + WxCreditHistory creditHistoryQ = new WxCreditHistory(); + creditHistoryQ.setTenantId(tenantInfo.getFinalTenantId()); + creditHistoryQ.setCreditType(EnumScoreType.CLEAN_CREDIT.getCode()); + String beforeYesterday = DateUtils.getTimeBefore(2, new Date()); + Date date = DateUtils.stringToDate(beforeYesterday); + creditHistoryQ.setStartTime(date); + List list = wxCreditHistoryMapper.getIsMemberCarAndClearCredit(creditHistoryQ); + for (WxCreditHistory history:list) { + wxMemberCardService.sendsyncMemberCardBonusMsg(tenantInfo,null,history.getCUserId(),history.getId()); + } + } + @Override public void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory) { PageInfo wxCreditHistoryVoList = findListMorePage(wxCreditHistory,0,50000); @@ -546,8 +564,8 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { // } @Override - public WxCreditHistory getById(Long id,String tenantId) { - return wxCreditHistoryMapper.selectById(id,tenantId); + public WxCreditHistory getById(Long id,String finalTenantId) { + return wxCreditHistoryMapper.selectById(id,finalTenantId); } @Override @@ -629,6 +647,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { //发消息 sendCreditUpdRemind(wxCUserBasicInfo,record,tenantId); + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(tenantId); + if(!record.getTenantId().equals(tenantId)){ + tenantEntity.setParentTenantId(record.getTenantId()); + } + wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); } else { @@ -646,15 +670,15 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { temp.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode()); temp = wxTemplateMsgService.getByObj(temp); if(temp.getId() != null){ - List openIds = wxCUserMapper.findOpenIdList(wxCUserBasicInfo.getId(),tenantId); - if(openIds != null && openIds.size() > 0){ + String openId = wxCUserMapper.findOpenId(wxCUserBasicInfo.getId(),tenantId); + if(StringUtils.isNotBlank(openId)){ WxMsg msg = new WxMsg(); // msg.updateTenantInfo(record); msg.setTenantId(tenantId); // msg.setWay(EnumSendWay.APPINFOR.getCode()); // msg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); // msg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode()); - msg.setPhones(String.join(",", openIds)); + msg.setPhones(openId); msg.setModelId(temp.getId()); Map map = new HashMap<>(); map.put("character_string1",record.getCreditNum().toString()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index f414bac3f..35a49e0c2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -392,6 +392,7 @@ public class WxGameServiceImpl implements WxGameService { wxCouponChannel.setEndTime(record.getValidEndDate()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponId(couponId); + wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setType(wxCoupon.getType()); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); wxCouponChannel.updateTenantInfo(wxCoupon); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java new file mode 100644 index 000000000..69de04691 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java @@ -0,0 +1,317 @@ +package com.iformall.service.impl; + +import com.alibaba.fastjson.JSON; +import com.github.binarywang.wxpay.bean.businesscircle.MemberCardAuthorizeResult; +import com.github.binarywang.wxpay.bean.membercard.MemberCardResult; +import com.github.binarywang.wxpay.bean.membercard.MemberCardRightsRequest; +import com.github.binarywang.wxpay.bean.membercard.MemberCardUpdRequest; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; +import com.iformall.common.IdWorker; +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterAddCreditMsg; +import com.iformall.domain.po.msg.AfterAddScoreMsg; +import com.iformall.domain.po.msg.FmInsideCLoginMsg; +import com.iformall.domain.po.msg.SyncMemberCardMsg; +import com.iformall.enums.*; +import com.iformall.mapper.WxMemberCardMapper; +import com.iformall.mq.MqBaseProducer; +import com.iformall.service.*; +import com.iformall.utils.DateUtils; +import com.iformall.utils.MaUtil; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class WxMemberCardServiceImpl implements WxMemberCardService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + WxMemberCardMapper wxMemberCardMapper; + + @Autowired + WxAppinfoService wxAppinfoService; + + @Autowired + WxPayAccountService wxPayAccountService; + + @Autowired + WxCUserBasicInfoService wxCUserBasicInfoService; + + @Autowired + private MqBaseProducer mqBaseProducer; + + @Autowired + MaUtil maUtil; + + @Override + public PageInfo listAsPage(WxMemberCard record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMemberCardMapper.findList(record)); + } + + @Override + public ResultData saveorupdate(WxMemberCard record) { + Date now = new Date(); + if(record.getId() == null){ + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + record.setCreateDate(now); + record.setUpdateDate(now); + wxMemberCardMapper.insert(record); + }else{ + record.setUpdateDate(now); + wxMemberCardMapper.updateById(record); + } + return new ResultData(); + } + + @Override + public ResultData saveorupdateByCode(WxMemberCard record) { + Long id = wxMemberCardMapper.getIdByCode(record); + Date now = new Date(); + if(id == null){ + final IdWorker idWorker = IdWorker.get(); + id = idWorker.nextId(); + record.setId(id); + if(record.getCreateDate() == null){ + record.setCreateDate(now); + } + record.setUpdateDate(record.getCreateDate()); + wxMemberCardMapper.insert(record); + + if(record.getCuserId() != null){ + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(record.getTenantId()); + tenantEntity.setParentTenantId(record.getParentTenantId()); + this.sendsyncMemberCardBonusMsg(tenantEntity,record.getCuserId(),null,null); + } + }else{ + record.setId(id); + if(record.getUpdateDate() == null){ + record.setUpdateDate(now); + } + wxMemberCardMapper.updateById(record); + } + return new ResultData(); + } + + @Override + public ResultData delUserCardStatusByCode(WxMemberCard record) { + record.setUserCardStatus(EnumMemberCardStatus.DELETE.getCode()); + if(record.getUpdateDate() == null){ + record.setUpdateDate(new Date()); + } + wxMemberCardMapper.deleteByCode(record); + return new ResultData(); + } + + @Override + public ResultData syncMemberCard(TenantEntity tenantEntity, String card_id, String code) { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); + MemberCardResult memberCard = wxPayService.getMemberCardService().getMemberCard(card_id, code); + WxMemberCard record = new WxMemberCard(); + record.setTenantId(tenantEntity.getTenantId()); + record.setParentTenantId(tenantEntity.getParentTenantId()); + record.updateFinalTenantId(tenantEntity); + record.setCardId(card_id); + record.setCardCode(code); + record.setOpenId(memberCard.getOpenid()); + record.setMembershipNumber(memberCard.getMembershipNumber()); + record.setLevel(memberCard.getLevel()); + record.setNickname(memberCard.getNickname()); + record.setHeadImageUrl(memberCard.getHeadImageUrl()); + record.setBackgroundPictureUrl(memberCard.getBackgroundPictureUrl()); + record.setBalance(memberCard.getBalance()); + EnumMemberCardStatus enumMemberCardStatus = EnumMemberCardStatus.getEnum(memberCard.getUserCardStatus()); + if(enumMemberCardStatus != null){ + record.setUserCardStatus(enumMemberCardStatus.getCode()); + } + record.setUserInformation(JSON.toJSONString(memberCard.getUserInformation())); + + record.setBonusValue(memberCard.getBonusValue()); + if(memberCard.getServiceModules() != null){ + record.setServiceModules(JSON.toJSONString(memberCard.getServiceModules())); + } + record.setMemberPriceWord(memberCard.getMemberPriceWord()); + record.setFapiaoJumpWord(memberCard.getFapiaoJumpWord()); + if(memberCard.getGuide() != null){ + record.setGuide(JSON.toJSONString(memberCard.getGuide())); + } + +// MemberCardResult.UserInformation userInformation = memberCard.getUserInformation(); +// List commonFieldList = userInformation.getCommonFieldList(); +// String phone = null, name = null, avatarUrl = null; +// Integer sex = null; +// for (MemberCardResult.CommonField commonField:commonFieldList) { +// /** +// * 平台提供了一些通用的开卡字段供开发者选用 +// * USER_FORM_FLAG_MOBILE:手机号 +// * USER_FORM_FLAG_SEX:性别 +// * USER_FORM_FLAG_NAME:姓名 +// * USER_FORM_FLAG_BIRTHDAY:生日 +// * USER_FORM_FLAG_ADDRESS:地址 +// * USER_FORM_FLAG_EMAIL:邮箱 +// * USER_FORM_FLAG_CITY:城市 +// */ +// if("USER_FORM_FLAG_MOBILE".equals(commonField.getName())){ +// phone = commonField.getValue(); +// }else if("USER_FORM_FLAG_SEX".equals(commonField.getName())){ +// if("男".equals(commonField.getValue())){ +// sex = 1; +// }else if("女".equals(commonField.getValue())){ +// sex = 2; +// }else{ +// sex = 0; +// } +// }else if("USER_FORM_FLAG_NAME".equals(commonField.getName())){ +// name = commonField.getValue(); +// } +// } + +// WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone, null,name, sex, avatarUrl); + + WxMemberCard old = wxMemberCardMapper.getByCode(record); + if(old != null){ + record.setId(old.getId()); + } +// if(basicInfo != null && (old == null || !basicInfo.getId().equals(old.getUserId()))){ +// record.setUserId(basicInfo.getId()); +// } + + this.saveorupdate(record); +// if(record.getUserId() != null){ +// this.sendsyncMemberCardBonusMsg(tenantEntity,record.getUserId(),null); +//// this.sendsyncMemberCardLevelMsg(tenantEntity,record.getUserId(),null); +// } + return new ResultData(); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public void sendSyncMemberCardMsg(TenantEntity tenantEntity, String card_id, String code) { + SyncMemberCardMsg msg = new SyncMemberCardMsg(); + msg.updateTenantInfo(tenantEntity); + msg.setMsgType(EnumMsgRecordType.SYNC_MEMBER_CARD.getCode()); + msg.setCardId(card_id); + msg.setCode(code); + mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); + } + + @Override + public ResultData syncMemberCardLevel(TenantEntity tenantEntity, String card_id, String code,String markid, + String level, Boolean need_inform_level) { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); + MemberCardUpdRequest request = new MemberCardUpdRequest(); + request.setLevel(level); + request.setOutRequestNo(markid); + request.setNeedInformLevel(need_inform_level); + + wxPayService.getMemberCardService().updMemberCard(card_id,code,request); + + this.sendSyncMemberCardMsg(tenantEntity,card_id,code); + return new ResultData(); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public void sendsyncMemberCardLevelMsg(TenantEntity tenantEntity, Long baseUserId, Long scoreHistoryId) { + //todo 暂不推送等级给商圈 +// AfterAddScoreMsg msg = new AfterAddScoreMsg(); +// msg.updateTenantInfo(tenantEntity); +// msg.setMsgType(EnumMsgRecordType.AFTER_ADD_SCORE.getCode()); +// msg.setBasicUserId(baseUserId); +// msg.setScoreHistoryId(scoreHistoryId); +// mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); + } + + @Override + public ResultData syncMemberCardBonus(TenantEntity tenantEntity, String card_id, String code,String markid, + int before_bonus_value,int bonus_value, Boolean need_inform_bonus) { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); + } + try { + WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); + MemberCardRightsRequest request = new MemberCardRightsRequest(); + request.setBeforeBonusValue(before_bonus_value); + request.setBonusValue(bonus_value); + request.setAddBonusValue(bonus_value - before_bonus_value); + request.setOutRequestNo(markid); + request.setNeedInformBonus(need_inform_bonus); + wxPayService.getMemberCardService().setMemberCardRights(card_id,code,request); + + this.sendSyncMemberCardMsg(tenantEntity,card_id,code); + return new ResultData(); + } catch (WxPayException e) { + e.printStackTrace(); + return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); + } + } + + @Override + public void sendsyncMemberCardBonusMsg(TenantEntity tenantEntity, Long cuserId, Long baseUserId, Long creditHistoryId) { + AfterAddCreditMsg msg = new AfterAddCreditMsg(); + msg.updateTenantInfo(tenantEntity); + msg.setMsgType(EnumMsgRecordType.AFTER_ADD_CREDIT.getCode()); + if(cuserId != null){ + msg.setCuserId(cuserId); + }else if(baseUserId != null){ + msg.setBasicUserId(baseUserId); + }else { + logger.error("商圈会员积分同步消息发送失败"); + } + msg.setCreditHistoryId(creditHistoryId); + mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); + } + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 6dc5e3ccd..c8e3533ed 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -482,11 +482,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { List couponIds = wxCouponMerchantList.stream().map(cm -> cm.getProductId()).collect(Collectors.toList()); couponIds.stream().filter(cid -> !isCouponMerchantValid(cid,wxCouponMerchant)).forEach(cid -> { - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setId(cid); - wxCoupon.updateTenantInfo(wxMerchant); - wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); - wxCouponService.saveOrUpdate(wxCoupon); + wxCouponService.disable(wxMerchant,cid); CouponCacheUtils.removeCouponMerchantCache(redisTemplate, cid); }); } @@ -934,6 +930,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { List list = wxMerchantMapper.findList(wxMerchant); list.stream().forEach(m->{ + + List receivers = wxProfitSharingReceiverService.findReceivers(m, m.getId()); + m.setWxProfitSharingReceiver(receivers); + //分账信息 可能有多个, 先干掉 // WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); // if (receiver != null) { @@ -1002,7 +1002,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public boolean hasMerchant(WxMerchant wxMerchant) { -// wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); + wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); return wxMerchantMapper.hasMerchant(wxMerchant) > 0 ? true : false; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index 36d53ced2..500b9a8c3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -87,7 +87,7 @@ public class WxOrderServiceImpl implements WxOrderService { WxAppinfoMapper wxAppinfoMapper; @Autowired - WxPayAccountMapper wxPayAccountMapper; + WxPayAccountService wxPayAccountService; @Autowired WxMallMapper wxMallMapper; @@ -1120,8 +1120,12 @@ public class WxOrderServiceImpl implements WxOrderService { * @return */ private boolean isCouponMerchantValid(Long couponId,TenantEntity tenantEntity) { - List merchantVoList = wxMerchantService.findMerchantListByProduct(tenantEntity,couponId,false); - if (merchantVoList.stream().anyMatch((cm -> cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))) { + WxCouponMerchant wxCouponMerchantQ = new WxCouponMerchant(); + wxCouponMerchantQ.updateTenantInfo(tenantEntity); + wxCouponMerchantQ.setProductId(couponId); + wxCouponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); + Integer count = wxCouponMerchantMapper.selectCount(new QueryWrapper<>(wxCouponMerchantQ)); + if(count > 0){ return true; } return false; @@ -1183,6 +1187,7 @@ public class WxOrderServiceImpl implements WxOrderService { record.setPayVendor(payWay.getCode()); record.setPayVersion(payVersion.getCode()); record.setProductId(user.getId()); + record.setProductName(EnumOrderType.MICROPAY.getMessage()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); record.setPayment(payment); record.setTotalPayment(payment); @@ -1255,6 +1260,7 @@ public class WxOrderServiceImpl implements WxOrderService { record.setPayVendor(EnumPayWay.PAY_WAY_WECHAT_MA.getCode()); record.setPayVersion(EnumPayVersion.WX_PAY_V2.getCode()); record.setProductId(user.getId()); + record.setProductName(EnumOrderType.MICROPAY.getMessage()); if (cUser != null) { record.setCUserId(cUser.getId()); } @@ -1296,11 +1302,8 @@ public class WxOrderServiceImpl implements WxOrderService { order.setOrderType(EnumComposeOrder.SINGLE.getCode()); order.setCreateDate(new Date()); wxBatchOrderMapper.insert(order); - - - - Long orderNumber = idWorker.nextId(); + Long orderNumber = idWorker.nextId(); // body // tenant_id + merchant_id + title + subtitle String bodyStr = "["+payWay.getMessage()+"("+payWay.getCode()+")]C扫B储值卡支付, 金额:" + totalFeeStr; @@ -1313,6 +1316,7 @@ public class WxOrderServiceImpl implements WxOrderService { record.setPayVendor(EnumPayWay.PAY_WAY_PREPAIDCARD.getCode()); record.setPayVersion(EnumPayVersion.NO_VERSION.getCode()); record.setProductId(merchant.getId()); + record.setProductName(EnumOrderType.PREPAIDCARD.getMessage()); record.setCUserId(cUserId); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); record.setPayment(payment); @@ -1345,14 +1349,6 @@ public class WxOrderServiceImpl implements WxOrderService { public WxCouponOrder createCouponOrder(Date curr,WxOrder order, WxCUserBasicInfo user, WxCoupon coupon, Long couponPasswordId,EnumPayWay payWay,EnumPayVersion payVersion,Long merchantId,Long bUserId,Long parentCouponOrderId) { Date valid_date = null; //int limit_days = Constant.WX_LIMIT_DAYS; - WxPayAccount payAccount = null; - WxPayAccount payAccountQ = new WxPayAccount(); - payAccountQ.updateTenantInfo(order); - try { - payAccount = wxPayAccountMapper.selectOne(new QueryWrapper<>(payAccountQ)); - } catch (Exception e) { - logger.error("获取payAccount error: " + order.getTenantId()); - } WxPayOrder payOrder = null; // if (coupon.getSalePrice() > 0) { if(order.getPayment() > 0) { @@ -1376,7 +1372,7 @@ public class WxOrderServiceImpl implements WxOrderService { // if (null != payOrder && null != payOrder.getShare() && payOrder.getShare().intValue() > 0) { // isShare = true; // } - valid_date = coupon.getRealValidDate(curr); + valid_date = coupon.getOuterRealValidDate(curr); boolean isCard = false; // 检查是否是储值卡 @@ -1463,6 +1459,14 @@ public class WxOrderServiceImpl implements WxOrderService { if (null != cardInfoList && cardInfoList.size() > 0) { //do nothing }else { + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(cardInfo.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } // 有价卡 cardInfo.setTransactionId(payOrder.getTransactionId()); WxComposeChildOrderShare share = payOrder.getChildOrderShare(order.getId()); @@ -1883,11 +1887,13 @@ public class WxOrderServiceImpl implements WxOrderService { record.updateTenantInfo(coupon); record.setOrderNumber(orderNumber); record.setProductId(couponId); + record.setProductName(coupon.getTitle()); record.setType(EnumOrderType.COUPON.getCode()); record.setPayVendor(payWay.getCode()); record.setPayVersion(payVersion.getCode()); record.setCUserId(user.getId()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); + record.setMakeMerchantId(coupon.getMakeMerchantId()); record.setPayment(payment); record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); record.setDetail(bodyStr); @@ -1959,9 +1965,11 @@ public class WxOrderServiceImpl implements WxOrderService { record.updateTenantInfo(coupon); record.setOrderNumber(orderNumber); record.setProductId(couponId); + record.setProductName(coupon.getTitle()); record.setType(EnumOrderType.COUPON.getCode()); record.setPayVendor(EnumPayWay.PAY_WAY_NOT_UNPAY_GIFTLIST.getCode()); record.setPayVersion(EnumPayVersion.NO_VERSION.getCode()); + record.setMakeMerchantId(coupon.getMakeMerchantId()); record.setCUserId(user.getId()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); record.setPayment(coupon.getSalePrice()); @@ -2866,83 +2874,7 @@ public class WxOrderServiceImpl implements WxOrderService { @Autowired @Qualifier("cUserBasicInfoRedisTemplate") RedisTemplate cUserBasicInfoRedisTemplate; - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public WxComposeOrder savePlatPushOrderForCoupon(TenantEntity tenantEntity,boolean allowUnPayOrder,EnumComposeOrder composeOrderType, - WxCUserBasicInfo user,String allExtParam,List platPushOrderList,EnumPayWay payWay,EnumPayVersion payVersion) throws Exception { - WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); - // 防止同一用户重复下单,1秒内 - String key = new StringBuilder().append("savePlatPushOrder:").append(user.getId()).toString(); - boolean hasKey = cUserBasicInfoRedisTemplate.hasKey(key); - if (hasKey) { - logger.error("用户正在下单,请求异常返回,user: {} " + JSON.toJSONString(user)); - throw new MallinkException(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - cUserBasicInfoRedisTemplate.opsForValue().set(key, user, 1000, TimeUnit.MILLISECONDS); - OrderAdapterService orderAdapterService = orderFactory.getOrderAdapterService(composeOrderType.getCode()); - //从这里开始,就需要锁住渠道的价格,不能修改 - WxComposeOrder composeOrder = orderAdapterService.createDBMainOrderByPushOrder(tenantEntity,user, allExtParam,platPushOrderList, payWay,payVersion); - Date orderDate = new Date(); - WxOrder lastOrder = null; - WxCoupon lastCoupon = null; - for (int i = 0 ; i < platPushOrderList.size(); i ++) { - PlatPushOrderSaveDto orderdto = platPushOrderList.get(i); - lastCoupon = orderdto.getWxCoupon(); - - Map couponChannelMap = composeOrder.getCouponChannelMap(); - Long couponChannelId = orderdto.getCouponChannelId(); - WxCouponChannel couponChannel = couponChannelMap.get(couponChannelId); - orderdto.setWxCouponChannel(couponChannel); - - //券一个数量创建一个订单 - boolean isOneNumberOneOrder = orderAdapterService.isOneNumberOneOrder(); - if (isOneNumberOneOrder) { - JSONArray jsonArray = new JSONArray(); - if(StringUtils.isNotBlank(orderdto.getExtParam())){ - logger.info("orderdto.getExtParam()---------------------------"+orderdto.getExtParam()); - try{ - jsonArray = JSONArray.parseArray(orderdto.getExtParam()); - }catch(Exception e){ - logger.error(e.getMessage()); - } - } - for (int j = 0; j < orderdto.getCount(); j++) { - String extParam = ""; - if(jsonArray != null && !jsonArray.isEmpty()){ - extParam = jsonArray.get(j).toString(); - } - logger.info("extParam---------------------------"+extParam); - lastOrder = proxy.handleSaveOrderForCouponSingle(orderDate,allowUnPayOrder,composeOrder, user, orderdto.getWxCoupon(), 1, - orderdto.isPress(),orderdto.getOrderGroupId(),orderdto.getFormId(),orderdto.getShippingType(),orderdto.getAddress(),extParam, - orderdto.getWxCouponChannel(), payWay,payVersion); - } - }else { - lastOrder = proxy.handleSaveOrderForCouponSingle(orderDate,allowUnPayOrder,composeOrder, user, orderdto.getWxCoupon(), orderdto.getCount(), - orderdto.isPress(),orderdto.getOrderGroupId(),orderdto.getFormId(),orderdto.getShippingType(),orderdto.getAddress(),orderdto.getExtParam(), - orderdto.getWxCouponChannel(), payWay,payVersion); - } - } - //如果没有orderId,则用lastOrder的信息 - if (EnumComposeOrder.isSingle(composeOrderType.getCode())) { - composeOrder.setSingleOrder(lastOrder); - } - List orderList = orderAdapterService.getChildOrders(composeOrder, tenantEntity.getTenantId()); - WxPayOrder record = new WxPayOrder(); - record.updateTenantInfo(tenantEntity); - record.setOrderId(composeOrder.getMainOrderId()); - record.setComposeOrder(composeOrder.getComposeOrderType()); - record.setOpenId((String) composeOrder.getMainOrder().getExpParamValue("open_id")); - String productName = orderAdapterService.getPayProductName(lastCoupon); - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, payWay.getPlat()); - PayAdapterResult payResult = wxPayOrderService.createPayOrder(cAppInfo, user, record,composeOrder,orderList,productName, payWay, new PayExtraParam("openId",record.getOpenId()),false); - if(payResult.isSuccess()){ - return composeOrder; - }else{ - throw new Exception(payResult.getMsg()); - } - } - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public WxComposeOrder saveOrderForCoupon(TenantEntity tenantEntity,boolean allowUnPayOrder,EnumComposeOrder composeOrderType,WxCUserBasicInfo user,List orderSave, @@ -2964,11 +2896,6 @@ public class WxOrderServiceImpl implements WxOrderService { WxOrder lastOrder = null; for (int i = 0 ; i < orderSave.size(); i ++) { OrderComposeSaveDto orderdto = orderSave.get(i); - - Map couponChannelMap = composeOrder.getCouponChannelMap(); - Long couponChannelId = orderdto.getSignleOrder().getCouponChannelId(); - WxCouponChannel couponChannel = couponChannelMap.get(couponChannelId); - orderdto.setWxCouponChannel(couponChannel); //券一个数量创建一个订单 boolean isOneNumberOneOrder = orderAdapterService.isOneNumberOneOrder(); @@ -3290,8 +3217,10 @@ public class WxOrderServiceImpl implements WxOrderService { record.updateTenantInfo(coupon); record.setOrderNumber(record.getId()); record.setProductId(coupon.getId()); + record.setProductName(coupon.getTitle()); record.setCUserId(user.getId()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); + record.setMakeMerchantId(coupon.getMakeMerchantId()); record.setDetail(bodyStr); record.setCreateDate(curr); record.setUpdateDate(curr); @@ -3405,6 +3334,8 @@ public class WxOrderServiceImpl implements WxOrderService { record.updateTenantInfo(coupon); record.setOrderNumber(orderNumber); record.setProductId(coupon.getId()); + record.setProductName(coupon.getTitle()); + record.setMakeMerchantId(coupon.getMakeMerchantId()); //record.setType(EnumOrderType.COUPON.getCode()); record.setCUserId(user.getId()); record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); @@ -3509,9 +3440,7 @@ public class WxOrderServiceImpl implements WxOrderService { for ( int i =0 ; i< composeOrderSaveDto.size(); i++ ) { OrderComposeSaveDto ocsd = composeOrderSaveDto.get(i); - WxCoupon coupon = singleOrderCheck(ocsd.getSignleOrder().getCouponChannelId(),ocsd.getSignleOrder().getOrderGroupId(),ocsd.getCount(), - wxCUserBasicInfo,payWay,tenantEntity,i+1,singleProduct); - ocsd.setWxCoupon(coupon); + singleOrderCheck(tenantEntity,wxCUserBasicInfo,ocsd,payWay,i+1,singleProduct); } WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); @@ -3534,51 +3463,6 @@ public class WxOrderServiceImpl implements WxOrderService { } } - - @Override - public ResultData platPushSaveOrder(boolean allowUnPayOrder,EnumComposeOrder composeOrderType,String allExtParam,List platPushOrderList,Long cUserId, - EnumPayWay payWay,EnumPayVersion payVersion,TenantEntity tenantEntity) { - try { - if (null == platPushOrderList || platPushOrderList.size() <= 0 ) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"无商品信息"); - } - - WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(cUserId,tenantEntity.getFinalTenantId()); - if (wxCUserBasicInfo != null && wxCUserBasicInfo.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { - logger.info("会员权益被锁定:cUserId:" + cUserId); - return new ResultData(ErrorCode.MEMBER_IS_LOCKED); - } - - boolean singleProduct = false; - if (platPushOrderList.size() == 1) { - singleProduct = true; - } - - for ( int i =0 ; i< platPushOrderList.size(); i++ ) { - PlatPushOrderSaveDto ocsd = platPushOrderList.get(i); - WxCoupon coupon = singleOrderCheck(ocsd.getCouponChannelId(),ocsd.getOrderGroupId(),ocsd.getCount(),wxCUserBasicInfo,payWay,tenantEntity,i+1,singleProduct); - ocsd.setWxCoupon(coupon); - } - WxOrderServiceImpl proxy = (WxOrderServiceImpl) AopContext.currentProxy(); - try { - WxComposeOrder order = proxy.savePlatPushOrderForCoupon(tenantEntity,allowUnPayOrder,composeOrderType,wxCUserBasicInfo, allExtParam,platPushOrderList, payWay,payVersion); - return new ResultData(order); - } catch (MallinkException e) { - logger.error("saveOrderForCoupon error.",e); - throw new MallinkException(e.getErrorCode(), e.getMessage()); - } catch (Exception e) { - logger.error("saveOrderForCoupon error.",e); - throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), e.getMessage()); - } - - }catch(MallinkException me) { - return new ResultData(me.getErrorCode(),me.getMessage()); - }catch(Exception e) { - logger.error("composeSaveOrder error.",e); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - - } @Override public void sendInsideOrderPushMsg(TenantEntity tenantEntity,Long composeOrderId) { @@ -3725,11 +3609,11 @@ public class WxOrderServiceImpl implements WxOrderService { @Override public ResultData handlerPushOrder(TenantEntity tenantEntity, Long composeOrderId, String batchExtParam, List goods) { WxBatchOrder wxBatchOrder = this.getWxBatchOrder(tenantEntity, composeOrderId); - if(wxBatchOrder == null){ + if (wxBatchOrder == null) { return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); } WxPayOrder payOrder = wxPayOrderService.getById(composeOrderId, tenantEntity.getTenantId()); - if(payOrder == null){ + if (payOrder == null) { return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); } WxBatchOrder updBatchOrder = new WxBatchOrder(); @@ -3741,45 +3625,76 @@ public class WxOrderServiceImpl implements WxOrderService { OrderAdapterService orderAdapterService = orderFactory.getOrderAdapterService(wxBatchOrder.getOrderType()); WxComposeOrder composeOrder = orderAdapterService.getComposeOrder(wxBatchOrder.getId(), tenantEntity.getTenantId()); - List childOrders = orderAdapterService.getChildOrders(composeOrder, tenantEntity.getTenantId()); - Map> collect = childOrders.stream().collect(groupingBy(WxOrder::getCouponChannelId)); - Map maps = goods.stream().collect(Collectors.toMap(CreateOrderCallback.Good::getGoodsId, Function.identity())); - if(collect.keySet().size() == goods.size()){ - List> order_goods_info = new ArrayList<>(); - for (Long key: collect.keySet()) { - List wxOrders = collect.get(key); - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectByChannelId(tenantEntity.getTenantId(),key); - CreateOrderCallback.Good good = maps.get(ttCouponChannelPoi.getSpuId()); - if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ - Map map_info = new HashMap<>(); - map_info.put("goods_id",good.getGoodsId()); - WxComposeChildOrderShare childOrderShare = payOrder.getChildOrderShare(wxOrders.get(0).getId()); - map_info.put("merchant_uid",childOrderShare.getMerchantUid()); - order_goods_info.add(map_info); - } - if(wxOrders.size() == good.getItemOrderInfoList().size()){ - for(int i=0;i> order_goods_info = new ArrayList<>(); + if (goods.size() == 1) { + WxOrder singleOrder = composeOrder.getSingleOrder(); + CreateOrderCallback.Good good = goods.get(0); + + WxOrder updOrder = new WxOrder(); + updOrder.updateTenantInfo(tenantEntity); + updOrder.setId(singleOrder.getId()); + if (good.getItemOrderInfoList().size() == 1) { + updOrder.setExtParam(JSON.toJSONString(good.getItemOrderInfoList().get(0))); + } else { + updOrder.setExtParam(JSON.toJSONString(good.getItemOrderInfoList())); + } + wxOrderMapper.updateById(updOrder); + + if (EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())) { + Map map_info = new HashMap<>(); + map_info.put("goods_id", good.getGoodsId()); + WxComposeChildOrderShare childOrderShare = payOrder.getChildOrderShare(singleOrder.getId()); + map_info.put("merchant_uid", childOrderShare.getMerchantUid()); + order_goods_info.add(map_info); + composeOrder.setExtParam(order_goods_info); } - composeOrder.setExtParam(order_goods_info); return new ResultData(composeOrder); - }else{ - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(),"数据异常"); - } + } else { + //todo 暂无多订单模式 + + } + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "数据异常"); + +// List childOrders = orderAdapterService.getChildOrders(composeOrder, tenantEntity.getTenantId()); +// Map> collect = childOrders.stream().collect(groupingBy(WxOrder::getCouponChannelId)); +// Map maps = goods.stream().collect(Collectors.toMap(CreateOrderCallback.Good::getGoodsId, Function.identity())); +// if(collect.keySet().size() == goods.size()){ +// List> order_goods_info = new ArrayList<>(); +// for (Long key: collect.keySet()) { +// List wxOrders = collect.get(key); +// TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectByChannelId(tenantEntity.getTenantId(),key); +// CreateOrderCallback.Good good = maps.get(ttCouponChannelPoi.getSpuId()); +// if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ +// Map map_info = new HashMap<>(); +// map_info.put("goods_id",good.getGoodsId()); +// WxComposeChildOrderShare childOrderShare = payOrder.getChildOrderShare(wxOrders.get(0).getId()); +// map_info.put("merchant_uid",childOrderShare.getMerchantUid()); +// order_goods_info.add(map_info); +// } +// if(wxOrders.size() == good.getItemOrderInfoList().size()){ +// for(int i=0;i> getBatchOrderMap(TenantEntity tenantEntity,List batchOrderIds){ @@ -3803,13 +3718,15 @@ public class WxOrderServiceImpl implements WxOrderService { // } - private WxCoupon singleOrderCheck(Long couponChannelId,Long orderGroupId,int productCount,WxCUserBasicInfo wxCUserBasicInfo,EnumPayWay payWay,TenantEntity tenantEntity,int curindex,boolean singleProduct) { + private WxCoupon singleOrderCheck(TenantEntity tenantEntity,WxCUserBasicInfo wxCUserBasicInfo,OrderComposeSaveDto orderComposeSaveDto,EnumPayWay payWay,int curindex,boolean singleProduct) { + String premsg = ""; if (singleProduct) { premsg = "此券"; }else { premsg = "第["+curindex+"]张券"; } + Long couponChannelId = orderComposeSaveDto.getSignleOrder().getCouponChannelId(); if (couponChannelId == null) { throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), premsg+"couponChannelId不能为空"); } @@ -3822,6 +3739,7 @@ public class WxOrderServiceImpl implements WxOrderService { premsg = premsg+"【"+wxCouponChannel.getTitle()+"】"; } couponChannelCheck(wxCouponChannel,premsg); + orderComposeSaveDto.setWxCouponChannel(wxCouponChannel); WxCoupon coupon = wxCouponService.getById(wxCouponChannel.getCouponId(),wxCouponChannel.getTenantId()); if (null == coupon) { @@ -3831,6 +3749,8 @@ public class WxOrderServiceImpl implements WxOrderService { if (coupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),premsg+"已作废"); } + orderComposeSaveDto.getSignleOrder().setCouponId(coupon.getId()); + orderComposeSaveDto.setWxCoupon(coupon); //判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制 if (coupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode())) { @@ -3840,27 +3760,6 @@ public class WxOrderServiceImpl implements WxOrderService { } } - WxCouponCVo wxCouponCVo = null; - - String key = "cc:" + couponChannelId; - ValueOperations operations = cdRedisTemplate.opsForValue(); - // 缓存 - boolean hasKey = cdRedisTemplate.hasKey(key); - if (hasKey) { - // 从缓存获取用户信息 - wxCouponCVo = operations.get(key); - } else { - // 游戏没有入缓存,需要从数据库中读取 - wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelId,wxCouponChannel.getTenantId(),false); - if (wxCouponCVo != null) { - // 游戏优化,进缓存 - cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); - } - } - if (wxCouponCVo == null) { - throw new MallinkException(ErrorCode.COUPON_IS_EMPTY.getCode(),premsg+"未查询到详细信息."); - } - //如果couponChannel设置了库存锁定,则订单需要走那个库存 if (null != wxCouponChannel.getChannelStock()) { boolean hascache = redisLock.hasCouponChannelStockCache(wxCouponChannel.getId()); @@ -3885,15 +3784,15 @@ public class WxOrderServiceImpl implements WxOrderService { }else { //此处判断是否存在绝对保证库存不超卖的缓存,如果没有,则把当前的库存设置为最大值。如果有,则是后台设置的时候保存的,以那个为准。 - boolean hascache = redisLock.hasCouponStockCache(wxCouponCVo.getCouponId()); + boolean hascache = redisLock.hasCouponStockCache(coupon.getId()); if (!hascache) { long time = System.currentTimeMillis() + RedisLock.TIMEOUT; String timeStr = String.valueOf(time); boolean stocksetlock = redisLock.lock("couponLockStockSetByOrder_"+coupon.getId(), timeStr); if (stocksetlock) { try { - if (!redisLock.hasCouponStockCache(wxCouponCVo.getCouponId())) { - redisLock.setCouponStock(wxCouponCVo.getCouponId(), coupon.getRemainInventory()); + if (!redisLock.hasCouponStockCache(coupon.getId())) { + redisLock.setCouponStock(coupon.getId(), coupon.getRemainInventory()); } }catch(Exception e) { logger.error("save order stock cache error.",e); @@ -3905,14 +3804,8 @@ public class WxOrderServiceImpl implements WxOrderService { } } } - couponUserCheck(wxCUserBasicInfo, wxCouponCVo,premsg); - Long couponId = wxCouponChannel.getCouponId(); - if (couponId == null) { - logger.error("couponChannelId或者couponId不能为空"); - throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), premsg+"couponChannelId或者couponId不能为空"); - } - + couponUserCheck(wxCUserBasicInfo, coupon,premsg); userCouponMerchantCheck(wxCUserBasicInfo, coupon,wxCouponChannel,premsg); if (coupon.checkIsCreditCoupon()) { @@ -3921,7 +3814,7 @@ public class WxOrderServiceImpl implements WxOrderService { throw new MallinkException(ErrorCode.CREDIT_NOT_ENOUGH.getCode(), premsg+"积分不够扣减值"); } } - + Long orderGroupId = orderComposeSaveDto.getSignleOrder().getOrderGroupId(); if (!checkCouponIsFree(coupon,wxCouponChannel,null)) { // 有价,拼团检查 if (isOrderGroup(orderGroupId)) { @@ -3951,7 +3844,7 @@ public class WxOrderServiceImpl implements WxOrderService { } } - private void couponUserCheck(WxCUserBasicInfo user, WxCouponCVo coupon,String premsg) { + private void couponUserCheck(WxCUserBasicInfo user, WxCoupon coupon,String premsg) { if (coupon.getConditions() == null) return ; JSONObject jo = null; try { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java index b222b08a0..6a5ad03e9 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java @@ -3,19 +3,25 @@ package com.iformall.service.impl; import com.github.binarywang.wxpay.service.WxPayService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.WxProjectConfig; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumAppPlat; import com.iformall.enums.EnumPayWay; +import com.iformall.exception.MallinkException; import com.iformall.mapper.WxPayAccountMapper; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxPayAccountService; +import com.iformall.utils.Constant; import com.iformall.utils.MaUtil; +import com.iformall.utils.RedisCacheUtils; 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.stereotype.Service; import com.iformall.common.IdWorker; @@ -28,6 +34,10 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { @Autowired WxAppinfoService wxAppinfoService; + + @Autowired + @Qualifier("objectCommonRedisTemplate") + RedisTemplate wxPayAccountRedisTemplate; @Autowired MaUtil maUtil; @@ -42,6 +52,20 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { return wxPayAccountMapper.selectById(id); } + @Override + public WxPayAccount getByIdFromRedis(Long id) { + WxPayAccount record = null; + String key = Constant.payaccountPrev + id; + record = RedisCacheUtils.getCacheObject(wxPayAccountRedisTemplate, key, WxPayAccount.class); + if (null == record) { + record = this.getById(id); + if(record != null){ + RedisCacheUtils.cache(wxPayAccountRedisTemplate, key, record, 3600*24*7); + } + } + return record; + } + @Override public void saveOrUpdate(WxPayAccount record) { if (record.getId() == null) { @@ -52,11 +76,13 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { } else { wxPayAccountMapper.updateById(record); } + deleteRedis(record.getId()); } @Override public void deleteById(Long id) { wxPayAccountMapper.deleteById(id); + deleteRedis(id); } @Override @@ -70,19 +96,27 @@ public class WxPayAccountServiceImpl implements WxPayAccountService { return null; } + private void deleteRedis(Long id){ + String key1 = Constant.payaccountPrev + id; + RedisCacheUtils.removeCache(wxPayAccountRedisTemplate, key1); + } + @Override public WxPayService getWxPayService(String tenantId) { - TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(tenantId); - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumAppPlat.WX); - WxPayAccount payAccount = this.getById(cAppInfo.getPayId()); - if(cAppInfo != null && payAccount != null){ - return maUtil.getWxPayService(cAppInfo,payAccount); - }else{ - return null; +// TenantEntity tenantEntity = new TenantEntity(); +// tenantEntity.setTenantId(tenantId); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantId, EnumAppPlat.WX); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); } + WxPayAccount payAccount = this.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } + return maUtil.getWxPayService(cAppInfo,payAccount); } + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java index 7f16cff32..535a7ad11 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java @@ -70,7 +70,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { WxCUserService wxCUserService; @Autowired - WxPayAccountMapper wxPayAccountMapper; + WxPayAccountService wxPayAccountService; @Autowired WxOrderMapper wxOrderMapper; @@ -269,12 +269,12 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { } List orderList = orderAdapterService.getChildOrders(composeOrder, appInfo.getTenantId()); - WxCoupon lastCoupon = null; + List productNames = new ArrayList<>(); for (WxOrder o : orderList) { - lastCoupon = checkSinglePayOrder(o, user, payWay); + productNames.add(o.getProductName()); + checkSinglePayOrder(o, user, payWay); } - String productName = orderAdapterService.getPayProductName(lastCoupon); - PayAdapterResult payResult = createPayOrder(appInfo, user, record,composeOrder,orderList,productName, payWay, params,isCreatePay); + PayAdapterResult payResult = createPayOrder(appInfo, user, record,composeOrder,orderList,JSON.toJSONString(productNames), payWay, params,isCreatePay); if (payResult.isSuccess()) { // wxOrderService.sendInsideOrderPushMsg(composeOrder,composeOrder.getMainOrderId()); return new ResultData(Result.SUCCESS,"创建支付单成功",payResult.getData()); @@ -284,8 +284,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { } - private WxCoupon checkSinglePayOrder(WxOrder order,WxCUserBasicInfo user,EnumPayWay payWay) { - if (!order.getOrderGroupId().equals(0L)) { + private void checkSinglePayOrder(WxOrder order,WxCUserBasicInfo user,EnumPayWay payWay) { + if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) { + throw new MallinkException(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); + } + if (order.getOrderGroupId() !=null && !order.getOrderGroupId().equals(0L)) { if (order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { logger.error("支付时拼团已满>>" + order.getOrderGroupId()); throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); @@ -311,43 +314,30 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { if (orderq.getOrderStatus()==EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()) { throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_ATTEND.getCode(),"不能重复参团订单[user:"+user.getId()+",groupId:"+order.getOrderGroupId()+"]"); } - } - - WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); - if (wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && - wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { - logger.error("券已经下架了>>>" + order.getProductId()); - throw new MallinkException(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); - } - - if (!wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && order.getPressEndDate() == null) { - // 非砍价券且非拼团券 - if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()) { + }else if(order.getPressEndDate() != null){ + if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PRESS_OVERTIME.getCode()) { + logger.error("砍价已过期: " + order.toString() + " , payWay: " + payWay.toString()); + throw new MallinkException(ErrorCode.ORDER_PRESS_IS_OVERTIME); + } + }else{ + if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode() + || order.getOrderStatus()==EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()) { logger.error("订单已支付: " + order.toString() + " , payWay: " + payWay.toString()); throw new MallinkException(ErrorCode.ORDER_HAD_PAY); - } else if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()) { + } else if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode() + || order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode()) { logger.error("订单已取消: " + order.toString() + " , payWay: " + payWay.toString()); throw new MallinkException(ErrorCode.ORDER_HAD_CANCEL); } else { - if (order.getOrderStatus() != EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()) { + if (order.getOrderStatus() != EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode() + && order.getOrderStatus() != EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()) { logger.error("订单已支付: " + order.toString() + " , payWay: " + payWay.toString()); throw new MallinkException(ErrorCode.ORDER_IS_NOT_PAY); } } - } else if (order.getPressEndDate() != null) { - // 砍价券,只有在过期时无法支付 - // 砍价中,原价购买 - // 砍价完成,低价购买 - if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PRESS_OVERTIME.getCode()) { - logger.error("砍价已过期: " + order.toString() + " , payWay: " + payWay.toString()); - throw new MallinkException(ErrorCode.ORDER_PRESS_IS_OVERTIME); - } - } - if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) { - throw new MallinkException(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); } - return wxCoupon; } + @Override public PayAdapterResult createPayOrder(WxAppinfo appInfo, WxCUserBasicInfo user,WxPayOrder record,WxComposeOrder composeOrder,List childOrders, String productName,EnumPayWay payWay,PayExtraParam params,boolean isCreatePay) { @@ -356,13 +346,13 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { EnumPayShare isShare = EnumPayShare.NO; try { - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); - PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); + EnumPayMchType payMchTypeEnum = EnumPayMchType.getEnum(payAccount.getMchType()); if(payMchTypeEnum != null){ payMchType = payMchTypeEnum; } - if(EnumAppPlat.TOUTIAO.equals(payWay.getPlat()) && EnumPayMchType.DIRECT.equals(payMchTypeEnum)){ + if(EnumPayMchType.DIRECT.equals(payMchTypeEnum)){ isShare = EnumPayShare.YES; }else{ EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); @@ -428,19 +418,12 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { record.setComposeOrder(composeOrder.getComposeOrderType()); //设置子订单分账金额 Map childShares = new HashMap(); - OrderAdapterService orderAdapterService = orderFactory.getOrderAdapterService(composeOrder.getComposeOrderType()); - List orderList = orderAdapterService.getChildOrders(composeOrder, appInfo.getTenantId()); - if(orderList == null || orderList.isEmpty()){ - logger.error("getChildOrders null" + record.toString()); - throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); - } - - for (WxOrder o : orderList) { - Long merchant_id = null; + for (WxOrder o : childOrders) { + Long merchant_id = 0L; String merchant_uid = ""; if(EnumPayMchType.DIRECT.equals(payMchType)){//直连模式记录收款商户 - //TODO 加缓存 - merchant_id = wxCouponChannelService.getCouponOneMerchantId(o.getCouponChannelId(),o.getTenantId()); + merchant_id = o.getMakeMerchantId(); + PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, payMchTypeEnum.getCode()); if(receiver == null){ throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); @@ -495,7 +478,14 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { public ResultData createMicroPayOrder(WxMerchantBUser user, WxPayOrder record, EnumPayWay payWay,PayExtraParam params) { final IdWorker idworker = IdWorker.get(); - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(user,payWay.getPlat()); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(record.getTenantId(), payWay.getPlat()); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } if (null == params) { params = new PayExtraParam(); } @@ -505,8 +495,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { try { // 1. check 订单 OrderAdapterService orderAdapterService = orderFactory.getOrderAdapterService(EnumComposeOrder.SINGLE.getCode()); - WxComposeOrder composeOrder = orderAdapterService.getComposeOrder(record.getOrderId(), appInfo.getTenantId()); - if (composeOrder == null) { + WxComposeOrder composeOrder = orderAdapterService.getComposeOrder(record.getOrderId(), cAppInfo.getTenantId()); + WxOrder singleOrder = composeOrder.getSingleOrder(); + if (composeOrder == null) { logger.error("pay order, order not allow, repaymentReq: " + record.toString() + ", payWay: " + payWay.toString()); throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); } @@ -522,7 +513,6 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) { return new ResultData(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT); } - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); EnumPayShare paySHareEnum = EnumPayShare.getEnum(payAccount.getShare()); if (paySHareEnum != null) { @@ -558,10 +548,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { record.setComposeOrder(EnumComposeOrder.SINGLE.getCode()); Map childShares = new HashMap(); - Long merchant_id = null; + Long merchant_id = 0L; String merchant_uid = ""; if(EnumPayMchType.DIRECT.getCode().equals(record.getMchType())){//直连模式记录收款商户 - //todo 缓存 merchant_id = user.getMerchantId(); WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, record.getMchType()); if(receiver == null){ @@ -583,9 +572,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { logger.debug("wxPayRecord md5 before:"+record.toString()); String beforemd5 = HashUtil.md5(record.toString()); - List orderList = orderAdapterService.getChildOrders(composeOrder, appInfo.getTenantId()); + List orderList = orderAdapterService.getChildOrders(composeOrder, cAppInfo.getTenantId()); PayAdapterResult payResult = payServiceFactory.getPayAdapterService(payWay.getCode(),payAccount.getPayVersion()).pay(payAccount, record,composeOrder,orderList, - "付款码支付",isShare,appInfo, currentDate, params); + "付款码支付",isShare,cAppInfo, currentDate, params); String aftermd5 = HashUtil.md5(record.toString()); if (beforemd5.equals(aftermd5)) { logger.error("支付方式["+payWay.getCode()+"]支付接口【pay】过程中 WxPayOrder 未做更新.record:"+record.toString()); @@ -595,7 +584,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { //支付失败,更新record,支付成功,则调用 if (payResult.isSuccess()) { try { - handleMicroOrderPaySuccess(payResult.getData(), payResult.getTransactionId(),payWay,payAccount,record,user, appInfo, params); + handleMicroOrderPaySuccess(payResult.getData(), payResult.getTransactionId(),payWay,payAccount,record,user, cAppInfo, params); }catch(Exception e) { logger.error("do handleMicroOrderPaySuccess() error.",e); try { @@ -647,10 +636,16 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), "payOrder not found"); } - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,payWay.getPlat()); - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(record.getTenantId(), payWay.getPlat()); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } PayAdapterService payService = payServiceFactory.getPayAdapterService(payWay.getCode(),payAccount.getPayVersion()); - PayQueryAdapterResult apiResult = payService.queryPayStatus(record, appInfo, payAccount); + PayQueryAdapterResult apiResult = payService.queryPayStatus(record, cAppInfo, payAccount); int status = payServiceFactory.getPayAdapterService(payWay.getCode(),payAccount.getPayVersion()).queryPayStatus(apiResult, record.getPayOrderNo()); boolean isSuccess = true; String msg = ""; @@ -672,7 +667,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { handleOrderPaySuccess(record, apiResult.getTransactionId()); //C端被动支付 }else if (payService instanceof CPassivePayService) { - handleMicroOrderPaySuccess(apiResult.getData(),apiResult.getTransactionId(),payWay,payAccount, record,user,appInfo,null); + handleMicroOrderPaySuccess(apiResult.getData(),apiResult.getTransactionId(),payWay,payAccount, record,user,cAppInfo,null); } return new ResultData(Result.SUCCESS, "success",apiResult.getData()); }else if (status == EnumPayStatus.PAY_STATUS_ORDER_NOT_EXISTS.getCode().intValue()) { @@ -718,7 +713,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { */ @Override public ResultData payOrderClose(WxAppinfo appInfo, WxPayOrder record) { - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); try { PayAdapterResult result = payServiceFactory.getPayAdapterService(record.getPayVendor(),record.getPayVersion()).payOrderClose(appInfo, record, payAccount); if (result.isSuccess()) { @@ -753,11 +748,17 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { */ @Override public ResultData payOrderReverse(WxPayOrder record) { - - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor()).getPlat()); - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + EnumAppPlat plat = EnumPayWay.getEnum(record.getPayVendor()).getPlat(); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(record.getTenantId(),plat); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } try { - PayAdapterResult result = payServiceFactory.getPayAdapterService(record.getPayVendor(),record.getPayVersion()).payOrderReverse(appInfo, record, payAccount); + PayAdapterResult result = payServiceFactory.getPayAdapterService(record.getPayVendor(),record.getPayVersion()).payOrderReverse(cAppInfo, record, payAccount); if (result.isSuccess()) { record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_REVERSE.getCode()); record.setUpdateTime(new Date()); @@ -1027,8 +1028,14 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { @Override public PayQueryAdapterResult ttorderQuery(TenantEntity tenantInfo, Long id) { - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantInfo,EnumAppPlat.TOUTIAO); - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(tenantInfo.getTenantId(), EnumAppPlat.TOUTIAO); + if(appInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } WxPayOrder payOrder = new WxPayOrder(); payOrder.setPayOrderNo(id.toString()); try { @@ -1318,12 +1325,19 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { // 有价券 if (EnumPayStatus.PAY_STATUS_FAIL.getCode() == status) { // 1. get appinfo - WxAppinfo appInfo = wxAppinfoService.getCAppInfo(record,EnumPayWay.getEnum(record.getPayVendor()).getPlat()); + EnumAppPlat plat = EnumPayWay.getEnum(record.getPayVendor()).getPlat(); + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(record.getTenantId(),plat); + if(cAppInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } // 前端支付取消, // 回调未返回,主动检查支付订单状态 try { - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); - int payStatus = payServiceFactory.getPayAdapterService(record.getPayVendor(),payAccount.getPayVersion()).queryPayStatusCode(record, appInfo, payAccount); + int payStatus = payServiceFactory.getPayAdapterService(record.getPayVendor(),payAccount.getPayVersion()).queryPayStatusCode(record, cAppInfo, payAccount); if (payStatus!=EnumPayStatus.PAY_STATUS_SUCCESS.getCode().intValue() && payStatus!=EnumPayStatus.PAY_STATUS_WAIT.getCode().intValue()) { // 支付订单未成功,返回异常 record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_FAIL.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java index db34ebfb0..0c2172123 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java @@ -169,7 +169,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ return 0; } Long couponId = wxCouponChannelMapper.findCouponIdById(o.getCouponChannelId(), o.getTenantId()); - TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantEntity.getTenantId(), couponId, EnumCpsPlanType.ALL.getCode(), null); + TtPoiTakeRate ttPoiTakeRate = ttPoiTakeRateMapper.selectByCoupon(tenantEntity.getTenantId(), couponId, EnumCpsPlanType.ALL.getCode()); if(ttPoiTakeRate != null){ return ttPoiTakeRate.getTakeRate(); }else{ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java index 9d31a0704..8fe0845e4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -37,15 +37,15 @@ import com.iformall.service.WxPayAccountService; import com.iformall.service.WxProfitSharingReceiverService; import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.service.share.entity.ShareAccountResult; -import com.iformall.utils.BeanUtils; -import com.iformall.utils.DateUtils; -import com.iformall.utils.Utility; +import com.iformall.utils.*; import net.sf.saxon.trans.Err; 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.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.Date; @@ -85,6 +85,10 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv @Autowired PayServiceFactory payServiceFactory; + @Autowired + @Qualifier("objectCommonRedisTemplate") + RedisTemplate sharingReceicerRedisTemplate; + @Override public PageInfo listAsPage(WxProfitSharingReceiver record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverMapper.findList(record)); @@ -108,6 +112,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } else { record.setUpdateTime(date); wxProfitSharingReceiverMapper.updateById(record); + this.deleteRedis(record.getId()); } } @@ -120,13 +125,25 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv @Override public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType) { - WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); - receiver.updateTenantInfo(tenantEntity); - receiver.setMerchantId(merchantId); - receiver.setPlat(plat.getCode()); - receiver.setSharingType(sharingType.getCode()); - receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); - return wxProfitSharingReceiverMapper.findOne(receiver); + WxProfitSharingReceiver record = null; + String key = Constant.sharingReceicerPrev + tenantEntity.getTenantId() + + ":" + merchantId + + ":" + plat.getCode() + "a" + sharingType.getCode(); + record = RedisCacheUtils.getCacheObject(sharingReceicerRedisTemplate, key, WxProfitSharingReceiver.class); + if(record == null){ + WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); + receiver.updateTenantInfo(tenantEntity); + receiver.setMerchantId(merchantId); + receiver.setPlat(plat.getCode()); + receiver.setSharingType(sharingType.getCode()); + receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); + record = wxProfitSharingReceiverMapper.findOne(receiver); + if(record != null){ + RedisCacheUtils.cache(sharingReceicerRedisTemplate, key, record, 3600*24*7); + } + } + return record; + } @Override @@ -250,14 +267,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } @Override - public ResultData updateTtReceiver(WxMerchant merchant, String appId, String payAccountKey) { - if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { + public ResultData updateTtReceiver(WxMerchant merchant) { + if(merchant == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); //进件页面 - AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); + AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); if(improt_URLResult.isSuccess()){ wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); @@ -265,7 +282,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); } //余额页面 - AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); + AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); if(balance_URLResult.isSuccess()){ wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); @@ -277,13 +294,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } @Override - public ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey) { - if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { + public ResultData getTtReceiverImprotURL(WxMerchant merchant) { + if(merchant == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); //进件页面 - AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); + AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); if(improt_URLResult.isSuccess()){ wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); @@ -296,13 +313,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } @Override - public ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey) { - if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { + public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { + if(merchant == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); //余额页面 - AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); + AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); if(balance_URLResult.isSuccess()){ wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); @@ -333,10 +350,19 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } @Override - public ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey) { - if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { + public ResultData updateTtReceiverIsUse(WxMerchant merchant) { + if(merchant == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); } + WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(merchant.getTenantId(), EnumAppPlat.TOUTIAO); + if(appInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); + if(payAcount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } + WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); oldReceiver.updateTenantInfo(merchant); oldReceiver.setMerchantId(merchant.getId()); @@ -346,7 +372,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv if(wxProfitSharingReceiver == null){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到分账信息"); } - QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appId, payAccountKey, wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); + + QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); if(queryMerchantResult != null){ // if(queryMerchantResult.getWx().intValue() != 1){ // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); @@ -363,10 +390,18 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } } - private AppAddSubMerchantResult appAddSubMerchant(String appId, String payAccountKey, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ + private AppAddSubMerchantResult appAddSubMerchant(TenantEntity tenantEntity, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ + WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.TOUTIAO); + if(appInfo == null){ + throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); + if(payAcount == null){ + throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); + } AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); - appAddSubMerchant.setAppId(appId); - appAddSubMerchant.setSalt(payAccountKey); + appAddSubMerchant.setAppId(appInfo.getAppId()); + appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); appAddSubMerchant.setSubMerchantId(merchantId); appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); @@ -405,7 +440,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); receiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateById(receiver); + this.saveOrUpdate(receiver); //发送短信 if (send.equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { @@ -435,9 +470,19 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } else { oldReceiver.setParameter(receiver.getParameter()); oldReceiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateById(oldReceiver); + this.saveOrUpdate(oldReceiver); } return new ResultData(); } + + private void deleteRedis(Long id){ + WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.selectById(id); + if(receiver != null){ + String key = Constant.sharingReceicerPrev + receiver.getTenantId() + + ":" + receiver.getMerchantId() + + ":" + receiver.getPlat() + "a" + receiver.getSharingType(); + RedisCacheUtils.removeCache(sharingReceicerRedisTemplate, key); + } + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java index 377df12c4..de2c19e50 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java @@ -205,6 +205,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService { updApp.updateTenantInfo(appinfo); updApp.setId(appinfo.getId()); updApp.setPayId(wxPayAccount.getId()); + wxAppinfoService.saveOrUpdate(updApp); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java index debaede09..d93bf1f26 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java @@ -509,13 +509,21 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); } - // 创建退款订单 - final IdWorker idWorker = IdWorker.get(); - Long refundId = idWorker.nextId(); - WxRefundOrder record = new WxRefundOrder(); + record.updateTenantInfo(wxOrder); record.setPayOrderNo(String.valueOf(payOrder.getId())); record.setOrderId(wxOrder.getId()); + record.setNotStatus(EnumRefundStatus.REFUND_FAIL.getCode()); + // check 是否有退款订单 + List refundList = wxRefundOrderMapper.findList(record); + if (refundList.size() > 0) { + logger.error("退款订单已存在, 无法再提交退款申请"); + throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); + } + + // 创建退款订单 + final IdWorker idWorker = IdWorker.get(); + Long refundId = idWorker.nextId(); //String out_refund_id = String.valueOf(refundId); @@ -543,13 +551,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { logger.error("退款订单数据库插入出错: " + record.toString()); throw new MallinkException(ErrorCode.DB_FAIL); } - - // check 是否有退款订单 - List refundList = wxRefundOrderMapper.findList(record); - if (refundList.size() > 0) { - logger.error("退款订单已存在, 无法再提交退款申请"); - throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); - } + WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); if (null == payAccount) { throw new MallinkException(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "payAccount为空[payId:"+appInfo.getPayId()+"]"); @@ -735,8 +737,16 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { } WxRefundOrder record = new WxRefundOrder(); + record.updateTenantInfo(wxOrder); record.setPayOrderNo(String.valueOf(payOrder.getId())); record.setOrderId(orderId); + record.setNotStatus(EnumRefundStatus.REFUND_FAIL.getCode()); + // check 是否有退款订单 + List refundList = wxRefundOrderMapper.findList(record); + if (refundList.size() > 0) { + logger.error("退款订单已存在, 无法再提交退款申请"); + throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); + } // 创建退款订单 Long refundId = idWorker.nextId(); String out_refund_id = String.valueOf(refundId); @@ -770,13 +780,8 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { logger.error("order:("+orderId+")"+appInfo.getPayId()+"查询不到WxPayAccount"); throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), appInfo.getPayId()+"查询不到WxPayAccount"); } - // check 是否有退款订单 - List refundList = wxRefundOrderMapper.findList(record); - if (refundList.size() > 0) { - logger.error("退款订单已存在, 无法再提交退款申请"); - throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); - } - RefundAdapterResult refundResult = payServiceFactory.getRefundPayAdapterService(payOrder.getPayVendor(),payAccount.getPayVersion()).refund(payAccount, appInfo, record, payOrder,orderId, null); + + RefundAdapterResult refundResult = payServiceFactory.getRefundPayAdapterService(payOrder.getPayVendor(),payAccount.getPayVersion()).refund(payAccount, appInfo, record, payOrder,orderId, EnumPayType.PAY_AUTO_REFUND); if (refundResult.isSuccess()) { record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); wxRefundOrderMapper.updateById(record); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java index 51011b0af..6a31010ae 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java @@ -160,7 +160,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); } if(basicInfo == null && StringUtils.isNotBlank(record.getUserPhone())){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null); + basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); } if(basicInfo != null){ @@ -377,7 +377,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); } if(basicInfo == null){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null); + basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); } if(basicInfo == null){ logger.error("--第三方积分订单--未找到用户---userId="+record.getUserNumber()); @@ -562,7 +562,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); } if(basicInfo == null){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null); + basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); } if(basicInfo == null){ logger.error("--第三方积分变动--未找到用户---userId="+record.getUserNumber()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java index 167b8db0f..f8332cff0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java @@ -157,7 +157,8 @@ public class WxTopicServiceImpl implements WxTopicService { wxCouponChannel.setId(idWorker.nextId()); wxCouponChannel.setBeginTime(record.getBeginTime()); wxCouponChannel.setEndTime(record.getEndTime()); - wxCouponChannel.setCouponId(Long.parseLong(couponArray[1])); + wxCouponChannel.setCouponId(wxCoupon.getId()); + wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setSubTargetId(record.getId()); wxCouponChannel.updateTenantInfo(record); wxCouponChannel.setTitle(wxCoupon.getTitle()); diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddCreditMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddCreditMsgServiceImpl.java new file mode 100644 index 000000000..8315a23a5 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddCreditMsgServiceImpl.java @@ -0,0 +1,124 @@ +package com.iformall.service.msg.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterAddCreditMsg; +import com.iformall.domain.po.msg.AppUniformMsg; +import com.iformall.domain.po.msg.BaseMsg; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumBusinessType; +import com.iformall.enums.EnumMemberCardStatus; +import com.iformall.mapper.*; +import com.iformall.service.WxAppinfoService; +import com.iformall.service.WxCUserService; +import com.iformall.service.WxMemberCardService; +import com.iformall.service.WxPayAccountService; +import com.iformall.service.msg.MsgSendService; +import com.iformall.service.wechat.FmOpenService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * + */ +@Service +public class AfterAddCreditMsgServiceImpl implements MsgSendService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxAppinfoService wxAppinfoService; + + @Autowired + private WxPayAccountService wxPayAccountService; + + @Autowired + private WxMemberCardService wxMemberCardService; + + @Autowired + private WxCUserBasicInfoMapper wxCUserBasicInfoMapper; + + @Autowired + private WxCUserMapper wxCUserMapper; + + @Autowired + private WxMemberCardMapper wxMemberCardMapper; + + @Autowired + private WxCreditHistoryMapper wxCreditHistoryMapper; + + + @Override + public void send(BaseMsg baseMsg) throws Exception{ + AfterAddCreditMsg afterAddCreditMsg = (AfterAddCreditMsg)baseMsg; + + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(afterAddCreditMsg.getTenantId()); + tenantEntity.setParentTenantId(afterAddCreditMsg.getParentTenantId()); + + //微信商圈同步会员积分 + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + logger.error("未找到微信C端小程序"); + return; + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + logger.error("未找到微信支付配置"); + return; + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + logger.error("未找到商圈配置或商圈版本不支持"); + return; + } + if(afterAddCreditMsg.getBasicUserId() != null){ + Long cuserId = wxCUserMapper.findCuserId(afterAddCreditMsg.getBasicUserId(), afterAddCreditMsg.getTenantId()); + afterAddCreditMsg.setCuserId(cuserId); + } + + WxMemberCard memberCardQ = new WxMemberCard(); + memberCardQ.updateFinalTenantId(tenantEntity); + memberCardQ.setCuserId(afterAddCreditMsg.getCuserId()); + memberCardQ.setUserCardStatus(EnumMemberCardStatus.EFFECTIVE.getCode()); + List memberCards = wxMemberCardMapper.findList(memberCardQ); + if(memberCards == null || memberCards.isEmpty()){ + logger.error("该用户未授权商圈"+afterAddCreditMsg.getCuserId()); + return; + } + String markid = null; + Integer before_bonus_value = 0,bonus_value = 0; + + if(afterAddCreditMsg.getCreditHistoryId() == null){ + if(afterAddCreditMsg.getBasicUserId() == null){ + WxCUser wxCUser = wxCUserMapper.selectById(afterAddCreditMsg.getCuserId(),afterAddCreditMsg.getTenantId()); + afterAddCreditMsg.setBasicUserId(wxCUser.getUserId()); + } + + WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(afterAddCreditMsg.getBasicUserId(), tenantEntity.getFinalTenantId()); + markid = basicInfo.getId().toString(); + bonus_value = basicInfo.getCredit(); + }else{ + WxCreditHistory wxCreditHistory = wxCreditHistoryMapper.selectById(afterAddCreditMsg.getCreditHistoryId(), tenantEntity.getFinalTenantId()); + markid = wxCreditHistory.getId().toString(); + before_bonus_value = wxCreditHistory.getCreditAmount()-wxCreditHistory.getCreditNum(); + bonus_value = wxCreditHistory.getCreditAmount(); + } + + for(int i = 0;i < memberCards.size();i++){ + WxMemberCard memberCard = memberCards.get(i); + markid = markid + "_" + i; + ResultData resultData = wxMemberCardService.syncMemberCardBonus(tenantEntity, memberCard.getCardId(), memberCard.getCardCode(), markid, + before_bonus_value, bonus_value, null); + logger.info(tenantEntity.getTenantId()+"--"+memberCard.getId()+"--微信商圈同步会员积分{}"+resultData.message); + } + + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddScoreMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddScoreMsgServiceImpl.java new file mode 100644 index 000000000..b7550c45d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterAddScoreMsgServiceImpl.java @@ -0,0 +1,63 @@ +package com.iformall.service.msg.impl; + +import com.iformall.domain.po.WxAppinfo; +import com.iformall.domain.po.WxPayAccount; +import com.iformall.domain.po.WxTemplateMsg; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterAddCreditMsg; +import com.iformall.domain.po.msg.AfterAddScoreMsg; +import com.iformall.domain.po.msg.BaseMsg; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumBusinessType; +import com.iformall.mapper.WxAppinfoMapper; +import com.iformall.service.WxAppinfoService; +import com.iformall.service.WxPayAccountService; +import com.iformall.service.msg.MsgSendService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class AfterAddScoreMsgServiceImpl implements MsgSendService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxAppinfoService wxAppinfoService; + + @Autowired + private WxPayAccountService wxPayAccountService; + + + @Override + public void send(BaseMsg baseMsg) throws Exception{ + AfterAddScoreMsg afterAddScoreMsg = (AfterAddScoreMsg)baseMsg; + + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(afterAddScoreMsg.getTenantId()); + tenantEntity.setParentTenantId(afterAddScoreMsg.getParentTenantId()); + + //微信商圈同步会员等级 todo + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + logger.error("未找到微信C端小程序"); + return; + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + logger.error("未找到微信支付配置"); + return; + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + logger.error("未找到商圈配置或商圈版本不支持"); + return; + } + + + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java new file mode 100644 index 000000000..71fa9556a --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java @@ -0,0 +1,58 @@ +package com.iformall.service.msg.impl; + +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterBusinessCreditMsg; +import com.iformall.domain.po.msg.AfterCarInOutMsg; +import com.iformall.domain.po.msg.BaseMsg; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumBusinessType; +import com.iformall.enums.EnumCarCmd; +import com.iformall.mapper.WxCUserMapper; +import com.iformall.mapper.WxCarCmdLogMapper; +import com.iformall.pay.WxPayConstant; +import com.iformall.service.WxAppinfoService; +import com.iformall.service.WxBusinessCircleOrderService; +import com.iformall.service.WxCUserCarService; +import com.iformall.service.WxPayAccountService; +import com.iformall.service.msg.MsgSendService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class AfterBusinessCreditMsgServiceImpl implements MsgSendService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxBusinessCircleOrderService wxBusinessCircleOrderService; + + + @Override + public void send(BaseMsg baseMsg) throws Exception{ + AfterBusinessCreditMsg msg = (AfterBusinessCreditMsg)baseMsg; + + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(msg.getTenantId()); + tenantEntity.setParentTenantId(msg.getParentTenantId()); + + try { + Thread.currentThread().sleep(3000); + } catch (Exception e) { + logger.error("sleep error: " + e.getMessage()); + } + + WxBusinessCircleOrder circleOrder = wxBusinessCircleOrderService.getById(msg.getBusinessCircleOrderId(), tenantEntity.getTenantId()); + if(circleOrder != null){ + wxBusinessCircleOrderService.notifyPoints(circleOrder); + } + + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java new file mode 100644 index 000000000..a70a7a7f1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java @@ -0,0 +1,110 @@ +package com.iformall.service.msg.impl; + +import com.iformall.common.ResultData; +import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.AfterAddScoreMsg; +import com.iformall.domain.po.msg.AfterCarInOutMsg; +import com.iformall.domain.po.msg.BaseMsg; +import com.iformall.enums.EnumAppPlat; +import com.iformall.enums.EnumBusinessType; +import com.iformall.enums.EnumCarCmd; +import com.iformall.mapper.WxAppinfoMapper; +import com.iformall.mapper.WxCUserMapper; +import com.iformall.mapper.WxCarCmdLogMapper; +import com.iformall.pay.WxPayConstant; +import com.iformall.service.*; +import com.iformall.service.msg.MsgSendService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class AfterCarInOutMsgServiceImpl implements MsgSendService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxAppinfoService wxAppinfoService; + + @Autowired + private WxPayAccountService wxPayAccountService; + + @Autowired + private WxBusinessCircleOrderService wxBusinessCircleOrderService; + + @Autowired + private WxCUserCarService wxCUserCarService; + + @Autowired + private WxCUserMapper wxCUserMapper; + + @Autowired + private WxCarCmdLogMapper wxCarCmdLogMapper; + + + @Override + public void send(BaseMsg baseMsg) throws Exception{ + AfterCarInOutMsg afterCarInOutMsg = (AfterCarInOutMsg)baseMsg; + + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(afterCarInOutMsg.getTenantId()); + tenantEntity.setParentTenantId(afterCarInOutMsg.getParentTenantId()); + + //微信商圈同步停车状态 + WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); + if(cAppInfo == null){ + logger.error("未找到微信C端小程序"); + return; + } + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); + if(payAccount == null){ + logger.error("未找到微信支付配置"); + return; + } + if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ + logger.error("未找到商圈配置或商圈版本不支持"); + return; + } + + WxCarCmdLog wxCarCmdLog = wxCarCmdLogMapper.selectById(afterCarInOutMsg.getCarCmdLogId(), tenantEntity.getTenantId()); + if(wxCarCmdLog == null || StringUtils.isBlank(wxCarCmdLog.getPlateNumber())){ + logger.error("未找到停车记录"); + return; + } + + String state = null; + if(EnumCarCmd.getCarIn().contains(wxCarCmdLog.getCmdType())){ + state = WxPayConstant.CAR_IN; + }else if(EnumCarCmd.getCarOut().contains(wxCarCmdLog.getCmdType())){ + state = WxPayConstant.CAR_OUT; + }else{ + logger.error("不是出入场记录"+wxCarCmdLog.getId()); + return; + } + + String plateNumber = wxCarCmdLog.getPlateNumber(); + WxCUserCar userCarQ = new WxCUserCar(); + userCarQ.updateTenantInfo(tenantEntity); + userCarQ.setCarNumber(plateNumber); + WxCUserCar userCar = wxCUserCarService.getOnlyOne(userCarQ); + if(userCar == null){ + logger.error("车牌未找到用户{}"+plateNumber); + return; + } + String openId = wxCUserMapper.findOpenId(userCar.getCUserId(), tenantEntity.getTenantId()); + if(StringUtils.isBlank(openId)){ + logger.error("车牌未找到用户{}"+plateNumber); + return; + } + ResultData resultData = wxBusinessCircleOrderService.syncParkings(tenantEntity, openId, plateNumber, state, wxCarCmdLog.getCreateDate()); + + logger.info(tenantEntity.getTenantId()+"--"+plateNumber+"--微信商圈同步停车记录{}"+resultData.message); + + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java index e490c543d..e88503577 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java @@ -33,8 +33,6 @@ public class FmInsideCLoginMsgServiceImpl implements MsgSendService { @Autowired private CUserServiceFactory cuserFactory; - private BasicCUserService basicCUserService; - @Autowired private WxCUserFromService wxCUserFromService; diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/SyncMemberCardMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/SyncMemberCardMsgServiceImpl.java new file mode 100644 index 000000000..a6509e9e5 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/SyncMemberCardMsgServiceImpl.java @@ -0,0 +1,38 @@ +package com.iformall.service.msg.impl; + +import com.iformall.common.ResultData; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.msg.BaseMsg; +import com.iformall.domain.po.msg.SyncMemberCardMsg; +import com.iformall.service.WxMemberCardService; +import com.iformall.service.msg.MsgSendService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + */ +@Service +public class SyncMemberCardMsgServiceImpl implements MsgSendService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxMemberCardService wxMemberCardService; + + + @Override + public void send(BaseMsg baseMsg) throws Exception{ + SyncMemberCardMsg syncMemberCardMsg = (SyncMemberCardMsg)baseMsg; + + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(syncMemberCardMsg.getTenantId()); + tenantEntity.setParentTenantId(syncMemberCardMsg.getParentTenantId()); + + ResultData resultData = wxMemberCardService.syncMemberCard(tenantEntity, syncMemberCardMsg.getCardId(), syncMemberCardMsg.getCode()); + logger.info(tenantEntity.getTenantId()+"--"+syncMemberCardMsg.getCode()+"--微信商圈同步会员卡{}"+resultData.message); + + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/order/OrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/OrderAdapterService.java index 6ae2f7c5d..f2e95f83b 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/OrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/OrderAdapterService.java @@ -21,10 +21,7 @@ public interface OrderAdapterService { WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,List orderSave,EnumPayWay payWay,EnumPayVersion payVersion); WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,int payment,EnumPayWay payWay,EnumPayVersion payVersion); - - //第三方平台推送过来的订单 - WxComposeOrder createDBMainOrderByPushOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,String allExtParam,List platPushOrderList,EnumPayWay payWay,EnumPayVersion payVersion); - + /** * 获取支付时商品名称,供服务商API使用 * @param lastCoupon diff --git a/mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeOrder.java b/mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeOrder.java index 96958e720..0217cf47d 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeOrder.java +++ b/mallinkService/src/main/java/com/iformall/service/order/entity/WxComposeOrder.java @@ -34,10 +34,6 @@ public class WxComposeOrder extends TenantEntity{ private WxOrder singleOrder;//单个模式时不用重复查询 private WxBatchOrder mainOrder;//真正的主订单对象,批量下单时才有 - - private Map couponChannelMap; - - private Map couponMap; private List> extParam;//处理其他返回参数 diff --git a/mallinkService/src/main/java/com/iformall/service/order/impl/SingleOrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/impl/SingleOrderAdapterService.java index 03af75957..e34ec52a1 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/impl/SingleOrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/impl/SingleOrderAdapterService.java @@ -50,14 +50,7 @@ public class SingleOrderAdapterService extends BaseBatchOrderAdapterService { @Override public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrder(tenantEntity,user, payment,null, payWay,payVersion, EnumComposeOrder.SINGLE,null,null); - } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - @Override - public WxComposeOrder createDBMainOrderByPushOrder(TenantEntity tenantEntity, WxCUserBasicInfo user,String allExtParam, - List platPushOrderList, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrderForPushOrders(tenantEntity, user, allExtParam,platPushOrderList, payWay,payVersion, EnumComposeOrder.SINGLE); + return super.createDBMainOrder(tenantEntity,user, payment,null, payWay,payVersion, EnumComposeOrder.SINGLE); } @Override @@ -70,7 +63,7 @@ public class SingleOrderAdapterService extends BaseBatchOrderAdapterService { public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { WxComposeOrder corder = super.getComposeOrder(mainOrderId, tenantId, EnumComposeOrder.SINGLE); List orders = super.getChildOrders(corder, tenantId, EnumComposeOrder.SINGLE); - if (null != orders && orders.size() > 0 ) { + if (null != orders && orders.size() == 1 ) { corder.setSingleOrder(orders.get(0)); } return corder; diff --git a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java index b0e7864b4..1e4473922 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/BaseBatchOrderAdapterService.java @@ -80,55 +80,20 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) protected WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,List orderSave,EnumPayWay payWay,EnumPayVersion payVersion,EnumComposeOrder composeOrderType) { int payment = 0; - Map couponMap = new HashMap(); - Map couponChannelMap = new HashMap(); for (OrderComposeSaveDto ocsd : orderSave) { - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(ocsd.getSignleOrder().getCouponChannelId(),tenantEntity.getTenantId()); - if (null == wxCouponChannel) { - throw new MallinkException(ErrorCode.MSG_INSIDE_ERROR.getCode(),"渠道不存在:"+ocsd.getSignleOrder().getCouponChannelId()); - } + WxCouponChannel wxCouponChannel = ocsd.getWxCouponChannel(); + WxCoupon wxCoupon = ocsd.getWxCoupon(); boolean isPress = ocsd.getSignleOrder().isPressOrder(); - WxComposeChildOrderPrice price = getChildCouponOrderPrice(ocsd,ocsd.getWxCoupon(),wxCouponChannel, isPress, ocsd.getSignleOrder().getOrderGroupId(), ocsd.getCount()); + WxComposeChildOrderPrice price = getChildCouponOrderPrice(ocsd,wxCoupon,wxCouponChannel, isPress, ocsd.getSignleOrder().getOrderGroupId(), ocsd.getCount()); payment = payment+price.getRealPayMent(); - couponMap.put(ocsd.getWxCoupon().getId(),ocsd.getWxCoupon()); - couponChannelMap.put(wxCouponChannel.getId(), wxCouponChannel); } - return createDBMainOrder(tenantEntity, user, payment, null,payWay,payVersion, composeOrderType,couponChannelMap,couponMap); - } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - protected WxComposeOrder createDBMainOrderForPushOrders(TenantEntity tenantEntity,WxCUserBasicInfo user,String allExtParam,List platPushOrderList,EnumPayWay payWay, - EnumPayVersion payVersion,EnumComposeOrder composeOrderType) { - int payment = 0; - Map couponMap = new HashMap(); - Map couponChannelMap = new HashMap(); - for (PlatPushOrderSaveDto ocsd : platPushOrderList) { - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(ocsd.getCouponChannelId(),tenantEntity.getTenantId()); - if (null == wxCouponChannel) { - throw new MallinkException(ErrorCode.MSG_INSIDE_ERROR.getCode(),"渠道不存在:"+ocsd.getCouponChannelId()); - } - boolean isPress = ocsd.isPress(); - WxComposeChildOrderPrice price = getChildCouponOrderPrice(ocsd.getShippingType(),ocsd.getWxCoupon(),wxCouponChannel, isPress, ocsd.getOrderGroupId(), ocsd.getCount()); - payment = payment+price.getRealPayMent(); - couponMap.put(ocsd.getWxCoupon().getId(),ocsd.getWxCoupon()); - couponChannelMap.put(wxCouponChannel.getId(), wxCouponChannel); - } - - return createDBMainOrder(tenantEntity, user, payment, allExtParam,payWay,payVersion, composeOrderType,couponChannelMap,couponMap); + return createDBMainOrder(tenantEntity, user, payment, null,payWay,payVersion, composeOrderType); } @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) protected WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,int payment,String allExtParam,EnumPayWay payWay,EnumPayVersion payVersion, - EnumComposeOrder composeOrderType,Map couponChannelMap,Map couponMap) { - //判断是否poi订单 - Integer isTtPoiOrder = null; - try{ - if(EnumPayWay.PAY_WAY_TT.equals(payWay) && isTtPoiOrder(tenantEntity,couponChannelMap)){ - isTtPoiOrder = EnumYesOrNo.YES.getCode(); - } - }catch(Exception e){ - } + EnumComposeOrder composeOrderType) { WxBatchOrder order =new WxBatchOrder(); final IdWorker idWorker = IdWorker.get(); @@ -139,35 +104,19 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic order.setPayVendor(payWay.getCode()); order.setPayVersion(payVersion.getCode()); order.setOrderType(composeOrderType.getCode()); - order.setIsTtPoiOrder(isTtPoiOrder); + if(EnumPayWay.PAY_WAY_TT.equals(payWay)){ + order.setIsTtPoiOrder(EnumYesOrNo.YES.getCode()); + } + order.setCreateDate(new Date()); order.setExtParam(allExtParam); wxBatchOrderMapper.insert(order); WxComposeOrder composeOrder = new WxComposeOrder(order.getId(), composeOrderType.getCode(), payment); composeOrder.setMainOrder(order); composeOrder.updateTenantInfo(tenantEntity); - if (null != couponChannelMap) { - composeOrder.setCouponChannelMap(couponChannelMap); - } - if (null != couponMap){ - composeOrder.setCouponMap(couponMap); - } return composeOrder; } - //判断是否poi订单 - private boolean isTtPoiOrder(TenantEntity tenantEntity,Map couponChannelMap){ - boolean isTtPoiOrder = false; - if(null != couponChannelMap){ - List couponChannelIds = new ArrayList<>(couponChannelMap.keySet()); - Integer poiCount = ttCouponChannelPoiMapper.getPoiPutOnCount(tenantEntity.getTenantId(),couponChannelIds); - if(couponChannelIds.size() == poiCount.intValue()){ - isTtPoiOrder = true; - } - } - return isTtPoiOrder; - } - protected WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId,EnumComposeOrder composeOrderType) { WxBatchOrder order = wxBatchOrderMapper.selectById(mainOrderId, tenantId); WxComposeOrder corder = new WxComposeOrder(order.getId(),composeOrderType.getCode(),order.getPayment()); diff --git a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/CouponPackageOrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/CouponPackageOrderAdapterService.java index 589a77394..bea5df03d 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/CouponPackageOrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/CouponPackageOrderAdapterService.java @@ -39,19 +39,17 @@ public class CouponPackageOrderAdapterService extends BaseBatchOrderAdapterServi @Override public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrder(tenantEntity, user, payment,null, payWay,payVersion, EnumComposeOrder.PACKAGECOUPON,null,null); - } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - @Override - public WxComposeOrder createDBMainOrderByPushOrder(TenantEntity tenantEntity, WxCUserBasicInfo user,String allExtParam, - List platPushOrderList, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrderForPushOrders(tenantEntity, user, allExtParam, platPushOrderList, payWay,payVersion, EnumComposeOrder.PACKAGECOUPON); + return super.createDBMainOrder(tenantEntity, user, payment,null, payWay,payVersion, EnumComposeOrder.PACKAGECOUPON); } @Override public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { - return super.getComposeOrder(mainOrderId, tenantId, EnumComposeOrder.PACKAGECOUPON); + WxComposeOrder corder = super.getComposeOrder(mainOrderId, tenantId, EnumComposeOrder.PACKAGECOUPON); + List orders = super.getChildOrders(corder, tenantId, EnumComposeOrder.PACKAGECOUPON); + if (null != orders && orders.size() == 1 ) { + corder.setSingleOrder(orders.get(0)); + } + return corder; } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/MulityNumberOneOrderBatchOrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/MulityNumberOneOrderBatchOrderAdapterService.java index 7b7a4ab38..7c36f4f5a 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/MulityNumberOneOrderBatchOrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/MulityNumberOneOrderBatchOrderAdapterService.java @@ -1,6 +1,7 @@ package com.iformall.service.order.impl.batch; +import java.util.ArrayList; import java.util.List; import com.iformall.domain.po.*; @@ -41,22 +42,15 @@ public class MulityNumberOneOrderBatchOrderAdapterService extends BaseBatchOrder @Override public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrder(tenantEntity,user, payment, null, payWay,payVersion, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH,null,null); + return super.createDBMainOrder(tenantEntity,user, payment, null, payWay,payVersion, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - @Override - public WxComposeOrder createDBMainOrderByPushOrder(TenantEntity tenantEntity, WxCUserBasicInfo user,String allExtParam, - List platPushOrderList, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrderForPushOrders(tenantEntity, user, allExtParam, platPushOrderList, payWay,payVersion, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); - } - @Override public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { WxComposeOrder composeOrder = super.getComposeOrder(mainOrderId, tenantId, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); List orders = super.getChildOrders(composeOrder, tenantId, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); - if (null != orders && orders.size() > 0 ) { + //todo 目前只有单订单 + if (null != orders && orders.size() == 1 ) { composeOrder.setSingleOrder(orders.get(0)); } return composeOrder; @@ -64,7 +58,11 @@ public class MulityNumberOneOrderBatchOrderAdapterService extends BaseBatchOrder @Override public List getChildOrders(WxComposeOrder composeOrder, String tenantId) { - return super.getChildOrders(composeOrder, tenantId, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); + //todo 目前只有单订单 + List childOrders = new ArrayList(); + childOrders.add(composeOrder.getSingleOrder()); + return childOrders; +// return super.getChildOrders(composeOrder, tenantId, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/OneNumberOneOrderBatchOrderAdapterService.java b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/OneNumberOneOrderBatchOrderAdapterService.java index 35aeadb29..201fdfe07 100644 --- a/mallinkService/src/main/java/com/iformall/service/order/impl/batch/OneNumberOneOrderBatchOrderAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/order/impl/batch/OneNumberOneOrderBatchOrderAdapterService.java @@ -40,14 +40,7 @@ public class OneNumberOneOrderBatchOrderAdapterService extends BaseBatchOrderAda @Override public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrder(tenantEntity,user, payment, null,payWay,payVersion, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH,null,null); - } - - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - @Override - public WxComposeOrder createDBMainOrderByPushOrder(TenantEntity tenantEntity, WxCUserBasicInfo user,String allExtParam, - List platPushOrderList, EnumPayWay payWay,EnumPayVersion payVersion) { - return super.createDBMainOrderForPushOrders(tenantEntity, user, allExtParam,platPushOrderList, payWay,payVersion, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH); + return super.createDBMainOrder(tenantEntity,user, payment, null,payWay,payVersion, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH); } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/park/impl/etcp/ETCPUtil.java b/mallinkService/src/main/java/com/iformall/service/park/impl/etcp/ETCPUtil.java index cedf9cbec..f25398ab2 100755 --- a/mallinkService/src/main/java/com/iformall/service/park/impl/etcp/ETCPUtil.java +++ b/mallinkService/src/main/java/com/iformall/service/park/impl/etcp/ETCPUtil.java @@ -46,7 +46,8 @@ public class ETCPUtil { /** * 域名地址 */ - private static final String domain = "http://mapi.test.etcp.cn"; +// private static final String domain = "http://mapi.test.etcp.cn"; + private static final String domain = "http://mapi.etcp.cn"; // private static final String appId = "FMLK"; @@ -56,12 +57,15 @@ public class ETCPUtil { /** * 商户号 测试时请换成ETCP开放平台为商户平台分配的商户号 */ - private static final String merchantNo = "C7AEAF80BA8C44ADB42F3DB3CBC7D18A"; +// private static final String merchantNo = "C7AEAF80BA8C44ADB42F3DB3CBC7D18A"; + private static final String merchantNo = "24E6DD2767F44F75A4AD916ECBFE4FA1"; /** * 商户密钥 测试时请换成ETCP开放平台为商户平台分配的商户密钥 */ - private static final String merchantKey = "C292FFC7DCFB46AFB02792CD43F6DCC7"; +// private static final String merchantKey = "C292FFC7DCFB46AFB02792CD43F6DCC7"; + private static final String merchantKey = "B6751C6B37254C4390031F098738B5D9"; + /** * 接口服务版本号 @@ -246,7 +250,9 @@ public class ETCPUtil { //caller.bCouponRecord(domain, merchantNo, merchantKey, version, etcpToken, parkId, businessId, carNumber, couponFreeId); // 联合登录测试 - /*ret = caller.userSignin(domain, appId, merchantNo, merchantKey, version, "13910154397"); + //etcp 登陆 + ret = caller.userSignin(domain, appId, merchantNo, merchantKey, version, "13597837191"); + System.out.println(ret); objret = JSON.parseObject(ret); if (objret.getIntValue("code") != 0) @@ -254,38 +260,37 @@ public class ETCPUtil { etcpToken = objret.getJSONObject("data").getString("token"); System.out.println(etcpToken); - */ - // 绑定车牌查询 + // 绑定的车牌查询 ret = caller.carNum(domain, merchantNo, merchantKey, version, etcpToken); System.out.println(ret); - objret = JSON.parseObject(ret); - if (objret.getIntValue("code") != 0) - return; - JSONObject data = objret.getJSONObject("data"); - if (data.getIntValue("number") <= 0) { - // 车牌绑定测试 - ret = caller.bindCar(domain, etcpToken, carNumber, null, merchantNo, merchantKey, version); - objret = JSON.parseObject(ret); - if (objret.getIntValue("code") != 0) - return; - } - JSONArray carArry = data.getJSONArray("carList"); - carNumber = JSON.toJSONString(carArry.get(0)); - carNumber = carNumber.substring(1, carNumber.length() -1); - System.out.println(carNumber); - // 停车费查询 - ret = caller.orderUnpay(domain, appId, merchantNo, merchantKey, version, etcpToken, carNumber); - System.out.println(ret); - objret = JSON.parseObject(ret); - if (objret.getIntValue("code") != 0) - return; - JSONArray payArr = objret.getJSONArray("data"); - JSONObject payObj = payArr.getJSONObject(0); - String orderId = payObj.getString("orderId"); - // 微信h5支付 - ret = caller.orderPay(domain, merchantNo, merchantKey, version, etcpToken, orderId, "http://test.cn", null); - System.out.println(ret); +// objret = JSON.parseObject(ret); +// if (objret.getIntValue("code") != 0) +// return; +// JSONObject data = objret.getJSONObject("data"); +// if (data.getIntValue("number") <= 0) { +// // 车牌绑定测试 +// ret = caller.bindCar(domain, etcpToken, carNumber, null, merchantNo, merchantKey, version); +// objret = JSON.parseObject(ret); +// if (objret.getIntValue("code") != 0) +// return; +// } +// JSONArray carArry = data.getJSONArray("carList"); +// carNumber = JSON.toJSONString(carArry.get(0)); +// carNumber = carNumber.substring(1, carNumber.length() -1); +// System.out.println(carNumber); +// // 停车费查询 +// ret = caller.orderUnpay(domain, appId, merchantNo, merchantKey, version, etcpToken, carNumber); +// System.out.println(ret); +// objret = JSON.parseObject(ret); +// if (objret.getIntValue("code") != 0) +// return; +// JSONArray payArr = objret.getJSONArray("data"); +// JSONObject payObj = payArr.getJSONObject(0); +// String orderId = payObj.getString("orderId"); +// // 微信h5支付 +// ret = caller.orderPay(domain, merchantNo, merchantKey, version, etcpToken, orderId, "http://test.cn", null); +// System.out.println(ret); // 车牌解绑测试 //caller.unbindCar(merchantNo, merchantKey, version, etcpToken, carNumber); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java index 74760bc7a..3e1005bde 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/v1/miniApp/TtMiniAppPayAdapterService.java @@ -17,6 +17,7 @@ import com.iformall.douyin.payv2.result.TtPayUnifiedOrderV2Result; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; +import com.iformall.service.WxCouponService; import com.iformall.service.order.OrderAdapterService; import com.iformall.service.order.OrderFactory; import com.iformall.service.order.entity.WxComposeOrder; @@ -62,6 +63,9 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen @Autowired private WxCouponMapper wxCouponMapper; + @Autowired + private WxCouponService wxCouponService; + @Autowired private WxOrderMapper wxOrderMapper; @@ -452,19 +456,15 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen payment.put("totalAmount",composeOrder.getPayment()); map.put("payment",payment); List> goodsList = new ArrayList<>(); - Map> collect = childOrders.stream().collect(groupingBy(WxOrder::getCouponChannelId)); - for (Long key: collect.keySet()) { + for (WxOrder o: childOrders) { + WxCoupon wxCoupon = wxCouponService.getById(o.getProductId(), record.getTenantId()); Map good = new HashMap<>(); - Long couponId = wxCouponChannelMapper.findCouponIdById(key, record.getTenantId()); - WxCoupon wxCoupon = wxCouponMapper.selectById(couponId, record.getTenantId()); - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(record.getTenantId(), couponId); - int quantity = collect.get(key).size(); - good.put("quantity",quantity); - good.put("price",wxCoupon.getSalePrice()*quantity); + good.put("quantity",o.getCouponNumber()); + good.put("price",o.getPayment()); good.put("goodsName",wxCoupon.getTitle()); good.put("goodsPhoto",wxCoupon.getCoverImg()); - good.put("goodsId",ttCouponChannelPoi.getSpuId()); - good.put("goodsType",1); + good.put("goodsId",wxCoupon.getGoodsId()); + good.put("goodsType",composeOrder.getMainOrder().getIsTtPoiOrder()); goodsList.add(good); } map.put("goodsList",goodsList); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v2/WxRefundAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v2/WxRefundAdapterService.java index 42de289d5..7511414c7 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v2/WxRefundAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v2/WxRefundAdapterService.java @@ -223,9 +223,9 @@ public class WxRefundAdapterService implements RefundPayAdapterService{ wxRefundOrderP.setRefund_desc("管理端商户退款"); } else if (payType == EnumPayType.PAY_AUTO_REFUND) { wxRefundOrderP.setRefund_desc("超期自动退款"); - } else { - wxRefundOrderP.setRefund_desc("用户自己退款"); - } + } else if (payType == EnumPayType.PAY_C_REFUND){ + wxRefundOrderP.setRefund_desc("用户自己退款"); + } } wxRefundOrderP.setNotify_url(payAccount.getRefundNotifyUrl()); return wxRefundOrderP; @@ -294,7 +294,7 @@ public class WxRefundAdapterService implements RefundPayAdapterService{ wxRefundOrderSP.setRefund_desc("管理端商户退款"); } else if (payType == EnumPayType.PAY_AUTO_REFUND) { wxRefundOrderSP.setRefund_desc("超期自动退款"); - } else { + } else if (payType == EnumPayType.PAY_C_REFUND){ wxRefundOrderSP.setRefund_desc("用户自己退款"); } } diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v3/WxRefundV3AdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v3/WxRefundV3AdapterService.java index c9975aa9e..598145215 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v3/WxRefundV3AdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/wx/v3/WxRefundV3AdapterService.java @@ -86,10 +86,16 @@ public class WxRefundV3AdapterService implements RefundPayAdapterService{ } req.setOut_trade_no(payOrder.getPayOrderNo()); req.setOut_refund_no(String.valueOf(record.getId())); - try { - req.setReason(WxPayV3.handleChinese(payType.getMessage())); - } catch (UnsupportedEncodingException e) { - req.setReason(payType.getCode().toString()); + if(null != payType) { + if (payType == EnumPayType.PAY_B_REFUND) { + req.setReason("B端商户退款"); + } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { + req.setReason("管理端商户退款"); + } else if (payType == EnumPayType.PAY_AUTO_REFUND) { + req.setReason("超期自动退款"); + } else if (payType == EnumPayType.PAY_C_REFUND){ + req.setReason("用户自己退款"); + } } req.setNotify_url(payAccount.getRefundNotifyV3Url()); V3PayRefundAmountReq amount = new V3PayRefundAmountReq(); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java index 5cdc6436e..c767e1582 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareBaseAdapterService.java @@ -21,6 +21,7 @@ import com.iformall.mapper.WxProfitSharingReceiverMapper; import com.iformall.pay.WxPayment; import com.iformall.pay.WxProfitSharing; import com.iformall.pay.WxProfitSharingReceiverP; +import com.iformall.service.WxProfitSharingReceiverService; import com.iformall.service.pay.service.share.entity.PayShareQueryResultReceivers; import com.iformall.service.pay.service.share.entity.ShareAccountResult; import com.iformall.service.pay.service.share.wx.v2.WxPayShareService; @@ -186,7 +187,7 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi return new ShareAccountResult(true, null, "success", returnMap); } - protected ShareAccountResult _deleteShareAccount(WxAppinfo appInfo, WxPayAccount payAccount,WxProfitSharingReceiver receiver,WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper) { + protected ShareAccountResult _deleteShareAccount(WxAppinfo appInfo, WxPayAccount payAccount, WxProfitSharingReceiver receiver, WxProfitSharingReceiverService wxProfitSharingReceiverService) { //删除分账账户从微信服务器 WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP(); if (StringUtils.isNotBlank(appInfo.getParentAppId())) { @@ -227,7 +228,7 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi if (returnMap.get("err_code").contains("USER_NOT_EXIST")) { receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); receiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateById(receiver); + wxProfitSharingReceiverService.saveOrUpdate(receiver); } log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("err_code_des")+":"+JSON.toJSONString(returnMap)); return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("err_code_des"), null); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java index 0ae6e8db9..f999dd01c 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/douyin/TtPayShareService.java @@ -32,12 +32,12 @@ import com.iformall.service.pay.service.share.entity.PayShareQueryResult; import com.iformall.service.pay.service.share.entity.PayShareResult; import com.iformall.service.pay.service.share.entity.ShareAccountResult; import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; -import com.iformall.utils.DateUtils; -import com.iformall.utils.MaUtil; -import com.iformall.utils.PayUtils; +import com.iformall.utils.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.*; @@ -68,9 +68,6 @@ public class TtPayShareService extends PayShareBaseAdapterService{ @Autowired WxProfitSharingOrderMapper wxProfitSharingOrderMapper; - @Autowired - WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; - @Autowired TtGoodsCategoryMapper ttGoodsCategoryMapper; @@ -281,8 +278,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ if(!EnumOrderType.COUPON.getCode().equals(o.getType())){ return 0; } - Long couponId = wxCouponChannelMapper.findCouponIdById(o.getCouponChannelId(), o.getTenantId()); - Integer categoryId = wxCouponMapper.findCategoryIdById(couponId,o.getTenantId()); + Integer categoryId = wxCouponMapper.findCategoryIdById(o.getProductId(),o.getTenantId()); if(categoryId != null){ TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(categoryId); if(ttGoodsCategory != null && ttGoodsCategory.getServiceFee() != null){ @@ -304,38 +300,26 @@ public class TtPayShareService extends PayShareBaseAdapterService{ if(merchantId == null || merchantId.equals(0L)){ return null; } + + WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.TOUTIAO,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN); - WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); - psReceiverQ.updateTenantInfo(tenantEntity); - psReceiverQ.setMerchantId(merchantId); - psReceiverQ.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); - psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); - psReceiverQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); - String payMsg = ""; if(ttPayWay != null){ - if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay)){ - payMsg = EnumTtPayChannel.WX_PAY.getMessage(); - psReceiverQ.setWxImportStatus(MerchantImportStatus.improt_success.getCode()); - }else if(EnumTtPayChannel.ALI_PAY.getCode().equals(ttPayWay)){ - payMsg = EnumTtPayChannel.ALI_PAY.getMessage(); - psReceiverQ.setAlipayImportStatus(MerchantImportStatus.improt_success.getCode()); - }else if(EnumTtPayChannel.HZ_PAY.getCode().equals(ttPayWay)){ - payMsg = EnumTtPayChannel.HZ_PAY.getMessage(); - psReceiverQ.setHzImportStatus(MerchantImportStatus.improt_success.getCode()); - }else{ - log.error("该订单支付方式异常{}"); + if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay) + && !MerchantImportStatus.improt_success.getCode().equals(record.getWxImportStatus())){ + log.error("支付方式【"+EnumTtPayChannel.WX_PAY.getMessage()+"】未开通"); + return null; + }else if(EnumTtPayChannel.ALI_PAY.getCode().equals(ttPayWay) + && !MerchantImportStatus.improt_success.getCode().equals(record.getAlipayImportStatus())){ + log.error("支付方式【"+EnumTtPayChannel.ALI_PAY.getMessage()+"】未开通"); + return null; + }else if(EnumTtPayChannel.HZ_PAY.getCode().equals(ttPayWay) + && !MerchantImportStatus.improt_success.getCode().equals(record.getHzImportStatus())){ + log.error("支付方式【"+EnumTtPayChannel.HZ_PAY.getMessage()+"】未开通"); + return null; } } + return record; - List list = wxProfitSharingReceiverMapper.findList(psReceiverQ); - if(list == null || list.isEmpty()){ - return null; -// throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未未进件."+payMsg); - } - if(list.size() > 1){ - throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN.getCode(),"该商户分账帐号异常."); - } - return list.get(0); } } diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v2/WxPayShareService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v2/WxPayShareService.java index c50bc5101..40bc71932 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v2/WxPayShareService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v2/WxPayShareService.java @@ -12,9 +12,13 @@ import com.iformall.douyin.pay.enums.MerchantImportStatus; import com.iformall.enums.*; import com.iformall.mapper.*; +import com.iformall.service.WxProfitSharingReceiverService; +import com.iformall.utils.*; import net.sf.saxon.trans.Err; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSON; @@ -38,9 +42,6 @@ import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; import com.iformall.service.pay.service.share.entity.PayShareQueryResult; import com.iformall.service.pay.service.share.entity.PayShareResult; import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; -import com.iformall.utils.BeanUtils; -import com.iformall.utils.Utility; -import com.iformall.utils.XmlUtil; import lombok.extern.slf4j.Slf4j; @@ -49,7 +50,7 @@ import lombok.extern.slf4j.Slf4j; public class WxPayShareService extends PayShareBaseAdapterService{ @Autowired - WxProfitSharingOrderMapper wxProfitSharingOrderMapper; + WxProfitSharingReceiverService wxProfitSharingReceiverService; final JSONObject statusMap = JSON.parseObject( "{\"ACCEPTED\":3," + @@ -338,13 +339,10 @@ public class WxPayShareService extends PayShareBaseAdapterService{ public ShareAccountResult createShareAccount(WxAppinfo appInfo,WxPayAccount payAccount,WxProfitSharingReceiver receiver) { return super._createShareAccount(appInfo, payAccount, receiver); } - - @Autowired - WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; @Override public ShareAccountResult deleteShareAccount(WxAppinfo appInfo, WxPayAccount payAccount,WxProfitSharingReceiver receiver) { - return super._deleteShareAccount(appInfo, payAccount, receiver,wxProfitSharingReceiverMapper); + return super._deleteShareAccount(appInfo, payAccount, receiver,wxProfitSharingReceiverService); } @Override @@ -357,31 +355,16 @@ public class WxPayShareService extends PayShareBaseAdapterService{ return 0; } - @Override public WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { if(merchantId == null || merchantId.equals(0L)){ return null; } - WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); - psReceiverQ.updateTenantInfo(tenantEntity); - psReceiverQ.setMerchantId(merchantId); - psReceiverQ.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); - psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); - psReceiverQ.setPlat(EnumAppPlat.WX.getCode()); - List psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ); - if (null == psReceiverList || psReceiverList.size() == 0) { - return null; -// throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); - }else { - for (WxProfitSharingReceiver receiver:psReceiverList) { - if (EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().intValue() - == receiver.getReceiverType().intValue()) { - throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); - } - } + WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); + if(record != null && EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().equals(record.getReceiverType())){ + throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); } - return psReceiverList.get(0); + return record; } private static String queryOrderShareAmount(String mchId,String transcationId,String apiKey) { diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java index 380c030e5..1cc113fc1 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java @@ -14,9 +14,13 @@ import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.*; import com.iformall.mapper.*; +import com.iformall.utils.Constant; +import com.iformall.utils.RedisCacheUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -44,9 +48,6 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @Service public class WxPayShareV3Service extends PayShareBaseAdapterService{ - - @Autowired - WxProfitSharingOrderMapper wxProfitSharingOrderMapper; @Lazy @Autowired @@ -82,19 +83,19 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ if(merchantId == null || merchantId.equals(0L)){ return null; } - WxProfitSharingReceiver receiver = null; + //直连,必须是特约商户号 -// if (EnumPayMchType.DIRECT.getCode() == mchType) { - receiver = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); - //总分 -// }else if (EnumPayMchType.TOTAL.getCode() == mchType) { -// receiver = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); -// } + if (EnumPayMchType.DIRECT.getCode() == mchType) { + return wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); +// 总分 + }else if (EnumPayMchType.TOTAL.getCode() == mchType) { + return wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); + } // if (null == receiver) { // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); // } - return receiver; + return null; } //无需分账,直接解冻 @@ -300,9 +301,6 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ return super._createShareAccount(appInfo, payAccount, receiver); } } - - @Autowired - WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; @Override public ShareAccountResult deleteShareAccount(WxAppinfo appInfo, WxPayAccount payAccount, @@ -312,7 +310,7 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), "微信支付3.0直连模式下不支持", null); //总分 }else { - return super._deleteShareAccount(appInfo, payAccount, receiver, wxProfitSharingReceiverMapper); + return super._deleteShareAccount(appInfo, payAccount, receiver, wxProfitSharingReceiverService); } } diff --git a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java index 885ef3215..cda211c07 100644 --- a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java @@ -248,7 +248,7 @@ public class TtOrderServiceImpl implements TtOrderService { DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder(); preOrder.setAppId(appInfo.getAppId()); preOrder.setSercrect(appInfo.getSecret()); - preOrder.setSalt(payAcount.getApiKey()); + preOrder.setSalt(payAcount.getMerchantApiKey()); preOrder.setOutOrderNo(order.getId().toString()); preOrder.setTotalAmount(order.getPayment()); preOrder.setSubject(coupon.getTitle()); @@ -296,7 +296,7 @@ public class TtOrderServiceImpl implements TtOrderService { if(order.getOrderStatus() == EnumTtOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()){ String msg = ""; //待付款 - OrderQueryResult orderQueryResult = DouYinPayHelper.orderQuery(appInfo.getAppId(), payAccount.getApiKey(), order.getId().toString(), null); + OrderQueryResult orderQueryResult = DouYinPayHelper.orderQuery(appInfo.getAppId(), payAccount.getMerchantApiKey(), order.getId().toString(), null); if(orderQueryResult == null){ msg = "查询-单号不存在"; }else{ diff --git a/mallinkService/src/main/java/com/iformall/utils/Constant.java b/mallinkService/src/main/java/com/iformall/utils/Constant.java index 427fed561..d5b8c76ca 100644 --- a/mallinkService/src/main/java/com/iformall/utils/Constant.java +++ b/mallinkService/src/main/java/com/iformall/utils/Constant.java @@ -42,6 +42,9 @@ public class Constant { // C端token public static final String tokenPrev = "weapp:token:"; + // 微信C授权积分状态缓存 + public static final String wx_user_authorize_state = "weapp:wxuser:authorizestate:"; + public static final String TOKEN_WXC_END = ":wx-cuser"; public static final String TOKEN_TTC_END = ":tt-cuser"; @@ -97,6 +100,8 @@ public class Constant { //获取mall信息 public static final String appinfoPrev = "appinfo:"; + public static final String payaccountPrev = "payAccount:"; + public static final String sharingReceicerPrev = "sharingReceicer:"; public static final String mallinfoPrev = "mallinfo:"; public static final String subMallinfoPrev = "mallinfo:subMallinfo:"; diff --git a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java index 772d2db4f..8b71fcfe8 100644 --- a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java @@ -126,7 +126,7 @@ public class MaUtil { config.setMchKey(payAccount.getMerchantApiKey()); config.setSubAppId(appinfo.getAppId()); config.setSubMchId(payAccount.getSubMchId()); - config.setKeyPath(payAccount.getMerchantKeyPath()); + config.setKeyPath(payAccount.getMerchantCertPath()); config.setPrivateKeyPath(payAccount.getMerchantKeyPath()); config.setPrivateCertPath(payAccount.getMerchantCertPemPath()); //config.setCertSerialNo(payAccount.getCertSerialNo()); @@ -150,12 +150,13 @@ public class MaUtil { } public TtPayService getTtPayService(WxAppinfo appinfo, WxPayAccount payAccount) { + //单商户模式 TtPayConfig config = new TtPayConfig(); config.setAppId(appinfo.getAppId()); - config.setPrivateKeyPath(payAccount.getPrivateKeyPath());//apiclient_key.pem 平台私钥 - config.setCertSerialNo(payAccount.getCertSerialNo());//平台私钥序列号 - config.setApiKey(payAccount.getApiV3Key());//平台私钥 + config.setPrivateKeyPath(payAccount.getMerchantKeyPath());//apiclient_key.pem 应用私钥证书 + config.setCertSerialNo(payAccount.getMerchantCertSerialNo());//证书序列号 + config.setApiKey(payAccount.getMerchantApiv3Key());//平台公钥 TtPayService service = ttpayServiceMap.get(appinfo.getAppId()); if ( null == service ) { diff --git a/mallinkService/src/main/resources/mapper/TtPoiTakeRateMapper.xml b/mallinkService/src/main/resources/mapper/TtPoiTakeRateMapper.xml index 41e7980a5..462909682 100644 --- a/mallinkService/src/main/resources/mapper/TtPoiTakeRateMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtPoiTakeRateMapper.xml @@ -8,21 +8,24 @@ + + + `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`, - `type`,`name`,`content_type`, - `douyin_id`,`take_rate`,`status`, - `start_time`,`end_time`,`create_date`,`update_date` + `type`,`name`,`merchant_phone`,`content_type`, + `douyin_id`,`douyin_id_status`,`take_rate`,`status`, + `start_time`,`end_time`,`commission_duration`,`create_date`,`update_date` @@ -78,9 +81,6 @@ where tenant_id = #{tenantId} and `coupon_id` = #{couponId} and `type` = #{type} - - and `douyin_id` = #{douyinId} - select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,name,7 billTypeValue,concat('其他费用-',name) as billType, - 0 as need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime, + 0 as needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime, rent_shop_type rentShopType,'[]' shopInfo,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay from wx_bill_other bill where bill.`tenant_id` = #{tenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index 55979cefe..23f5a166a 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -48,6 +48,9 @@ + + + @@ -58,7 +61,8 @@ `login_count`, `extra_info`, `is_subscribe`, `open_app_id`, `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`, - `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit`,`active_time`,`qr_code` + `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit`,`active_time`,`qr_code`, + `authorize_state`,`authorize_time`, `deauthorize_time` @@ -215,6 +219,10 @@ and `credit` = #{credit} + + and `authorize_state` = #{authorizeState} + + and id in @@ -442,7 +450,25 @@ - select open_id from wx_c_user where user_id=#{userId} and tenant_id = #{tenantId} + + + + + update wx_c_user + set `authorize_state` = #{authorizeState} + + ,`authorize_time` = #{authorizeTime} + + + ,`deauthorize_time` = #{deauthorizeTime} + + WHERE `tenant_id` = #{tenantId} + and `open_id` = #{openId} + and `authorize_state` != #{authorizeState} + diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index 557d7b6e1..413734aee 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -134,11 +134,23 @@ and `parent_tenant_id` = #{parentTenantId} - ) as orderSendCount + ) as orderSendCount, + (select Count(*) from ( + SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} + ) c + where DATE_FORMAT(create_time,'%m/%d')=xTime + and c.channel_type=7 + + and `tenant_id` = #{tenantId} + + + and `parent_tenant_id` = #{parentTenantId} + + ) as merchantSendCount from ( SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix} ) wx_coupon_action_log - where channel_type in (2,3,4,5) + where channel_type in (2,3,4,5,7) and `tenant_id` = #{tenantId} @@ -154,7 +166,7 @@ select COUNT(*) FROM wx_coupon_action_log - where `channel_type` != 0 - and `channel_type` != 1 + where channel_type in (2,3,4,5,7) and `tenant_id` = #{tenantId} and `create_time` >= #{startTime} and `create_time` <= #{endTime} diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 5f6cbef84..884f1810d 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -6,6 +6,7 @@ + @@ -26,7 +27,7 @@ - distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.`qr_code`, + distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`make_merchant_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.`qr_code`, cc.`tt_qr_code`,cc.`tt_spu_id`,cc.`channel_price`,cc.`channel_stock` @@ -175,7 +176,7 @@ diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 29a82c45d..8298470e6 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -59,6 +59,7 @@ + @@ -119,7 +120,7 @@ c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.pick_start_date,c.pick_end_date,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`, c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`, c.`press_limit_num`, c.`press_limit_hours`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`, - c.`conditions`,c.approval_type,c.content_type,c.source_type,c.merchant_type,c.password_support,c.gift_list,c.product_type,c.category_id + c.`conditions`,c.approval_type,c.content_type,c.source_type,c.merchant_type,c.password_support,c.gift_list,c.product_type,c.category_id,c.goods_id diff --git a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml index 138cddd42..941b14848 100644 --- a/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml @@ -216,6 +216,16 @@ {call user_credit_clear(#{cutOffDate},#{finalTableIndex})} + + + select + + from wx_member_card + + + + + + + + + update wx_member_card set `user_card_status` = #{userCardStatus},`update_date` = #{updateDate} + WHERE `final_tenant_id` = #{finalTenantId} + and `card_id` = #{cardId} + and `card_code` = #{cardCode} + + + diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 41d95e9c0..05b1af88b 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -9,10 +9,12 @@ + + @@ -38,7 +40,7 @@ - `id`,`order_number`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`type`,`pay_vendor`,`pay_version`,`payment_type`,`payment`,`payment_time`,`freight_price`,`order_status`,`cps_status`,`create_date`,`update_date`,`detail`,`ref_detail`, + `id`,`order_number`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`product_name`,`type`,`pay_vendor`,`pay_version`,`make_merchant_id`,`payment_type`,`payment`,`payment_time`,`freight_price`,`order_status`,`cps_status`,`create_date`,`update_date`,`detail`,`ref_detail`, `press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`total_payment`,`compose_order_id`,`coupon_number`,`compose_order_type`,`shipping_type`,`shipping_address`,`parent_order_id`,`ext_param` @@ -333,7 +335,7 @@ select - o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, + o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.product_name,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, o.compose_order_type,o.compose_order_id,o.parent_order_id,o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`,o.ext_param FROM wx_order o where o.`tenant_id` = #{tenantId} diff --git a/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml b/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml index 58565cc8d..cc946fbf9 100644 --- a/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml @@ -5,42 +5,59 @@ + + + - - + + - - + + + + + + + + + + + - - - - + + + + - `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`merchant_api_key`,`notify_url`,`notify_token`,`cert_path`, - `merchant_cert_path`,`type`,`mch_type`,`open_pay`,`share`,`rate`,`real_rate`,`is_commission`,`system_rate`,`sell_rate`, - `service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_pem_path`, - `merchant_key_path`,`merchant_apiv3_key`,`merchant_cert_pem_path` + `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`, + `api_key`,`cert_path`,`merchant_api_key`,`merchant_cert_path`, + `notify_url`,`notify_token`, + `api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_pem_path`, + `merchant_apiv3_key`,`merchant_cert_serial_no`,`merchant_key_path`,`merchant_cert_pem_path`, + `type`,`mch_type`,`open_pay`,`pay_version`,`share`,`rate`,`real_rate`, + `is_commission`,`system_rate`,`sell_rate`, + `service_id`,`pay_score_notify_url`, + `business_type`,`brandid`,`card_id` @@ -60,30 +77,12 @@ and `sub_mch_id` = #{subMchId} - - - and `api_key` like concat('%', #{apiKey},'%') - - - - and `notify_url` like concat('%', #{notifyUrl},'%') - - - - and `cert_path` like concat('%', #{certPath},'%') - and `type` = #{type} and `share` = #{share} - - and `rate` = #{rate} - - - and `real_rate` = #{realRate} - and `is_commission` = #{isCommission}