Browse Source

tt

release_toaliyun_real
xhxu 5 years ago
parent
commit
a1d6312617
8 changed files with 132 additions and 62 deletions
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java
  2. +2
    -2
      mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java
  3. +41
    -41
      mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java
  4. +6
    -15
      mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java
  5. +5
    -0
      mallinkTTAdmin/src/main/resources/application-dev.yml
  6. +5
    -0
      mallinkTTAdmin/src/main/resources/application-prod.yml
  7. +2
    -2
      mallinkTTAdmin/src/main/resources/application.yml
  8. +69
    -0
      mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderCallbackController.java

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/video/VideoController.java View File

@@ -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
*/


+ 2
- 2
mallinkTTAdmin/src/main/java/com/iformall/config/ShiroConfig.java View File

@@ -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);


+ 41
- 41
mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java View File

@@ -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);


+ 6
- 15
mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java View File

@@ -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);
}
}



+ 5
- 0
mallinkTTAdmin/src/main/resources/application-dev.yml View File

@@ -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:


+ 5
- 0
mallinkTTAdmin/src/main/resources/application-prod.yml View File

@@ -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


+ 2
- 2
mallinkTTAdmin/src/main/resources/application.yml View File

@@ -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 #缓存的名字(可以不指定)


+ 69
- 0
mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderCallbackController.java View File

@@ -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;
}
}


}

Loading…
Cancel
Save