|
|
|
@@ -105,33 +105,39 @@ public class TtCouponController extends BaseController { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到课程,或课程已删除"); |
|
|
|
} |
|
|
|
if(!coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_DRAFT.getCode()) |
|
|
|
&& !coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_REJECT.getCode())){ |
|
|
|
&& !coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_REJECT.getCode()) |
|
|
|
&& !coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_AFTER_SHELF.getCode())){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"该课程状态不允许修改"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); |
|
|
|
List<WxMerchant> list = wxMerchantService.findList(merchantQ); |
|
|
|
if(list != null && list.size() > 0){ |
|
|
|
record.setMerchantId(list.get(0).getId()); |
|
|
|
if(coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_AFTER_SHELF.getCode())){ |
|
|
|
record.setVideoId(null); |
|
|
|
record.setVideoUrl(null); |
|
|
|
record.setVideoTime(null); |
|
|
|
record.setColumnCoupons(null); |
|
|
|
} |
|
|
|
} |
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到作者"); |
|
|
|
} |
|
|
|
if(record.getBusinessId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未选择分类"); |
|
|
|
} |
|
|
|
if(record.getType() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"type为空"); |
|
|
|
} |
|
|
|
if(record.getType().equals(EnumTtCouponType.COUPON_SINGLE.getCode())){ |
|
|
|
if(StringUtils.isBlank(record.getVideoId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
merchantQ.updateTenantInfo(tenantEntity); |
|
|
|
merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); |
|
|
|
List<WxMerchant> list = wxMerchantService.findList(merchantQ); |
|
|
|
if(list != null && list.size() > 0){ |
|
|
|
record.setMerchantId(list.get(0).getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到作者"); |
|
|
|
} |
|
|
|
if(record.getBusinessId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未选择分类"); |
|
|
|
} |
|
|
|
if(record.getType() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"type为空"); |
|
|
|
} |
|
|
|
if(record.getType().equals(EnumTtCouponType.COUPON_SINGLE.getCode())){ |
|
|
|
if(StringUtils.isBlank(record.getVideoId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); |
|
|
|
}else{ |
|
|
|
// VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); |
|
|
|
// if(result.isSuccess()){ |
|
|
|
// record.setVideoTime(result.getDuration()); |
|
|
|
@@ -146,13 +152,13 @@ public class TtCouponController extends BaseController { |
|
|
|
// }else{ |
|
|
|
// return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); |
|
|
|
// } |
|
|
|
} |
|
|
|
}else if(record.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode())){ |
|
|
|
if(record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ |
|
|
|
for (TtCoupon ttc:record.getColumnCoupons()) { |
|
|
|
if(StringUtils.isBlank(ttc.getVideoId())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "部分未上传视频"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if(record.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode())){ |
|
|
|
if(record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ |
|
|
|
for (TtCoupon ttc:record.getColumnCoupons()) { |
|
|
|
if(StringUtils.isBlank(ttc.getVideoId())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "部分未上传视频"); |
|
|
|
} |
|
|
|
// VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(ttc.getVideoId()); |
|
|
|
// if(result.isSuccess()){ |
|
|
|
// ttc.setVideoTime(result.getDuration()); |
|
|
|
@@ -167,14 +173,15 @@ public class TtCouponController extends BaseController { |
|
|
|
// }else{ |
|
|
|
// return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); |
|
|
|
// } |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "未上传视频"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "未上传视频"); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未识别type类型"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未识别type类型"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// record.setType(EnumTtCouponType.COUPON_SINGLE.getCode()); |
|
|
|
ResultData resultData = ttCouponService.saveOrUpdate(record); |
|
|
|
|