小程序-教学视频
This commit is contained in:
parent
b8dd18642e
commit
07e15beb6d
@ -13,6 +13,7 @@ import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
|
||||
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||
import com.stdiet.custom.dto.response.VideoClassifyTwoResponse;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import com.stdiet.custom.service.ISysOrderService;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
@ -71,6 +72,7 @@ public class VideoWebInterfaceController extends BaseController {
|
||||
//客户类型 0未付费客户-playLevel根据上传的标记 1已付费客户-playLevel全为0
|
||||
sysVideoClassify.setUserType(payed);
|
||||
List<VideoClassifyResponse> list = sysVideoClassifyService.getAllClassifyAndVideo(sysVideoClassify);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,7 @@ import com.stdiet.common.utils.file.MimeTypeUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.common.utils.sign.AesUtils;
|
||||
import com.stdiet.custom.domain.*;
|
||||
import com.stdiet.custom.dto.response.CustomerCaseResponse;
|
||||
import com.stdiet.custom.dto.response.MessageNoticeResponse;
|
||||
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
|
||||
import com.stdiet.custom.dto.response.*;
|
||||
import com.stdiet.custom.page.WxLogInfo;
|
||||
import com.stdiet.custom.service.*;
|
||||
import com.stdiet.system.service.ISysDictTypeService;
|
||||
@ -43,6 +40,8 @@ public class WechatAppletController extends BaseController {
|
||||
@Autowired
|
||||
ISysRecipesService iSysRecipesService;
|
||||
@Autowired
|
||||
ISysNutritionalVideoService iSysNutritionalVideoService;
|
||||
@Autowired
|
||||
private ISysCustomerCaseService sysCustomerCaseService;
|
||||
@Autowired
|
||||
private ISysWxUserLogService sysWxUserLogService;
|
||||
@ -349,6 +348,7 @@ public class WechatAppletController extends BaseController {
|
||||
*/
|
||||
/**
|
||||
* 获取小程序展示的营养小知识列表
|
||||
*
|
||||
* @param sysNutritionQuestion 查询参数对象
|
||||
* @param pageNum 分页当前页码
|
||||
* @param pageSize 分页每页数量
|
||||
@ -435,7 +435,6 @@ public class WechatAppletController extends BaseController {
|
||||
*/
|
||||
@GetMapping(value = "/getVideoDetailById")
|
||||
public AjaxResult getVideoDetailById(@RequestParam(value = "videoId") String videoId) {
|
||||
AjaxResult result = AjaxResult.success();
|
||||
NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse();
|
||||
try {
|
||||
SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId);
|
||||
@ -458,8 +457,7 @@ public class WechatAppletController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
result.put("videoDetail", nutritionalVideoResponse);
|
||||
return result;
|
||||
return AjaxResult.success(nutritionalVideoResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -742,6 +740,7 @@ public class WechatAppletController extends BaseController {
|
||||
|
||||
/**
|
||||
* 获取视频分类
|
||||
*
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
@ -777,6 +776,70 @@ public class WechatAppletController extends BaseController {
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/studyVideoClassify")
|
||||
public AjaxResult fetchStudyVideoClassify(@RequestParam String openid) {
|
||||
int payed = 0;
|
||||
SysWxUserInfo userInfo = sysWxUserInfoService.selectSysWxUserInfoById(openid);
|
||||
if (StringUtils.isNotNull(userInfo)) {
|
||||
List<SysOrder> orders = sysOrderService.getAllOrderByCusId(userInfo.getCusId());
|
||||
if (StringUtils.isNotEmpty(orders)) {
|
||||
payed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
SysVideoClassify sysVideoClassify = new SysVideoClassify();
|
||||
//父级分类ID 0表示主分类
|
||||
sysVideoClassify.setParentId(4l);
|
||||
//客户类型 0未付费客户-playLevel根据上传的标记 1已付费客户-playLevel全为0
|
||||
sysVideoClassify.setUserType(payed);
|
||||
List<VideoClassifyResponse> list = sysVideoClassifyService.getAllClassifyAndVideo(sysVideoClassify);
|
||||
|
||||
String imgUrl = "https://stdiet.oss-cn-shenzhen.aliyuncs.com/videoCover/2021-07-12/";
|
||||
if (StringUtils.isNotNull(list)) {
|
||||
for (VideoClassifyResponse res : list) {
|
||||
List<VideoClassifyResponse> classifies = res.getChildrenClassify();
|
||||
if (StringUtils.isEmpty(classifies)) {
|
||||
res.setImgUrl(AliyunOSSUtils.generatePresignedUrl(imgUrl + res.getId() + ".png"));
|
||||
} else {
|
||||
for (VideoClassifyResponse twoRes : classifies) {
|
||||
twoRes.setImgUrl(AliyunOSSUtils.generatePresignedUrl(imgUrl + twoRes.getId() + ".png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/studyVideoComments")
|
||||
public AjaxResult fetchStudyVideoComments(@RequestParam String openid, @RequestParam String topicId) {
|
||||
SysVideoComment videoComment = new SysVideoComment();
|
||||
videoComment.setTopicId(topicId);
|
||||
List<SysVideoComment> comments = iSysNutritionalVideoService.selectVideoCommentByTopicId(videoComment, openid);
|
||||
return AjaxResult.success(comments);
|
||||
}
|
||||
|
||||
@PostMapping("/video/post/comment")
|
||||
public AjaxResult videoPostComment(@RequestBody SysVideoComment videoComment, @RequestParam String openid) {
|
||||
SysVideoComment comment = iSysNutritionalVideoService.insertVideoComment(videoComment);
|
||||
if (StringUtils.isNull(comment)) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
return AjaxResult.success(comment);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/video/post/reply")
|
||||
public AjaxResult videoPostReply(@RequestBody SysVideoComment videoComment, @RequestParam String openid) {
|
||||
SysVideoComment reply = iSysNutritionalVideoService.insertVideoCommentReply(videoComment);
|
||||
|
||||
if (StringUtils.isNull(reply)) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
return AjaxResult.success(reply);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,9 @@ package com.stdiet.common.core.domain.entity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
@ -16,6 +19,7 @@ import java.util.List;
|
||||
*
|
||||
* @author stdiet
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysDictData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -1,14 +1,11 @@
|
||||
package com.stdiet.custom.dto.response;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class VideoClassifyResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class VideoClassifyResponse {
|
||||
|
||||
//目录分类ID
|
||||
private Long id;
|
||||
@ -19,8 +16,10 @@ public class VideoClassifyResponse implements Serializable {
|
||||
//用户类型 0 普通用户 1付费客户
|
||||
private Integer userType;
|
||||
|
||||
private String imgUrl;
|
||||
|
||||
//子分类
|
||||
private List<VideoClassifyTwoResponse> childrenClassify;
|
||||
private List<VideoClassifyResponse> childrenClassify;
|
||||
|
||||
//子视频
|
||||
private List<VideoResponse> childrenVideo;
|
||||
|
@ -299,9 +299,11 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
}
|
||||
if (comment.getFromRole().equals("phone")) {
|
||||
comment.setFromUid(StringUtils.hiddenPhoneNumber(comment.getFromUid()));
|
||||
comment.setFromName(StringUtils.hiddenPhoneNumber(comment.getFromName()));
|
||||
}
|
||||
if (comment.getToRole().equals("phone")) {
|
||||
comment.setToUid(StringUtils.hiddenPhoneNumber(comment.getToUid()));
|
||||
comment.setToName(StringUtils.hiddenPhoneNumber(comment.getToName()));
|
||||
}
|
||||
List<SysVideoComment> replys = comment.getReplys();
|
||||
for (SysVideoComment reply : replys) {
|
||||
@ -312,9 +314,11 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
}
|
||||
if (reply.getFromRole().equals("phone")) {
|
||||
reply.setFromUid(StringUtils.hiddenPhoneNumber(reply.getFromUid()));
|
||||
reply.setFromName(StringUtils.hiddenPhoneNumber(reply.getFromName()));
|
||||
}
|
||||
if (reply.getToRole().equals("phone")) {
|
||||
reply.setToUid(StringUtils.hiddenPhoneNumber(reply.getToUid()));
|
||||
reply.setToName(StringUtils.hiddenPhoneNumber(reply.getToName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,10 @@
|
||||
<result column="to_role" property="toRole"/>
|
||||
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
|
||||
<result column="create_time" property="createTime"/>
|
||||
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
|
||||
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
|
||||
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
|
||||
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
|
||||
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
|
||||
<association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>
|
||||
<association property="replys" column="id"
|
||||
select="selectVideoCommentReplyByCommentId"/>
|
||||
</resultMap>
|
||||
@ -33,30 +34,33 @@
|
||||
<result column="reply_id" property="replyId"/>
|
||||
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
|
||||
<result column="create_time" property="createTime"/>
|
||||
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
|
||||
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
|
||||
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
|
||||
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
|
||||
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
|
||||
<association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVideoCommentByTopicId" resultMap="SysVideoCommentResult">
|
||||
select * from sys_nutritional_video_comment where topic_id = #{topicId} and del_flag = 0
|
||||
order by create_time asc
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectVideoCommentReplyByCommentId" resultMap="SysVideoCommentReplyResult">
|
||||
select * from sys_nutritional_video_reply where comment_id = #{id} and del_flag = 0
|
||||
order by create_time asc
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 查询人名-->
|
||||
<select id="selectUserInfo" parameterType="java.util.Map" resultType="String">
|
||||
<choose>
|
||||
<when test="_parameter.get('role') == 'customer'">
|
||||
select name from sys_customer where id = #{uid}
|
||||
select nick_name from sys_wx_user_info where openid = #{uid}
|
||||
</when>
|
||||
<when test="_parameter.get('uid') == null">
|
||||
select "" as nick_name
|
||||
</when>
|
||||
<otherwise>
|
||||
select nick_name from sys_user where user_id = #{uid}
|
||||
select #{uid} as nick_name
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
@ -65,11 +69,10 @@
|
||||
<select id="selectUserAvatar" parameterType="java.util.Map" resultType="String">
|
||||
<choose>
|
||||
<when test="_parameter.get('role') == 'customer'">
|
||||
select avatar_url from sys_wx_user_info where cus_id = #{uid}
|
||||
select avatar_url from sys_wx_user_info where openid = #{uid}
|
||||
</when>
|
||||
<otherwise>
|
||||
select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user
|
||||
where user_id = #{uid}
|
||||
select "" as avatar_url
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user