diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 4f2ef3df6..b2d3df092 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -252,6 +252,18 @@ public class WxCouponController extends BaseController { return result; } + @TenantIgnore + @ApiOperation("根据id查询接口") + @GetMapping("/findCouponDetail") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + @SystemControllerLog(description = "券投放-查询") + public ResultData findCouponDetail(@RequestParam Long id) { + logger.debug("[" + getIpAddr() + "] WxCouponController::findCouponDetail"); + TenantEntity tenantEntity = getTenantInfo(); + Map couponDetail = wxCouponService.findCouponDetail(getTenantInfo(),id); + return new ResultData(couponDetail); + } + @TenantIgnore @ApiOperation("根据id查询接口") @GetMapping("/findDraftCoupon") diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 4c780f1b2..a2c461dde 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -317,4 +317,5 @@ public interface WxCouponService { WxCouponCVo getDraftCoupon(Long couponId, String tenantId, TenantEntity mallTenantEntity); + Map findCouponDetail(TenantEntity tenantInfo, Long id); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 8d228242c..4e492957b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -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 findCouponDetail(TenantEntity tenantInfo, Long id) { + Map 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; + } + }