|
|
|
@@ -2129,11 +2129,18 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void handleDraftCoupon(WxCoupon wxCoupon) { |
|
|
|
WxCoupon onlineCoupon = wxCouponMapper.selectOnlineCoupon(wxCoupon.getId(),wxCoupon.getTenantId()); |
|
|
|
if(onlineCoupon == null){ |
|
|
|
WxCoupon coupon = wxCouponMapper.selectOnlineCoupon(wxCoupon.getId(),wxCoupon.getTenantId()); |
|
|
|
if(coupon == null){ |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到券数据"); |
|
|
|
} |
|
|
|
TtCouponChannelPoi onlineCouponChannelPoi = ttCouponChannelPoiMapper.selectById(onlineCoupon.getTenantId(), onlineCoupon.getId()); |
|
|
|
if(EnumCouponVersion.draft.getCode().equals(coupon.getVersion())){ |
|
|
|
TtCouponChannelPoi draftCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(), coupon.getId()); |
|
|
|
if(draftCouponChannelPoi != null && EnumSpuSyncStatus.sync_auditing.getCode().equals(draftCouponChannelPoi.getStatus())){ |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"商品数据流程中"); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
TtCouponChannelPoi onlineCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(), coupon.getId()); |
|
|
|
if(onlineCouponChannelPoi != null){ |
|
|
|
if(EnumSpuSyncStatus.sync_auditing.getCode().equals(onlineCouponChannelPoi.getStatus())){ |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"商品数据流程中"); |
|
|
|
@@ -2143,12 +2150,12 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_pass.getCode().equals(onlineCouponChannelPoi.getStatus()) |
|
|
|
|| EnumSpuSyncStatus.sync_audit_disable.getCode().equals(onlineCouponChannelPoi.getStatus())){ |
|
|
|
//复制草稿数据 |
|
|
|
WxCoupon draftCoupon = wxCouponMapper.selectDraftCoupon(onlineCoupon.getId(),onlineCoupon.getTenantId()); |
|
|
|
WxCoupon draftCoupon = wxCouponMapper.selectDraftCoupon(coupon.getId(),coupon.getTenantId()); |
|
|
|
if(draftCoupon == null){ |
|
|
|
try{ |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
draftCoupon = new WxCoupon(); |
|
|
|
BeanUtils.copyProperties(draftCoupon,onlineCoupon); |
|
|
|
BeanUtils.copyProperties(draftCoupon,coupon); |
|
|
|
draftCoupon.setId(idWorker.nextId()); |
|
|
|
draftCoupon.setVersion(EnumCouponVersion.draft.getCode()); |
|
|
|
draftCoupon.setCreateDate(new Date()); |
|
|
|
@@ -2217,5 +2224,33 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> findCouponDetail(TenantEntity tenantInfo, Long id) { |
|
|
|
Map<String, Object> couponDetail = new HashMap<>(); |
|
|
|
couponDetail.put("id",id); |
|
|
|
couponDetail.put("tenantId",tenantInfo.getTenantId()); |
|
|
|
couponDetail.put("parentTenantId",tenantInfo.getParentTenantId()); |
|
|
|
WxCoupon onlineCoupon = wxCouponMapper.selectOnlineCoupon(id, tenantInfo.getTenantId()); |
|
|
|
if(onlineCoupon == null){ |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
couponDetail.put("onlineCoupon",onlineCoupon); |
|
|
|
couponDetail.put("supId",onlineCoupon.getGoodsId()); |
|
|
|
TtCouponChannelPoi onlineCouponChannelPoi = ttCouponChannelPoiMapper.selectById(onlineCoupon.getTenantId(), onlineCoupon.getId()); |
|
|
|
if(onlineCouponChannelPoi != null){ |
|
|
|
couponDetail.put("onlineTTStatus",onlineCouponChannelPoi); |
|
|
|
} |
|
|
|
WxCoupon draftCoupon = wxCouponMapper.selectDraftCoupon(id, tenantInfo.getTenantId()); |
|
|
|
if(draftCoupon != null){ |
|
|
|
couponDetail.put("draftCoupon",draftCoupon); |
|
|
|
TtCouponChannelPoi draftCouponChannelPoi = ttCouponChannelPoiMapper.selectById(draftCoupon.getTenantId(), draftCoupon.getId()); |
|
|
|
if(draftCouponChannelPoi != null){ |
|
|
|
couponDetail.put("draftTTStatus",draftCouponChannelPoi); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |