| @@ -117,7 +117,7 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); | ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); | ||||
| return new ResultData(goodsTemplateGet); | return new ResultData(goodsTemplateGet); | ||||
| }else { | }else { | ||||
| GoodsTemplateGet goodsTemplateGet = ttMerchantPoiService.getTtGoodLifeSassService(getTenantInfo()).getGoodLifeSaasGoodsService().templateGet(categoryId, productType); | |||||
| GoodsTemplateGet goodsTemplateGet = ttMerchantPoiService.getTtGoodLifeSassService(getTenantInfo()).getGoodsService().templateGet(categoryId, productType); | |||||
| ttGoodsCategoryService.adminIsShow(goodsTemplateGet); | ttGoodsCategoryService.adminIsShow(goodsTemplateGet); | ||||
| ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); | ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); | ||||
| return new ResultData(goodsTemplateGet); | return new ResultData(goodsTemplateGet); | ||||
| @@ -145,10 +145,12 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| } | } | ||||
| try { | try { | ||||
| return ttCouponGoodsService.productSave(coupon); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| boolean isSaas = this.isGoodLifeSaas(); | |||||
| return ttCouponGoodsService.productSave(coupon,isSaas); | |||||
| } catch (Exception e) { | |||||
| logger.error("allTreeList error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("实时查询审核状态") | @ApiOperation("实时查询审核状态") | ||||
| @@ -158,7 +160,14 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ResultData.ERROR, "缺少id"); | return new ResultData(ResultData.ERROR, "缺少id"); | ||||
| } | } | ||||
| return ttCouponGoodsService.productDraftGet(getTenantInfo(),id); | |||||
| try { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | |||||
| return ttCouponGoodsService.productDraftGet(getTenantInfo(),id,isSaas); | |||||
| } catch (Exception e) { | |||||
| logger.error("allTreeList error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("实时查询线上商品状态") | @ApiOperation("实时查询线上商品状态") | ||||
| @@ -168,7 +177,14 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ResultData.ERROR, "缺少id"); | return new ResultData(ResultData.ERROR, "缺少id"); | ||||
| } | } | ||||
| return ttCouponGoodsService.productOnlineGet(getTenantInfo(),id); | |||||
| try { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | |||||
| return ttCouponGoodsService.productOnlineGet(getTenantInfo(),id,isSaas); | |||||
| } catch (Exception e) { | |||||
| logger.error("allTreeList error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("实时同步上下架状态") | @ApiOperation("实时同步上下架状态") | ||||
| @@ -178,7 +194,14 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ResultData.ERROR, "缺少id"); | return new ResultData(ResultData.ERROR, "缺少id"); | ||||
| } | } | ||||
| return ttCouponGoodsService.productOperate(getTenantInfo(),id); | |||||
| try { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | |||||
| return ttCouponGoodsService.productOperate(getTenantInfo(),id,isSaas); | |||||
| } catch (Exception e) { | |||||
| logger.error("allTreeList error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @ApiOperation("实时同步库存") | @ApiOperation("实时同步库存") | ||||
| @@ -188,7 +211,14 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| if (id == null) { | if (id == null) { | ||||
| return new ResultData(ResultData.ERROR, "缺少id"); | return new ResultData(ResultData.ERROR, "缺少id"); | ||||
| } | } | ||||
| return ttCouponGoodsService.productStockSync(getTenantInfo(),id); | |||||
| try { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | |||||
| return ttCouponGoodsService.productStockSync(getTenantInfo(),id,isSaas); | |||||
| } catch (Exception e) { | |||||
| logger.error("allTreeList error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @@ -6,5 +6,8 @@ CREATE TABLE `wx_mall_version` ( | |||||
| PRIMARY KEY (`id`) | PRIMARY KEY (`id`) | ||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='商场'; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='商场'; | ||||
| ###现有的抖音版本都要设置该表 | |||||
| create table tt_goods_category_new like tt_goods_category; | |||||
| create table tt_goods_category_new like tt_goods_category; | |||||
| ALTER TABLE `mallink`.`wx_appinfo` ADD COLUMN `laike_id` varchar(30) COMMENT '来客ID'; | |||||
| @@ -51,6 +51,8 @@ public class WxAppinfo extends BaseTenantEntity { | |||||
| private String businessLicense; | private String businessLicense; | ||||
| @io.swagger.annotations.ApiModelProperty(value="主体ICP证",name="icp") | @io.swagger.annotations.ApiModelProperty(value="主体ICP证",name="icp") | ||||
| private String icp; | private String icp; | ||||
| @io.swagger.annotations.ApiModelProperty(value="抖音来客ID",name="laikeId") | |||||
| private String laikeId; | |||||
| public WxAppinfo(){} | public WxAppinfo(){} | ||||
| public WxAppinfo(Integer mouldType){ | public WxAppinfo(Integer mouldType){ | ||||
| @@ -78,7 +78,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * product_ids string TRUE 商品ID列表(逗号分隔) | * product_ids string TRUE 商品ID列表(逗号分隔) | ||||
| * out_ids string TRUE 外部商品ID列表(逗号分隔) | * out_ids string TRUE 外部商品ID列表(逗号分隔) | ||||
| */ | */ | ||||
| List<Product> productDraftGet(String product_ids, String out_ids) throws WxErrorException ; | |||||
| List<Product> productDraftGet(String accountId,String product_ids, String out_ids) throws WxErrorException ; | |||||
| /** | /** | ||||
| * - 查询本client_key(或绑定的账号)对应的商品草稿列表 | * - 查询本client_key(或绑定的账号)对应的商品草稿列表 | ||||
| @@ -88,7 +88,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * status int FALSE 过滤草稿状态,10-审核中 12-审核失败 1-审核通过 | * status int FALSE 过滤草稿状态,10-审核中 12-审核失败 1-审核通过 | ||||
| * | * | ||||
| */ | */ | ||||
| ProductPage productDraftListGet(String cursor,Integer count,Integer status) throws WxErrorException ; | |||||
| ProductPage productDraftListGet(String accountId,String cursor,Integer count,Integer status) throws WxErrorException ; | |||||
| /** | /** | ||||
| * - - 使用商品ID或外部商品ID查询商品线上数据 | * - - 使用商品ID或外部商品ID查询商品线上数据 | ||||
| @@ -96,7 +96,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * product_ids string TRUE 商品ID列表(逗号分隔) | * product_ids string TRUE 商品ID列表(逗号分隔) | ||||
| * out_ids string TRUE 外部商品ID列表(逗号分隔) | * out_ids string TRUE 外部商品ID列表(逗号分隔) | ||||
| */ | */ | ||||
| List<Product> productOnlineGet(String product_ids, String out_ids) throws WxErrorException ; | |||||
| List<Product> productOnlineGet(String accountId,String product_ids, String out_ids) throws WxErrorException ; | |||||
| /** | /** | ||||
| * - 查询本client_key(或绑定的账号)对应的商品线上列表 | * - 查询本client_key(或绑定的账号)对应的商品线上列表 | ||||
| @@ -106,7 +106,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * status int FALSE 过滤在线状态 1-在线 2-下线 3-封禁 | * status int FALSE 过滤在线状态 1-在线 2-下线 3-封禁 | ||||
| * | * | ||||
| */ | */ | ||||
| ProductPage productOnlineListGet(String cursor,Integer count,Integer status) throws WxErrorException ; | |||||
| ProductPage productOnlineListGet(String accountId,String cursor,Integer count,Integer status) throws WxErrorException ; | |||||
| /** | /** | ||||
| * - 创建或更新商品 | * - 创建或更新商品 | ||||
| @@ -123,7 +123,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * sold_end_time int64 FALSE 售卖结束时间 | * sold_end_time int64 FALSE 售卖结束时间 | ||||
| * stock_qty int64 FALSE 总库存 | * stock_qty int64 FALSE 总库存 | ||||
| */ | */ | ||||
| boolean productFreeAudit(String productId,String outId,Long soldEndTime,Integer stockQty) throws WxErrorException ; | |||||
| boolean productFreeAudit(String accountId,String productId,String outId,Long soldEndTime,Integer stockQty) throws WxErrorException ; | |||||
| /** | /** | ||||
| * 创建/更新多SKU商品的SKU列表(团购/代金券不用对接这个接口) | * 创建/更新多SKU商品的SKU列表(团购/代金券不用对接这个接口) | ||||
| @@ -139,7 +139,7 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * op_type int64 TRUE 1-上线 2-下线 | * op_type int64 TRUE 1-上线 2-下线 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| boolean productOperate(String product_id,String out_id,Integer op_type) throws WxErrorException ; | |||||
| boolean productOperate(String accountId,String product_id,String out_id,Integer op_type) throws WxErrorException ; | |||||
| /** | /** | ||||
| * 同步库存 | * 同步库存 | ||||
| @@ -149,6 +149,6 @@ public interface TtGoodLifeSaasGoodsService { | |||||
| * - limit_type int TRUE 库存上限类型,为2时stock_qty和avail_qty字段无意义 1-有限库存 2-无限库存 | * - limit_type int TRUE 库存上限类型,为2时stock_qty和avail_qty字段无意义 1-有限库存 2-无限库存 | ||||
| * - stock_qty int TRUE 总库存,limit_type=2时无意义 | * - stock_qty int TRUE 总库存,limit_type=2时无意义 | ||||
| */ | */ | ||||
| boolean stockSync(String product_id,String out_id,Integer stock) throws WxErrorException ; | |||||
| boolean stockSync(String accountId,String product_id,String out_id,Integer stock) throws WxErrorException ; | |||||
| } | } | ||||
| @@ -10,5 +10,5 @@ import com.iformall.douyin.web.api.web.TtWebShopMatchService; | |||||
| */ | */ | ||||
| public interface TtGoodLifeSaasService extends TtBasicService{ | public interface TtGoodLifeSaasService extends TtBasicService{ | ||||
| TtGoodLifeSaasGoodsService getGoodLifeSaasGoodsService(); | |||||
| TtGoodLifeSaasGoodsService getGoodsService(); | |||||
| } | } | ||||
| @@ -68,21 +68,21 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<Product> productDraftGet(String product_ids, String out_ids) throws WxErrorException { | |||||
| public List<Product> productDraftGet(String accountId,String product_ids, String out_ids) throws WxErrorException { | |||||
| TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_DRAFT_GET; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_DRAFT_GET; | ||||
| String param = "" ; | String param = "" ; | ||||
| if(StringUtils.isNotBlank(product_ids)){ | if(StringUtils.isNotBlank(product_ids)){ | ||||
| param = "product_ids=" + product_ids; | param = "product_ids=" + product_ids; | ||||
| }else if(StringUtils.isNotBlank(out_ids)){ | |||||
| }if(StringUtils.isNotBlank(out_ids)){ | |||||
| param = "out_ids=" + out_ids; | param = "out_ids=" + out_ids; | ||||
| } | } | ||||
| String result = this.service.execute(getExecutor, apiUrl, param); | |||||
| String result = this.service.execute(getExecutor, apiUrl, param+"&account_id="+accountId); | |||||
| BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| Map map = (Map) baseResult.getData(); | Map map = (Map) baseResult.getData(); | ||||
| if(map != null){ | if(map != null){ | ||||
| Object product_draft_list = map.get("product_draft_list"); | |||||
| Object product_draft_list = map.get("product_drafts"); | |||||
| List<Product> list = GSON.fromJson(GSON.toJson(product_draft_list), | List<Product> list = GSON.fromJson(GSON.toJson(product_draft_list), | ||||
| new TypeReference<List<Product>>() {}.getType()); | new TypeReference<List<Product>>() {}.getType()); | ||||
| return list; | return list; | ||||
| @@ -94,7 +94,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ProductPage productDraftListGet(String cursor, Integer count, Integer status) throws WxErrorException { | |||||
| public ProductPage productDraftListGet(String accountId,String cursor, Integer count, Integer status) throws WxErrorException { | |||||
| TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_DRAFT_LIST; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_DRAFT_LIST; | ||||
| String param = "" ; | String param = "" ; | ||||
| @@ -109,7 +109,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| if(status != null){ | if(status != null){ | ||||
| param += "&status=" + status; | param += "&status=" + status; | ||||
| } | } | ||||
| String result = this.service.execute(getExecutor, apiUrl, param); | |||||
| String result = this.service.execute(getExecutor, apiUrl, param+"&account_id="+accountId); | |||||
| BaseGoodsResult<ProductPage> baseResult = GSON.fromJson(result, | BaseGoodsResult<ProductPage> baseResult = GSON.fromJson(result, | ||||
| new TypeReference<BaseGoodsResult<ProductPage>>() {}.getType()); | new TypeReference<BaseGoodsResult<ProductPage>>() {}.getType()); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| @@ -120,7 +120,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<Product> productOnlineGet(String product_ids, String out_ids) throws WxErrorException { | |||||
| public List<Product> productOnlineGet(String accountId,String product_ids, String out_ids) throws WxErrorException { | |||||
| TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_ONLINE_GET; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_ONLINE_GET; | ||||
| String param = "" ; | String param = "" ; | ||||
| @@ -129,12 +129,12 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| }else if(StringUtils.isNotBlank(out_ids)){ | }else if(StringUtils.isNotBlank(out_ids)){ | ||||
| param = "out_ids=" + out_ids; | param = "out_ids=" + out_ids; | ||||
| } | } | ||||
| String result = this.service.execute(getExecutor, apiUrl, param); | |||||
| String result = this.service.execute(getExecutor, apiUrl, param+"&account_id="+accountId); | |||||
| BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| Map map = (Map) baseResult.getData(); | Map map = (Map) baseResult.getData(); | ||||
| if(map != null){ | if(map != null){ | ||||
| Object product_online_list = map.get("product_online_list"); | |||||
| Object product_online_list = map.get("product_onlines"); | |||||
| List<Product> list = GSON.fromJson(GSON.toJson(product_online_list), | List<Product> list = GSON.fromJson(GSON.toJson(product_online_list), | ||||
| new TypeReference<List<Product>>() {}.getType()); | new TypeReference<List<Product>>() {}.getType()); | ||||
| return list; | return list; | ||||
| @@ -146,7 +146,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ProductPage productOnlineListGet(String cursor, Integer count, Integer status) throws WxErrorException { | |||||
| public ProductPage productOnlineListGet(String accountId,String cursor, Integer count, Integer status) throws WxErrorException { | |||||
| TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsGetRequestExecutor getExecutor = new TtWebGoodsGetRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_ONLINE_LIST; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_ONLINE_LIST; | ||||
| String param = "" ; | String param = "" ; | ||||
| @@ -161,7 +161,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| if(status != null){ | if(status != null){ | ||||
| param += "&status=" + status; | param += "&status=" + status; | ||||
| } | } | ||||
| String result = this.service.execute(getExecutor, apiUrl, param); | |||||
| String result = this.service.execute(getExecutor, apiUrl, param+"&account_id="+accountId); | |||||
| BaseGoodsResult<ProductPage> baseResult = GSON.fromJson(result, | BaseGoodsResult<ProductPage> baseResult = GSON.fromJson(result, | ||||
| new TypeReference<BaseGoodsResult<ProductPage>>() {}.getType()); | new TypeReference<BaseGoodsResult<ProductPage>>() {}.getType()); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| @@ -186,7 +186,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public boolean productFreeAudit(String productId, String outId, Long soldEndTime, Integer stockQty) throws WxErrorException { | |||||
| public boolean productFreeAudit(String accountId,String productId, String outId, Long soldEndTime, Integer stockQty) throws WxErrorException { | |||||
| TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_FREE_AUDIT; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_FREE_AUDIT; | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| @@ -201,6 +201,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| if(stockQty != null){ | if(stockQty != null){ | ||||
| map.put("stock_qty",stockQty); | map.put("stock_qty",stockQty); | ||||
| } | } | ||||
| map.put("account_id",accountId); | |||||
| String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | ||||
| BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| @@ -224,7 +225,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public boolean productOperate(String product_id, String out_id, Integer op_type) throws WxErrorException { | |||||
| public boolean productOperate(String accountId,String product_id, String out_id, Integer op_type) throws WxErrorException { | |||||
| TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_OPERATE; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.PRODUCT_OPERATE; | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| @@ -234,6 +235,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| map.put("out_id",out_id); | map.put("out_id",out_id); | ||||
| } | } | ||||
| map.put("op_type",op_type); | map.put("op_type",op_type); | ||||
| map.put("account_id",accountId); | |||||
| String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | ||||
| BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| @@ -244,7 +246,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public boolean stockSync(String product_id, String out_id, Integer stock) throws WxErrorException { | |||||
| public boolean stockSync(String accountId,String product_id, String out_id, Integer stock) throws WxErrorException { | |||||
| TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | TtWebGoodsPostRequestExecutor postExecutor = new TtWebGoodsPostRequestExecutor(this.service.getRequestHttp()); | ||||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.STOCK_SYNC; | String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.STOCK_SYNC; | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| @@ -261,6 +263,7 @@ public class TtGoodLifeSaasGoodsServiceImpl implements TtGoodLifeSaasGoodsServic | |||||
| stockStruct.put("stock_qty",stock); | stockStruct.put("stock_qty",stock); | ||||
| } | } | ||||
| map.put("stock",stockStruct); | map.put("stock",stockStruct); | ||||
| map.put("account_id",accountId); | |||||
| String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | String result = this.service.execute(postExecutor, apiUrl, GSON.toJson(map)); | ||||
| BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | BaseGoodsResult baseResult = GSON.fromJson(result, BaseGoodsResult.class); | ||||
| if(baseResult.isSuccess()){ | if(baseResult.isSuccess()){ | ||||
| @@ -13,7 +13,7 @@ public class TtGoodLifeSaasServiceImpl extends TtBasicServiceImpl implements TtG | |||||
| private TtGoodLifeSaasGoodsService shopMatchService = new TtGoodLifeSaasGoodsServiceImpl(this); | private TtGoodLifeSaasGoodsService shopMatchService = new TtGoodLifeSaasGoodsServiceImpl(this); | ||||
| @Override | @Override | ||||
| public TtGoodLifeSaasGoodsService getGoodLifeSaasGoodsService() { | |||||
| public TtGoodLifeSaasGoodsService getGoodsService() { | |||||
| return this.shopMatchService; | return this.shopMatchService; | ||||
| } | } | ||||
| @@ -19,6 +19,12 @@ public class Product implements Serializable { | |||||
| private static final long serialVersionUID = -1L; | private static final long serialVersionUID = -1L; | ||||
| /** | |||||
| * 抖音来客ID | |||||
| */ | |||||
| @SerializedName(value = "account_id") | |||||
| private String accountId; | |||||
| /** | /** | ||||
| * 草稿状态 10-审核中 12-审核失败 1-审核通过 | * 草稿状态 10-审核中 12-审核失败 1-审核通过 | ||||
| */ | */ | ||||
| @@ -125,6 +131,8 @@ public class Product implements Serializable { | |||||
| @SerializedName(value = "poi_list") | @SerializedName(value = "poi_list") | ||||
| private List<PoiStruct> poiList; | private List<PoiStruct> poiList; | ||||
| @SerializedName(value = "pois") | |||||
| private List<PoiStruct> pois; | |||||
| /** | /** | ||||
| * 商品属性KV | * 商品属性KV | ||||
| */ | */ | ||||
| @@ -19,6 +19,12 @@ public class ProductSku implements Serializable { | |||||
| private static final long serialVersionUID = -1L; | private static final long serialVersionUID = -1L; | ||||
| /** | |||||
| * 来客ID | |||||
| */ | |||||
| @SerializedName(value = "account_id") | |||||
| private String accountId; | |||||
| /** | /** | ||||
| * 商品Id | * 商品Id | ||||
| * 创建时不必填写,更新时如有out_id可不填写 | * 创建时不必填写,更新时如有out_id可不填写 | ||||
| @@ -18,19 +18,19 @@ public interface TtCouponGoodsService { | |||||
| // | // | ||||
| // ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); | // ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); | ||||
| ResultData productSave(WxCoupon coupon) throws Exception; | |||||
| ResultData productSave(WxCoupon coupon,boolean isSaas) throws Exception; | |||||
| int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi); | int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi); | ||||
| ResultData productDraftGet(TenantEntity tenantEntity,Long id); | |||||
| ResultData productDraftGet(TenantEntity tenantEntity,Long id,boolean isSaas); | |||||
| ResultData productOnlineGet(TenantEntity tenantEntity,Long id); | |||||
| ResultData productOnlineGet(TenantEntity tenantEntity,Long id,boolean isSaas); | |||||
| ResultData productOperate(TenantEntity tenantInfo, Long id); | |||||
| ResultData productOperate(TenantEntity tenantInfo, Long id,boolean isSaas); | |||||
| ResultData productStockSync(TenantEntity tenantInfo, Long id); | |||||
| ResultData productStockSync(TenantEntity tenantInfo, Long id,boolean isSaas); | |||||
| ResultData productFreeAudit(TenantEntity tenantInfo, Long id); | |||||
| ResultData productFreeAudit(TenantEntity tenantInfo, Long id,boolean isSaas); | |||||
| //cps 佣金 | //cps 佣金 | ||||
| @@ -165,7 +165,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData productSave(WxCoupon coupon) throws Exception { | |||||
| public ResultData productSave(WxCoupon coupon,boolean isSaas) throws Exception { | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId()); | TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId()); | ||||
| if(ttCouponChannelPoi != null && | if(ttCouponChannelPoi != null && | ||||
| (EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) | (EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getLastStatus()) | ||||
| @@ -260,7 +260,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| List<Product.PoiStruct> poiList = new ArrayList(); | List<Product.PoiStruct> poiList = new ArrayList(); | ||||
| for (TtMerchantPoi poi: pois) { | for (TtMerchantPoi poi: pois) { | ||||
| Product.PoiStruct poiStruct = new Product.PoiStruct(); | Product.PoiStruct poiStruct = new Product.PoiStruct(); | ||||
| poiStruct.setSupplierExtId(poi.getSupplierExtId()); | |||||
| if (!isSaas) { | |||||
| poiStruct.setSupplierExtId(poi.getSupplierExtId()); | |||||
| }else { | |||||
| poiStruct.setPoiId(Long.parseLong(poi.getPoiId())); | |||||
| } | |||||
| poiList.add(poiStruct); | poiList.add(poiStruct); | ||||
| } | } | ||||
| @@ -342,7 +346,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| //提交审核 | //提交审核 | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(coupon); | |||||
| Product product = new Product(); | Product product = new Product(); | ||||
| Product.ProductStruct prostruct = new Product.ProductStruct(); | Product.ProductStruct prostruct = new Product.ProductStruct(); | ||||
| prostruct.setOutId(coupon.getId().toString()); | prostruct.setOutId(coupon.getId().toString()); | ||||
| @@ -356,7 +359,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| prostruct.setSoldEndTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getEndTime())); | prostruct.setSoldEndTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getEndTime())); | ||||
| prostruct.setOutUrl(getGoodsEntrySchema(coupon,wxCouponChannel.getId())); | prostruct.setOutUrl(getGoodsEntrySchema(coupon,wxCouponChannel.getId())); | ||||
| prostruct.setPoiList(poiList); | |||||
| if (isSaas) { | |||||
| prostruct.setPois(poiList); | |||||
| }else { | |||||
| prostruct.setPoiList(poiList); | |||||
| } | |||||
| Map<String, String> productAttrKeyValueMap = ttattrs.getProductAttrKeyValueMap(); | Map<String, String> productAttrKeyValueMap = ttattrs.getProductAttrKeyValueMap(); | ||||
| productAttrKeyValueMap.put("trade_url",getUpOrderEntrySchema(coupon,wxCouponChannel.getId())); | productAttrKeyValueMap.put("trade_url",getUpOrderEntrySchema(coupon,wxCouponChannel.getId())); | ||||
| prostruct.setAttrKeyValueMap(productAttrKeyValueMap); | prostruct.setAttrKeyValueMap(productAttrKeyValueMap); | ||||
| @@ -373,8 +380,17 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| skuStruct.setStatus(1); | skuStruct.setStatus(1); | ||||
| skuStruct.setAttrKeyValueMap(ttattrs.getSkuAttrKeyValueMap()); | skuStruct.setAttrKeyValueMap(ttattrs.getSkuAttrKeyValueMap()); | ||||
| product.setSku(skuStruct); | product.setSku(skuStruct); | ||||
| if (isSaas) { | |||||
| product.setAccountId(getDouyinLaikeId(coupon)); | |||||
| } | |||||
| String productId = ttWebService.getGoodsService().productSave(product); | |||||
| String productId = null; | |||||
| if (isSaas) { | |||||
| productId = ttMerchantPoiService.getTtGoodLifeSassService(coupon).getGoodsService().productSave(product); | |||||
| }else { | |||||
| productId = ttMerchantPoiService.getTtWebService(coupon).getGoodsService().productSave(product); | |||||
| } | |||||
| if(StringUtils.isBlank(productId)){ | if(StringUtils.isBlank(productId)){ | ||||
| throw new Exception("未获取到抖音商品product_id"); | throw new Exception("未获取到抖音商品product_id"); | ||||
| @@ -395,21 +411,35 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } | } | ||||
| } | } | ||||
| private String getDouyinLaikeId(TenantEntity tenantEntity) throws Exception { | |||||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumAppPlat.TOUTIAO); | |||||
| if (null == appinfo || StringUtils.isBlank(appinfo.getLaikeId())) { | |||||
| throw new Exception("appinfo未配置laikeId"); | |||||
| } | |||||
| return appinfo.getLaikeId(); | |||||
| } | |||||
| @Override | @Override | ||||
| public int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi) { | public int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi) { | ||||
| return ttCouponChannelPoiMapper.updateBySpuId(couponChannelPoi); | return ttCouponChannelPoiMapper.updateBySpuId(couponChannelPoi); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData productDraftGet(TenantEntity tenantEntity,Long id) { | |||||
| public ResultData productDraftGet(TenantEntity tenantEntity,Long id,boolean isSaas) { | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); | TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); | ||||
| if(ttCouponChannelPoi == null){ | if(ttCouponChannelPoi == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); | ||||
| } | } | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); | |||||
| List<Product> products = ttWebService.getGoodsService().productDraftGet(null, ttCouponChannelPoi.getId().toString()); | |||||
| if(products.size() > 0){ | |||||
| List<Product> products = null; | |||||
| if (isSaas) { | |||||
| products = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productDraftGet(getDouyinLaikeId(tenantEntity),null, ttCouponChannelPoi.getId().toString()); | |||||
| }else { | |||||
| products = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productDraftGet(null, ttCouponChannelPoi.getId().toString()); | |||||
| } | |||||
| if(null != products && products.size() > 0){ | |||||
| Product product = products.get(0); | Product product = products.get(0); | ||||
| if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ | if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ | ||||
| ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_rejection.getCode()); | ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_rejection.getCode()); | ||||
| @@ -433,18 +463,25 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | ||||
| } | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData productOnlineGet(TenantEntity tenantEntity,Long id) { | |||||
| public ResultData productOnlineGet(TenantEntity tenantEntity,Long id,boolean isSaas) { | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); | TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); | ||||
| if(ttCouponChannelPoi == null){ | if(ttCouponChannelPoi == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); | ||||
| } | } | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); | |||||
| List<Product> products = ttWebService.getGoodsService().productOnlineGet(null, ttCouponChannelPoi.getId().toString()); | |||||
| List<Product> products = null; | |||||
| if (isSaas) { | |||||
| products = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productOnlineGet(getDouyinLaikeId(ttCouponChannelPoi),null, ttCouponChannelPoi.getId().toString()); | |||||
| }else { | |||||
| products = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productOnlineGet(null, ttCouponChannelPoi.getId().toString()); | |||||
| } | |||||
| if(products.size() > 0){ | if(products.size() > 0){ | ||||
| Product product = products.get(0); | Product product = products.get(0); | ||||
| if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ | if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ | ||||
| @@ -470,11 +507,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | ||||
| } | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData productOperate(TenantEntity tenantInfo, Long id) { | |||||
| public ResultData productOperate(TenantEntity tenantInfo, Long id,boolean isSaas) { | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | ||||
| if(wxCoupon == null){ | if(wxCoupon == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | ||||
| @@ -505,8 +544,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } | } | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); | |||||
| boolean b = ttWebService.getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); | |||||
| boolean b = false; | |||||
| if (isSaas) { | |||||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productOperate(getDouyinLaikeId(wxCoupon),null,wxCoupon.getId().toString(),op_type); | |||||
| }else { | |||||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); | |||||
| } | |||||
| if(b){ | if(b){ | ||||
| TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); | TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); | ||||
| ccPoi.setId(ttCouponChannelPoi.getId()); | ccPoi.setId(ttCouponChannelPoi.getId()); | ||||
| @@ -522,11 +566,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | ||||
| } | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData productStockSync(TenantEntity tenantInfo, Long id) { | |||||
| public ResultData productStockSync(TenantEntity tenantInfo, Long id,boolean isSaas) { | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | ||||
| if(wxCoupon == null){ | if(wxCoupon == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | ||||
| @@ -537,8 +583,12 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | ||||
| } | } | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); | |||||
| boolean b = ttWebService.getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||||
| boolean b = false; | |||||
| if (isSaas) { | |||||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().stockSync(getDouyinLaikeId(ttCouponChannelPoi),null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||||
| } else { | |||||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||||
| } | |||||
| if(b){ | if(b){ | ||||
| return new ResultData(); | return new ResultData(); | ||||
| }else{ | }else{ | ||||
| @@ -548,11 +598,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | ||||
| } | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData productFreeAudit(TenantEntity tenantInfo, Long id) { | |||||
| public ResultData productFreeAudit(TenantEntity tenantInfo, Long id,boolean isSaas) { | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | ||||
| if(wxCoupon == null){ | if(wxCoupon == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | ||||
| @@ -563,9 +615,15 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | ||||
| } | } | ||||
| try { | try { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); | |||||
| boolean b = ttWebService.getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(), | |||||
| null,wxCoupon.getInventory()); | |||||
| boolean b = false; | |||||
| if (isSaas) { | |||||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productFreeAudit(getDouyinLaikeId(ttCouponChannelPoi),null,wxCoupon.getId().toString(), | |||||
| null,wxCoupon.getInventory()); | |||||
| }else { | |||||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(), | |||||
| null,wxCoupon.getInventory()); | |||||
| } | |||||
| if(b){ | if(b){ | ||||
| return new ResultData(); | return new ResultData(); | ||||
| }else{ | }else{ | ||||
| @@ -575,7 +633,10 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | ||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| @@ -607,7 +607,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| TenantEntity defaultEntity = new TenantEntity(); | TenantEntity defaultEntity = new TenantEntity(); | ||||
| defaultEntity.setTenantId("789"); | defaultEntity.setTenantId("789"); | ||||
| TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); | TtGoodLifeSaasService ttWebService = ttMerchantPoiService.getTtGoodLifeSassService(defaultEntity); | ||||
| goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(categoryId, null); | |||||
| goodsCategories = ttWebService.getGoodsService().categoryGet(categoryId, null); | |||||
| }else { | }else { | ||||
| TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); | TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); | ||||
| goodsCategories = ttWebService.getGoodsService().categoryGet(categoryId, null); | goodsCategories = ttWebService.getGoodsService().categoryGet(categoryId, null); | ||||
| @@ -715,7 +715,7 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||||
| private void handSyncCategoryForNew(TtGoodLifeSaasService ttWebService,Integer category_id,Date now){ | private void handSyncCategoryForNew(TtGoodLifeSaasService ttWebService,Integer category_id,Date now){ | ||||
| try { | try { | ||||
| List<GoodsCategory> goodsCategories = ttWebService.getGoodLifeSaasGoodsService().categoryGet(category_id, null); | |||||
| List<GoodsCategory> goodsCategories = ttWebService.getGoodsService().categoryGet(category_id, null); | |||||
| if(goodsCategories != null){ | if(goodsCategories != null){ | ||||
| TtGoodsCategoryNew record = new TtGoodsCategoryNew(); | TtGoodsCategoryNew record = new TtGoodsCategoryNew(); | ||||
| record.setParentId(category_id); | record.setParentId(category_id); | ||||
| @@ -1465,7 +1465,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| private void spuStockSync(TenantEntity tenantEntity,Long couponId){ | private void spuStockSync(TenantEntity tenantEntity,Long couponId){ | ||||
| FmInsideProductPushMsg productPush = new FmInsideProductPushMsg(); | FmInsideProductPushMsg productPush = new FmInsideProductPushMsg(); | ||||
| productPush.setDelayTimeLevel(3); | productPush.setDelayTimeLevel(3); | ||||
| productPush.setMsgType(EnumMsgRecordType.INSIDE_PRODUCT_PUSH.getCode()); | productPush.setMsgType(EnumMsgRecordType.INSIDE_PRODUCT_PUSH.getCode()); | ||||
| @@ -1479,7 +1478,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| private void spuFreeAuditSync(TenantEntity tenantEntity,Long couponId){ | private void spuFreeAuditSync(TenantEntity tenantEntity,Long couponId){ | ||||
| FmInsideProductPushMsg productPush = new FmInsideProductPushMsg(); | FmInsideProductPushMsg productPush = new FmInsideProductPushMsg(); | ||||
| productPush.setDelayTimeLevel(3); | productPush.setDelayTimeLevel(3); | ||||
| productPush.setMsgType(EnumMsgRecordType.INSIDE_PRODUCT_PUSH.getCode()); | productPush.setMsgType(EnumMsgRecordType.INSIDE_PRODUCT_PUSH.getCode()); | ||||
| @@ -1,11 +1,14 @@ | |||||
| package com.iformall.service.msg.impl; | package com.iformall.service.msg.impl; | ||||
| import com.iformall.domain.po.WxMallVersion; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.FmInsideProductPushMsg; | import com.iformall.domain.po.msg.FmInsideProductPushMsg; | ||||
| import com.iformall.enums.EnumDouyinApplicationVersion; | |||||
| import com.iformall.enums.EnumPushType; | import com.iformall.enums.EnumPushType; | ||||
| import com.iformall.service.TtCouponGoodsService; | import com.iformall.service.TtCouponGoodsService; | ||||
| import com.iformall.service.TtGoodsCategoryService; | import com.iformall.service.TtGoodsCategoryService; | ||||
| import com.iformall.service.TtMerchantPoiService; | import com.iformall.service.TtMerchantPoiService; | ||||
| import com.iformall.service.WxMallService; | |||||
| import com.iformall.service.msg.MsgSendService; | import com.iformall.service.msg.MsgSendService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -27,6 +30,9 @@ public class FmInsideProductPushMsgServiceImpl implements MsgSendService { | |||||
| @Autowired | @Autowired | ||||
| private TtCouponGoodsService ttCouponGoodsService; | private TtCouponGoodsService ttCouponGoodsService; | ||||
| @Autowired | |||||
| private WxMallService wxMallService; | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| @@ -36,14 +42,20 @@ public class FmInsideProductPushMsgServiceImpl implements MsgSendService { | |||||
| Thread.currentThread().sleep(1000);//延时秒 | Thread.currentThread().sleep(1000);//延时秒 | ||||
| }catch(Exception e){} | }catch(Exception e){} | ||||
| WxMallVersion mallVersion = wxMallService.getMallVersion(msg.getTenantInfo()); | |||||
| boolean isSaas = false; | |||||
| if (null != mallVersion && null != mallVersion.getDouyinApplicationVersion()) { | |||||
| isSaas = EnumDouyinApplicationVersion.isSaas(mallVersion.getDouyinApplicationVersion()); | |||||
| } | |||||
| if(EnumPushType.SPU_STATUS_SYNC.equals(msg.getSyncType())){ | if(EnumPushType.SPU_STATUS_SYNC.equals(msg.getSyncType())){ | ||||
| ttCouponGoodsService.productOperate(msg.getTenantInfo(),msg.getCouponId()); | |||||
| ttCouponGoodsService.productOperate(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||||
| // poiService.spuStatusSync(msg.getTenantInfo(),msg.getCouponId()); | // poiService.spuStatusSync(msg.getTenantInfo(),msg.getCouponId()); | ||||
| }else if(EnumPushType.SPU_STOCK_SYNC.equals(msg.getSyncType())){ | }else if(EnumPushType.SPU_STOCK_SYNC.equals(msg.getSyncType())){ | ||||
| ttCouponGoodsService.productStockSync(msg.getTenantInfo(),msg.getCouponId()); | |||||
| ttCouponGoodsService.productStockSync(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||||
| // poiService.spuStockSync(msg.getTenantInfo(),msg.getCouponId()); | // poiService.spuStockSync(msg.getTenantInfo(),msg.getCouponId()); | ||||
| }else if(EnumPushType.SPU_FREE_AUDIT_SYNC.equals(msg.getSyncType())){ | }else if(EnumPushType.SPU_FREE_AUDIT_SYNC.equals(msg.getSyncType())){ | ||||
| ttCouponGoodsService.productFreeAudit(msg.getTenantInfo(),msg.getCouponId()); | |||||
| ttCouponGoodsService.productFreeAudit(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||||
| } | } | ||||
| } | } | ||||
| @@ -24,13 +24,14 @@ | |||||
| <result column="business_license" jdbcType="VARCHAR" property="businessLicense"/> | <result column="business_license" jdbcType="VARCHAR" property="businessLicense"/> | ||||
| <result column="icp" jdbcType="VARCHAR" property="icp"/> | <result column="icp" jdbcType="VARCHAR" property="icp"/> | ||||
| <result column="laike_id" jdbcType="VARCHAR" property="laikeId"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`app_id`,`parent_app_id`,`name`, | `id`,`tenant_id`,`app_id`,`parent_app_id`,`name`, | ||||
| `secret`,`token`,`aes_key`,`msg_data_format`,`access_token`,`last_token_time`,`expires_in`, | `secret`,`token`,`aes_key`,`msg_data_format`,`access_token`,`last_token_time`,`expires_in`, | ||||
| `pay_id`,`type`,`mould_type`,`enable`,`plat`,`sort_url`,`business_license`,`icp` | |||||
| `pay_id`,`type`,`mould_type`,`enable`,`plat`,`sort_url`,`business_license`,`icp`,`laike_id` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -109,7 +110,7 @@ | |||||
| </select> | </select> | ||||
| <select id="findByAppId" parameterType="java.lang.String" resultMap="BaseResultMap"> | <select id="findByAppId" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||||
| SELECT * | |||||
| SELECT <include refid="allColumns"/> | |||||
| FROM wx_appinfo | FROM wx_appinfo | ||||
| WHERE `app_id` = #{appId} | WHERE `app_id` = #{appId} | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||