diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java index 1c52b41f4..f0b8b115a 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java @@ -107,7 +107,7 @@ public class VideoController extends BaseController { /** * 上传视频 * - * @param multiReq + * @param * @return * @throws Exception */ @@ -128,7 +128,7 @@ public class VideoController extends BaseController { /** * 上传视频 * - * @param multiReq + * @param * @return * @throws Exception */ diff --git a/mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java b/mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java index 7e16e23c8..75cd12d65 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java @@ -152,8 +152,8 @@ public class ShiroConfig { //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 filterChainDefinitionMap.put("/logout", "authc"); - filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); -// filterChainDefinitionMap.put("/**", "anon"); +// filterChainDefinitionMap.put("/**", "corsFilter,token,authc"); + filterChainDefinitionMap.put("/**", "anon"); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java index 4f1158933..304c0c01c 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java @@ -121,20 +121,20 @@ public class TtCouponController extends BaseController { if(StringUtils.isBlank(record.getVideoId())){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); }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())){ if(record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ @@ -142,20 +142,20 @@ public class TtCouponController extends BaseController { if(StringUtils.isBlank(ttc.getVideoId())) { 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{ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "未上传视频"); @@ -220,19 +220,19 @@ public class TtCouponController extends BaseController { if(StringUtils.isBlank(record.getVideoId())){ 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()); ResultData resultData = ttCouponService.saveOrUpdate(record); diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java index 5eeb548b2..2f393c9bc 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java @@ -3,7 +3,6 @@ package com.iformall.controller.video; import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxPropertyContract; import com.iformall.video.VideoFactory; import com.iformall.video.entity.VideUploadResult; @@ -34,14 +33,6 @@ public class VideoController extends BaseController { @Autowired 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")){ 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); } catch (Exception e) { logger.error(e.getMessage()); @@ -95,23 +86,23 @@ public class VideoController extends BaseController { } /** - * 获取视频信息 + * 上传视频 * * @param * @return * @throws Exception */ - @GetMapping(value = "/getVideoDetail") + @GetMapping(value = "/videoContentLength") @ApiOperation("上传视频进度") @ApiImplicitParams({ @ApiImplicitParam(name = "videoId", value = "视频编号", dataType = "String", paramType = "query", required = true)}) - public ResultData getVideoDetail(String videoId) { + public ResultData videoContentLength(String videoId) { try { - VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(videoId); + String result = videoFactory.getExcutor(videoType).getVedioContentLength(videoId); return new ResultData(result); } catch (Exception e) { logger.error(e.getMessage()); - return new ResultData(ErrorCode.SYS_SERVER_ERROR); + return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR); } } diff --git a/mallinkTTAdmin/src/main/resources/application-dev.yml b/mallinkTTAdmin/src/main/resources/application-dev.yml index 65d5e37ea..2d9c659a2 100644 --- a/mallinkTTAdmin/src/main/resources/application-dev.yml +++ b/mallinkTTAdmin/src/main/resources/application-dev.yml @@ -172,6 +172,11 @@ video: accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry regionId: cn-beijing + endPoint: https://oss-cn-beijing.aliyuncs.com + corePoolSize: 6 + maxPoolSize: 20 + queueCapacity: 1000 + namePrefix: aliyun-video-upload jasypt: diff --git a/mallinkTTAdmin/src/main/resources/application-prod.yml b/mallinkTTAdmin/src/main/resources/application-prod.yml index 13a90a493..f4442fbc4 100644 --- a/mallinkTTAdmin/src/main/resources/application-prod.yml +++ b/mallinkTTAdmin/src/main/resources/application-prod.yml @@ -132,6 +132,11 @@ video: accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry regionId: cn-beijing + endPoint: https://oss-cn-beijing.aliyuncs.com + corePoolSize: 6 + maxPoolSize: 20 + queueCapacity: 1000 + namePrefix: aliyun-video-upload fm: exception: true diff --git a/mallinkTTAdmin/src/main/resources/application.yml b/mallinkTTAdmin/src/main/resources/application.yml index 5343e86a1..a7e6c2cd1 100644 --- a/mallinkTTAdmin/src/main/resources/application.yml +++ b/mallinkTTAdmin/src/main/resources/application.yml @@ -14,8 +14,8 @@ spring: default-property-inclusion: non_null servlet: multipart: - max-file-size: 20MB - max-request-size: 200MB + max-file-size: 1024MB + max-request-size: 10240MB cache: type: REDIS cache-names: redis_cache #缓存的名字(可以不指定) diff --git a/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderCallbackController.java b/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderCallbackController.java new file mode 100644 index 000000000..fd194fb4d --- /dev/null +++ b/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderCallbackController.java @@ -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 createOrder( HttpServletRequest request){ + + Map 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 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; + } + } + + +}