package cn.stylefeng.guns.modular.business.dto;
|
|
import cn.hutool.core.util.StrUtil;
|
import cn.stylefeng.guns.modular.business.entity.CourseOrder;
|
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModelProperty;
|
import lombok.Data;
|
|
import java.util.Date;
|
import java.util.List;
|
|
@ApiModel("课程订单-响应参数")
|
@Data
|
public class CourseOrderResponseDTO extends CourseOrder {
|
|
@ApiModelProperty("课程名称")
|
private String courseName;
|
|
@ApiModelProperty("用户姓名")
|
private String userName;
|
|
@ApiModelProperty("课程顾问名称")
|
private String courseUserName;
|
|
@ApiModelProperty("咨询顾问名称")
|
private String tutoringUserName;
|
|
@ApiModelProperty("展示状态用于后台系统展示和查询:0待支付,1已完成,3已支付,9取消,10退款")
|
private Integer showState;
|
|
public Integer getShowState() {
|
Integer statusFlag = getStatusFlag();
|
//判断订单状态
|
if (statusFlag != null){
|
if (statusFlag.intValue() == 0){
|
return 0;
|
} else if (statusFlag.intValue() == 1) {
|
Date nowDate = new Date();
|
if(nowDate.getTime() > getEffectiveEndTime().getTime()){
|
return 1;
|
}else{
|
return 3;
|
}
|
}else if (statusFlag.intValue() == 2) {//订单已完成
|
return 1;
|
}else{
|
return getStatusFlag();
|
}
|
}
|
return showState;
|
}
|
|
@ApiModelProperty("总课程时长")
|
private String totalCourseShowTime = "00:00:00";
|
|
@ApiModelProperty("已学习总课程时长")
|
private String studyCourseShowTime = "00:00:00";
|
|
@ApiModelProperty("学习百分比")
|
private Integer studyPercent = 0;
|
|
@ApiModelProperty(value = "课程详细内容")
|
@ChineseDescription("课程详细内容")
|
private String courseContent;
|
|
@ApiModelProperty(value = "总章节课程数量")
|
@ChineseDescription("总章节课程数量")
|
private Integer totalCourseChapter;
|
|
@ApiModelProperty(value = "已学章节课程数量")
|
@ChineseDescription("已学章节课程数量")
|
private Integer studyCourseChapter;
|
|
public Integer getStudyPercent() {
|
if (getTotalTime() != null && getLearnedTime() != null){
|
return (int)Math.ceil(getLearnedTime()*100f/getTotalTime());
|
}
|
return studyPercent;
|
}
|
|
public String getStudyCourseShowTime() {
|
if (getLearnedTime() != null){
|
int hour = (int) Math.floor(getLearnedTime().longValue() / 3600f);
|
long minute = (int) Math.floor((getLearnedTime().longValue() % 3600) / 60f);
|
long sec = (getLearnedTime().longValue() % 3600l) % 60;
|
return String.format("%02d", hour)+":"+String.format("%02d", minute)+":"+String.format("%02d", sec);
|
}
|
return studyCourseShowTime;
|
}
|
|
public String getTotalCourseShowTime() {
|
if (getTotalTime() != null){
|
int hour = (int) Math.floor(getTotalTime().longValue() / 3600f);
|
long minute = (int) Math.floor((getTotalTime().longValue() % 3600l) / 60f);
|
long sec = (getTotalTime().longValue() % 3600l) % 60;
|
return String.format("%02d", hour)+":"+String.format("%02d", minute)+":"+String.format("%02d", sec);
|
|
}
|
return totalCourseShowTime;
|
}
|
|
@ApiModelProperty(value = "课程章节学习")
|
@ChineseDescription("课程详细内容")
|
private List<CourseResponseDTO.CourseChapterResponseDTO> courseChapterResponseDTOList;
|
|
@ApiModelProperty(value = "最近一次观看章节id")
|
@ChineseDescription("最近一次观看章节id")
|
private Long lastLookCourseChapterId;
|
|
@ApiModelProperty(value = "上架状态 1-上架,2-下架")
|
@ChineseDescription("上架状态 1-上架,2-下架")
|
private Integer listingStatus;
|
}
|