Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -7,6 +8,8 @@ import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务提成比例对象 sys_commision
|
||||
@ -28,6 +31,8 @@ public class SysCommision extends BaseEntity {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
/**
|
||||
* 岗位id
|
||||
*/
|
||||
@ -54,6 +59,11 @@ public class SysCommision extends BaseEntity {
|
||||
@Excel(name = "比例", suffix = "%")
|
||||
private Float rate;
|
||||
|
||||
/** 比例开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 提成
|
||||
*/
|
||||
|
@ -22,6 +22,8 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频分类ID")
|
||||
private Long cateId;
|
||||
|
||||
private String cateName;
|
||||
|
||||
/** 阿里云视频ID */
|
||||
@Excel(name = "阿里云视频ID")
|
||||
private String videoId;
|
||||
@ -30,6 +32,9 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频封面URL")
|
||||
private String coverUrl;
|
||||
|
||||
//预览URL
|
||||
private String previewUrl;
|
||||
|
||||
/** 视频标题 */
|
||||
@Excel(name = "视频标题")
|
||||
private String title;
|
||||
@ -50,9 +55,21 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "是否显示,0不显示 1显示,默认0")
|
||||
private Integer showFlag;
|
||||
|
||||
/** 优先级,默认0 */
|
||||
@Excel(name = "优先级,默认0")
|
||||
private Long priorityLevel;
|
||||
|
||||
/** 视频付费等级,0无需付费 1客户可看 2付费可看 */
|
||||
@Excel(name = "视频付费等级,0无需付费 1客户可看 2付费可看")
|
||||
private Long payLevel;
|
||||
|
||||
private String payLevelName;
|
||||
|
||||
/** 删除标识,0未删除 1已删除,默认0 */
|
||||
private Integer delFlag;
|
||||
|
||||
//文件名称
|
||||
private String fileName;
|
||||
|
||||
private String key;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 视频分类对象 sys_video_classify
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Data
|
||||
public class SysVideoClassify extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 分类名称 */
|
||||
@Excel(name = "分类名称")
|
||||
private String cateName;
|
||||
|
||||
/** 类型标识,0全部可看 1客户可看 2额外付费观看 */
|
||||
@Excel(name = "类型标识,0全部可看 1客户可看 2额外付费观看")
|
||||
private Integer payFlag;
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Integer delFlag;
|
||||
}
|
@ -68,4 +68,6 @@ public interface SysCommisionMapper
|
||||
* @return
|
||||
*/
|
||||
List<SysCommision> getAfterSaleAndNutri(SysCommision sysCommision);
|
||||
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -66,4 +66,13 @@ public interface SysNutritionalVideoMapper
|
||||
* @return
|
||||
*/
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(@Param("videoId")String videoId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Mapper接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface SysVideoClassifyMapper
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 删除视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -62,4 +62,11 @@ public interface ISysCommisionService
|
||||
public int deleteSysCommisionById(Long ruleId);
|
||||
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -39,4 +39,11 @@ public interface ISysCommissionDayService {
|
||||
*/
|
||||
AjaxResult calculateOrderCommissionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 根据开始生效时间分类提成比例
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
|
||||
/**
|
||||
@ -25,7 +27,7 @@ public interface ISysNutritionalVideoService
|
||||
* @param sysNutritionalVideo 营养视频
|
||||
* @return 营养视频集合
|
||||
*/
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo);
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag);
|
||||
|
||||
/**
|
||||
* 新增营养视频
|
||||
@ -65,4 +67,18 @@ public interface ISysNutritionalVideoService
|
||||
* @return
|
||||
*/
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId);
|
||||
|
||||
/**
|
||||
* 阿里云视频查询检索
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> searchVideo(String key, Integer status, Integer pageNo, Integer pageSize, String scrollToken);
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(Integer wxShow, Long[] ids);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
|
||||
/**
|
||||
* 视频分类Service接口
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
public interface ISysVideoClassifyService
|
||||
{
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类集合
|
||||
*/
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoClassify> getAllClassify();
|
||||
}
|
@ -98,4 +98,14 @@ public class SysCommisionServiceImpl implements ISysCommisionService
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) {
|
||||
return sysCommisionMapper.selectSysCommisionDetail(sysCommision);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getAfterSaleId(SysCommision sysCommision){
|
||||
return sysCommisionMapper.getAfterSaleId(sysCommision);
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
//该笔订单当月的成交总额
|
||||
sysOrderCommisionDayDetail.setMonthOrderTotalAmount(everyMonthTotalAmountMap.get(yearMonth));
|
||||
//该笔订单对应提成比例
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth));
|
||||
sysOrderCommisionDayDetail.setCommissionRate(rateMap.get(yearMonth) == null ? rateMap.get("19001") : rateMap.get(yearMonth));
|
||||
//计算该笔订单总提成
|
||||
sysOrderCommisionDayDetail.setOrderCommission(getMoney(sysOrderCommisionDayDetail.getOrderAmount().doubleValue() * sysOrderCommisionDayDetail.getCommissionRate() / 100D));
|
||||
//每年每月提成
|
||||
@ -357,24 +357,43 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
tmpQueryCom.setPostId(postId);
|
||||
List<SysCommision> tmpComList = sysCommisionMapper.selectSysCommisionList(tmpQueryCom);
|
||||
Map<String, Float> rateMap = new TreeMap<>(new MyComparator());
|
||||
//取第一个区间为默认提成比例
|
||||
rateMap.put("19001", (tmpComList != null && tmpComList.size() > 0) ? tmpComList.get(0).getRate() : 0.0F);
|
||||
//按比例开始时间分类
|
||||
Map<String, List<SysCommision>> rateYearMonthMap = getRateMapByStartTime(tmpComList);
|
||||
for(String yearMonth : amountMap.keySet()){
|
||||
BigDecimal orderAmount = amountMap.get(yearMonth);
|
||||
rateMap.put(yearMonth, 0F);
|
||||
if(tmpComList != null && tmpComList.size() > 0){
|
||||
for (int i = 0; i < tmpComList.size(); i++) {
|
||||
SysCommision com = tmpComList.get(i);
|
||||
List<SysCommision> yearMonthRateList = null;
|
||||
for (String rateMonth : rateYearMonthMap.keySet()) {
|
||||
if(Long.parseLong(yearMonth) >= Long.parseLong(rateMonth)){
|
||||
yearMonthRateList = rateYearMonthMap.get(rateMonth);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(yearMonthRateList != null && yearMonthRateList.size() > 0){
|
||||
for (int i = 0; i < yearMonthRateList.size(); i++) {
|
||||
SysCommision com = yearMonthRateList.get(i);
|
||||
double cAmount = com.getAmount().floatValue();
|
||||
if (orderAmount.floatValue() <= cAmount && i == 0) {
|
||||
Long rateStartYearMonth = null;
|
||||
if(com.getStartTime() != null){
|
||||
rateStartYearMonth = Long.parseLong(DateUtils.dateToLocalDate(com.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(com.getStartTime()).getMonth().getValue());
|
||||
}else{
|
||||
rateStartYearMonth = 19001L;
|
||||
}
|
||||
|
||||
if (orderAmount.floatValue() <= cAmount && i == 0 && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 第一条规则
|
||||
rateMap.put(yearMonth,com.getRate());
|
||||
break;
|
||||
} else if (i == tmpComList.size() - 1 && orderAmount.floatValue() > cAmount) {
|
||||
} else if (i == yearMonthRateList.size() - 1 && orderAmount.floatValue() > cAmount && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 最后一条规则
|
||||
rateMap.put(yearMonth,com.getRate());
|
||||
break;
|
||||
} else if (cAmount < orderAmount.floatValue() && orderAmount.floatValue() <= tmpComList.get(i + 1).getAmount().floatValue()) {
|
||||
} else if (cAmount < orderAmount.floatValue() && orderAmount.floatValue() <= yearMonthRateList.get(i + 1).getAmount().floatValue() && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 中间规则
|
||||
rateMap.put(yearMonth,tmpComList.get(i + 1).getRate());
|
||||
rateMap.put(yearMonth,yearMonthRateList.get(i + 1).getRate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -383,6 +402,33 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
return rateMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据比例开始执行时间进行分类
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList){
|
||||
Map<String, List<SysCommision>> result = new TreeMap<>(new MyComparator());
|
||||
for (SysCommision sysCommision : tmpComList) {
|
||||
String rateStartYearMonth = null;
|
||||
if(sysCommision.getStartTime() != null){
|
||||
rateStartYearMonth = DateUtils.dateToLocalDate(sysCommision.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(sysCommision.getStartTime()).getMonth().getValue();
|
||||
}else{
|
||||
rateStartYearMonth = 19001+"";
|
||||
}
|
||||
if(result.containsKey(rateStartYearMonth)){
|
||||
result.get(rateStartYearMonth).add(sysCommision);
|
||||
}else{
|
||||
List<SysCommision> list = new ArrayList<>();
|
||||
list.add(sysCommision);
|
||||
result.put(rateStartYearMonth, list);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询2021年1月份之后所有订单,对订单进行处理,得出每笔订单的相关信息
|
||||
* @param sysCommision 是否
|
||||
@ -547,12 +593,12 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (SysOrderCommisionDayDetail c : sysOrderCommisionDayDetailList) {
|
||||
/**for (SysOrderCommisionDayDetail c : sysOrderCommisionDayDetailList) {
|
||||
System.out.println(c.getOrderId() + "-" + c.getNutritionistId() + "-" + c.getAfterSaleId() + "-"+
|
||||
DateUtils.localDateToString(c.getServerStartDate(),"yyyy-MM-dd") + "-" +
|
||||
DateUtils.localDateToString(c.getServerEndDate(),"yyyy-MM-dd") +
|
||||
"-" + c.getDayMoney().doubleValue() + "-" + c.getOrderAmount().doubleValue());
|
||||
}
|
||||
}**/
|
||||
return sysOrderCommisionDayDetailList;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,15 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponse;
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponseBody;
|
||||
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
@ -39,9 +47,24 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 营养视频
|
||||
*/
|
||||
@Override
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo)
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag)
|
||||
{
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
if(flag && list != null && list.size() > 0){
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
for (SysNutritionalVideo video : list) {
|
||||
fileUrl.add(video.getCoverUrl());
|
||||
}
|
||||
List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl);
|
||||
if(downUrlList != null && downUrlList.size() > 0){
|
||||
int index = 0;
|
||||
for (String downUrl : downUrlList) {
|
||||
list.get(index).setCoverUrl(downUrl);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,4 +125,69 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
public SysNutritionalVideo selectSysNutritionalVideByVideoId(String videoId){
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideByVideoId(videoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 阿里云视频查询检索
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken){
|
||||
pageSize = pageSize.intValue() > 100 ? 10 : pageSize;
|
||||
long total = 0;
|
||||
String newScrollToken = null;
|
||||
List<SysNutritionalVideo> nutritionalVideoList = new ArrayList<>();
|
||||
try {
|
||||
SearchMediaResponse response = AliyunVideoUtils.searchVideo(key, getStatusString(showFlag), pageNo, pageSize, scrollToken);
|
||||
if(response != null){
|
||||
SearchMediaResponseBody body = response.body;
|
||||
total = body.total;
|
||||
newScrollToken = body.scrollToken;
|
||||
List<SearchMediaResponseBody.SearchMediaResponseBodyMediaList> mediaList = body.mediaList;
|
||||
if(mediaList != null && mediaList.size() > 0){
|
||||
for (SearchMediaResponseBody.SearchMediaResponseBodyMediaList media : mediaList) {
|
||||
SysNutritionalVideo sysNutritionalVideo = new SysNutritionalVideo();
|
||||
sysNutritionalVideo.setTitle(media.video.title);
|
||||
sysNutritionalVideo.setCoverUrl(media.video.coverURL);
|
||||
sysNutritionalVideo.setShowFlag(getStatus(media.video.getStatus()));
|
||||
sysNutritionalVideo.setTags(media.video.tags);
|
||||
//String createTime = media.video.creationTime;
|
||||
sysNutritionalVideo.setDescription(media.video.description);
|
||||
sysNutritionalVideo.setVideoId(media.video.videoId);
|
||||
nutritionalVideoList.add(sysNutritionalVideo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("total", total);
|
||||
result.put("newScrollToken", newScrollToken);
|
||||
result.put("nutritionalVideoList", nutritionalVideoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getStatusString(Integer status){
|
||||
if(status == null){
|
||||
return "Normal,Blocked";
|
||||
}
|
||||
return status.intValue() == 1 ? "Normal" : "Blocked";
|
||||
}
|
||||
|
||||
private Integer getStatus(String status){
|
||||
if(status == null){
|
||||
return 1;
|
||||
}
|
||||
return "Normal".equals(status) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int updateWxshowByIds(Integer wxShow, Long[] ids){
|
||||
return sysNutritionalVideoMapper. updateWxshowByIds(wxShow, ids);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysVideoClassifyMapper;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.service.ISysVideoClassifyService;
|
||||
|
||||
/**
|
||||
* 视频分类Service业务层处理
|
||||
*
|
||||
* @author xzj
|
||||
* @date 2021-05-05
|
||||
*/
|
||||
@Service
|
||||
public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
||||
{
|
||||
@Autowired
|
||||
private SysVideoClassifyMapper sysVideoClassifyMapper;
|
||||
|
||||
/**
|
||||
* 查询视频分类
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public SysVideoClassify selectSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询视频分类列表
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 视频分类
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> selectSysVideoClassifyList(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
return sysVideoClassifyMapper.selectSysVideoClassifyList(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setCreateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.insertSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频分类
|
||||
*
|
||||
* @param sysVideoClassify 视频分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify)
|
||||
{
|
||||
sysVideoClassify.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysVideoClassifyMapper.updateSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
*
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysVideoClassify> getAllClassify(){
|
||||
return sysVideoClassifyMapper.getAllClassify();
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
<result property="postName" column="post_name"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="rate" column="rate"/>
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -114,6 +115,12 @@
|
||||
<where>
|
||||
<if test="postId != null and postId != ''">and post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="userIds != null">
|
||||
and user_id in
|
||||
<foreach item="id" collection="userIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -136,6 +143,8 @@
|
||||
<if test="userId != null ">and user_id = #{userId}</if>
|
||||
<if test="postId != null ">and post_id = #{postId}</if>
|
||||
</where>
|
||||
<!-- 请勿随意修改排序方式,会影响提成计算 -->
|
||||
order by user_id asc,amount asc,start_time asc
|
||||
</select>
|
||||
|
||||
<select id="selectSysCommisionById" parameterType="SysCommision" resultMap="SysCommisionResult">
|
||||
@ -152,6 +161,7 @@
|
||||
<if test="postId != null">post_id,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="rate != null">rate,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -163,6 +173,7 @@
|
||||
<if test="postId != null">#{postId},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="rate != null">#{rate},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
@ -178,6 +189,7 @@
|
||||
<if test="postId != null">post_id = #{postId},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="rate != null">rate = #{rate},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
@ -207,4 +219,11 @@
|
||||
<if test="postId != null and postId != ''">and sp.post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and su.user_id = #{userId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getAfterSaleId" parameterType="SysCommision" resultType="Long">
|
||||
SELECT su.user_id FROM sys_user su
|
||||
LEFT JOIN sys_user_post sup ON sup.user_id = su.user_id
|
||||
LEFT JOIN sys_post sp ON sp.post_id = sup.post_id
|
||||
WHERE su.del_flag = 0 and sp.post_id = #{postId}
|
||||
</select>
|
||||
</mapper>
|
@ -14,22 +14,42 @@
|
||||
<result property="videoSize" column="video_size" />
|
||||
<result property="tags" column="tags" />
|
||||
<result property="showFlag" column="show_flag" />
|
||||
<result property="priorityLevel" column="priority_level" />
|
||||
<result property="payLevel" column="pay_level" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="payLevelName" column="pay_level_name"></result>
|
||||
<result property="cateName" column="cate_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysNutritionalVideoVo">
|
||||
select id, cate_id, video_id, cover_url, title, description, video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
select id, cate_id, video_id, cover_url, title, description, priority_level,pay_level,video_size, tags, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutritional_video
|
||||
</sql>
|
||||
|
||||
<select id="selectSysNutritionalVideoList" parameterType="SysNutritionalVideo" resultMap="SysNutritionalVideoResult">
|
||||
<include refid="selectSysNutritionalVideoVo"/> where del_flag = 0
|
||||
select snv.id, snv.cate_id, snv.video_id, snv.cover_url, snv.title, snv.description, snv.priority_level,snv.pay_level,snv.video_size, snv.tags, snv.show_flag, snv.create_time,
|
||||
pay.dict_label as pay_level_name, svc.cate_name
|
||||
from sys_nutritional_video snv
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'video_pay_level') AS pay ON pay.dict_value = snv.pay_level
|
||||
left join sys_video_classify svc on svc.id = snv.cate_id and svc.del_flag = 0
|
||||
where snv.del_flag = 0
|
||||
<if test="showFlag != null">
|
||||
and show_flag = #{showFlag}
|
||||
and snv.show_flag = #{showFlag}
|
||||
</if>
|
||||
<if test="cateId != null">
|
||||
and snv.cate_id = #{cateId}
|
||||
</if>
|
||||
<if test="payLevel != null">
|
||||
and snv.pay_level = #{payLevel}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (snv.title like concat('%',#{key},'%') or snv.description like concat('%',#{key},'%'))
|
||||
</if>
|
||||
order by snv.priority_level DESC,snv.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectSysNutritionalVideoById" parameterType="Long" resultMap="SysNutritionalVideoResult">
|
||||
@ -48,8 +68,10 @@
|
||||
<if test="videoSize != null">video_size,</if>
|
||||
<if test="tags != null">tags,</if>
|
||||
<if test="showFlag != null">show_flag,</if>
|
||||
<if test="priorityLevel != null">priority_level,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="payLevel != null">pay_level,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
@ -63,8 +85,10 @@
|
||||
<if test="videoSize != null">#{videoSize},</if>
|
||||
<if test="tags != null">#{tags},</if>
|
||||
<if test="showFlag != null">#{showFlag},</if>
|
||||
<if test="priorityLevel != null">#{priorityLevel},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="payLevel != null">#{payLevel},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
@ -82,8 +106,10 @@
|
||||
<if test="videoSize != null">video_size = #{videoSize},</if>
|
||||
<if test="tags != null">tags = #{tags},</if>
|
||||
<if test="showFlag != null">show_flag = #{showFlag},</if>
|
||||
<if test="priorityLevel != null">priority_level = #{priorityLevel},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="payLevel != null">pay_level = #{payLevel},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
@ -106,4 +132,11 @@
|
||||
<include refid="selectSysNutritionalVideoVo"/> where video_id = #{videoId} and del_flag = 0 limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateWxshowByIds" parameterType="String">
|
||||
update sys_nutritional_video set show_flag = #{wxShow} where del_flag = 0 and id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysVideoClassifyMapper">
|
||||
|
||||
<resultMap type="SysVideoClassify" id="SysVideoClassifyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cateName" column="cate_name" />
|
||||
<result property="payFlag" column="pay_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysVideoClassifyVo">
|
||||
select id, cate_name, pay_flag, create_time, create_by, update_time, update_by, del_flag from sys_video_classify
|
||||
</sql>
|
||||
|
||||
<select id="selectSysVideoClassifyList" parameterType="SysVideoClassify" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="selectSysVideoClassifyById" parameterType="Long" resultMap="SysVideoClassifyResult">
|
||||
<include refid="selectSysVideoClassifyVo"/>
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysVideoClassify" parameterType="SysVideoClassify">
|
||||
insert into sys_video_classify
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="cateName != null">cate_name,</if>
|
||||
<if test="payFlag != null">pay_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="cateName != null">#{cateName},</if>
|
||||
<if test="payFlag != null">#{payFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysVideoClassify" parameterType="SysVideoClassify">
|
||||
update sys_video_classify
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cateName != null">cate_name = #{cateName},</if>
|
||||
<if test="payFlag != null">pay_flag = #{payFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyById" parameterType="Long">
|
||||
update sys_video_classify set del_flag = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteSysVideoClassifyByIds" parameterType="String">
|
||||
update sys_video_classify set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getAllClassify" resultMap="SysVideoClassifyResult">
|
||||
select id,cate_name from sys_video_classify where del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user