|
|
|
@@ -100,20 +100,44 @@ public class TtCouponController extends BaseController { |
|
|
|
record.updateTenantInfo(tenantEntity); |
|
|
|
|
|
|
|
if(record.getId() != null){ |
|
|
|
TtCoupon coupon = ttCouponService.getById(record.getId()); |
|
|
|
TtCoupon coupon = ttCouponService.detail(record.getId()); |
|
|
|
if (null == coupon || EnumDelFlag.YES.getCode().equals(record.getIsDel())) { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到课程,或课程已删除"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到课程,或课程已删除"); |
|
|
|
} |
|
|
|
if(!coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_DRAFT.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,"该课程状态不允许修改"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"该课程状态不允许修改"); |
|
|
|
} |
|
|
|
if(coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_AFTER_SHELF.getCode())){ |
|
|
|
record.setVideoId(null); |
|
|
|
record.setVideoUrl(null); |
|
|
|
record.setVideoTime(null); |
|
|
|
record.setColumnCoupons(null); |
|
|
|
if(coupon.getPutonDate() != null){ |
|
|
|
if(coupon.getType().equals(EnumTtCouponType.COUPON_SINGLE.getCode())){ |
|
|
|
if(StringUtils.isNotBlank(record.getVideoId()) && !coupon.getVideoId().equals(record.getVideoId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"该课程上架过,视频不允许修改"); |
|
|
|
} |
|
|
|
}else if(coupon.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode())){ |
|
|
|
if(coupon.getColumnCoupons() != null && coupon.getColumnCoupons().size()>0 |
|
|
|
&& record.getColumnCoupons() != null && record.getColumnCoupons().size()>0){ |
|
|
|
if(coupon.getColumnCoupons().size() == record.getColumnCoupons().size()){ |
|
|
|
int count = coupon.getColumnCoupons().size(); |
|
|
|
for (TtCoupon oldc:coupon.getColumnCoupons()) { |
|
|
|
for (TtCoupon newc:record.getColumnCoupons()) { |
|
|
|
if(oldc.getId().equals(newc.getId()) && oldc.getVideoId().equals(newc.getVideoId())){ |
|
|
|
count--; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(count > 0){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"该课程上架过,视频不允许修改"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"该课程上架过,视频不允许新增或删除"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"数据异常,未找到课程视频"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"数据异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
@@ -126,32 +150,17 @@ public class TtCouponController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
if(record.getMerchantId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到作者"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到作者"); |
|
|
|
} |
|
|
|
if(record.getBusinessId() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未选择分类"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未选择分类"); |
|
|
|
} |
|
|
|
if(record.getType() == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR,"type为空"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_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()); |
|
|
|
//// record.setVideoUrl(result.getVideoUrl()); |
|
|
|
// TtVideoLibrary video = new TtVideoLibrary(); |
|
|
|
// video.updateTenantInfo(tenantEntity); |
|
|
|
// video.setVideoId(record.getVideoId()); |
|
|
|
// video.setVideoUrl(result.getVideoUrl()); |
|
|
|
// video.setPreview(result.getCoverURL()); |
|
|
|
// video.setDuration(result.getDuration()); |
|
|
|
// ttVideoLibraryService.saveOrUpdate(video); |
|
|
|
// }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){ |
|
|
|
@@ -159,26 +168,12 @@ public class TtCouponController extends BaseController { |
|
|
|
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()); |
|
|
|
//// ttc.setVideoUrl(result.getVideoUrl()); |
|
|
|
// TtVideoLibrary video = new TtVideoLibrary(); |
|
|
|
// video.updateTenantInfo(tenantEntity); |
|
|
|
// video.setVideoId(record.getVideoId()); |
|
|
|
// video.setVideoUrl(result.getVideoUrl()); |
|
|
|
// video.setPreview(result.getCoverURL()); |
|
|
|
// video.setDuration(result.getDuration()); |
|
|
|
// ttVideoLibraryService.saveOrUpdate(video); |
|
|
|
// }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_SERVER_ERROR,"未识别type类型"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未识别type类型"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@@ -189,14 +184,6 @@ public class TtCouponController extends BaseController { |
|
|
|
return resultData; |
|
|
|
} |
|
|
|
|
|
|
|
//启动投放审批 |
|
|
|
// if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { |
|
|
|
// record.getFlowParams().put("businessId",record.getId()); |
|
|
|
// wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); |
|
|
|
// //修改coupon applyStatus状态为审核中 |
|
|
|
// record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); |
|
|
|
// } |
|
|
|
|
|
|
|
return resultData; |
|
|
|
} |
|
|
|
|
|
|
|
|