|
|
|
@@ -147,6 +147,9 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
PayServiceFactory payServiceFactory; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponMallMapper wxCouponMallMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { |
|
|
|
@@ -520,9 +523,12 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); |
|
|
|
}else if (record.checkCreateWithMalls()) { |
|
|
|
String[] mallTenantIds = record.getMallTenantIds(); |
|
|
|
if (null == mallTenantIds || mallTenantIds.length <= 0 ) { |
|
|
|
return new ResultData(Result.ERROR,"请选择商场"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
if (record.getId() == null) { |
|
|
|
@@ -541,6 +547,17 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
wxCouponMerchantMapper.insert(cm); |
|
|
|
}); |
|
|
|
}else if (record.checkCreateWithMalls()) { |
|
|
|
for (String mt : record.getMallTenantIds()) { |
|
|
|
WxCouponMall mall = new WxCouponMall(); |
|
|
|
mall.updateTenantInfo(record); |
|
|
|
mall.setMallTenantId(mt); |
|
|
|
mall.setProductId(record.getId()); |
|
|
|
mall.setCreateDate(new Date()); |
|
|
|
mall.setUpdateDate(new Date()); |
|
|
|
mall.setStatus(EnumCouponMallStatus.UNFINISED.getCode()); |
|
|
|
wxCouponMallMapper.insert(mall); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (record.getPasswordSupport() != null && record.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) { |
|
|
|
@@ -571,6 +588,21 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
} |
|
|
|
if (record.checkCreateWithMerchants()) { |
|
|
|
updateCouponMerchants(record,merchantParamList,idWorker); |
|
|
|
}else if (record.checkCreateWithMalls()) { |
|
|
|
WxCouponMall couponMall = new WxCouponMall(); |
|
|
|
couponMall.updateTenantInfo(record); |
|
|
|
couponMall.setProductId(record.getId()); |
|
|
|
wxCouponMallMapper.delteAllByProductId(couponMall); |
|
|
|
for (String mt : record.getMallTenantIds()) { |
|
|
|
WxCouponMall mall = new WxCouponMall(); |
|
|
|
mall.updateTenantInfo(record); |
|
|
|
mall.setMallTenantId(mt); |
|
|
|
mall.setProductId(record.getId()); |
|
|
|
mall.setCreateDate(new Date()); |
|
|
|
mall.setUpdateDate(new Date()); |
|
|
|
mall.setStatus(EnumCouponMallStatus.UNFINISED.getCode()); |
|
|
|
wxCouponMallMapper.insert(mall); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
record.setUpdateDate(new Date()); |
|
|
|
|