Просмотр исходного кода

//..coupon_

release_toaliyun_real
xhxu 2 лет назад
Родитель
Сommit
e00be4176e
3 измененных файлов: 53 добавлений и 5 удалений
  1. +12
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  3. +40
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java

+ 12
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java Просмотреть файл

@@ -252,6 +252,18 @@ public class WxCouponController extends BaseController {
return result; 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<String,Object> couponDetail = wxCouponService.findCouponDetail(getTenantInfo(),id);
return new ResultData(couponDetail);
}

@TenantIgnore @TenantIgnore
@ApiOperation("根据id查询接口") @ApiOperation("根据id查询接口")
@GetMapping("/findDraftCoupon") @GetMapping("/findDraftCoupon")


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponService.java Просмотреть файл

@@ -317,4 +317,5 @@ public interface WxCouponService {


WxCouponCVo getDraftCoupon(Long couponId, String tenantId, TenantEntity mallTenantEntity); WxCouponCVo getDraftCoupon(Long couponId, String tenantId, TenantEntity mallTenantEntity);


Map<String, Object> findCouponDetail(TenantEntity tenantInfo, Long id);
} }

+ 40
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -2129,11 +2129,18 @@ public class WxCouponServiceImpl implements WxCouponService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handleDraftCoupon(WxCoupon wxCoupon) { 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(),"未查询到券数据"); 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(onlineCouponChannelPoi != null){
if(EnumSpuSyncStatus.sync_auditing.getCode().equals(onlineCouponChannelPoi.getStatus())){ if(EnumSpuSyncStatus.sync_auditing.getCode().equals(onlineCouponChannelPoi.getStatus())){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"商品数据流程中"); 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_pass.getCode().equals(onlineCouponChannelPoi.getStatus())
|| EnumSpuSyncStatus.sync_audit_disable.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){ if(draftCoupon == null){
try{ try{
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
draftCoupon = new WxCoupon(); draftCoupon = new WxCoupon();
BeanUtils.copyProperties(draftCoupon,onlineCoupon);
BeanUtils.copyProperties(draftCoupon,coupon);
draftCoupon.setId(idWorker.nextId()); draftCoupon.setId(idWorker.nextId());
draftCoupon.setVersion(EnumCouponVersion.draft.getCode()); draftCoupon.setVersion(EnumCouponVersion.draft.getCode());
draftCoupon.setCreateDate(new Date()); 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;
}



} }

Загрузка…
Отмена
Сохранить