|
|
|
@@ -230,6 +230,40 @@ public class WxCouponController extends BaseController { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id更新接口") |
|
|
|
@PostMapping("continueAdd") |
|
|
|
@SystemControllerLog(description = "继续添加") |
|
|
|
public ResultData continueAdd(@RequestBody WxCoupon wxCoupon) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::update"); |
|
|
|
if (wxCoupon.getId() == null) { |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
if(wxCoupon.getProductType() == null || wxCoupon.getCategoryId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "缺少必要参数"); |
|
|
|
} |
|
|
|
|
|
|
|
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(wxCouponChannelMapper.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()); |
|
|
|
} |
|
|
|
|
|
|
|
ResultData result = wxCouponService.updateTtProduct(wxCoupon); |
|
|
|
CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId()); |
|
|
|
CouponCacheUtils.removeCouponMerchantCache(redisTemplate, wxCoupon.getId()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id更新库存及有效期接口") |
|
|
|
@PostMapping("updateStokeAndValidDate") |
|
|
|
@SystemControllerLog(description = "券投放-库存/有效期更新") |
|
|
|
@@ -565,9 +599,9 @@ public class WxCouponController extends BaseController { |
|
|
|
|
|
|
|
try { |
|
|
|
GoodsTemplateGet goodsTemplateGet = ttMerchantPoiService.getTtWebService(getTenantInfo()).getGoodsService().templateGet(categoryId, productType); |
|
|
|
GoodsTemplateGet admintemp = ttGoodsCategoryService.adminIsShow(goodsTemplateGet); |
|
|
|
ttGoodsCategoryService.handTemplate(admintemp,coupon); |
|
|
|
return new ResultData(admintemp); |
|
|
|
ttGoodsCategoryService.adminIsShow(goodsTemplateGet); |
|
|
|
ttGoodsCategoryService.handTemplate(goodsTemplateGet,coupon); |
|
|
|
return new ResultData(goodsTemplateGet); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
|