@ -88,4 +88,11 @@ public interface SysNutritionalVideoMapper
|
||||
* @return
|
||||
*/
|
||||
public int updateVideoPlayNum(@Param("videoId")String videoId);
|
||||
|
||||
/**
|
||||
* 根据视频分类ID查询该分类下存在视频数量
|
||||
* @param cateId
|
||||
* @return
|
||||
*/
|
||||
public int getVideoCountByCateId(@Param("cateId")Long cateId);
|
||||
}
|
@ -3,6 +3,7 @@ package com.stdiet.custom.mapper;
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 视频分类Mapper接口
|
||||
@ -72,4 +73,11 @@ public interface SysVideoClassifyMapper
|
||||
* @return
|
||||
*/
|
||||
public List<VideoClassifyResponse> getOneAllClassifyAndVideo(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 根据分类ID查询分类以及分类下的子类ID
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getVideoClassifyIdsById(@Param("id")Long id);
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||
|
||||
@ -44,13 +46,6 @@ public interface ISysVideoClassifyService
|
||||
*/
|
||||
public int updateSysVideoClassify(SysVideoClassify sysVideoClassify);
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
@ -58,7 +53,7 @@ public interface ISysVideoClassifyService
|
||||
* @param id 视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysVideoClassifyById(Long id);
|
||||
public AjaxResult deleteSysVideoClassifyById(Long id);
|
||||
|
||||
/**
|
||||
* 获取所有类别
|
||||
|
@ -379,24 +379,28 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
||||
//判断是否提成单,拆分单中的副单,体验单,定金单
|
||||
if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 ||
|
||||
"2".equals(sysOrder.getOrderType()) || !isNeedByOrderMoneyType(sysOrder)){
|
||||
continue;
|
||||
}
|
||||
//判断前一个订单的结束时间是否大于第二个订单的
|
||||
if(lastServerEndTime != null && ChronoUnit.DAYS.between(lastServerEndTime, DateUtils.dateToLocalDate(sysOrder.getStartTime())) <= 0){
|
||||
newStartTime = lastServerEndTime.plusDays(1);
|
||||
//本月第一天
|
||||
LocalDate monthStart = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth());
|
||||
//旧的开始时间和新的开始时间都要需要大于本月第一天
|
||||
if(sysOrder.getCommissStartTime() != null && ChronoUnit.DAYS.between(monthStart, DateUtils.dateToLocalDate(sysOrder.getCommissStartTime())) >= 0 && ChronoUnit.DAYS.between(monthStart, newStartTime) >= 0){
|
||||
sysOrder.setCommissStartTime(DateUtils.localDateToDate(newStartTime));
|
||||
//设置服务到期时间
|
||||
setOrderServerEndDate(sysOrder);
|
||||
sysOrder.setUpdateTime(new Date());
|
||||
row = updateSysOrder(sysOrder);
|
||||
}else {
|
||||
//判断前一个订单的结束时间是否大于第二个订单的
|
||||
if (lastServerEndTime != null && ChronoUnit.DAYS.between(lastServerEndTime, DateUtils.dateToLocalDate(sysOrder.getStartTime())) <= 0) {
|
||||
newStartTime = lastServerEndTime.plusDays(1);
|
||||
//本月第一天
|
||||
LocalDate monthStart = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth());
|
||||
//旧的开始时间和新的开始时间都要需要大于本月第一天
|
||||
if (sysOrder.getCommissStartTime() != null && ChronoUnit.DAYS.between(monthStart, DateUtils.dateToLocalDate(sysOrder.getCommissStartTime())) >= 0 && ChronoUnit.DAYS.between(monthStart, newStartTime) >= 0) {
|
||||
sysOrder.setCommissStartTime(DateUtils.localDateToDate(newStartTime));
|
||||
}
|
||||
sysOrder.setStartTime(DateUtils.localDateToDate(newStartTime));
|
||||
}
|
||||
sysOrder.setStartTime(DateUtils.localDateToDate(newStartTime));
|
||||
//设置服务到期时间
|
||||
setOrderServerEndDate(sysOrder);
|
||||
sysOrder.setUpdateTime(new Date());
|
||||
row = updateSysOrder(sysOrder);
|
||||
lastServerEndTime = DateUtils.dateToLocalDate(sysOrder.getServerEndTime());
|
||||
}
|
||||
//设置服务到期时间
|
||||
setOrderServerEndDate(sysOrder);
|
||||
sysOrder.setUpdateTime(new Date());
|
||||
row = updateSysOrder(sysOrder);
|
||||
lastServerEndTime = DateUtils.dateToLocalDate(sysOrder.getServerEndTime());
|
||||
}
|
||||
//异步更新食谱计划
|
||||
sysRecipesPlanService.regenerateRecipesPlan(cusId);
|
||||
@ -404,7 +408,7 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
||||
return row;
|
||||
}
|
||||
|
||||
//定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月11日之后成交的订单只生成定金单计划
|
||||
//定金单或尾款单是否需要生成食谱计划,2021-01-12修改为6月1日之后成交的订单只生成定金单计划
|
||||
private boolean isNeedByOrderMoneyType(SysOrder sysOrder){
|
||||
if("0".equals(sysOrder.getOrderMoneyType())){
|
||||
return true;
|
||||
|
@ -45,7 +45,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
private SysRecipesMapper sysRecipesMapper;
|
||||
|
||||
//2021-06-11之后(大于等于)成交的订单,只生成定金单食谱计划,不生成尾款食谱计划,之前成交的订单还是保持之前逻辑
|
||||
public static final LocalDate newVersionPlanStartDate = DateUtils.stringToLocalDate("2021-06-11", "yyyy-MM-dd");
|
||||
public static final LocalDate newVersionPlanStartDate = DateUtils.stringToLocalDate("2021-06-01", "yyyy-MM-dd");
|
||||
|
||||
/**
|
||||
* 查询食谱计划
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.dto.response.VideoClassifyResponse;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
@ -75,17 +77,6 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
||||
return sysVideoClassifyMapper.updateSysVideoClassify(sysVideoClassify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除视频分类
|
||||
*
|
||||
* @param ids 需要删除的视频分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyByIds(Long[] ids)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除视频分类信息
|
||||
@ -94,15 +85,31 @@ public class SysVideoClassifyServiceImpl implements ISysVideoClassifyService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysVideoClassifyById(Long id)
|
||||
public AjaxResult deleteSysVideoClassifyById(Long id)
|
||||
{
|
||||
return sysVideoClassifyMapper.deleteSysVideoClassifyById(id);
|
||||
return delChildrenClassify(id);
|
||||
}
|
||||
|
||||
private boolean delChildrenClassify(Long id){
|
||||
/**
|
||||
* 删除分类以及子分类,删除之前需要判断分类下是否存在视频
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private AjaxResult delChildrenClassify(Long id){
|
||||
//判断分类下是否存在视频,存在视频不能删除
|
||||
|
||||
return true;
|
||||
int videoNum = sysNutritionalVideoMapper.getVideoCountByCateId(id);
|
||||
if(videoNum > 0){
|
||||
return AjaxResult.error("该分类下存在视频,无法直接删除");
|
||||
}
|
||||
//删除该分类以及全部子分类
|
||||
List<Long> childrenIds = sysVideoClassifyMapper.getVideoClassifyIdsById(id);
|
||||
if(childrenIds != null && childrenIds.size() > 0){
|
||||
Long[] ids = new Long[childrenIds.size()];
|
||||
if(sysVideoClassifyMapper.deleteSysVideoClassifyByIds(childrenIds.toArray(ids)) > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,4 +173,14 @@
|
||||
update sys_nutritional_video set play_num = play_num + 1 where video_id = #{videoId} and del_flag = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据视频分类ID查询该分类下视频总量 -->
|
||||
<select id="getVideoCountByCateId" parameterType="Long" resultType="int">
|
||||
select count(snv.id) from sys_nutritional_video snv where snv.del_flag = 0
|
||||
and snv.cate_id in (
|
||||
select id from sys_video_classify where del_flag = 0
|
||||
and (id = #{cateId} or id in (select s.id from sys_video_classify s where s.parent_id = #{cateId} and s.del_flag = 0)
|
||||
or id in (select ss.id from sys_video_classify ss where ss.del_flag = 0 and ss.parent_id in (select a.id from sys_video_classify a where a.parent_id = #{cateId} and a.del_flag = 0 )))
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -113,6 +113,7 @@
|
||||
<if test="status != null ">and status = #{status}</if>
|
||||
<if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
|
||||
<if test="preSaleId != null ">and pre_sale_id = #{preSaleId}</if>
|
||||
<if test="pushPreSaleId != null ">and push_pre_sale_id = #{pushPreSaleId}</if>
|
||||
<if test="onSaleId != null">
|
||||
and on_sale_id = #{onSaleId}
|
||||
</if>
|
||||
@ -167,6 +168,7 @@
|
||||
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
|
||||
<if test="status != null ">and status = #{status}</if>
|
||||
<if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
|
||||
<if test="pushPreSaleId != null ">and push_pre_sale_id = #{pushPreSaleId}</if>
|
||||
<if test="onSaleId != null">
|
||||
and on_sale_id = #{onSaleId}
|
||||
</if>
|
||||
|
@ -159,4 +159,11 @@
|
||||
order by priority_level asc
|
||||
</select>
|
||||
|
||||
<!-- 根据分类ID查询该分类ID以及分类下的子类ID -->
|
||||
<select id="getVideoClassifyIdsById" parameterType="Long" resultType="Long">
|
||||
select id from sys_video_classify where del_flag = 0
|
||||
and (id = #{id} or id in (select s.id from sys_video_classify s where s.parent_id = #{id} and s.del_flag = 0)
|
||||
or id in (select ss.id from sys_video_classify ss where ss.del_flag = 0 and ss.parent_id in (select a.id from sys_video_classify a where a.parent_id = #{id} and a.del_flag = 0 )))
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user