diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCommisionController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCommisionController.java index 663b886a7..126059004 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCommisionController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCommisionController.java @@ -237,16 +237,6 @@ public class SysCommisionController extends BaseController { return getDataTable(sysCommissionDayService.calculateCommissionByDay(sysCommision)); } - /** - * 根据用户ID查询该用户按天计算提成的详情 - * */ - @PreAuthorize("@ss.hasPermi('commisionDay:detail:list')") - @GetMapping("/orderDetailDay") - public AjaxResult getOrderCommissionDetailDay(SysCommision sysCommision) { - startPage(); - return sysCommissionDayService.calculateOrderCommissionDetail(sysCommision); - } - /** * 导出按天计算提成详细列表 */ @@ -258,4 +248,30 @@ public class SysCommisionController extends BaseController { List<SysCommissionDayDetail> list = sysCommissionDayService.calculateCommissionByDay(sysCommision); return util.exportExcel(list, "commision"); } + + /** + * 根据用户ID查询该用户按天计算提成的详情 + * */ + @PreAuthorize("@ss.hasPermi('commisionDay:detail:list')") + @GetMapping("/orderDetailDay") + public AjaxResult getOrderCommissionDetailDay(SysCommision sysCommision) { + startPage(); + return sysCommissionDayService.calculateOrderCommissionDetail(sysCommision); + } + + /** + * 导出具体地点按天计算提成详细列表 + */ + @PreAuthorize("@ss.hasPermi('commisionDay:detail:export')") + @Log(title = "导出具体地点按天计算提成详细列表", businessType = BusinessType.EXPORT) + @GetMapping("/exportOrderDetailDay") + public AjaxResult exportOrderDetailDay(SysCommision sysCommision) { + ExcelUtil<SysOrderCommisionDayDetail> util = new ExcelUtil<>(SysOrderCommisionDayDetail.class); + AjaxResult result = sysCommissionDayService.calculateOrderCommissionDetail(sysCommision); + List<SysOrderCommisionDayDetail> orderDetailList = null; + if(result != null && (int)result.get("code") == 200){ + orderDetailList = (List<SysOrderCommisionDayDetail>)result.get("list"); + } + return util.exportExcel(orderDetailList == null ? new ArrayList<>() : orderDetailList, "commision"); + } } diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java index 099d0afa9..f8e0a3db8 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java @@ -18,6 +18,8 @@ import com.stdiet.common.utils.file.MimeTypeUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.custom.domain.SysCustomerCaseFile; import com.stdiet.custom.dto.request.FileRequest; +import com.stdiet.custom.service.ISysPhysicalSignsService; +import org.springframework.scheduling.annotation.Async; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.unit.DataUnit; @@ -49,6 +51,9 @@ public class SysCustomerCaseController extends BaseController @Autowired private ISysCustomerCaseService sysCustomerCaseService; + @Autowired + private ISysPhysicalSignsService sysPhysicalSignsService; + /** * 查询客户案例管理列表 */ @@ -56,8 +61,13 @@ public class SysCustomerCaseController extends BaseController @GetMapping("/list") public TableDataInfo list(SysCustomerCase sysCustomerCase) { + //sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); + + if(StringUtils.isNotEmpty(sysCustomerCase.getKeyword())){ + sysCustomerCase.setSignIdList(sysPhysicalSignsService.getSignIdByName(sysCustomerCase.getKeyword())); + } + startPage(); - sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null); List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); return getDataTable(list); } diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index a85fc2e2d..020053bea 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -51,7 +51,6 @@ public class SysCustomerController extends BaseController { @PreAuthorize("@ss.hasPermi('custom:customer:list')") @GetMapping("/list") public TableDataInfo list(SysCustomer sysCustomer) { - startPage(); List<SysCustomer> list = new ArrayList<>(); if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) { String remark = SecurityUtils.getLoginUser().getUser().getRemark(); @@ -74,7 +73,7 @@ public class SysCustomerController extends BaseController { sysCustomer.setSignIdList(sysPhysicalSignsService.getSignIdByName(sysCustomer.getPhysicalSignsId())); } } - + startPage(); list = sysCustomerService.selectSysCustomerList(sysCustomer); if (list != null && list.size() > 0) { for (SysCustomer sysCus : list) { diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java index 5600daf3a..404dc8bb3 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysNutritionalVideoController.java @@ -1,9 +1,9 @@ package com.stdiet.web.controller.custom; -import java.util.ArrayList; import java.util.List; import com.aliyun.vod20170321.models.CreateUploadVideoResponse; +import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.utils.AliyunVideoUtils; import com.stdiet.common.utils.StringUtils; @@ -127,4 +127,26 @@ public class SysNutritionalVideoController extends BaseController return toAjax(sysNutritionalVideoService.updateWxshowByIds(showFlag, ids)); } + /** + * 获取营养视频播放地址 + */ + @PreAuthorize("@ss.hasPermi('custom:nutritionalVideo:query')") + @GetMapping(value = "/getVideoPlayUrlById/{id}") + public AjaxResult getVideoPlayUrlById(@PathVariable("id") Long id) + { + SysNutritionalVideo sysNutritionalVideos = sysNutritionalVideoService.selectSysNutritionalVideoById(id); + if(sysNutritionalVideos != null && StringUtils.isNotEmpty(sysNutritionalVideos.getVideoId())){ + try{ + GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(sysNutritionalVideos.getVideoId()); + List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo; + if(playList != null && playList.size() > 0){ + sysNutritionalVideos.setPlayUrl(playList.get(0).getPlayURL()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return AjaxResult.success(sysNutritionalVideos); + } + } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java index c28140ea9..97a7bff6c 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java @@ -195,6 +195,4 @@ public class SysOrderController extends OrderBaseController { public AjaxResult remove(@PathVariable Long orderId) { return toAjax(sysOrderService.deleteSysOrderById(orderId)); } - - } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 55c5ee703..c86e9ce84 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -106,6 +106,14 @@ public class WechatAppletController extends BaseController { if (StringUtils.isEmpty(sysWxUserInfo.getOpenid()) || StringUtils.isEmpty(sysWxUserInfo.getPhone())) { return AjaxResult.error("手机号为空"); } + //根据手机号查询返回用户加密ID + SysCustomer customer = sysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone()); + //加密ID + String customerEncId = null; + if(customer != null){ + sysWxUserInfo.setCusId(customer.getId()); + customerEncId = AesUtils.encrypt(customer.getId() + "", null); + } // 查询微信用户 SysWxUserInfo userInfo = sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserInfo.getOpenid()); if (userInfo != null) { @@ -115,9 +123,7 @@ public class WechatAppletController extends BaseController { sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); } Map<String, Object> result = new HashMap<>(); - //根据手机号查询返回用户加密ID - SysCustomer customer = sysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone()); - result.put("customerId", customer != null ? AesUtils.encrypt(customer.getId() + "", null) : null); + result.put("customerId", customerEncId); //查询未读消息数量 SysMessageNotice messageParam = new SysMessageNotice(); messageParam.setReadType(0); @@ -358,9 +364,18 @@ public class WechatAppletController extends BaseController { */ @GetMapping(value = "/getVideoList") public TableDataInfo getVideoList(SysNutritionalVideo sysNutritionalVideo) { - startPage(); sysNutritionalVideo.setShowFlag(1); sysNutritionalVideo.setSortType(2); + //普通用户 + sysNutritionalVideo.setUserType(0); + if(StringUtils.isNotEmpty(sysNutritionalVideo.getOpenId())){ + //查询是否为客户,存在订单就视为客户 + int orderNum = sysOrderService.getOrderCountByOpenId(sysNutritionalVideo.getOpenId()); + if(orderNum > 0){ + sysNutritionalVideo.setUserType(1); + } + } + startPage(); List<SysNutritionalVideo> list = sysNutritionalVideoService.selectSysNutritionalVideoList(sysNutritionalVideo, true); return getDataTable(list); } @@ -381,6 +396,9 @@ public class WechatAppletController extends BaseController { if(playList != null && playList.size() > 0){ nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL()); } + if(StringUtils.isNotEmpty(sysNutritionalVideo.getCoverUrl())){ + nutritionalVideoResponse.setCoverUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideo.getCoverUrl())); + } nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription()); nutritionalVideoResponse.setTags(sysNutritionalVideo.getTags()); nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle()); diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java index d131b9490..fd1d73cc3 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/AliyunVideoUtils.java @@ -4,6 +4,11 @@ import com.aliyun.vod20170321.models.*; import com.aliyun.teaopenapi.models.*; import com.stdiet.common.config.AliyunOSSConfig; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class AliyunVideoUtils { public static com.aliyun.vod20170321.Client videoClient = null; @@ -116,12 +121,16 @@ public class AliyunVideoUtils { public static CreateUploadVideoResponse createUploadVideoRequest(Long cateId, String fileName, String title, String coverURL, String tags, String description) throws Exception{ com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); CreateUploadVideoRequest createUploadVideoRequest = new CreateUploadVideoRequest() - .setDescription(description) - .setCoverURL(coverURL) - .setFileName(fileName) - .setTitle(title) - .setCateId(cateId) - .setTags(tags); + .setDescription(description).setFileName(fileName).setTitle(title); + if(StringUtils.isNotEmpty(coverURL)){ + createUploadVideoRequest.setCoverURL(coverURL); + } + if(cateId != null){ + createUploadVideoRequest.setCateId(cateId); + } + if(StringUtils.isNotEmpty(tags)){ + createUploadVideoRequest.setTags(tags); + } return client.createUploadVideo(createUploadVideoRequest); } @@ -202,6 +211,33 @@ public class AliyunVideoUtils { return updateVideo(videoId, null,null,null, default_delete_cateId); } + /** + * 根据VideoId获取封面 + * @param videoId + * @return + */ + public static List<String> getVideoCoverUrl(List<String> videoId){ + List<String> result = new ArrayList<>(); + try{ + com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient(); + GetVideoInfosRequest getVideoInfosRequest = new GetVideoInfosRequest() + .setVideoIds(StringUtils.join(videoId.toArray(), ",")); + GetVideoInfosResponse getVideoInfosResponse = client.getVideoInfos(getVideoInfosRequest); + if(getVideoInfosResponse != null){ + GetVideoInfosResponseBody body = getVideoInfosResponse.body; + List<GetVideoInfosResponseBody.GetVideoInfosResponseBodyVideoList> videoList = body.videoList; + if(videoList != null && videoList.size() > 0){ + for (GetVideoInfosResponseBody.GetVideoInfosResponseBodyVideoList video : videoList) { + result.add(video.getCoverURL()); + } + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return result; + } + diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java index 4cb800dff..d855f9729 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java @@ -54,4 +54,7 @@ public class SysCustomerCase extends BaseEntity //案例文件URL数组 private String[] caseFileUrl; + + //病史体征ID集合,非持久化字段 + private List<Long> signIdList; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java index 2cf25618e..738f38d1d 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysNutritionalVideo.java @@ -61,7 +61,7 @@ public class SysNutritionalVideo extends BaseEntity /** 视频付费等级,0无需付费 1客户可看 2付费可看 */ @Excel(name = "视频付费等级,0无需付费 1客户可看 2付费可看") - private Long payLevel; + private Integer payLevel; private String payLevelName; @@ -72,6 +72,8 @@ public class SysNutritionalVideo extends BaseEntity /** 删除标识,0未删除 1已删除,默认0 */ private Integer delFlag; + private String playUrl; + //文件名称 private String fileName; @@ -79,4 +81,9 @@ public class SysNutritionalVideo extends BaseEntity //排序方式 1 按照创建时间倒序 2按照优先级、时间倒序 private Integer sortType; + + private String openId; + + //微信用户类型 0 普通用户 1 已下单客户 + private Integer userType; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderCommisionDayDetail.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderCommisionDayDetail.java index d8b65c728..a1e9baf1f 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderCommisionDayDetail.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderCommisionDayDetail.java @@ -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; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java index 37d0c8390..12285ba47 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java @@ -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); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java index 26466474b..19fbd8b88 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderService.java @@ -114,4 +114,11 @@ public interface ISysOrderService * @return */ List<SysOrder> getAllOrderByCusId(Long cusId); + + /** + * 根据openid查询订单数量 + * @param openid + * @return + */ + int getOrderCountByOpenId(String openid); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java index a8d3f4945..3fa709ac8 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysNutritionalVideoServiceImpl.java @@ -9,6 +9,7 @@ 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; @@ -53,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; + } + } + } } } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java index a51367076..b7e43f43a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderServiceImpl.java @@ -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); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml index 7ed96cf76..d6e02d44f 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml @@ -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> diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 0e7b805e0..ff5a0fa16 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -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> diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml index 3d523409d..a468e8714 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysNutritionalVideoMapper.xml @@ -47,6 +47,14 @@ <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> diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index 3ecbb19ed..8a702643e 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -512,4 +512,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> \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/commision.js b/stdiet-ui/src/api/custom/commision.js index 977a0f422..4d223944a 100644 --- a/stdiet-ui/src/api/custom/commision.js +++ b/stdiet-ui/src/api/custom/commision.js @@ -96,3 +96,13 @@ export function orderDetailDay(query) { }) } +// 导出具体订单按天计算提成明细 +export function exportOrderDetailDay(query) { + return request({ + url: '/custom/commision/exportOrderDetailDay', + method: 'get', + params: query + }) +} + + diff --git a/stdiet-ui/src/api/custom/nutritionalVideo.js b/stdiet-ui/src/api/custom/nutritionalVideo.js index de31f2134..649406caa 100644 --- a/stdiet-ui/src/api/custom/nutritionalVideo.js +++ b/stdiet-ui/src/api/custom/nutritionalVideo.js @@ -69,3 +69,12 @@ export function updateWxShow(data){ params: data }) } + +// 查询营养视频播放地址 +export function getVideoPlayUrlById(id) { + return request({ + url: '/custom/nutritionalVideo/getVideoPlayUrlById/' + id, + method: 'get' + }) +} + diff --git a/stdiet-ui/src/components/FileUpload/UploadFile.vue b/stdiet-ui/src/components/FileUpload/UploadFile.vue index d56954d9d..1113c76bf 100644 --- a/stdiet-ui/src/components/FileUpload/UploadFile.vue +++ b/stdiet-ui/src/components/FileUpload/UploadFile.vue @@ -9,10 +9,11 @@ :before-upload="beforeAvatarUpload"> <img v-if="imageUrl || coverUrl" :src="imageUrl || coverUrl" class="avatar"> <i v-else class="el-icon-plus avatar-uploader-icon"></i> - <div class="el-upload__tip" slot="tip"> - 1、只能上传png、jpg文件,且每个文件不超过{{ + <div class="el-upload__tip" slot="tip" style="color:#1890ff"> + <div>1、只能上传png、jpg文件,且每个文件不超过{{ upload.fileSize / (1024 * 1024) - }}M + }}M</div> + <div style="margin-top:-10px;">{{tips ? ('2、'+tips) : ''}}</div> </div> </el-upload> </template> @@ -79,6 +80,10 @@ export default { coverUrl:{ type: String, default: "" + }, + tips: { + type: String, + default: "" } } }; diff --git a/stdiet-ui/src/components/OrdercommissDetail/index.vue b/stdiet-ui/src/components/OrdercommissDetail/index.vue index 1b3c5c932..c804f0b3d 100644 --- a/stdiet-ui/src/components/OrdercommissDetail/index.vue +++ b/stdiet-ui/src/components/OrdercommissDetail/index.vue @@ -37,6 +37,7 @@ <div class="order_total_data" > + <span class="order_total_data_span_right20"> 当前页总服务金额:{{totalServerAmount}}元 </span> @@ -50,6 +51,18 @@ >未发放总提成:{{ totalNotSendCommission }}元</span > </div> + <el-row :gutter="10" class="mb8" style="margin-top: 10px;margin-left:10px"> + <el-col :span="1.5"> + <el-button + type="warning" + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['commisionDay:detail:export']" + >导出 + </el-button> + </el-col> + </el-row> <div style="width:100%;height:80%;overflow: auto"> <el-table :data="orderList" v-loading="loading" stripe> <el-table-column @@ -208,7 +221,7 @@ </div> </template> <script> -import { orderDetailDay } from "@/api/custom/commision"; +import { orderDetailDay,exportOrderDetailDay } from "@/api/custom/commision"; import OrderDetail from "@/components/OrderDetail"; export default { @@ -317,6 +330,23 @@ export default { handleOnDetailClick(data) { this.$refs.orderDetailRef.showDialog(data.orderId); }, + handleExport(){ + this.queryParam.serverScopeStartTime = this.serverDateScope && this.serverDateScope.length > 0 ? this.serverDateScope[0] : null; + this.queryParam.serverScopeEndTime = this.serverDateScope && this.serverDateScope.length > 0 ? this.serverDateScope[1] : null; + const queryParams = this.queryParam; + this.$confirm("是否确认导出所有订单提成比例数据项?", "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(function () { + return exportOrderDetailDay(queryParams); + }) + .then((response) => { + this.download(response.msg); + }) + .catch(function () {}); + } }, }; </script> @@ -332,7 +362,7 @@ export default { .order_total_data { float: right; margin-right: 40px; - margin-bottom:20px + margin-bottom:15px } .order_total_data_span_right20 { diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index 3368355b0..4f6161eeb 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -102,7 +102,7 @@ </el-table> </div> <!-- 其他信息 --> - <div style="height: 390px; overflow: auto"> + <div style="height: 370px; overflow: auto"> <div v-for="(item, index) in dataList.slice(1, 10)" style="margin-bottom: 50px" diff --git a/stdiet-ui/src/components/UploadVideo/index.vue b/stdiet-ui/src/components/UploadVideo/index.vue index 5865fb7d9..9a5462a86 100644 --- a/stdiet-ui/src/components/UploadVideo/index.vue +++ b/stdiet-ui/src/components/UploadVideo/index.vue @@ -23,7 +23,7 @@ </el-form-item> <el-form-item label="视频封面" prop="coverUrl"> - <UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl"></UploadFile> + <UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl" :tips="'视频未传封面图片时,会主动截取封面,但会存在延迟,请勿直接发布到小程序'"></UploadFile> </el-form-item> <div style="display:flex"> <el-form-item label="视频类别" prop="cateId"> @@ -52,7 +52,9 @@ <div> <input type="file" accept=".mp4" ref="videoFile" id="videoFile" @change="fileChange($event)"> <div > <span>上传状态:{{statusText}}</span><span style="margin-left:100px">进度:{{authProgress}}%</span></div> - <div > 1、只能上传mp4文件,上传大文件时请使用客户端上传,防止上传超时</div> + <div style="color:#1890ff"> + 1、只能上传mp4文件,上传大文件时请使用客户端上传,防止上传超时 + </div> </div> </el-form-item> <el-form-item label="展示状态" prop="wxShow"> @@ -61,7 +63,7 @@ active-text="小程序展示" inactive-text="小程序不展示"> </el-switch> - <div>提示:请保证内容正确再展示到小程序</div> + <div style="color:red">提示:请保证内容正确再展示到小程序</div> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -86,9 +88,6 @@ title: [ { required: true, message: "标题不能为空", trigger: "blur" }, ], - coverUrl: [ - { required: true, message: "封面不能为空", trigger: "blur" }, - ], cateId:[ { required: true, message: "视频类别不能为空", trigger: "blur" }, ], @@ -145,13 +144,13 @@ }, methods: { showDialog(classifyList, callback){ + if(classifyList != null && classifyList.length > 0){ + this.defaultClassify = classifyList[0].id; + } this.resetVideoFrom(); this.open = true; this.callback = callback; this.classifyList = classifyList; - if(classifyList != null && classifyList.length > 0){ - this.defaultClassify = classifyList[0].id; - } }, handleCoverUrl(url){ this.videoFrom.coverUrl = url; diff --git a/stdiet-ui/src/views/custom/customerCase/index.vue b/stdiet-ui/src/views/custom/customerCase/index.vue index 73441fb61..020e2f270 100644 --- a/stdiet-ui/src/views/custom/customerCase/index.vue +++ b/stdiet-ui/src/views/custom/customerCase/index.vue @@ -17,8 +17,7 @@ </el-form-item>--> <el-form-item label="案例信息" prop="name"> <el-select - v-model="keywordArray" - multiple + v-model="queryParams.keyword" filterable allow-create clearable @@ -150,12 +149,22 @@ ></AutoHideMessage> </template> </el-table-column> - <el-table-column label="所属客户" align="center" prop="customerName" /> + <el-table-column label="所属客户" align="center" prop="customerName"> + <template slot-scope="scope"> + <el-button + size="normal" + type="text" + @click="handleOnHealthSignClick(scope.row.customerId)" + title="点击查看用户详情" + >{{scope.row.customerName}}</el-button + > + </template> + </el-table-column> <el-table-column label="文件" align="center"> <template slot-scope="scope"> <el-button - size="mini" + size="normal" type="text" @click="getFileListByCaseId(scope.row)" >文件列表 @@ -323,6 +332,9 @@ @dealCustomerId="dealCustomerId" ref="selectCustomerRef" ></SelectCustomer> + + <!-- 健康评估弹窗 --> + <PhysicalSignsDialog ref="physicalSignsDialogRef" /> </div> </template> @@ -337,13 +349,16 @@ import { getFileListByCaseId, updateWxShow } from "@/api/custom/customerCase"; +import { + getCustomer +} from "@/api/custom/customer"; import DragUpload from "@/components/FileUpload/DragUpload"; import DragUploadEdit from "@/components/FileUpload/DragUploadEdit"; import SelectCustomer from "@/components/Customer/SelectCustomer"; import MuchFileDown from "@/components/FileDownload/MuchFileDown"; import AutoHideMessage from "@/components/AutoHideMessage"; import AutoHideInfo from "@/components/AutoHideInfo"; - +import PhysicalSignsDialog from "@/components/PhysicalSignsDialog"; export default { name: "CustomerCase", data() { @@ -398,6 +413,7 @@ export default { AutoHideMessage: AutoHideMessage, AutoHideInfo: AutoHideInfo, DragUploadEdit: DragUploadEdit, + PhysicalSignsDialog }, created() { this.getList(); @@ -409,7 +425,7 @@ export default { /** 查询客户案例管理列表 */ getList() { this.loading = true; - this.queryParams.keyword = this.keywordArray.join(","); + //this.queryParams.keyword = this.keywordArray.join(","); listCustomerCase(this.queryParams).then((response) => { this.customerCaseList = response.rows; this.total = response.total; @@ -425,6 +441,14 @@ export default { this.$refs["editUploadCaseFile"].uploadReset(); this.reset(); }, + handleOnHealthSignClick(id) { + getCustomer(id).then((response) => { + if(response.code == 200){ + this.$refs["physicalSignsDialogRef"].showDialog(response.data); + } + }); + + }, // 表单重置 reset() { this.form = { diff --git a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue index 5b2d6fc59..609307f1d 100644 --- a/stdiet-ui/src/views/custom/nutritionalVideo/index.vue +++ b/stdiet-ui/src/views/custom/nutritionalVideo/index.vue @@ -110,8 +110,16 @@ </el-image> </template> </el-table-column> - <el-table-column label="标题" align="center" prop="title" width="200"/> - <el-table-column label="描述" align="center" prop="description" /> + <el-table-column label="标题" align="center" prop="title" width="200"> + <template slot-scope="scope" > + <AutoHideMessage :data="scope.row.title == null ? '' : (scope.row.title+'')" :maxLength="20"></AutoHideMessage> + </template> + </el-table-column> + <el-table-column label="描述" align="center" prop="description" > + <template slot-scope="scope" > + <AutoHideMessage :data="scope.row.description == null ? '' : (scope.row.description+'')" :maxLength="100"></AutoHideMessage> + </template> + </el-table-column> <!--<el-table-column label="标签" align="center" prop="tags" width="100"/>--> <el-table-column label="分类" align="center" prop="cateName" width="100"/> <el-table-column label="权限等级" align="center" prop="payLevelName" width="100"/> @@ -128,6 +136,13 @@ </el-table-column> <el-table-column label="操作" align="center" width="200"> <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="getVideoPlayUrl(scope.row.id)" + v-hasPermi="['custom:nutritionalVideo:query']" + >播放</el-button> <el-button size="mini" type="text" @@ -229,11 +244,12 @@ </template> <script> - import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo, updateWxShow } from "@/api/custom/nutritionalVideo"; + import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo, updateWxShow,getVideoPlayUrlById } from "@/api/custom/nutritionalVideo"; import {getAllClassify } from "@/api/custom/videoClassify"; import UploadVideo from "@/components/UploadVideo"; import UploadFile from "@/components/FileUpload/UploadFile"; import VideoClassify from "../videoClassify"; + import AutoHideMessage from "@/components/AutoHideMessage"; export default { name: "NutritionalVideo", data() { @@ -269,6 +285,15 @@ form: {}, // 表单校验 rules: { + title: [ + { required: true, message: "标题不能为空", trigger: "blur" }, + ], + cateId:[ + { required: true, message: "视频类别不能为空", trigger: "blur" }, + ], + payLevel:[ + { required: true, message: "视频权限不能为空", trigger: "blur" }, + ] }, coverImageList:[], //分类列表 @@ -288,7 +313,7 @@ }); }, components: { - UploadVideo,UploadFile,VideoClassify + UploadVideo,UploadFile,VideoClassify,AutoHideMessage }, methods: { /** 查询营养视频列表 */ @@ -372,6 +397,15 @@ this.title = "修改营养视频"; }); }, + //获取播放地址 + getVideoPlayUrl(id){ + getVideoPlayUrlById(id).then(response => { + let url = response.data.playUrl; + if(url != undefined && url != null){ + window.open(url, '_blank'); + } + }); + }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate(valid => {