| @@ -107,7 +107,7 @@ public class VideoController extends BaseController { | |||||
| /** | /** | ||||
| * 上传视频 | * 上传视频 | ||||
| * | * | ||||
| * @param multiReq | |||||
| * @param | |||||
| * @return | * @return | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -128,7 +128,7 @@ public class VideoController extends BaseController { | |||||
| /** | /** | ||||
| * 上传视频 | * 上传视频 | ||||
| * | * | ||||
| * @param multiReq | |||||
| * @param | |||||
| * @return | * @return | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -152,8 +152,8 @@ public class ShiroConfig { | |||||
| //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 | //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 | ||||
| filterChainDefinitionMap.put("/logout", "authc"); | filterChainDefinitionMap.put("/logout", "authc"); | ||||
| filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | |||||
| // filterChainDefinitionMap.put("/**", "anon"); | |||||
| // filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); | |||||
| filterChainDefinitionMap.put("/**", "anon"); | |||||
| shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); | shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); | ||||
| @@ -121,20 +121,20 @@ public class TtCouponController extends BaseController { | |||||
| if(StringUtils.isBlank(record.getVideoId())){ | if(StringUtils.isBlank(record.getVideoId())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); | ||||
| }else{ | }else{ | ||||
| VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); | |||||
| if(result.isSuccess()){ | |||||
| record.setVideoTime(result.getDuration()); | |||||
| // record.setVideoUrl(result.getVideoUrl()); | |||||
| TtVideoLibrary video = new TtVideoLibrary(); | |||||
| video.updateTenantInfo(tenantEntity); | |||||
| video.setVideoId(record.getVideoId()); | |||||
| video.setVideoUrl(result.getVideoUrl()); | |||||
| video.setPreview(result.getCoverURL()); | |||||
| video.setDuration(result.getDuration()); | |||||
| ttVideoLibraryService.saveOrUpdate(video); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| } | |||||
| // VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); | |||||
| // if(result.isSuccess()){ | |||||
| // record.setVideoTime(result.getDuration()); | |||||
| //// record.setVideoUrl(result.getVideoUrl()); | |||||
| // TtVideoLibrary video = new TtVideoLibrary(); | |||||
| // video.updateTenantInfo(tenantEntity); | |||||
| // video.setVideoId(record.getVideoId()); | |||||
| // video.setVideoUrl(result.getVideoUrl()); | |||||
| // video.setPreview(result.getCoverURL()); | |||||
| // video.setDuration(result.getDuration()); | |||||
| // ttVideoLibraryService.saveOrUpdate(video); | |||||
| // }else{ | |||||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| // } | |||||
| } | } | ||||
| }else if(record.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode())){ | }else if(record.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode())){ | ||||
| if(record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ | if(record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ | ||||
| @@ -142,20 +142,20 @@ public class TtCouponController extends BaseController { | |||||
| if(StringUtils.isBlank(ttc.getVideoId())) { | if(StringUtils.isBlank(ttc.getVideoId())) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "部分未上传视频"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "部分未上传视频"); | ||||
| } | } | ||||
| VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(ttc.getVideoId()); | |||||
| if(result.isSuccess()){ | |||||
| ttc.setVideoTime(result.getDuration()); | |||||
| // ttc.setVideoUrl(result.getVideoUrl()); | |||||
| TtVideoLibrary video = new TtVideoLibrary(); | |||||
| video.updateTenantInfo(tenantEntity); | |||||
| video.setVideoId(record.getVideoId()); | |||||
| video.setVideoUrl(result.getVideoUrl()); | |||||
| video.setPreview(result.getCoverURL()); | |||||
| video.setDuration(result.getDuration()); | |||||
| ttVideoLibraryService.saveOrUpdate(video); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| } | |||||
| // VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(ttc.getVideoId()); | |||||
| // if(result.isSuccess()){ | |||||
| // ttc.setVideoTime(result.getDuration()); | |||||
| //// ttc.setVideoUrl(result.getVideoUrl()); | |||||
| // TtVideoLibrary video = new TtVideoLibrary(); | |||||
| // video.updateTenantInfo(tenantEntity); | |||||
| // video.setVideoId(record.getVideoId()); | |||||
| // video.setVideoUrl(result.getVideoUrl()); | |||||
| // video.setPreview(result.getCoverURL()); | |||||
| // video.setDuration(result.getDuration()); | |||||
| // ttVideoLibraryService.saveOrUpdate(video); | |||||
| // }else{ | |||||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| // } | |||||
| } | } | ||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "未上传视频"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "未上传视频"); | ||||
| @@ -220,19 +220,19 @@ public class TtCouponController extends BaseController { | |||||
| if(StringUtils.isBlank(record.getVideoId())){ | if(StringUtils.isBlank(record.getVideoId())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); | ||||
| } | } | ||||
| VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); | |||||
| if(result.isSuccess()){ | |||||
| record.setVideoTime(result.getDuration()); | |||||
| TtVideoLibrary video = new TtVideoLibrary(); | |||||
| video.updateTenantInfo(tenantEntity); | |||||
| video.setVideoId(record.getVideoId()); | |||||
| video.setVideoUrl(result.getVideoUrl()); | |||||
| video.setPreview(result.getCoverURL()); | |||||
| video.setDuration(result.getDuration()); | |||||
| ttVideoLibraryService.saveOrUpdate(video); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| } | |||||
| // VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); | |||||
| // if(result.isSuccess()){ | |||||
| // record.setVideoTime(result.getDuration()); | |||||
| // TtVideoLibrary video = new TtVideoLibrary(); | |||||
| // video.updateTenantInfo(tenantEntity); | |||||
| // video.setVideoId(record.getVideoId()); | |||||
| // video.setVideoUrl(result.getVideoUrl()); | |||||
| // video.setPreview(result.getCoverURL()); | |||||
| // video.setDuration(result.getDuration()); | |||||
| // ttVideoLibraryService.saveOrUpdate(video); | |||||
| // }else{ | |||||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); | |||||
| // } | |||||
| // record.setType(EnumTtCouponType.COUPON_SINGLE.getCode()); | // record.setType(EnumTtCouponType.COUPON_SINGLE.getCode()); | ||||
| ResultData resultData = ttCouponService.saveOrUpdate(record); | ResultData resultData = ttCouponService.saveOrUpdate(record); | ||||
| @@ -3,7 +3,6 @@ package com.iformall.controller.video; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxPropertyContract; | |||||
| import com.iformall.video.VideoFactory; | import com.iformall.video.VideoFactory; | ||||
| import com.iformall.video.entity.VideUploadResult; | import com.iformall.video.entity.VideUploadResult; | ||||
| @@ -34,14 +33,6 @@ public class VideoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| String videoType; | String videoType; | ||||
| @GetMapping("/test") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "title", value = "页数", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract, String title) { | |||||
| VideUploadResult result = videoFactory.getExcutor(videoType).uploadLocalVideo("123123213", "/root/111.mp4"); | |||||
| return new ResultData(result); | |||||
| } | |||||
| /** | /** | ||||
| * 上传视频 | * 上传视频 | ||||
| * | * | ||||
| @@ -65,7 +56,7 @@ public class VideoController extends BaseController { | |||||
| if(!fileFormat.endsWith("mp4")){ | if(!fileFormat.endsWith("mp4")){ | ||||
| return new ResultData(ErrorCode.PICTURE_ENDWIDTH_ERROR); | return new ResultData(ErrorCode.PICTURE_ENDWIDTH_ERROR); | ||||
| } | } | ||||
| VideUploadResult result = videoFactory.getExcutor(videoType).uploadLocalVideo(title, multiReq.getInputStream(),fileFormat); | |||||
| VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoStream(title, multiReq.getInputStream(),fileFormat); | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -95,23 +86,23 @@ public class VideoController extends BaseController { | |||||
| } | } | ||||
| /** | /** | ||||
| * 获取视频信息 | |||||
| * 上传视频 | |||||
| * | * | ||||
| * @param | * @param | ||||
| * @return | * @return | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @GetMapping(value = "/getVideoDetail") | |||||
| @GetMapping(value = "/videoContentLength") | |||||
| @ApiOperation("上传视频进度") | @ApiOperation("上传视频进度") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "videoId", value = "视频编号", dataType = "String", paramType = "query", required = true)}) | @ApiImplicitParam(name = "videoId", value = "视频编号", dataType = "String", paramType = "query", required = true)}) | ||||
| public ResultData getVideoDetail(String videoId) { | |||||
| public ResultData videoContentLength(String videoId) { | |||||
| try { | try { | ||||
| VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(videoId); | |||||
| String result = videoFactory.getExcutor(videoType).getVedioContentLength(videoId); | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR); | |||||
| } | } | ||||
| } | } | ||||
| @@ -172,6 +172,11 @@ video: | |||||
| accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V | accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V | ||||
| accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry | accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry | ||||
| regionId: cn-beijing | regionId: cn-beijing | ||||
| endPoint: https://oss-cn-beijing.aliyuncs.com | |||||
| corePoolSize: 6 | |||||
| maxPoolSize: 20 | |||||
| queueCapacity: 1000 | |||||
| namePrefix: aliyun-video-upload | |||||
| jasypt: | jasypt: | ||||
| @@ -132,6 +132,11 @@ video: | |||||
| accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V | accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V | ||||
| accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry | accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry | ||||
| regionId: cn-beijing | regionId: cn-beijing | ||||
| endPoint: https://oss-cn-beijing.aliyuncs.com | |||||
| corePoolSize: 6 | |||||
| maxPoolSize: 20 | |||||
| queueCapacity: 1000 | |||||
| namePrefix: aliyun-video-upload | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| @@ -14,8 +14,8 @@ spring: | |||||
| default-property-inclusion: non_null | default-property-inclusion: non_null | ||||
| servlet: | servlet: | ||||
| multipart: | multipart: | ||||
| max-file-size: 20MB | |||||
| max-request-size: 200MB | |||||
| max-file-size: 1024MB | |||||
| max-request-size: 10240MB | |||||
| cache: | cache: | ||||
| type: REDIS | type: REDIS | ||||
| cache-names: redis_cache #缓存的名字(可以不指定) | cache-names: redis_cache #缓存的名字(可以不指定) | ||||
| @@ -0,0 +1,69 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.utils.sign.SignUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/callback") | |||||
| public class TtOrderCallbackController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| private final String token = "ttZhiBoTang"; | |||||
| /** | |||||
| * timestamp number Unix 时间戳,10 位,整型数 | |||||
| * nonce string 随机数 | |||||
| * msg string 订单信息的 json 字符串 | |||||
| * type string 回调类型标记,支付成功回调为"payment" | |||||
| * msg_signature String 签名 | |||||
| * | |||||
| * appid string 小程序 id | |||||
| * cp_orderno string 开发者传入订单号 | |||||
| * way string way 字段中标识了支付渠道:2-支付宝,1-微信 | |||||
| * cp_extra string 预下单时开发者传入字段 | |||||
| * | |||||
| * @return 支付通知 | |||||
| */ | |||||
| @PostMapping(value = "/orderPay") | |||||
| @ResponseBody | |||||
| public Map<String,Object> createOrder( HttpServletRequest request){ | |||||
| Map<String,Object> resultMap = new HashMap<>(); | |||||
| String timestamp = request.getParameter("timestamp"); | |||||
| String nonce = request.getParameter("nonce"); | |||||
| String msg = request.getParameter("msg"); | |||||
| String type = request.getParameter("type"); | |||||
| String msgSignature = request.getParameter("msg_signature"); | |||||
| logger.info("timestamp:"+timestamp+",nonce:"+nonce+",msg:"+msg+",type:"+type+",msgSignature:"+msgSignature); | |||||
| Map<String,Object> paramMap = new HashMap<>(); | |||||
| paramMap.put("token",token); | |||||
| paramMap.put("timestamp",timestamp); | |||||
| paramMap.put("nonce",nonce); | |||||
| paramMap.put("msg",msg); | |||||
| String sha = SignUtils.getSign(null, paramMap, "SHA"); | |||||
| logger.info("sha----"+sha); | |||||
| if(msgSignature.equals(sha)){ | |||||
| logger.info("true"); | |||||
| } | |||||
| try { | |||||
| // resultMap.put("err_no",0); | |||||
| // resultMap.put("err_tips","success"); | |||||
| return resultMap; | |||||
| } catch (Exception e){ | |||||
| e.printStackTrace(); | |||||
| return resultMap; | |||||
| } | |||||
| } | |||||
| } | |||||