Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
		| @@ -54,4 +54,7 @@ public class SysCustomerCase extends BaseEntity | ||||
|  | ||||
|     //案例文件URL数组 | ||||
|     private String[] caseFileUrl; | ||||
|  | ||||
|     //病史体征ID集合,非持久化字段 | ||||
|     private List<Long> signIdList; | ||||
| } | ||||
| @@ -61,15 +61,29 @@ public class SysNutritionalVideo extends BaseEntity | ||||
|  | ||||
|     /** 视频付费等级,0无需付费 1客户可看 2付费可看 */ | ||||
|     @Excel(name = "视频付费等级,0无需付费 1客户可看 2付费可看") | ||||
|     private Long payLevel; | ||||
|     private Integer payLevel; | ||||
|  | ||||
|     private String payLevelName; | ||||
|  | ||||
|     /** 播放次数,默认0 */ | ||||
|     @Excel(name = "播放次数,默认0") | ||||
|     private Integer playNum; | ||||
|  | ||||
|     /** 删除标识,0未删除 1已删除,默认0 */ | ||||
|     private Integer delFlag; | ||||
|  | ||||
|     private String playUrl; | ||||
|  | ||||
|     //文件名称 | ||||
|     private String fileName; | ||||
|  | ||||
|     private String key; | ||||
|  | ||||
|     //排序方式 1 按照创建时间倒序 2按照优先级、时间倒序 | ||||
|     private Integer sortType; | ||||
|  | ||||
|     private String openId; | ||||
|  | ||||
|     //微信用户类型  0 普通用户 1 已下单客户 | ||||
|     private Integer userType; | ||||
| } | ||||
| @@ -19,34 +19,45 @@ public class SysOrderCommisionDayDetail extends BaseEntity { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /**订单ID*/ | ||||
|     @Excel(name = "订单ID") | ||||
|     private Long orderId; | ||||
|  | ||||
|     /**订单成交时间*/ | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
|     @Excel(name = "订单成交时间") | ||||
|     private LocalDateTime orderTime; | ||||
|  | ||||
|     /**客户姓名*/ | ||||
|     @Excel(name = "客户姓名") | ||||
|     private String name; | ||||
|  | ||||
|     /**服务结束时间*/ | ||||
|     /**订单金额或服务订单金额*/ | ||||
|     @Excel(name = "订单金额") | ||||
|     private BigDecimal orderAmount; | ||||
|  | ||||
|     /**服务开始时间*/ | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd") | ||||
|     @Excel(name = "服务开始时间") | ||||
|     private LocalDate serverStartDate; | ||||
|  | ||||
|     /**服务结束时间*/ | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd") | ||||
|     @Excel(name = "服务结束时间") | ||||
|     private LocalDate serverEndDate; | ||||
|  | ||||
|     /**服务月数*/ | ||||
|     private Integer serverMonth; | ||||
|  | ||||
|     /**服务天数*/ | ||||
|     @Excel(name = "服务天数") | ||||
|     private Integer serverDay; | ||||
|  | ||||
|     /**赠送天数*/ | ||||
|     private Integer giveDay; | ||||
|  | ||||
|     /**订单金额或服务订单金额*/ | ||||
|     private BigDecimal orderAmount; | ||||
|     /** 暂停总天数 **/ | ||||
|  | ||||
|     /**订单总提成**/ | ||||
|     private BigDecimal orderCommission; | ||||
|     private int pauseTotalDay; | ||||
|  | ||||
|     //已发放提成 | ||||
|     private BigDecimal hasSendOrderCommission; | ||||
| @@ -54,15 +65,10 @@ public class SysOrderCommisionDayDetail extends BaseEntity { | ||||
|     //未发放提成 | ||||
|     private BigDecimal notHasSendOrderCommission; | ||||
|  | ||||
|     /**服务天数*/ | ||||
|     private Integer serverDay; | ||||
|  | ||||
|     /**每天金额*/ | ||||
|     @Excel(name = "每天金额") | ||||
|     private BigDecimal dayMoney; | ||||
|  | ||||
|     /** 暂停总天数 **/ | ||||
|     private int pauseTotalDay; | ||||
|  | ||||
|     /**每年每月暂停天数*/ | ||||
|     private Map<String, Integer> everyYearMonthPauseDay; | ||||
|  | ||||
| @@ -79,11 +85,17 @@ public class SysOrderCommisionDayDetail extends BaseEntity { | ||||
|     private Map<String, Boolean> everyYearMonthCommissionSendFlag; | ||||
|  | ||||
|     //该笔订单成交的当月的总成交额,用于确定提成比例 | ||||
|     @Excel(name = "当月的成交额") | ||||
|     private BigDecimal monthOrderTotalAmount; | ||||
|  | ||||
|     //该笔订单对应提成比例 | ||||
|     @Excel(name = "提成比例") | ||||
|     private Float commissionRate; | ||||
|  | ||||
|     /**订单总提成**/ | ||||
|     @Excel(name = "订单提成") | ||||
|     private BigDecimal orderCommission; | ||||
|  | ||||
|     //售后 | ||||
|     private Long afterSaleId; | ||||
|  | ||||
|   | ||||
| @@ -26,10 +26,10 @@ public class SysOrderPause { | ||||
|     /** | ||||
|      * 订单id | ||||
|      */ | ||||
|     @JsonIgnore | ||||
|     //@JsonIgnore | ||||
|     private Long orderId; | ||||
|  | ||||
|     @JsonIgnore | ||||
|     //@JsonIgnore | ||||
|     private Long cusId; | ||||
|  | ||||
|     private String outId; | ||||
|   | ||||
| @@ -33,6 +33,8 @@ public class NutritionalVideoResponse implements Serializable { | ||||
|     //播放链接 | ||||
|     public String playUrl; | ||||
|  | ||||
|     //播放量 | ||||
|     private Integer playNum; | ||||
|  | ||||
|     public String createTime; | ||||
|  | ||||
|   | ||||
| @@ -75,4 +75,17 @@ public interface SysNutritionalVideoMapper | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateWxshowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 查询阿里云的视频ID,包含已删除的 | ||||
|      * @param ids | ||||
|      * @return | ||||
|      */ | ||||
|     public List<String> getVideoIdByIds(@Param("array") Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 更新视频播放量 | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateVideoPlayNum(@Param("videoId")String videoId); | ||||
| } | ||||
| @@ -106,4 +106,18 @@ public interface SysOrderMapper | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysOrder> getAllOrderByCusId(@Param("cusId") Long cusId); | ||||
|  | ||||
|     /** | ||||
|      * 根据openid查询订单数量 | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     int getOrderCountByOpenId(@Param("openid")String openid); | ||||
|  | ||||
|     /** | ||||
|      * 根据营养师ID查询最后一个订单 | ||||
|      * @param nutritionistId | ||||
|      * @return | ||||
|      */ | ||||
|     SysOrder getLastOrderByNutritionistId(@Param("nutritionistId")Long nutritionistId); | ||||
| } | ||||
| @@ -4,6 +4,7 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.stdiet.custom.domain.SysNutritionalVideo; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| /** | ||||
|  * 营养视频Service接口 | ||||
| @@ -81,4 +82,10 @@ public interface ISysNutritionalVideoService | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateWxshowByIds(Integer wxShow, Long[] ids); | ||||
|  | ||||
|     /** | ||||
|      * 更新视频播放量 | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateVideoPlayNum(String videoId); | ||||
| } | ||||
| @@ -114,4 +114,11 @@ public interface ISysOrderService | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysOrder> getAllOrderByCusId(Long cusId); | ||||
|  | ||||
|     /** | ||||
|      * 根据openid查询订单数量 | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     int getOrderCountByOpenId(String openid); | ||||
| } | ||||
| @@ -731,7 +731,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { | ||||
|         } | ||||
|         //更新服务结束时间 | ||||
|         if(ChronoUnit.DAYS.between(realEndDate,serverEndDate) > 0){ | ||||
|             serverEndDate =  realEndDate; | ||||
|             //serverEndDate =  realEndDate; | ||||
|         } | ||||
|         return getEveryYearMonthPauseDay(list, serverStartDate, serverEndDate); | ||||
|     } | ||||
| @@ -759,7 +759,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { | ||||
|                 pauseStartDate = serverStartDate; | ||||
|             } | ||||
|             if(ChronoUnit.DAYS.between(serverEndDate, pauseEndDate) > 0){ | ||||
|                 pauseEndDate = serverEndDate; | ||||
|                 //pauseEndDate = serverEndDate; | ||||
|             } | ||||
|             //根据暂停记录获取该条记录在每年每月的暂停天数 | ||||
|             Map<String, Integer> orderYearMonthPauseDay = getEveryYearMonthDayCount(pauseStartDate, pauseEndDate, null); | ||||
|   | ||||
| @@ -9,8 +9,10 @@ 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.StringUtils; | ||||
| import com.stdiet.common.utils.oss.AliyunOSSUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.stdiet.custom.mapper.SysNutritionalVideoMapper; | ||||
| import com.stdiet.custom.domain.SysNutritionalVideo; | ||||
| @@ -52,15 +54,42 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi | ||||
|         List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo); | ||||
|         if(flag && list != null && list.size() > 0){ | ||||
|             List<String> fileUrl = new ArrayList<>(); | ||||
|             List<String> videoIdList = new ArrayList<>(); | ||||
|             for (SysNutritionalVideo video : list) { | ||||
|                 fileUrl.add(video.getCoverUrl()); | ||||
|                 if(StringUtils.isNotEmpty(video.getCoverUrl())){ | ||||
|                     fileUrl.add(video.getCoverUrl()); | ||||
|                 }else{ | ||||
|                     videoIdList.add(video.getVideoId()); | ||||
|                 } | ||||
|             } | ||||
|             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++; | ||||
|             if(fileUrl.size() > 0){ | ||||
|                 List<String> downUrlList = AliyunOSSUtils.generatePresignedUrl(fileUrl); | ||||
|                 if(downUrlList != null && downUrlList.size() > 0){ | ||||
|                     int index = 0; | ||||
|                     for (SysNutritionalVideo video : list) { | ||||
|                         if (StringUtils.isNotEmpty(video.getCoverUrl())) { | ||||
|                             video.setCoverUrl(downUrlList.get(index)); | ||||
|                             index++; | ||||
|                             if(index == downUrlList.size()){ | ||||
|                                 break; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if(videoIdList.size() > 0) { | ||||
|                 List<String> coverUrlList = AliyunVideoUtils.getVideoCoverUrl(videoIdList); | ||||
|                 if (coverUrlList != null && coverUrlList.size() > 0) { | ||||
|                     int index = 0; | ||||
|                     for (SysNutritionalVideo video : list) { | ||||
|                         if (StringUtils.isEmpty(video.getCoverUrl())) { | ||||
|                             video.setCoverUrl(coverUrlList.get(index)); | ||||
|                             index++; | ||||
|                             if(index == coverUrlList.size()){ | ||||
|                                 break; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -90,7 +119,23 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi | ||||
|     public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) | ||||
|     { | ||||
|         sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate()); | ||||
|         return sysNutritionalVideoMapper.updateSysNutritionalVideo(sysNutritionalVideo); | ||||
|         int row = sysNutritionalVideoMapper.updateSysNutritionalVideo(sysNutritionalVideo); | ||||
|         if(row > 0){ | ||||
|             updateAliyunVideo(sysNutritionalVideo.getId()); | ||||
|         } | ||||
|         return row; | ||||
|     } | ||||
|  | ||||
|     @Async | ||||
|     public void updateAliyunVideo(Long id){ | ||||
|         try{ | ||||
|             SysNutritionalVideo sysNutritionalVideo = selectSysNutritionalVideoById(id); | ||||
|             if(sysNutritionalVideo != null && sysNutritionalVideo.getVideoId() != null){ | ||||
|                 AliyunVideoUtils.updateVideo(sysNutritionalVideo.getVideoId(), sysNutritionalVideo.getTitle(), sysNutritionalVideo.getTags(), sysNutritionalVideo.getDescription(), null); | ||||
|             } | ||||
|         }catch (Exception e){ | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -102,7 +147,11 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi | ||||
|     @Override | ||||
|     public int deleteSysNutritionalVideoByIds(Long[] ids) | ||||
|     { | ||||
|         return sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids); | ||||
|         int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids); | ||||
|         if(row > 0){ | ||||
|             updateAliyunVideoCateId(ids); | ||||
|         } | ||||
|         return row; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -114,7 +163,12 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi | ||||
|     @Override | ||||
|     public int deleteSysNutritionalVideoById(Long id) | ||||
|     { | ||||
|         return sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id); | ||||
|         int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id); | ||||
|         if(row > 0){ | ||||
|             Long[] ids = {id}; | ||||
|             updateAliyunVideoCateId(ids); | ||||
|         } | ||||
|         return row; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -187,7 +241,33 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateWxshowByIds(Integer wxShow, Long[] ids){ | ||||
|         return sysNutritionalVideoMapper. updateWxshowByIds(wxShow, ids); | ||||
|         return sysNutritionalVideoMapper.updateWxshowByIds(wxShow, ids); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 将删除的阿里云视频放入回收站 | ||||
|      * @param ids | ||||
|      */ | ||||
|     @Async | ||||
|     public void updateAliyunVideoCateId(Long[] ids){ | ||||
|         try { | ||||
|             List<String> videoIdList = sysNutritionalVideoMapper.getVideoIdByIds(ids); | ||||
|             if(videoIdList != null && videoIdList.size() > 0){ | ||||
|                 for (String videoId : videoIdList) { | ||||
|                     AliyunVideoUtils.delVideo(videoId); | ||||
|                 } | ||||
|             } | ||||
|         }catch (Exception e){ | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 更新视频播放量 | ||||
|      * @return | ||||
|      */ | ||||
|     public int updateVideoPlayNum(String videoId){ | ||||
|         return sysNutritionalVideoMapper.updateVideoPlayNum(videoId); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -406,4 +406,13 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|     public List<SysOrder> getAllOrderByCusId(Long cusId){ | ||||
|         return sysOrderMapper.getAllOrderByCusId(cusId); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据openid查询订单数量 | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     public int getOrderCountByOpenId(String openid){ | ||||
|         return sysOrderMapper.getOrderCountByOpenId(openid); | ||||
|     } | ||||
| } | ||||
| @@ -236,16 +236,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | ||||
|         if (beforeOrderLastPlan != null) { | ||||
|             long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate); | ||||
|             //检查之前食谱的结束时间和目前该订单的开始时间是否连续 | ||||
|             if (differDay <= 1) { | ||||
|                 /*if(differDay <= 0){ | ||||
|                     serverStartDate = DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(1); | ||||
|                     //更新该订单的开始时间 | ||||
|                     sysOrderService.updateOrderStartTime(sysOrder, serverStartDate);1 7   1  3  2 | ||||
|                 }*/ | ||||
|             if(differDay <= 1){ | ||||
|                 //判断前一个订单食谱是否满七天,不满则需要接上 | ||||
|                 int differNum = beforeOrderLastPlan.getEndNumDay() - beforeOrderLastPlan.getStartNumDay(); | ||||
|  | ||||
|                 if (differNum < 6) { | ||||
|                 if(differNum < 6){ | ||||
|                     //更新该食谱计划 | ||||
|                     beforeOrderLastPlan.setEndNumDay(beforeOrderLastPlan.getStartNumDay() + 6); | ||||
|                     beforeOrderLastPlan.setEndDate(DateUtils.localDateToDate(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(6 - differNum))); | ||||
| @@ -328,9 +323,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | ||||
|                     if (ChronoUnit.DAYS.between(pauseStartDate, planStartDate) > 0) { | ||||
|                         pauseStartDate = planStartDate; | ||||
|                     } | ||||
|                     if (ChronoUnit.DAYS.between(planEndDate, pauseEndDate) > 0) { | ||||
|                     /*if (ChronoUnit.DAYS.between(planEndDate, pauseEndDate) > 0) { | ||||
|                         pauseEndDate = planEndDate; | ||||
|                     } | ||||
|                     }*/ | ||||
|                     //判断暂停记录是否从食谱计划开始时间开始的 | ||||
|                     if (ChronoUnit.DAYS.between(pauseStartDate, planStartDate) == 0) { | ||||
|                         planStartDate = pauseEndDate.plusDays(1); | ||||
|   | ||||
| @@ -45,6 +45,7 @@ | ||||
|     <select id="selectSysCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResult"> | ||||
|         select scc.id, scc.name, scc.keyword, scc.remark, scc.customer_id, scc.wx_show, scc.create_time,sc.name as customer_name from sys_customer_case scc | ||||
|         left join sys_customer sc on sc.id = scc.customer_id and sc.del_flag = 0 | ||||
|         left join sys_customer_healthy as sch on sch.customer_id = sc.id and sch.del_flag = 0 | ||||
|         where scc.del_flag = 0 | ||||
|         <include refid="searchKey"> | ||||
|             <property name="keywordArray" value="#{keywordArray}"/> | ||||
| @@ -52,6 +53,21 @@ | ||||
|         <if test="customerName != null and customerName != ''"> | ||||
|             and sc.name like concat('%', #{customerName}, '%') | ||||
|         </if> | ||||
|         <if test="keyword != null"> | ||||
|             and | ||||
|             ( | ||||
|               sc.name like concat('%', #{keyword}, '%') or | ||||
|               scc.keyword like concat('%', #{keyword}, '%') or scc.name like concat('%', #{keyword}, '%') | ||||
|               or scc.remark like concat('%', #{keyword}, '%') or sch.other_physical_signs like concat('%', #{keyword}, '%') | ||||
|               or sch.remark like concat('%', #{keyword}, '%') | ||||
|             <if test="signIdList != null"> | ||||
|                   <foreach collection="signIdList " item="signId" index="index" open=" OR (" close=")" separator=" OR "> | ||||
|                       FIND_IN_SET(#{signId}, sch.physical_signs_id) | ||||
|                   </foreach> | ||||
|               </if> | ||||
|             ) | ||||
|         </if> | ||||
|  | ||||
|         <if test="wxShow != null"> | ||||
|             and scc.wx_show = #{wxShow} | ||||
|         </if> | ||||
|   | ||||
| @@ -62,7 +62,7 @@ | ||||
|         </if> | ||||
|         <if test="signIdList != null"> | ||||
|             and ( | ||||
|             sch.other_physical_signs like concat('%', #{name}, '%') | ||||
|             sch.other_physical_signs like concat('%', #{physicalSignsId}, '%') | ||||
|             <foreach collection="signIdList " item="signId" index="index" open=" OR (" close=")" separator=" OR "> | ||||
|                 FIND_IN_SET(#{signId}, sch.physical_signs_id) | ||||
|             </foreach> | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|         <result property="showFlag"    column="show_flag"    /> | ||||
|         <result property="priorityLevel"    column="priority_level"    /> | ||||
|         <result property="payLevel"    column="pay_level"    /> | ||||
|         <result property="playNum"    column="play_num"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
| @@ -27,11 +28,11 @@ | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysNutritionalVideoVo"> | ||||
|         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 | ||||
|         select id, cate_id, video_id, cover_url, title, description, priority_level,pay_level,play_num,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"> | ||||
|         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, | ||||
|         select snv.id, snv.cate_id, snv.video_id, snv.cover_url, snv.title, snv.description, snv.priority_level,snv.pay_level,snv.play_num,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 | ||||
| @@ -46,10 +47,23 @@ | ||||
|         <if test="payLevel != null"> | ||||
|             and snv.pay_level = #{payLevel} | ||||
|         </if> | ||||
|         <if test="userType != null"> | ||||
|             <if test="userType == 0"> | ||||
|                 and pay_level = 0 | ||||
|             </if> | ||||
|             <if test="userType == 1"> | ||||
|                 and (pay_level = 0 or pay_level = 1) | ||||
|             </if> | ||||
|         </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 | ||||
|         <if test="sortType == null or sortType == 1"> | ||||
|             order by snv.create_time DESC | ||||
|         </if> | ||||
|         <if test="sortType != null and sortType == 2"> | ||||
|             order by snv.priority_level DESC,snv.create_time DESC | ||||
|         </if> | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectSysNutritionalVideoById" parameterType="Long" resultMap="SysNutritionalVideoResult"> | ||||
| @@ -69,6 +83,7 @@ | ||||
|             <if test="tags != null">tags,</if> | ||||
|             <if test="showFlag != null">show_flag,</if> | ||||
|             <if test="priorityLevel != null">priority_level,</if> | ||||
|             <if test="playNum != null">play_num,</if> | ||||
|             <if test="createTime != null">create_time,</if> | ||||
|             <if test="createBy != null">create_by,</if> | ||||
|             <if test="payLevel != null">pay_level,</if> | ||||
| @@ -86,6 +101,7 @@ | ||||
|             <if test="tags != null">#{tags},</if> | ||||
|             <if test="showFlag != null">#{showFlag},</if> | ||||
|             <if test="priorityLevel != null">#{priorityLevel},</if> | ||||
|             <if test="playNum != null">#{playNum},</if> | ||||
|             <if test="createTime != null">#{createTime},</if> | ||||
|             <if test="createBy != null">#{createBy},</if> | ||||
|             <if test="payLevel != null">#{payLevel},</if> | ||||
| @@ -107,6 +123,7 @@ | ||||
|             <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="playNum != null">play_num = #{playNum},</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> | ||||
| @@ -139,4 +156,17 @@ | ||||
|         </foreach> | ||||
|     </update> | ||||
|  | ||||
|     <!-- 查询视频的阿里云ID,包含已删除的 --> | ||||
|     <select id="getVideoIdByIds" parameterType="String" resultType="String"> | ||||
|         select video_id from sys_nutritional_video where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </select> | ||||
|  | ||||
|     <!-- 更新视频播放量  --> | ||||
|     <update id="updateVideoPlayNum" parameterType="String"> | ||||
|         update sys_nutritional_video set play_num = play_num + 1 where video_id = #{videoId} and del_flag = 0 | ||||
|     </update> | ||||
|  | ||||
| </mapper> | ||||
| @@ -516,4 +516,15 @@ | ||||
|         select * from sys_order where del_flag = 0 and cus_id = #{cusId} order by order_time asc | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据微信openId查询客户订单数量 --> | ||||
|     <select id="getOrderCountByOpenId" parameterType="String" resultType="int"> | ||||
|       select count(so.order_id) from sys_order so | ||||
|       where so.del_flag = 0 and so.cus_id is not null and so.cus_id = (select su.cus_id from sys_wx_user_info su where su.openid = #{openid} limit 1) | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据营养师ID查询最后一单的情况 --> | ||||
|     <select id="getLastOrderByNutritionistId" parameterType="Long" resultMap="SysOrderResult"> | ||||
|         select * from sys_order so | ||||
|         where del_flag = 0 and nutritionist_id = #{nutritionistId} order by order_id desc limit 1 | ||||
|     </select> | ||||
| </mapper> | ||||
		Reference in New Issue
	
	Block a user