commit
8807eb538e
@ -9,7 +9,7 @@ stdiet:
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
profile: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath
|
||||
# profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
@ -19,7 +19,7 @@ stdiet:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8091
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,8 @@ public class WechatAppletController extends BaseController {
|
||||
@Autowired
|
||||
ISysRecipesService iSysRecipesService;
|
||||
@Autowired
|
||||
ISysNutritionalVideoService iSysNutritionalVideoService;
|
||||
@Autowired
|
||||
private ISysCustomerCaseService sysCustomerCaseService;
|
||||
@Autowired
|
||||
private ISysWxUserLogService sysWxUserLogService;
|
||||
@ -79,9 +81,9 @@ public class WechatAppletController extends BaseController {
|
||||
* 查询微信小程序中展示的客户案例
|
||||
*/
|
||||
@GetMapping("/caseList")
|
||||
public TableDataInfo caseList(SysCustomerCase sysCustomerCase, @RequestParam(value = "pageSize",required = false,defaultValue = "10")int pageSize,
|
||||
@RequestParam(value="randomFlag",required = false,defaultValue = "false") boolean randomFlag) {
|
||||
if(randomFlag){
|
||||
public TableDataInfo caseList(SysCustomerCase sysCustomerCase, @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
|
||||
@RequestParam(value = "randomFlag", required = false, defaultValue = "false") boolean randomFlag) {
|
||||
if (randomFlag) {
|
||||
List<CustomerCaseResponse> reponseList = sysCustomerCaseService.getWxCustomerCaseByRandom(pageSize);
|
||||
//处理ID加密
|
||||
dealIdEnc(reponseList);
|
||||
@ -91,7 +93,7 @@ public class WechatAppletController extends BaseController {
|
||||
rspData.setRows(reponseList);
|
||||
rspData.setTotal(pageSize);
|
||||
return rspData;
|
||||
}else{
|
||||
} else {
|
||||
startPage();
|
||||
sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null);
|
||||
List<CustomerCaseResponse> list = sysCustomerCaseService.getWxCustomerCaseList(sysCustomerCase);
|
||||
@ -307,7 +309,7 @@ public class WechatAppletController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
private void dealIdEnc(List<CustomerCaseResponse> list) {
|
||||
if(list != null){
|
||||
if (list != null) {
|
||||
for (CustomerCaseResponse cus : list) {
|
||||
cus.setId(AesUtils.encrypt(cus.getId() + "", null));
|
||||
}
|
||||
@ -349,6 +351,7 @@ public class WechatAppletController extends BaseController {
|
||||
*/
|
||||
/**
|
||||
* 获取小程序展示的营养小知识列表
|
||||
*
|
||||
* @param sysNutritionQuestion 查询参数对象
|
||||
* @param pageNum 分页当前页码
|
||||
* @param pageSize 分页每页数量
|
||||
@ -357,14 +360,14 @@ public class WechatAppletController extends BaseController {
|
||||
*/
|
||||
@GetMapping(value = "/getNutritionQuestionList")
|
||||
public AjaxResult getNutritionQuestionList(SysNutritionQuestion sysNutritionQuestion, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
|
||||
@RequestParam(value="randomFlag",required = false,defaultValue = "false") boolean randomFlag) {
|
||||
@RequestParam(value = "randomFlag", required = false, defaultValue = "false") boolean randomFlag) {
|
||||
sysNutritionQuestion.setShowFlag(1);
|
||||
if(randomFlag){
|
||||
if (randomFlag) {
|
||||
//随机获取指定条数
|
||||
sysNutritionQuestion.setKey(null);
|
||||
List<NutritionQuestionResponse> list = sysNutritionQuestionService.getNutritionQuestionByRandom(sysNutritionQuestion, pageSize);
|
||||
return AjaxResult.success(list);
|
||||
}else{
|
||||
} else {
|
||||
Map<String, Object> result = sysNutritionQuestionService.getNutritionQuestionListByKey(sysNutritionQuestion, pageNum, pageSize);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
@ -421,7 +424,7 @@ public class WechatAppletController extends BaseController {
|
||||
sysNutritionalVideo.setUserType(1);
|
||||
}
|
||||
}
|
||||
if(sysNutritionalVideo.getCateId() != null && sysNutritionalVideo.getCateId().longValue() == 0){
|
||||
if (sysNutritionalVideo.getCateId() != null && sysNutritionalVideo.getCateId().longValue() == 0) {
|
||||
sysNutritionalVideo.setCateId(null);
|
||||
}
|
||||
startPage();
|
||||
@ -435,7 +438,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 +460,7 @@ public class WechatAppletController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
result.put("videoDetail", nutritionalVideoResponse);
|
||||
return result;
|
||||
return AjaxResult.success(nutritionalVideoResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -742,33 +743,34 @@ public class WechatAppletController extends BaseController {
|
||||
|
||||
/**
|
||||
* 获取视频分类
|
||||
*
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
/*@GetMapping("/getVideoClassify")
|
||||
public AjaxResult getVideoClassify(@RequestParam("openid")String openid) {
|
||||
@GetMapping("/getVideoClassify")
|
||||
public AjaxResult getVideoClassify(@RequestParam("openid") String openid) {
|
||||
SysVideoClassify param = new SysVideoClassify();
|
||||
param.setParentId(0L);
|
||||
List<SysVideoClassify> list = sysVideoClassifyService.getAllClassify(param);
|
||||
List<List<Map<String,Object>>> result = new ArrayList<>();
|
||||
List<List<Map<String, Object>>> result = new ArrayList<>();
|
||||
int groupCount = 3;
|
||||
SysVideoClassify all = new SysVideoClassify();
|
||||
all.setId(0L);
|
||||
all.setCateName("全部内容");
|
||||
list.add(0, all);
|
||||
if(list != null && list.size() > 0){
|
||||
if (list != null && list.size() > 0) {
|
||||
//分成三组
|
||||
int groupNum = list.size()/groupCount + (list.size() % groupCount > 0 ? 1 : 0);
|
||||
int groupNum = list.size() / groupCount + (list.size() % groupCount > 0 ? 1 : 0);
|
||||
for (int i = 0; i < groupNum; i++) {
|
||||
List<Map<String,Object>> groupList = new ArrayList<>();
|
||||
for (int j = i * groupCount; j < (i+1)*groupCount; j++) {
|
||||
if(j < list.size()){
|
||||
Map<String,Object> videoClassifyMap = new HashMap<>();
|
||||
List<Map<String, Object>> groupList = new ArrayList<>();
|
||||
for (int j = i * groupCount; j < (i + 1) * groupCount; j++) {
|
||||
if (j < list.size()) {
|
||||
Map<String, Object> videoClassifyMap = new HashMap<>();
|
||||
SysVideoClassify sysVideoClassify = list.get(j);
|
||||
videoClassifyMap.put("cateName", sysVideoClassify.getCateName());
|
||||
videoClassifyMap.put("cateId", sysVideoClassify.getId());
|
||||
groupList.add(videoClassifyMap);
|
||||
}else{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -858,6 +860,70 @@ public class WechatAppletController extends BaseController {
|
||||
List<BannerResponse> list = sysWxBannerImageService.getBannerListOrderByOrderNum(sysWxBannerImage);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@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