| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- package com.linkwechat.controller;
- import com.alibaba.excel.EasyExcel;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.linkwechat.common.core.controller.BaseController;
- import com.linkwechat.common.core.domain.AjaxResult;
- import com.linkwechat.common.core.page.TableDataInfo;
- import com.linkwechat.common.utils.ServletUtils;
- import com.linkwechat.common.utils.StringUtils;
- import com.linkwechat.common.utils.poi.LwExcelUtil;
- import com.linkwechat.domain.kf.vo.WeKfRecordListVo;
- import com.linkwechat.domain.live.WeLive;
- import com.linkwechat.domain.live.WeLiveWatchUser;
- import com.linkwechat.domain.live.vo.WeLinveUserVo;
- import com.linkwechat.fegin.QwSysUserClient;
- import com.linkwechat.service.IWeLiveService;
- import com.linkwechat.service.IWeLiveTipService;
- import com.linkwechat.service.IWeLiveWatchUserService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.io.UnsupportedEncodingException;
- import java.net.URLEncoder;
- import java.text.ParseException;
- import java.util.Arrays;
- import java.util.List;
- /**
- * 直播相关
- */
- @RestController
- @RequestMapping("/live")
- public class WeLiveController extends BaseController {
- @Autowired
- IWeLiveService iWeLiveService;
- @Autowired
- IWeLiveTipService iWeLiveTipService;
- @Autowired
- IWeLiveWatchUserService iWeLiveWatchUserService;
- @Autowired
- QwSysUserClient qwSysUserClient;
- /**
- * 新增或更新直播
- * @param weLive
- * @return
- */
- @PostMapping("/addOrUpdate")
- public AjaxResult addOrUpdate(@RequestBody WeLive weLive){
- iWeLiveService.addOrUpdate(weLive);
- return AjaxResult.success();
- }
- /**
- * 获取直播列表
- * @param weLive
- * @return
- */
- @GetMapping("/findWelives")
- public TableDataInfo findWelives(WeLive weLive){
- startPage();
- return getDataTable(iWeLiveService.findLives(weLive));
- }
- /**
- * 获取直播详情
- * @return
- */
- @GetMapping("/findLiveDetail/{weLiveId}")
- public AjaxResult findLiveDetail(@PathVariable String weLiveId){
- return AjaxResult.success(
- iWeLiveService.findLiveDetail(weLiveId)
- );
- }
- /**
- * 通过id列表删除
- *
- * @param ids id列表
- * @return 结果
- */
- @DeleteMapping(path = "/{ids}")
- public AjaxResult batchDeleteLiwes(@PathVariable("ids") Long[] ids) {
- iWeLiveService.removeLives(Arrays.asList(ids));
- return AjaxResult.success();
- }
- /**
- * 取消直播
- * @param live
- * @return
- */
- @PostMapping("/cancelLive")
- public AjaxResult cancelLive(@RequestBody WeLive live){
- iWeLiveService.cancleLive(live);
- return AjaxResult.success();
- }
- /**
- * 同步直播
- * @return
- */
- @GetMapping("/synchLive")
- public AjaxResult synchLive(){
- iWeLiveService.synchLive();
- return AjaxResult.success();
- }
- /**
- * 导出直播
- * @return
- */
- @GetMapping("/exportWeLives")
- public void exportWeLives(){
- LwExcelUtil.exprotForWeb(
- ServletUtils.getResponse(), WeLive.class, iWeLiveService.findLives(new WeLive()),"直播"
- );
- }
- /**
- * 分享统计-tab(客户或客群维度) (客户或客群维度 1:客户 2:客群)
- * @param liveId
- * @return
- */
- @GetMapping("/findWeLiveTaskCustomerDetailTab")
- public AjaxResult findWeLiveTaskCustomerDetailTab(String liveId){
- WeLive weLive = iWeLiveService.getById(liveId);
- if(null != weLive){
- return AjaxResult.success(
- iWeLiveTipService.findWeLiveTaskExecuteUserDetailTab(liveId,weLive.getTargetType())
- );
- }
- return AjaxResult.success();
- }
- /**
- * 分享统计(员工维度)-tab
- * @param liveId
- * @return
- */
- @GetMapping("findWeLiveTaskUserDetailTab")
- public AjaxResult findWeLiveTaskUserDetailTab(String liveId){
- WeLive weLive = iWeLiveService.getById(liveId);
- if(null != weLive){
- return AjaxResult.success(
- iWeLiveTipService.findWeLiveTaskUserDetailTab(liveId,weLive.getTargetType())
- );
- }
- return AjaxResult.success();
- }
- /**
- * 分享统计-员工详情(客户或客群)
- * @param userName 员工名称
- * @param liveId 直播id
- * @param sendTargetType 目标类型 发送目标1:客户;2:客群
- * @return
- */
- @GetMapping("/findWeLiveTaskUserDetail")
- public TableDataInfo findWeLiveTaskUserDetail(String userName, String liveId,@RequestParam(defaultValue = "1") Integer sendTargetType){
- startPage();
- return getDataTable(
- iWeLiveTipService.findWeLiveTaskUserDetail(userName, liveId, sendTargetType)
- );
- }
- /**
- * 分享统计-客户详情(客户或客群)
- * @param sendTargetType 目标类型 发送目标1:客户;2:客群
- * @param userName 员工名称
- * @param liveId 直播id
- * @param sendState 直播状态(0:预约中;1:直播中;2:已结束;3:已过期;4:已取消)
- * @return
- */
- @GetMapping("/findWeLiveTaskCustomerDetail")
- public TableDataInfo findWeLiveTaskCustomerDetail(Integer sendTargetType,String userName,String liveId,Integer sendState){
- startPage();
- return getDataTable(
- iWeLiveTipService.findWeLiveTaskCustomerDetail(sendTargetType,userName,liveId,sendState)
- );
- }
- /**
- * 获取观众列表
- * @param weLiveWatchUser
- * @return
- */
- @GetMapping("/weLiveWatchUser")
- public TableDataInfo findVisitorList(WeLiveWatchUser weLiveWatchUser){
- startPage();
- return getDataTable(
- iWeLiveWatchUserService.list(
- new LambdaQueryWrapper<WeLiveWatchUser>()
- .eq(weLiveWatchUser.getLiveId() !=null,WeLiveWatchUser::getLiveId,weLiveWatchUser.getLiveId())
- .eq(weLiveWatchUser.getWatchUserType()!=null,WeLiveWatchUser::getWatchUserType,weLiveWatchUser.getWatchUserType())
- )
- );
- }
- /**
- * 获取直播凭证
- * @param livingId
- * @param openId
- * @return
- */
- @GetMapping("/getLivingCode")
- public AjaxResult getLivingCode(String livingId,String openId){
- WeLinveUserVo weLinveUserVo=new WeLinveUserVo();
- WeLive weLive = iWeLiveService.getById(livingId);
- if(null != weLive){
- weLinveUserVo.setLiveCode(iWeLiveService.getLivingCode(weLive.getLivingId(), openId));
- }
- return AjaxResult.success(
- weLinveUserVo
- );
- }
- /**
- * 导出观看成员
- * @param watchUserType
- * @return
- */
- @GetMapping("/exprotWeLiveWatchUser")
- public AjaxResult exprotWeLiveWatchUser(Integer watchUserType,String liveId){
- LwExcelUtil.exprotForWeb(
- ServletUtils.getResponse(), WeLiveWatchUser.class,
- iWeLiveWatchUserService.list(
- new LambdaQueryWrapper<WeLiveWatchUser>()
- .eq(StringUtils.isNotEmpty(liveId),WeLiveWatchUser::getLiveId,liveId)
- .eq(watchUserType != null, WeLiveWatchUser::getWatchUserType, watchUserType)
- )
- ,"观看成员"
- );
- return AjaxResult.success();
- }
- /**
- * 同步发送结果
- * @param id
- * @return
- */
- @GetMapping("/synchExecuteResult/{id}")
- public AjaxResult synchExecuteResult(@PathVariable String id){
- iWeLiveService.synchExecuteResult(id);
- return AjaxResult.success();
- }
- }
|