Browse Source

//tt product

release_toaliyun_real
xhxu 4 years ago
parent
commit
5966b536e3
5 changed files with 67 additions and 15 deletions
  1. +37
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java
  3. +4
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  4. +9
    -10
      mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java
  5. +16
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java

+ 37
- 3
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java View File

@@ -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());


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/TtGoodsCategoryService.java View File

@@ -20,7 +20,7 @@ public interface TtGoodsCategoryService {
/**
* A端是否显示处理
*/
GoodsTemplateGet adminIsShow(GoodsTemplateGet temp);
void adminIsShow(GoodsTemplateGet temp);


/**


+ 4
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponService.java View File

@@ -85,6 +85,8 @@ public interface WxCouponService {
* @param record
*/
ResultData saveOrUpdate(WxCoupon record);

ResultData updateTtProduct(WxCoupon wxCoupon);
/**
* 更新实体
*
@@ -269,5 +271,6 @@ public interface WxCouponService {
Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity);

List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId);


}

+ 9
- 10
mallinkService/src/main/java/com/iformall/service/impl/TtGoodsCategoryServiceImpl.java View File

@@ -101,23 +101,22 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService {
* @return
*/
@Override
public GoodsTemplateGet adminIsShow(GoodsTemplateGet temp) {
GoodsTemplateGet newAttr = new GoodsTemplateGet();
List<GoodsTemplateGet.ProductAttrs> productAttrs = new ArrayList<>();
public void adminIsShow(GoodsTemplateGet temp) {
for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) {
if(!getProductAdminIsNotShowKey().contains(attr.getKey())){
productAttrs.add(attr);
if(getProductAdminIsNotShowKey().contains(attr.getKey())){
attr.setIsShow(false);
}else{
attr.setIsShow(true);
}
}
newAttr.setProductAttrs(productAttrs);
List<GoodsTemplateGet.ProductAttrs> skuAttrs = new ArrayList<>();
for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) {
if(!getAttrAdminIsNotShowKey().contains(attr.getKey())){
skuAttrs.add(attr);
if(getAttrAdminIsNotShowKey().contains(attr.getKey())){
attr.setIsShow(false);
}else{
attr.setIsShow(true);
}
}
newAttr.setSkuAttrs(skuAttrs);
return newAttr;
}

@Override


+ 16
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -642,6 +642,22 @@ public class WxCouponServiceImpl implements WxCouponService {
return new ResultData(record.getId());
}

@Override
public ResultData updateTtProduct(WxCoupon record) {
WxCoupon coupon = new WxCoupon();
coupon.setId(record.getId());
coupon.updateTenantInfo(record);
coupon.setProductType(record.getProductType());
coupon.setCategoryId(record.getCategoryId());
coupon.setProductAttrs(record.getProductAttrs());
coupon.setSkuAttrs(record.getSkuAttrs());
coupon.setUpdateDate(new Date());
wxCouponMapper.updateById(coupon);
//清空缓存
clearCache(record);
return new ResultData(record.getId());
}


/**
* 清除c端首页券列表缓存


Loading…
Cancel
Save