2023年1月15日14:26:48

This commit is contained in:
小黄狗横扫士力架 2023-01-15 14:29:49 +08:00
parent be6a801bd1
commit d083fa2946
42 changed files with 1045 additions and 312 deletions

35
pom.xml
View File

@ -20,7 +20,8 @@
<java.version>1.8</java.version>
<mybatisplus.spring.boot.version>2.1.9</mybatisplus.spring.boot.version>
<mybatisplus.version>2.1.9</mybatisplus.version>
<mysql.version>5.1.38</mysql.version>
<!-- <mysql.version>5.1.38</mysql.version>-->
<mysql.version>8.0.26</mysql.version>
<druid.version>1.1.3</druid.version>
<quartz.version>2.3.0</quartz.version>
<commons.lang.version>2.6</commons.lang.version>
@ -33,7 +34,7 @@
<kaptcha.version>0.0.9</kaptcha.version>
<qiniu.version>[7.2.0, 7.2.99]</qiniu.version>
<aliyun.oss.version>3.10.2</aliyun.oss.version>
<qcloud.cos.version>4.4</qcloud.cos.version>
<qcloud.cos.version>5.6.8</qcloud.cos.version>
<swagger.version>2.9.2</swagger.version>
<joda.time.version>2.9.9</joda.time.version>
<lucene.version>7.7.0</lucene.version>
@ -100,6 +101,12 @@
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!--腾讯云存储依赖-->
<!-- <dependency>-->
<!-- <groupId>com.qcloud</groupId>-->
<!-- <artifactId>cos_api</artifactId>-->
<!-- <version>5.2.4</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
@ -274,10 +281,10 @@
<version>20170516</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
@ -314,7 +321,7 @@
<artifactId>core</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>com.github.tencentyun</groupId>
<artifactId>tls-sig-api</artifactId>
@ -325,6 +332,18 @@
<artifactId>IKAnalyzer-lucene</artifactId>
<version>8.0.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.qcloud</groupId>-->
<!-- <artifactId>cos_api</artifactId>-->
<!-- <version>5.6.97</version>-->
<!-- </dependency>-->
<!--腾讯云osssdk-->
<!-- <dependency>-->
<!-- <groupId>com.qcloud</groupId>-->
<!-- <artifactId>cos_api</artifactId>-->
<!-- <version>5.6.97</version>-->
<!-- </dependency>-->
</dependencies>
<build>
@ -353,7 +372,7 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>

View File

@ -1,6 +1,10 @@
package com.platform.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@ -14,5 +18,24 @@ public class CorsConfig extends WebMvcConfigurerAdapter {
.allowCredentials(true)
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.maxAge(3600);
}
}
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
final CorsConfiguration corsConfiguration = new CorsConfiguration();
/*是否允许请求带有验证信息*/
corsConfiguration.setAllowCredentials(true);
/*允许访问的客户端域名*/
corsConfiguration.addAllowedOrigin("*");
/*允许服务端访问的客户端请求头*/
corsConfiguration.addAllowedHeader("*");
/*允许访问的方法名,GET POST等*/
corsConfiguration.addAllowedMethod("*");
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(urlBasedCorsConfigurationSource);
}
}

View File

@ -63,6 +63,7 @@ public class ShiroConfig {
filterMap.put("/druid/**", "anon");
filterMap.put("/app/**", "anon");
filterMap.put("/test", "anon");
filterMap.put("/profile/**", "anon");
filterMap.put("/test/**", "anon");
filterMap.put("/sys/login", "anon");
filterMap.put("/video/**", "anon");

View File

@ -1,7 +1,9 @@
package com.platform.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import com.platform.modules.plm.util.ImageFileProperties;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@ -28,6 +30,7 @@ import java.util.List;
@EnableSwaggerBootstrapUI
public class SwaggerConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
@ -59,4 +62,4 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
.build();
}
}
}

View File

@ -3,10 +3,12 @@ package com.platform.modules.app.config;
import java.util.List;
import com.platform.modules.foreign.oauth2.ForeignOAuth2Interceptor;
import com.platform.modules.plm.util.ImageFileProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.platform.modules.app.interceptor.AuthorizationInterceptor;
@ -18,6 +20,8 @@ import com.platform.modules.qk.interceptor.CloudClipsAuthorizationInterceptor;
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
private ImageFileProperties imageFileProperties;
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired
@ -29,15 +33,23 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
registry.addInterceptor(qukanAuthorizationInterceptor).addPathPatterns("/api/cloud/clips/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/profile/**");
// registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
// registry.addInterceptor(qukanAuthorizationInterceptor).addPathPatterns("/api/cloud/clips/**");
// TODO 20190228 TROY 暂时只拦截列表详情页数据需要公开无法鉴权
registry.addInterceptor(foreignOAuth2Interceptor).addPathPatterns("/foreign/live/scene/list")
.addPathPatterns("/foreign/live/channel/list").addPathPatterns("/foreign/live/reporter/list").addPathPatterns("/foreign/live/task/allocation");
// registry.addInterceptor(foreignOAuth2Interceptor).addPathPatterns("/foreign/live/scene/list")
// .addPathPatterns("/foreign/live/channel/list").addPathPatterns("/foreign/live/reporter/list").addPathPatterns("/foreign/live/task/allocation");
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(loginUserHandlerMethodArgumentResolver);
}
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
/** 本地文件上传路径 */
registry.addResourceHandler("/profile/**")
.addResourceLocations("file:"+imageFileProperties.getImagePath()+"/");
}
}

View File

@ -86,7 +86,8 @@ public class AppLiveSceneController extends AppAbstractController {
@ApiImplicitParam(value = "标题图", name = "titleFile", dataType = "file"),
@ApiImplicitParam(value = "视频文件", name = "videoFile", dataType = "file")})
public R update(@ModelAttribute AppSceneEntityVo liveScene, Integer userId,
@RequestParam(value = "titleFile", required = false) MultipartFile titleFile, @RequestParam(value = "videoFile", required = false) MultipartFile videoFile) {
@RequestParam(value = "titleFile", required = false) MultipartFile titleFile,
@RequestParam(value = "videoFile", required = false) MultipartFile videoFile) {
if (userId == null || null == liveScene || liveScene.getId() == null || liveScene.getLiveEnd() == null
|| liveScene.getLiveStart() == null || StringUtils.isBlank(liveScene.getLivePosition())

View File

@ -9,9 +9,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.platform.modules.sys.controller.AbstractController;
import javax.servlet.http.HttpServletRequest;
import com.platform.modules.sys.service.SysTenantService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -44,7 +46,7 @@ import net.sf.json.JSONObject;
*/
@RestController
@RequestMapping("/foreign/live")
public class LiveForeignController {
public class LiveForeignController {
@Autowired
private LiveForeignService liveForeignService;
@ -92,6 +94,8 @@ public class LiveForeignController {
e.printStackTrace();
return R.error("信息不存在");
}
return R.ok().put("data", data);
}
@ -102,9 +106,13 @@ public class LiveForeignController {
return R.error("缺少必要参数");
}
PageUtils pu = liveForeignService.getReportList(sceneId, page, size, reverse);
return R.ok().put("data", pu);
}
//根据机构评论默认头像
String tenantUrl= sysTenantService.selectTenant(sceneId);
return R.ok().put("data", pu).put("tenantUrl",tenantUrl);
}
@Autowired
private SysTenantService sysTenantService;
@GetMapping("/comment/list")
@ResponseBody
public R commentList(Integer sceneId, Integer page, Integer size) {
@ -112,7 +120,9 @@ public class LiveForeignController {
return R.error("缺少必要参数");
}
List<CommentForeignEntity> list = liveForeignService.getCommentList(sceneId, page, size);
return R.ok().put("data", list);
//根据机构评论默认头像
String anonymousUrl= sysTenantService.selectAnonymousurl(sceneId);
return R.ok().put("data", list).put("anonymousUrl",anonymousUrl);
}
@GetMapping("/caster/streamsUrl")
@ -220,7 +230,7 @@ public class LiveForeignController {
return R.ok().put("data", reporterInterviewProcesses);
}
@SysLog("任务分配")
@PostMapping("/task/allocation")
public R taskAllocation(Integer[] reporterIds,Integer userId, MultipartFile mediaFile, Integer durationTime) {
@ -232,7 +242,7 @@ public class LiveForeignController {
return R.ok("success");
}
@GetMapping("/weixin/getJsApiTicket")
@ResponseBody
public R getWeixinJsApiTicket (String url) {
@ -246,7 +256,7 @@ public class LiveForeignController {
return R.error("验证信息获取失败");
}
JSONObject object = liveForeignService.getWeixinJsApiTicket(url);
if(object==null || object.isEmpty()){
return R.error("验证信息获取失败");
}

View File

@ -165,6 +165,7 @@ public class LiveForeignServiceImpl implements com.platform.modules.foreign.serv
String thumb = doc.get("thumb");
entity.put("thumb",
StringUtils.isNotBlank(thumb)
//图片压缩
? compressImage(MaterialUtils.getMaterialUrl(thumb, foreignProperties.getMediaurl()))
: "");
entity.put("title", doc.get("title"));
@ -364,10 +365,10 @@ public class LiveForeignServiceImpl implements com.platform.modules.foreign.serv
}
return new PageUtils(pageStore);
}
/**
* 获取分页列表数据
*
*
* @param sceneId
* 现场ID 必填
* @param page
@ -457,7 +458,7 @@ public class LiveForeignServiceImpl implements com.platform.modules.foreign.serv
liveCommentService.insert(comment);
return;
}
@Override
public JSONArray channeltList(){
@ -466,7 +467,7 @@ public class LiveForeignServiceImpl implements com.platform.modules.foreign.serv
/**
* 处理拼接图片资源路径
*
*
* @param imgsStr
* @return
*/
@ -590,31 +591,31 @@ public class LiveForeignServiceImpl implements com.platform.modules.foreign.serv
// 返回拼接压缩后地址
return sourceUrl + liveProperties.getCompressImage().getGeometricFormat();
}
/**
* 获取微信JS验证
*/
public JSONObject getWeixinJsApiTicket(String url){
JSONObject jsonObject = new JSONObject();
JsTicketApi jsTicketApi = new JsTicketApi(liveProperties.getWeixin().getAppId(), liveProperties.getWeixin().getAppSecret(), redisUtils);
String timeStamp = System.currentTimeMillis() / 1000 + "";
String nonceStr = StringKit.getRandomString(16);
String jsapi_ticket = jsTicketApi.getJsTicketFromRedis();
if(StringUtils.isBlank(jsapi_ticket)){
return null;
}
JsSignature signature = new JsSignature(nonceStr, jsapi_ticket, timeStamp, url);
String sign = JsSignKit.sign(signature);
jsonObject.put("appid", liveProperties.getWeixin().getAppId());
jsonObject.put("timeStamp", timeStamp);
jsonObject.put("nonceStr", nonceStr);
jsonObject.put("sign", sign);
jsonObject.put("url", url);
return jsonObject;
}
}

View File

@ -2,6 +2,7 @@ package com.platform.modules.live.controller;
import java.util.Map;
import com.platform.modules.live.service.LiveChannelTenantService;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -32,9 +33,9 @@ import springfox.documentation.annotations.ApiIgnore;
/**
* 现场栏目信息
*
*
* @author weiyan
* @email
* @email
* @date 2019-03-28 10:06:27
*/
@RestController
@ -43,7 +44,7 @@ import springfox.documentation.annotations.ApiIgnore;
public class LiveChannelController extends AbstractController{
@Autowired
private LiveChannelService liveChannelService;
/**
* 列表
*/
@ -57,11 +58,19 @@ public class LiveChannelController extends AbstractController{
@ApiResponses({@ApiResponse(code = HttpStatus.SC_OK, message = "success", response = LiveReportEntity.class, responseContainer = "List")})
public R list(@ApiIgnore @RequestParam(required = false) Map<String, Object> params){
params.put("isDelete", 0);
Long tenantId = getUser().getTenantId();
params.put("tenantId",tenantId);
PageUtils page = liveChannelService.page(params);
//济南报业查询所有
if (tenantId==1){
PageUtils pageall =liveChannelService.pageAll(params);
return R.ok().put("page", pageall);
}
return R.ok().put("page", page);
}
/**
* 信息
*/
@ -74,6 +83,8 @@ public class LiveChannelController extends AbstractController{
/**
* 保存
*/
@Autowired
private LiveChannelTenantService liveChannelTenantService;
@SysLog("保存栏目信息")
@PostMapping("/save")
@RequiresPermissions("live:channel:save")
@ -86,9 +97,14 @@ public class LiveChannelController extends AbstractController{
return R.error("栏目标识不能为空");
}
liveChannelService.save(liveChannel, getUserId());
//根据企业id保存对应的栏目
Long tenantId = getUser().getTenantId();
Integer channelId = liveChannel.getId();
liveChannelTenantService.saveByTenantId(tenantId,channelId);
return R.ok();
}
/**
* 修改
*/
@ -109,19 +125,23 @@ public class LiveChannelController extends AbstractController{
liveChannelService.update(liveChannel, getUserId());
return R.ok();
}
/**
* 删除
*/
@SysLog("删除栏目信息")
@PostMapping("/delete")
@RequiresPermissions("live:channel:delete")
@ApiOperation("删除栏目信息")
public R delete(Integer[] ids){
liveChannelService.deleteBatch(ids, getUserId());
//删除关联表live_channel_tenant 对应数据
liveChannelTenantService.deleteChannelTenantBatch(ids,getUserId());
return R.ok();
}
/**
* 显示
*/
@ -167,5 +187,5 @@ public class LiveChannelController extends AbstractController{
liveChannelService.priority(ids, prioritys, getUserId());
return R.ok();
}
}

View File

@ -2,6 +2,8 @@ package com.platform.modules.live.controller;
import java.util.Map;
import com.platform.modules.sys.controller.SysTenantController;
import com.platform.modules.sys.service.SysTenantService;
import org.apache.http.HttpStatus;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -30,9 +32,9 @@ import springfox.documentation.annotations.ApiIgnore;
/**
* 现场评论
*
*
* @author weiyan
* @email
* @email
* @date 2019-02-15 17:49:07
*/
@RestController
@ -41,11 +43,12 @@ import springfox.documentation.annotations.ApiIgnore;
public class LiveCommentController extends AbstractController{
@Autowired
private LiveCommentService liveCommentService;
/**
* 列表
*/
@Autowired
private SysTenantService sysTenantService;
@GetMapping("/list")
@RequiresPermissions("live:comment:list")
@ApiOperation("评论列表")
@ -59,10 +62,11 @@ public class LiveCommentController extends AbstractController{
public R list(@ApiIgnore @RequestParam(required = false) Map<String, Object> params){
params.put("isDelete", 0);
PageUtils page = liveCommentService.queryPageByParams(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@ -76,7 +80,7 @@ public class LiveCommentController extends AbstractController{
}
return R.ok().put("info", liveCommentService.info(id));
}
/**
* 保存
*/
@ -94,7 +98,7 @@ public class LiveCommentController extends AbstractController{
liveCommentService.save(liveComment, getUserId());
return R.ok();
}
/**
* 修改
*/
@ -114,7 +118,7 @@ public class LiveCommentController extends AbstractController{
liveCommentService.update(liveComment,getUserId());
return R.ok();
}
/**
* 删除
*/
@ -129,7 +133,7 @@ public class LiveCommentController extends AbstractController{
liveCommentService.deleteBatch(ids,getUserId());
return R.ok();
}
/**
* 发布
*/
@ -144,7 +148,7 @@ public class LiveCommentController extends AbstractController{
liveCommentService.releaseBatch(ids,getUserId());
return R.ok();
}
/**
* 取消发布
*/
@ -159,5 +163,5 @@ public class LiveCommentController extends AbstractController{
liveCommentService.cancelReleaseBatch(ids,getUserId());
return R.ok();
}
}

View File

@ -8,6 +8,7 @@ import com.platform.modules.live.entity.LiveReportEntity;
import com.platform.modules.live.service.LiveReportService;
import com.platform.modules.live.utils.ReportTypeEnum;
import com.platform.modules.sys.controller.AbstractController;
import com.platform.modules.sys.service.SysTenantService;
import io.swagger.annotations.*;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
@ -22,9 +23,9 @@ import java.util.Map;
/**
* 直播报道
*
*
* @author weiyan
* @email
* @email
* @date 2019-01-19 12:13:39
*/
@RestController
@ -33,10 +34,12 @@ import java.util.Map;
public class LiveReportController extends AbstractController{
@Autowired
private LiveReportService liveReportService;
/**
* 列表
*/
@Autowired
private SysTenantService sysTenantService;
@GetMapping("/list")
@RequiresPermissions("live:report:list")
@ApiOperation("报道列表")
@ -50,10 +53,13 @@ public class LiveReportController extends AbstractController{
public R list(@ApiIgnore @RequestParam(required = false) Map<String, Object> params){
params.put("isDelete", 0);
PageUtils page = liveReportService.queryPageByParams(params, false);
return R.ok().put("page", page);
}
/**
* 信息
*/
@ -64,7 +70,7 @@ public class LiveReportController extends AbstractController{
public R info(@RequestParam("id")Integer id){
return R.ok().put("info", liveReportService.info(id));
}
/**
* 保存
*/
@ -90,7 +96,7 @@ public class LiveReportController extends AbstractController{
liveReportService.save(liveReport, getUserId());
return R.ok();
}
/**
* 修改
*/
@ -121,7 +127,7 @@ public class LiveReportController extends AbstractController{
}
return R.ok();
}
/**
* 删除
*/
@ -137,7 +143,7 @@ public class LiveReportController extends AbstractController{
liveReportService.deleteBatch(ids, getUserId());
return R.ok();
}
/**
* 发布
*/
@ -153,7 +159,7 @@ public class LiveReportController extends AbstractController{
liveReportService.releaseBatch(ids,getUserId());
return R.ok();
}
/**
* 取消发布
*/
@ -169,7 +175,7 @@ public class LiveReportController extends AbstractController{
liveReportService.cancelReleaseBatch(ids, getUserId());
return R.ok();
}
/**
* 置顶
*/

View File

@ -44,9 +44,9 @@ import java.util.Map;
/**
* 现场表
*
*
* @author TROY
* @email
* @email
* @date 2019-01-19 14:50:50
*/
@RestController
@ -82,8 +82,8 @@ public class LiveSceneController extends AbstractController {
return R.ok().put("page", page);
}
}
/**
* 信息
*/
@ -125,7 +125,7 @@ public class LiveSceneController extends AbstractController {
return R.ok("现场保存成功");
}
/**
* 修改
*/
@ -213,7 +213,7 @@ public class LiveSceneController extends AbstractController {
}
return R.ok();
}
@SysLog("现场开播")
@PostMapping("/startLive")
@RequiresPermissions("live:livescene:startLive")
@ -482,7 +482,7 @@ public class LiveSceneController extends AbstractController {
}
return r;
}
/**
* 置顶
*/
@ -525,13 +525,24 @@ public class LiveSceneController extends AbstractController {
liveSceneService.priority(ids, prioritys, getUserId());
return R.ok();
}
@GetMapping("/channels")
@ApiOperation(value = "获取所有栏目", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiresPermissions("live:livescene:channels")
public R channels(Integer sid){
// return R.ok().put("list", liveChannelService.getAllList());
return R.ok().put("list", liveChannelService.getAllChannel());
//return R.ok().put("list", liveChannelService.getAllChannel());
//获取对应机构下的栏目
Long tenantId= getUser().getTenantId();
if (tenantId==1){
return R.ok().put("list", liveChannelService.getAllList());
}else {
return R.ok().put("list",liveChannelService.getAllChannelByTenant(tenantId));
}
}
@Autowired
@ -572,7 +583,7 @@ public class LiveSceneController extends AbstractController {
}
return null;
}
@SysLog("现场还原")
@PostMapping("/cycle/recycle")
@RequiresPermissions("live:livescene:cycle:recycle")
@ -584,7 +595,7 @@ public class LiveSceneController extends AbstractController {
liveSceneService.recycle(ids);
return R.ok();
}
@SysLog("现场彻底删除")
@PostMapping("/cycle/delete")
@RequiresPermissions("live:livescene:cycle:delete")

View File

@ -1,5 +1,8 @@
package com.platform.modules.live.controller;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.StorageClass;
import com.aliyuncs.auth.BasicSessionCredentials;
import com.platform.common.annotation.SysLog;
import com.platform.common.utils.FileUtils;
import com.platform.common.utils.R;
@ -7,9 +10,19 @@ import com.platform.common.utils.RedisKeys;
import com.platform.common.utils.RedisUtils;
import com.platform.modules.live.service.LiveMultimediaSyncService;
import com.platform.modules.plm.entity.PlmChunkEntity;
import com.platform.modules.plm.util.ImageFileProperties;
import com.platform.modules.plm.util.MateriaFileProperties;
import com.platform.modules.plm.util.MaterialUtils;
import com.platform.modules.video.service.RealPathResolver;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.model.PutObjectRequest;
import com.qcloud.cos.model.PutObjectResult;
import com.qcloud.cos.region.Region;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -17,6 +30,7 @@ import org.apache.http.HttpStatus;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -24,100 +38,187 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Calendar;
import java.util.UUID;
@RestController
@Api(value = "资源上传", tags = "资源上传")
@Slf4j
public class MediaUploadController {
@Autowired
private MateriaFileProperties materiaFileProperties;
@Autowired
private RealPathResolver realPathResolver;
@Autowired
private RedisUtils redisUtils;
@SysLog("资源上传")
@PostMapping("/common/upload_media")
@ApiOperation("资源上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "materialFile", value = "上传文件", paramType = "update", dataType = "file")})
@ApiResponses({@ApiResponse(code = HttpStatus.SC_OK, message = "success")})
public R save(@RequestParam("materialFile") MultipartFile materialFile){
try {
String newCoverName = FileUtils.createFileName() + "." + FileUtils.getSuffix(materialFile.getOriginalFilename());
String serverCoverPath = materiaFileProperties.getMediaPath() + "/" + MaterialUtils.getDateDir() +"/" + newCoverName;
String newCoverPath = materiaFileProperties.getMateriaPath() + serverCoverPath;
FileUtils.copy(materialFile.getInputStream(), realPathResolver.get(newCoverPath));
return R.ok("资源上传成功").put("fileUrl", serverCoverPath);
} catch (Exception e) {
return R.error("资源上传失败");
}
}
@PostMapping("/common/upload_media/chunk")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R uploadChunk(PlmChunkEntity chunk) {
if (null==chunk || null==chunk.getFile() || StringUtils.isBlank(chunk.getIdentifier())
|| null==chunk.getChunkNumber()) {
return R.error("缺少必要参数");
}
String key = RedisKeys.getUploadMediaKey() + chunk.getIdentifier();
String field = chunk.getIdentifier()+"#"+chunk.getChunkNumber();
// 续传判断
if (redisUtils.hexists(key, field)) {
return R.ok("文件块上传成功");
}
MultipartFile file = chunk.getFile();
String uploadFolder = materiaFileProperties.getMateriaPath() + materiaFileProperties.getMediaPath() + "/" +
MaterialUtils.getDateDir() +"/";
try {
byte[] bytes = file.getBytes();
Path path = Paths.get(MaterialUtils.generatePath(uploadFolder, chunk));
//文件写入指定路径
Files.write(path, bytes);
// Redis状态存储
redisUtils.hset(key, field, field);
return R.ok("文件块上传成功");
} catch (Exception e) {
e.printStackTrace();
return R.error("系统异常");
}
}
@Autowired
private MateriaFileProperties materiaFileProperties;
@Autowired
private ImageFileProperties imageFileProperties;
@Autowired
private RealPathResolver realPathResolver;
@Autowired
private RedisUtils redisUtils;
@GetMapping("/common/upload_media/chunk")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R checkChunk(PlmChunkEntity chunk, HttpServletResponse response) {
String key = chunk.getIdentifier()+"#"+chunk.getChunkNumber();
String desc = "文件已存在";
if (!redisUtils.hexists(RedisKeys.getUploadMediaKey() + chunk.getIdentifier(), key)) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
desc = "文件不存在";
}
return R.ok(desc);
}
@PostMapping("/common/upload_media/merge")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R mergeFile(String filename, String identifier) {
String uploadFolder = materiaFileProperties.getMateriaPath() + materiaFileProperties.getMediaPath() + "/" +
MaterialUtils.getDateDir();
String file = uploadFolder + "/" + identifier + "/" + filename;
String folder = uploadFolder + "/" + identifier;
try {
MaterialUtils.merge(file, folder, filename);
redisUtils.delete(RedisKeys.getUploadMediaKey() + identifier);
} catch (Exception e) {
e.printStackTrace();
// 合并异常后分片数据可能全部丢失
redisUtils.delete(RedisKeys.getUploadMediaKey() + identifier);
return R.error("文件上传失败");
}
return R.ok("文件上传成功");
}
@Value("${spring.tengxun.accessKey}")
private String accessKey;
@Value("${spring.tengxun.secretKey}")
private String secretKey;
@Value("${spring.tengxun.bucket}")
private String bucket;
@Value("${spring.tengxun.bucketName}")
private String bucketName;
@Value("${spring.tengxun.path}")
private String path;
// @Value("${spring.tengxun.qianzui}")
// private String qianzui;
// @SysLog("资源上传")
// @PostMapping("/common/upload_media")
// @ApiOperation("资源上传")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "materialFile", value = "上传文件", paramType = "update", dataType = "file")})
// @ApiResponses({@ApiResponse(code = HttpStatus.SC_OK, message = "success")})
// public R save(@RequestParam("materialFile") MultipartFile materialFile) {
// try {
// String newCoverName = FileUtils.createFileName() + "." + FileUtils.getSuffix(materialFile.getOriginalFilename());
// String serverCoverPath = materiaFileProperties.getMediaPath() + "/" + MaterialUtils.getDateDir() + "/" + newCoverName;
// String newCoverPath = materiaFileProperties.getMateriaPath() + serverCoverPath;
// FileUtils.copy(materialFile.getInputStream(), realPathResolver.get(newCoverPath));
// return R.ok("资源上传成功").put("fileUrl", serverCoverPath);
// } catch (Exception e) {
//
// return R.error("资源上传失败");
// }
// }
// @SysLog("图片资源上传")
// @PostMapping("/common/upload_image")
// @ApiOperation("图片资源上传")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "materialFile", value = "上传文件", paramType = "update", dataType = "file")})
// @ApiResponses({@ApiResponse(code = HttpStatus.SC_OK, message = "success")})
// public R saveImages(@RequestParam("materialFile") MultipartFile materialFile){
// try {
// String newCoverName = FileUtils.createFileName() + "." + FileUtils.getSuffix(materialFile.getOriginalFilename());
// String serverCoverPath = imageFileProperties.getImagePath() + "/" + MaterialUtils.getDateDir() +"/" + newCoverName;
// String filePath = "/profile/" + MaterialUtils.getDateDir() +"/" + newCoverName;
// FileUtils.copy(materialFile.getInputStream(), realPathResolver.get(serverCoverPath));
// return R.ok("资源上传成功").put("imageUrl", filePath);
// } catch (Exception e) {
//
// return R.error("资源上传失败");
// }
// }
//上传到腾讯云oss
@PostMapping("/common/upload_media/chunk")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R uploadChunk(PlmChunkEntity chunk) {
if (null == chunk || null == chunk.getFile() || StringUtils.isBlank(chunk.getIdentifier())
|| null == chunk.getChunkNumber()) {
return R.error("缺少必要参数");
}
String key = RedisKeys.getUploadMediaKey() + chunk.getIdentifier();
String field = chunk.getIdentifier() + "#" + chunk.getChunkNumber();
// 续传判断
if (redisUtils.hexists(key, field)) {
return R.ok("文件块上传成功");
}
MultipartFile file = chunk.getFile();
String uploadFolder = materiaFileProperties.getMateriaPath() + materiaFileProperties.getMediaPath() + "/" +
MaterialUtils.getDateDir() + "/";
try {
byte[] bytes = file.getBytes();
Path path = Paths.get(MaterialUtils.generatePath(uploadFolder, chunk));
//文件写入指定路径
Files.write(path, bytes);
// Redis状态存储
redisUtils.hset(key, field, field);
return R.ok("文件块上传成功");
} catch (Exception e) {
e.printStackTrace();
return R.error("系统异常");
}
}
@GetMapping("/common/upload_media/chunk")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R checkChunk(PlmChunkEntity chunk, HttpServletResponse response) {
String key = chunk.getIdentifier() + "#" + chunk.getChunkNumber();
String desc = "文件已存在";
if (!redisUtils.hexists(RedisKeys.getUploadMediaKey() + chunk.getIdentifier(), key)) {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
desc = "文件不存在";
}
return R.ok(desc);
}
@PostMapping("/common/upload_media/merge")
@RequiresPermissions(value = {"live:multimedia:save", "live:multimedia:update"}, logical = Logical.OR)
public R mergeFile(String filename, String identifier) {
String uploadFolder = materiaFileProperties.getMateriaPath() + materiaFileProperties.getMediaPath() + "/" +
MaterialUtils.getDateDir();
String file = uploadFolder + "/" + identifier + "/" + filename;
String folder = uploadFolder + "/" + identifier;
try {
MaterialUtils.merge(file, folder, filename);
redisUtils.delete(RedisKeys.getUploadMediaKey() + identifier);
} catch (Exception e) {
e.printStackTrace();
// 合并异常后分片数据可能全部丢失
redisUtils.delete(RedisKeys.getUploadMediaKey() + identifier);
return R.error("文件上传失败");
}
return R.ok("文件上传成功");
}
@SysLog("图片资源上传")
@PostMapping("/common/upload_media")
@ApiOperation("图片资源上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "materialFile", value = "上传文件", paramType = "update", dataType = "file")})
@ApiResponses({@ApiResponse(code = HttpStatus.SC_OK, message = "success")})
public R saveImages(@RequestParam("materialFile") MultipartFile file) {
if (file == null) {
return R.error("文件為空");
}
String oldFileName = file.getOriginalFilename();
String eName = oldFileName.substring(oldFileName.lastIndexOf("."));
String newFileName = UUID.randomUUID() + eName;
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DATE);
// 1 初始化用户身份信息(secretId, secretKey)
COSCredentials cred = new BasicCOSCredentials(accessKey, secretKey);
// 2 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
final Region region = new Region(bucket);
ClientConfig clientConfig = new ClientConfig(region);
// 3 生成cos客户端
COSClient cosclient = new COSClient(cred, clientConfig);
// bucket的命名规则为{name}-{appid} 此处填写的存储桶名称必须为此格式
String bucketName = this.bucketName;
// 简单文件上传, 最大支持 5 GB, 适用于小文件上传, 建议 20 M 以下的文件使用该接口
// 大文件上传请参照 API 文档高级 API 上传
File localFile = null;
try {
localFile = File.createTempFile("temp", null);
file.transferTo(localFile);
// 指定要上传到 COS 上的路径
String key = "/" + "/" + year + "/" + month + "/" + day + "/" + newFileName;
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, localFile);
PutObjectResult putObjectResult = cosclient.putObject(putObjectRequest);
// return new UploadMsg(1,"上传成功",this.path + putObjectRequest.getKey());
String url = this.path + putObjectRequest.getKey();
return R.ok().put("url", url);
} catch (IOException e) {
return R.error("上传失败");
} finally {
// 关闭客户端(关闭后台线程)
cosclient.shutdown();
}
}
}

View File

@ -8,18 +8,23 @@ import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.platform.modules.live.entity.LiveChannelEntity;
import org.apache.ibatis.annotations.Param;
/**
* 现场栏目信息
*
*
* @author weiyan
* @email
* @email
* @date 2019-03-28 10:06:27
*/
@Mapper
public interface LiveChannelDao extends BaseMapper<LiveChannelEntity> {
List<LiveChannelEntity> queryPageMap(Page<Map<String, Object>> page, Map<String, Object> params);
void save(LiveChannelEntity liveChannel);
List<LiveChannelEntity> getAllChannelByTenant(@Param("tenantId") Long tenantId);
List<LiveChannelEntity> queryPageMapAll(Page<Map<String, Object>> page, Map<String, Object> params);
}

View File

@ -0,0 +1,26 @@
package com.platform.modules.live.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.platform.modules.live.entity.LiveChannelEntity;
import com.platform.modules.live.entity.LiveChannelTenantEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 现场栏目信息
*
* @author weiyan
* @email
* @date 2019-03-28 10:06:27
*/
@Mapper
public interface LiveChannelTenantDao extends BaseMapper<LiveChannelTenantEntity> {
void save(@Param("tenantId") Long tenantId, @Param("channelId") Integer channelId);
void deleteChannelTenantBatch(@Param("ids") Integer[] ids);
}

View File

@ -0,0 +1,37 @@
package com.platform.modules.live.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 现场栏目信息
*
* @author weiyan
* @email
* @date 2019-03-28 10:06:27
*/
@TableName("live_channel_tenant")
@Data
public class LiveChannelTenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Integer id;
/**
* 栏目id
*/
private Integer channelId;
/**
* 机构id
*/
private Integer tenantId;
}

View File

@ -10,15 +10,15 @@ import net.sf.json.JSONArray;
/**
* 现场栏目信息
*
*
* @author weiyan
* @email
* @email
* @date 2019-03-28 10:06:27
*/
public interface LiveChannelService extends IService<LiveChannelEntity> {
PageUtils page(Map<String, Object> params);
JSONArray getAllList();
void save(LiveChannelEntity liveChannel, Long userId);
@ -26,18 +26,26 @@ public interface LiveChannelService extends IService<LiveChannelEntity> {
void update(LiveChannelEntity liveChannel, Long userId);
void deleteBatch(Integer[] ids, Long userId);
void displayBatch(Integer[] ids, Long userId);
void cancelDisplayBatch(Integer[] ids, Long userId);
void priority(Integer[] ids,Integer[] prioritys,Long userId);
JSONArray getRedisCache();
/**
* 后台获取所有栏目
* */
JSONArray getAllChannel();
/**
* 后台获取对应机构的栏目
* @param tenantId
* @return
*/
JSONArray getAllChannelByTenant(Long tenantId);
PageUtils pageAll(Map<String, Object> params);
}

View File

@ -0,0 +1,24 @@
package com.platform.modules.live.service;
import com.baomidou.mybatisplus.service.IService;
import com.platform.common.utils.PageUtils;
import com.platform.modules.live.entity.LiveChannelEntity;
import com.platform.modules.live.entity.LiveChannelTenantEntity;
import net.sf.json.JSONArray;
import java.util.Map;
/**
* 现场栏目信息
*
* @author weiyan
* @email
* @date 2019-03-28 10:06:27
*/
public interface LiveChannelTenantService extends IService<LiveChannelTenantEntity> {
//根据企业id保存对应的栏目
void saveByTenantId(Long tenantId, Integer channelId);
////删除关联表live_channel_tenant 对应数据
void deleteChannelTenantBatch(Integer[] ids, Long userId);
}

View File

@ -287,4 +287,56 @@ public class LiveChannelServiceImpl extends ServiceImpl<LiveChannelDao, LiveChan
return jsonArray;
}
@Autowired
private LiveChannelDao liveChannelDao;
@Override
public JSONArray getAllChannelByTenant(Long tenantId) {
List<LiveChannelEntity> channels =liveChannelDao.getAllChannelByTenant(tenantId);
if (null == channels || channels.size() == 0)
return null;
JSONArray jsonArray = new JSONArray();
channels.forEach(channel -> {
JSONObject json = new JSONObject();
json.put("id", channel.getId());
json.put("name", channel.getName());
jsonArray.add(json);
});
return jsonArray;
}
@Override
public PageUtils pageAll(Map<String, Object> params) {
//检索记录
int current = ConverterUtils.parseInt(params.get("page"));
int limit = ConverterUtils.parseInt(params.get("limit"));
Page<Map<String, Object>> page = new Page<>(current, limit);
List<LiveChannelEntity> pageList = this.baseMapper.queryPageMapAll(page, params);
List<Map<String, Object>> list = new ArrayList<>();
if(pageList!=null && pageList.size()>0){
for(int i=0;i<pageList.size();i++){
Map<String, Object> map = new HashMap<>();
LiveChannelEntity bean = pageList.get(i);
if(bean==null){
continue;
}
map.put("id", bean.getId());
map.put("name", bean.getName());
map.put("priority", bean.getPriority());
map.put("identify", bean.getIdentify());
map.put("isDisplay", bean.getIsDisplay());
map.put("creatorUserName", bean.getCreatorUserName());
map.put("lastUpdateUserName", bean.getLastUpdateUserName());
list.add(map);
}
}
page.setRecords(list);
return new PageUtils(page);
}
}

View File

@ -0,0 +1,32 @@
package com.platform.modules.live.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.platform.modules.live.dao.LiveChannelTenantDao;
import com.platform.modules.live.entity.LiveChannelTenantEntity;
import com.platform.modules.live.service.LiveChannelTenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("LiveChannelTenantService")
@Transactional
public class LiveChannelTenantServiceImpl extends ServiceImpl<LiveChannelTenantDao,LiveChannelTenantEntity> implements LiveChannelTenantService {
@Autowired
private LiveChannelTenantDao liveChannelTenantDao;
@Override
public void saveByTenantId(Long tenantId, Integer channelId) {
liveChannelTenantDao.save(tenantId,channelId);
}
@Override
public void deleteChannelTenantBatch(Integer[] ids, Long userId) {
liveChannelTenantDao.deleteChannelTenantBatch(ids);
}
}

View File

@ -9,7 +9,7 @@ import java.net.URL;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -299,7 +299,15 @@ public class LiveMultimediaServiceImpl extends ServiceImpl<LiveMultimediaDao, Li
try {
if (mediaFile != null && liveMultimedia.getMediaType() != null && (liveMultimedia.getMediaType() == 3 || liveMultimedia.getMediaType().equals(3))) {
liveMultimedia.setOriFileName(mediaFile.getOriginalFilename());
UploadImageResponse response = liveClient.liveUploadToVoD().uploadImageStream(liveMultimedia.getTitle(), mediaFile.getOriginalFilename(), mediaFile.getInputStream(), "default", mediaFile.getOriginalFilename().substring(mediaFile.getOriginalFilename().lastIndexOf(".") + 1), liveMultimedia.getTags(), false, null);
UploadImageResponse response = liveClient.liveUploadToVoD()
.uploadImageStream
(liveMultimedia.getTitle(),
mediaFile.getOriginalFilename(),
mediaFile.getInputStream(),
"default",
mediaFile.getOriginalFilename()
.substring(mediaFile.getOriginalFilename().lastIndexOf(".") + 1),
liveMultimedia.getTags(), false, null);
if (response.isSuccess()) {
liveMultimedia.setMediaId(response.getImageId());
liveMultimedia.setRequestId(response.getRequestId());
@ -534,7 +542,7 @@ public class LiveMultimediaServiceImpl extends ServiceImpl<LiveMultimediaDao, Li
}
}
}
@Override
public void videoAnalysisComplete(String videoId, Integer mediaWidth, Integer mediaHeight, Float mediaDuration, String mediaBitrate, String mediaFps, Long mediaSize) {
if (StringUtils.isBlank(videoId)) {
@ -1074,7 +1082,7 @@ public class LiveMultimediaServiceImpl extends ServiceImpl<LiveMultimediaDao, Li
wrapper.eq("media_url", mediaUrl);
return this.selectOne(wrapper);
}
@Override
public void saveToLocal(String videoUrl,String title, HttpServletResponse response){
InputStream is = null;
@ -1092,7 +1100,7 @@ public class LiveMultimediaServiceImpl extends ServiceImpl<LiveMultimediaDao, Li
con.connect();
// 输入流
is = con.getInputStream();
String fileName = (StringUtils.isBlank(title)? new Date().getTime() : title)+"."+videoUrl.substring(videoUrl.lastIndexOf(".")+1);
String fileName = (StringUtils.isBlank(title)? new Date().getTime() : title)+"."+videoUrl.substring(videoUrl.lastIndexOf(".")+1);
response.setContentType("application/force-download;charset=UTF-8");
// response.setCharacterEncoding("utf-8");
// response.setHeader("Content-disposition", "attachment;filename="+URLEncoder.encode(fileName, "UTF-8"));

View File

@ -25,7 +25,7 @@ import com.platform.modules.live.service.TranscodingTaskService;
import com.platform.modules.live.utils.AliMediaUtils;
import com.platform.modules.live.thread.TranscodingTaskThread;
import com.platform.modules.live.utils.RSAUtils;
import com.platform.modules.oss.cloud.CloudStorageConfig;
import com.platform.modules.oss.cloud.CloudStorageService;
import com.platform.modules.oss.cloud.OSSFactory;
import com.platform.modules.sys.entity.SysUserEntity;
@ -442,4 +442,4 @@ public class TranscodingTaskServiceImpl implements TranscodingTaskService {
return outputs.toJSONString();
}
}
}

View File

@ -1,3 +1,4 @@
package com.platform.modules.oss.cloud;
@ -5,9 +6,16 @@ import com.platform.common.utils.ConfigConstant;
import com.platform.common.utils.Constant;
import com.platform.common.utils.SpringContextUtils;
import com.platform.modules.sys.service.SysConfigService;
import com.platform.common.utils.ConfigConstant;
import com.platform.modules.oss.cloud.CloudStorageConfig;
import com.platform.modules.oss.cloud.CloudStorageService;
//import com.platform.modules.oss.cloud.QcloudCloudStorageService;
import com.platform.modules.oss.cloud.QiniuCloudStorageService;
/**
* 文件上传Factory
*
* @author Mark sunlightcs@gmail.com
*/
public final class OSSFactory {
private static SysConfigService sysConfigService;
@ -25,7 +33,7 @@ public final class OSSFactory {
}else if(config.getType() == Constant.CloudService.ALIYUN.getValue()){
return new AliyunCloudStorageService(config);
}else if(config.getType() == Constant.CloudService.QCLOUD.getValue()){
return new QcloudCloudStorageService(config);
// return new QcloudCloudStorageService(config);
}
return null;

View File

@ -1,96 +1,96 @@
package com.platform.modules.oss.cloud;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.request.UploadFileRequest;
import com.qcloud.cos.sign.Credentials;
import com.platform.common.exception.RRException;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import java.io.*;
/**
* 腾讯云存储
*/
public class QcloudCloudStorageService extends CloudStorageService {
private COSClient client;
public QcloudCloudStorageService(CloudStorageConfig config){
this.config = config;
//初始化
init();
}
private void init(){
Credentials credentials = new Credentials(config.getQcloudAppId(), config.getQcloudSecretId(),
config.getQcloudSecretKey());
//初始化客户端配置
ClientConfig clientConfig = new ClientConfig();
//设置bucket所在的区域华南gz 华北tj 华东sh
clientConfig.setRegion(config.getQcloudRegion());
client = new COSClient(clientConfig, credentials);
}
@Override
public String upload(byte[] data, String path) {
//腾讯云必需要以"/"开头
if(!path.startsWith("/")) {
path = "/" + path;
}
//上传到腾讯云
UploadFileRequest request = new UploadFileRequest(config.getQcloudBucketName(), path, data);
String response = client.uploadFile(request);
JSONObject jsonObject = JSONObject.fromObject(response);
if(jsonObject.getInt("code") != 0) {
throw new RRException("文件上传失败," + jsonObject.getString("message"));
}
return config.getQcloudDomain() + path;
}
@Override
public String upload(InputStream inputStream, String path) {
try {
byte[] data = IOUtils.toByteArray(inputStream);
return this.upload(data, path);
} catch (IOException e) {
throw new RRException("上传文件失败", e);
}
}
@Override
public String uploadSuffix(byte[] data, String suffix) {
return upload(data, getPath(config.getQcloudPrefix(), suffix));
}
@Override
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getQcloudPrefix(), suffix));
}
public static void main(String[] args) throws IOException {
Credentials credentials = new Credentials(1253189972, "AKIDbOF2iQuzOqsqnZ97wZ0JRN9jV7f2YERU",
"qa8h7Yq0BFHBD9vdBZmnhQxqmX7XHrKi");
//初始化客户端配置
ClientConfig clientConfig = new ClientConfig();
//设置bucket所在的区域华南gz 华北tj 华东sh
clientConfig.setRegion("ap-beijing");
COSClient client = new COSClient(clientConfig, credentials);
UploadFileRequest request = new UploadFileRequest("face-xhs-1253189972", "/test.jpg",
IOUtils.toByteArray(new FileInputStream(new File("d:/test.jpg"))));
String response = client.uploadFile(request);
System.out.println(response);
}
}
//package com.platform.modules.oss.cloud;
//
//
//import com.qcloud.cos.COSClient;
//import com.qcloud.cos.ClientConfig;
//import com.qcloud.cos.request.UploadFileRequest;
//import com.qcloud.cos.sign.Credentials;
//import com.platform.common.exception.RRException;
//import net.sf.json.JSONObject;
//import org.apache.commons.io.IOUtils;
//
//import java.io.*;
//
///**
// * 腾讯云存储
// */
//public class QcloudCloudStorageService extends CloudStorageService {
// private COSClient client;
//
// public QcloudCloudStorageService(CloudStorageConfig config){
// this.config = config;
//
// //初始化
// init();
// }
//
// private void init(){
// Credentials credentials = new Credentials(config.getQcloudAppId(), config.getQcloudSecretId(),
// config.getQcloudSecretKey());
//
// //初始化客户端配置
// ClientConfig clientConfig = new ClientConfig();
// //设置bucket所在的区域华南gz 华北tj 华东sh
// clientConfig.setRegion(config.getQcloudRegion());
//
// client = new COSClient(clientConfig, credentials);
// }
//
// @Override
// public String upload(byte[] data, String path) {
// //腾讯云必需要以"/"开头
// if(!path.startsWith("/")) {
// path = "/" + path;
// }
//
// //上传到腾讯云
// UploadFileRequest request = new UploadFileRequest(config.getQcloudBucketName(), path, data);
// String response = client.uploadFile(request);
//
// JSONObject jsonObject = JSONObject.fromObject(response);
// if(jsonObject.getInt("code") != 0) {
// throw new RRException("文件上传失败," + jsonObject.getString("message"));
// }
//
// return config.getQcloudDomain() + path;
// }
//
// @Override
// public String upload(InputStream inputStream, String path) {
// try {
// byte[] data = IOUtils.toByteArray(inputStream);
// return this.upload(data, path);
// } catch (IOException e) {
// throw new RRException("上传文件失败", e);
// }
// }
//
// @Override
// public String uploadSuffix(byte[] data, String suffix) {
// return upload(data, getPath(config.getQcloudPrefix(), suffix));
// }
//
// @Override
// public String uploadSuffix(InputStream inputStream, String suffix) {
// return upload(inputStream, getPath(config.getQcloudPrefix(), suffix));
// }
//
// public static void main(String[] args) throws IOException {
// Credentials credentials = new Credentials(1253189972, "AKIDbOF2iQuzOqsqnZ97wZ0JRN9jV7f2YERU",
// "qa8h7Yq0BFHBD9vdBZmnhQxqmX7XHrKi");
//
// //初始化客户端配置
// ClientConfig clientConfig = new ClientConfig();
// //设置bucket所在的区域华南gz 华北tj 华东sh
// clientConfig.setRegion("ap-beijing");
//
// COSClient client = new COSClient(clientConfig, credentials);
//
//
// UploadFileRequest request = new UploadFileRequest("face-xhs-1253189972", "/test.jpg",
// IOUtils.toByteArray(new FileInputStream(new File("d:/test.jpg"))));
// String response = client.uploadFile(request);
//
// System.out.println(response);
// }
//}

View File

@ -12,6 +12,7 @@ import com.platform.common.validator.ValidatorUtils;
import com.platform.common.validator.group.AliyunGroup;
import com.platform.common.validator.group.QiniuGroup;
import com.platform.modules.oss.cloud.CloudStorageConfig;
import com.platform.modules.oss.cloud.OSSFactory;
import com.platform.modules.oss.entity.SysOssEntity;
import com.platform.modules.oss.service.SysOssService;
@ -37,7 +38,7 @@ public class SysOssController {
private SysConfigService sysConfigService;
private final static String KEY = ConfigConstant.CLOUD_STORAGE_CONFIG_KEY;
/**
* 列表
*/
@ -86,7 +87,7 @@ public class SysOssController {
return R.ok();
}
/**
* 上传文件

View File

@ -0,0 +1,68 @@
//
//package com.platform.modules.plm.util;
//
//import lombok.Data;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.ServletContextAware;
//
//import javax.servlet.ServletContext;
//import java.io.Serializable;
//
//@Component
//@ConfigurationProperties(prefix = "tencent", ignoreInvalidFields = true, ignoreUnknownFields = true)
//public class CosUtilProperties implements Serializable {
// private static String appId;
//
// private static String secretId;
//
// private static String secretKey;
//
// private static String region;
//
// private static String photoBucket;
//
// //注入值
// @Value("${tencent.appId}")
// public void setAppId(String appId) {
// this.appId = appId;
// }
// @Value("${tencent.secretId}")
// public void setSecretId(String secretId) {
// this.secretId = secretId;
// }
// @Value("${tencent.secretKey}")
// public void setSecretKey(String secretKey) {
// this.secretKey = secretKey;
// }
// @Value("${tencent.region}")
// public void setRegion(String region) {
// this.region = region;
// }
// @Value("${tencent.photoBucket}")
// public void setPhotoBucket(String photoBucket) {
// this.photoBucket = photoBucket;
// }
// @Value("${tencent.appId}")
// public static String getAppId() {
// return appId;
// }
// @Value("${tencent.secretId}")
// public static String getSecretId() {
// return secretId;
// }
// @Value("${tencent.secretKey}")
// public static String getSecretKey() {
// return secretKey;
// }
// @Value("${tencent.region}")
// public static String getRegion() {
// return region;
// }
// @Value("${tencent.photoBucket}")
// public static String getPhotoBucket() {
// return photoBucket;
// }
//}
//

View File

@ -0,0 +1,45 @@
package com.platform.modules.plm.util;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.web.context.ServletContextAware;
import javax.servlet.ServletContext;
@ConfigurationProperties(prefix = "image")
@Component
public class ImageFileProperties implements ServletContextAware{
public String imagePath;
private String baseSavePath;
public String getImagePath() {
return imagePath;
}
public void setImagePath(String imagePath) {
this.imagePath = imagePath;
}
public String getBaseSavePath() {
return baseSavePath;
}
public void setBaseSavePath(String baseSavePath) {
this.baseSavePath = baseSavePath;
}
public String getRealPath(String name){
String realpath=ctx.getRealPath(name);
if(realpath==null){
realpath=ctx.getRealPath("/")+name;
}
return realpath;
}
private ServletContext ctx;
public void setServletContext(ServletContext servletContext) {
this.ctx = servletContext;
}
}

View File

@ -87,6 +87,9 @@ public class SysTenantController extends AbstractController {
if (StringUtils.isNotBlank(userCheckResult)){
return R.error(userCheckResult);
}
/**
* 保存
*/
return sysTenantService.saveTenant(tenantDTO);
}
@ -126,7 +129,7 @@ public class SysTenantController extends AbstractController {
@ApiOperationSort(4)
@ApiOperation(value = "分页查询")
@GetMapping("/page")
@RequiresPermissions("sys:systenant:page")
@RequiresPermissions("sys:systenant:list")
public R page(@RequestParam Map<String, Object> params){
PageUtils page = sysTenantService.queryPage(params);
return R.ok().put("page", page);
@ -159,9 +162,10 @@ public class SysTenantController extends AbstractController {
@ApiOperationSort(6)
@ApiOperation(value = "机构详情")
@GetMapping("/info/{id}")
@RequiresPermissions("sys:systenant:info")
//@RequiresPermissions("sys:systenant:info")
public R info(@PathVariable("id") Long id){
return sysTenantService.info(id);
}
}

View File

@ -92,8 +92,16 @@ public class SysUserController extends AbstractController {
userImg = DOMAIN + userImg;
userVo.setUserImg(userImg);
}
//设置评选判断条件
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userEntity.getUserId());
return R.ok().put("user", userVo).put("mngTenantId", tenantProperties.getManageTenantId()).put("isMng", userEntity.getTenantId() == null || userEntity.getTenantId().equals(tenantProperties.getManageTenantId()));
// return R.ok().put("user", userVo).put("mngTenantId", tenantProperties.getManageTenantId()).put("isMng", userEntity.getTenantId() == null || userEntity.getTenantId().equals(tenantProperties.getManageTenantId()));
//管理员和app审核员都可也进行品论
return R.ok().put("user", userVo).put("mngTenantId", tenantProperties.getManageTenantId()).put("isMng", roleIdList.contains(1L)||roleIdList.contains(4L));
}
/**

View File

@ -25,4 +25,13 @@ public interface SysTenantDao extends BaseMapper<SysTenantEntity> {
* @return 机构实体类集合
* */
List<SysTenantEntity> checkExist(@Param("tenantName") String tenantName, @Param("license") String license);
/**
* h5页面根据直播流查询默认头像
* @param sceneId
* @return
*/
String selectAnonymousurl(@Param("sceneid") Integer sceneId);
String selectTenant(@Param("sceneid")Integer sceneId);
}

View File

@ -93,5 +93,13 @@ public class SaveTenantDTO {
* */
@ApiModelProperty(value = "创建人ID")
private Long userCreateUserId;
/**
* 机构头像
*/
private String tLogoUrl;
/**
* 机构默认评论头像
*/
private String anonymousUrl;
}

View File

@ -19,7 +19,7 @@ public class SysTenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*
*/
@TableId("tenant_id")
@ApiModelProperty(value = "主键")
@ -80,6 +80,17 @@ public class SysTenantEntity implements Serializable {
@ApiModelProperty(value = "删除标志")
@TableLogic
private Integer deleteFlag;
/**
* 机构头像
*/
@ApiModelProperty(value = "机构头像")
private String tLogoUrl;
/**
* 机构评论匿名头像
*/
@ApiModelProperty(value = "机构评论匿名头像")
private String anonymousUrl;
/**
* 设置
@ -225,4 +236,30 @@ public class SysTenantEntity implements Serializable {
public Integer getDeleteFlag() {
return deleteFlag;
}
/**
* 设置机构头像
*/
public void setTLogoUrl(String tLogoUrl){
this.tLogoUrl=tLogoUrl;
}
/**
* 获取机构头像
*/
public String getTLogoUrl(){
return tLogoUrl;
}
/**
* 设置机构评论匿名头像
*/
public void setAnonymousUrl(String anonymousUrl){
this.anonymousUrl=anonymousUrl;
}
/**
* 获取机构评论匿名头像
*/
public String getAnonymousUrl(){
return anonymousUrl;
}
}

View File

@ -28,5 +28,9 @@ public interface SysTenantService extends IService<SysTenantEntity> {
R info(Long id);
R delete(Long[] ids);
String selectAnonymousurl(Integer sceneId);
String selectTenant(Integer sceneId);
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.platform.common.utils.*;
import com.platform.modules.live.entity.LiveSceneEntity;
import com.platform.modules.live.service.LiveSceneService;
import com.platform.modules.live.utils.ForeignProperties;
import com.platform.modules.plm.util.ImageFileProperties;
import com.platform.modules.plm.util.MateriaFileProperties;
import com.platform.modules.plm.util.MaterialUtils;
import com.platform.modules.sys.dao.SysTenantDao;
@ -41,6 +43,8 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
private RedisUtils redisUtils;
@Autowired
private MateriaFileProperties materiaFileProperties;
@Autowired
private ImageFileProperties imageFileProperties;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@ -71,13 +75,19 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
this.baseMapper.saveBatch(list);
return list;
}
//
@Override
@Transactional(rollbackFor = Exception.class)
public R saveTenant(SaveTenantDTO tenantDTO) {
// 1.保存企业信息
// 1.保存企业信息
SysTenantEntity tenantEntity = new SysTenantEntity();
//2.保存企业默认照片和机构默认评论
//tenantEntity.setTLogoUrl(MaterialUtils.getMaterialUrl(tenantDTO.getTLogoUrl(), foreignProperties.getMediaurl()));
tenantEntity.setTLogoUrl(tenantDTO.getTLogoUrl());
//2.1保存评论默认照片
//tenantEntity.setAnonymousUrl(MaterialUtils.getMaterialUrl(tenantDTO.getAnonymousUrl(), foreignProperties.getMediaurl()));
tenantEntity.setAnonymousUrl(tenantDTO.getAnonymousUrl());
tenantEntity.setTenantName(tenantDTO.getTenantName());
tenantEntity.setStatus(tenantDTO.getTenantStatus() == null ? 1 : tenantDTO.getTenantStatus());
@ -91,7 +101,10 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
if (StringUtils.isBlank(tenantDTO.getLicenseUrl())){
tenantEntity.setLicenseUrl(null);
}else {
tenantEntity.setLicenseUrl(handlerLicenseUrl(tenantDTO.getLicenseUrl(), materiaFileProperties.getBasePath()));
tenantEntity.setLicenseUrl(
tenantDTO.getLicenseUrl());
// handlerLicenseUrl
// (tenantDTO.getLicenseUrl(), materiaFileProperties.getBasePath()));
}
this.insert(tenantEntity);
@ -124,7 +137,8 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
return null;
}
@Autowired
private ForeignProperties foreignProperties;
@Override
@Transactional(rollbackFor = Exception.class)
public R updateTenant(SysTenantEntity sysTenant) {
@ -140,6 +154,26 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
}else {
statusFlag = 1;
}
/**
* 修改机构默认图片
*/
if (StringUtils.isNotBlank(sysTenant.getTLogoUrl())) {
// MaterialUtils.getMaterialUrl(, foreignProperties.getVodmediaurl())
tenantEntity.setTLogoUrl( handlerLicenseUrl(sysTenant.getTLogoUrl(), materiaFileProperties.getBasePath()));
}else {
tenantEntity.setTLogoUrl(null);
}
/**
* 修改默认评论图片
*/
if (StringUtils.isNotBlank(sysTenant.getAnonymousUrl())){
tenantEntity.setAnonymousUrl(handlerLicenseUrl(sysTenant.getAnonymousUrl(), materiaFileProperties.getBasePath()));
System.out.println("ttttttt"+tenantEntity.getAnonymousUrl());
}else {
tenantEntity.setAnonymousUrl(null);
}
if (StringUtils.isNotBlank(sysTenant.getTenantName()))
tenantEntity.setTenantName(sysTenant.getTenantName());
@ -151,7 +185,9 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
tenantEntity.setLicense(null);
}
if (StringUtils.isNotBlank(sysTenant.getLicenseUrl())){
tenantEntity.setLicenseUrl(handlerLicenseUrl(sysTenant.getLicenseUrl(), materiaFileProperties.getBasePath()));
tenantEntity.setLicenseUrl( sysTenant.getLicenseUrl());
// handlerLicenseUrl
// (sysTenant.getLicenseUrl(), materiaFileProperties.getBasePath()));
}else {
tenantEntity.setLicenseUrl(null);
}
@ -204,7 +240,20 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
// 地址拼接头
if (StringUtils.isNotBlank(sysTenantEntity.getLicenseUrl())) {
sysTenantEntity.setLicenseUrl(MaterialUtils.getMaterialUrl(sysTenantEntity.getLicenseUrl(), materiaFileProperties.getBasePath()));
//sysTenantEntity.setLicenseUrl(MaterialUtils.getMaterialUrl(sysTenantEntity.getLicenseUrl(), materiaFileProperties.getBasePath()));
sysTenantEntity.setLicenseUrl(sysTenantEntity.getLicenseUrl());
}
//回显机构头像
if (StringUtils.isNotBlank(sysTenantEntity.getTLogoUrl())){
// sysTenantEntity.setTLogoUrl(MaterialUtils.getMaterialUrl(sysTenantEntity.getTLogoUrl(), materiaFileProperties.getBasePath()));
sysTenantEntity.setTLogoUrl(sysTenantEntity.getTLogoUrl());
}
//回显默认评论头像
if (StringUtils.isNotBlank(sysTenantEntity.getAnonymousUrl())){
// sysTenantEntity.setAnonymousUrl(MaterialUtils.getMaterialUrl(sysTenantEntity.getAnonymousUrl(), materiaFileProperties.getBasePath()));
sysTenantEntity.setAnonymousUrl(sysTenantEntity.getAnonymousUrl());
}
return R.ok().put("sysTenant", sysTenantEntity);
@ -241,6 +290,26 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantDao, SysTenantEnt
return R.ok();
}
/**
* 移动端根据机构查询默认评论照片
* @param sceneId
* @return
*/
@Autowired
private SysTenantDao sysTenantDao;
@Override
public String selectAnonymousurl(Integer sceneId) {
//根据直播流id获取到企业默认评论图像
String anonymousUrl =sysTenantDao.selectAnonymousurl(sceneId);
return anonymousUrl;
}
@Override
public String selectTenant(Integer sceneId) {
String tenantUrl=sysTenantDao.selectTenant(sceneId);
return tenantUrl;
}
/**
* 保存员工信息
*

View File

@ -126,7 +126,7 @@ public class TrtcController extends AppAbstractController {
return R.ok().put("reporterList", trtcService.getReporterStatusList(userId, status));
}
@GetMapping("/app/getUserSig")
@GetMapping("/getUserSig")
@ApiOperation("(APP)根据记者ID获取userSig")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "记者Id", paramType = "query", dataType = "Long")

View File

@ -222,4 +222,4 @@ public class VideoController {
}
}
}

View File

@ -4,13 +4,13 @@ spring:
driverClassName: com.mysql.jdbc.Driver
druid:
first: #数据源1
url: jdbc:mysql://localhost:3306/aijinan-live-2?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
url: jdbc:mysql://localhost:3306/jinan-live?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
username: root
password: 1
password: 55436
second: #数据源2
url: jdbc:mysql://localhost:3306/aijinan-live-2?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
url: jdbc:mysql://localhost:3306/jinan-live?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true
username: root
password: 1
password: 55436
initial-size: 10
max-active: 100
min-idle: 10

View File

@ -41,7 +41,7 @@ zkdx:
wide: 640
high: 360
compress-image:
geometric-format: ?x-oss-process=image/resize,w_400
geometric-format: ?x-oss-process=image/resize,w_600
mandatory-format: ?x-oss-process=image/resize,m_fixed,h_500,w_500
#audio:
# recognition:

View File

@ -6,14 +6,42 @@
<select id="queryPageMap" parameterType="java.util.Map" resultType="com.platform.modules.live.entity.LiveChannelEntity">
select bean.*,uu.realname as last_update_user_name,u.realname as creator_user_name
from live_channel bean
left join sys_user uu on bean.last_update_user= uu.user_id left join sys_user u on bean.creator_id= u.user_id where 1=1
<if test="isDelete != null ">
and bean.is_delete=#{isDelete}
left join sys_user uu on bean.last_update_user= uu.user_id
left join sys_user u on bean.creator_id= u.user_id
<!-- 根据企业查对应的栏目-->
left join live_channel_tenant lct ON bean.id=lct.channel_id
where lct.tenant_id=#{tenantId} and 1=1
and lct.is_delete=0
<if test="isDelete != null ">
and bean.is_delete=#{isDelete}
</if>
<if test="name != null and name !='' ">
and bean.name like CONCAT('%',#{name},'%')
<if test="name != null and name !='' ">
and bean.name like CONCAT('%',#{name},'%')
</if>
ORDER BY bean.priority DESC,bean.id DESC
</select>
</mapper>
<select id="getAllChannelByTenant" resultType="com.platform.modules.live.entity.LiveChannelEntity">
SELECT lc.*
FROM live_channel lc
LEFT JOIN live_channel_tenant lct ON lc.id=lct.channel_id
where lct.tenant_id=#{tenantId} and lc.is_display=1 and lct.is_delete=0
ORDER BY lc.priority desc,lc.id desc
</select>
<select id="queryPageMapAll" resultType="com.platform.modules.live.entity.LiveChannelEntity">
select bean.*,uu.realname as last_update_user_name,u.realname as creator_user_name
from live_channel bean
left join sys_user uu on bean.last_update_user= uu.user_id
left join sys_user u on bean.creator_id= u.user_id
where 1=1
<if test="isDelete != null ">
and bean.is_delete=#{isDelete}
</if>
<if test="name != null and name !='' ">
and bean.name like CONCAT('%',#{name},'%')
</if>
ORDER BY bean.priority DESC,bean.id DESC
</select>
</mapper>

View File

@ -0,0 +1,26 @@
<?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.platform.modules.live.dao.LiveChannelTenantDao">
<insert id="save">
insert into live_channel_tenant (channel_id,tenant_id) values(#{channelId},#{tenantId});
</insert>
<update id="deleteChannelTenantBatch">
update live_channel_tenant set is_delete = 1
where channel_id in
<foreach collection="ids" open="(" close=")" item="ids" separator="," >
#{ids}
</foreach>-->
</update>
<!-- <delete id="deleteChannelTenantBatch">-->
<!-- delete from live_channel_tenant where channel_id in-->
<!-- <foreach collection="ids" open="(" close=")" item="ids" separator="," >-->
<!-- #{ids}-->
<!-- </foreach>-->
<!-- </delete>-->
</mapper>

View File

@ -5,8 +5,11 @@
<select id="queryPageMap" parameterType="java.util.Map" resultType="com.platform.modules.live.vo.SceneEntityVo">
select bean.*,su.realname as creator_name,sc.views as views,sc.views_show as views_show,sc.comments as comments,sc.comments_show as comments_show,channel.name as channel_name
from live_scene bean left join live_scene_live_info info on bean.id=info.scene_id left join sys_user su on bean.creator_id= su.user_id
left join live_scene_count sc on bean.id=sc.scene_id left join live_channel channel on bean.channel_id=channel.id where 1=1
from live_scene bean
left join live_scene_live_info info on bean.id=info.scene_id
left join sys_user su on bean.creator_id= su.user_id
left join live_scene_count sc on bean.id=sc.scene_id
left join live_channel channel on bean.channel_id=channel.id where 1=1
<if test="title != null and title !='' ">
and bean.title like CONCAT('%',#{title},'%')
</if>
@ -33,16 +36,16 @@
and bean.live_state=#{liveState}
</if>
<if test="tenantId != null">
and bean.tenant_id=#{tenantId}
and bean.tenant_id=#{tenantId}
</if>
<if test="creatorId != null">
and bean.creator_id=#{creatorId}
and bean.creator_id=#{creatorId}
</if>
<if test="creatorId != null">
and bean.creator_id=#{creatorId}
and bean.creator_id=#{creatorId}
</if>
<if test="isProd != null and isProd !=''">
GROUP BY bean.id ORDER BY CASE live_state WHEN 1 THEN -1 WHEN 0 THEN 0 else 2 end,bean.id DESC
GROUP BY bean.id ORDER BY CASE live_state WHEN 1 THEN -1 WHEN 0 THEN 0 else 2 end,bean.id DESC
</if>
<if test="isProd == null or isProd ==''">
GROUP BY bean.id ORDER BY bean.live_state ASC ,bean.live_start DESC ,bean.id DESC
@ -51,7 +54,7 @@
<select id="queryById" parameterType="Integer" resultType="com.platform.modules.live.entity.LiveSceneEntity">
select bean.*,su.realname as creator_name,sc.views as views,sc.views_show as views_show,sc.comments as comments,sc.comments_show as comments_show,channel.name as channel_name
from live_scene bean left join sys_user su on bean.creator_id= su.user_id left join live_scene_count sc on bean.id=sc.scene_id
from live_scene bean left join sys_user su on bean.creator_id= su.user_id left join live_scene_count sc on bean.id=sc.scene_id
left join live_channel channel on bean.channel_id=channel.id where 1=1 and bean.id=#{id}
</select>
@ -114,7 +117,7 @@
</if>
order by sceneChannel.drag_sort desc, scene.is_top desc, scene.priority desc, scene.live_state asc, scene.live_start desc, scene.id desc
</select>
<update id="updateByIdSelective" parameterType="map">
UPDATE live_scene
<set>
@ -134,4 +137,4 @@
</set>
WHERE id = #{entity.id}
</update>
</mapper>
</mapper>

View File

@ -23,5 +23,16 @@
select * from sys_tenant bean WHERE 1=1 AND (bean.tenant_name = #{tenantName}
OR bean.license = #{license})
</select>
<select id="selectAnonymousurl" resultType="java.lang.String">
SELECT st.anonymous_url
from live_scene ls LEFT JOIN sys_tenant st on ls.tenant_id= st.tenant_id
where ls.id=#{sceneid}
</mapper>
</select>
<select id="selectTenant" resultType="java.lang.String">
SELECT st.t_logo_url
from live_scene ls LEFT JOIN sys_tenant st on ls.tenant_id= st.tenant_id
where ls.id=#{sceneid}
</select>
</mapper>