VodDictServiceImpl.java
2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.configure.VODConfig;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.service.VodDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.Signature;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
* <p>
* 视频表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> implements VodDictService {
@Autowired
private VODConfig vodConfig;
public SignatureVO signature() throws Exception {
//
SignatureVO signatureVO = new SignatureVO();
Signature signature = new Signature();
signature.setSecretId(vodConfig.getSecretId());
signature.setSecretKey(vodConfig.getSecretKey());
signature.setCurrentTime(System.currentTimeMillis());
signature.setRandom(new Random().nextInt(Integer.MAX_VALUE));
signature.setSignValidDuration(3600 * 24 * 2);
String sign = "";
try {
sign = signature.getUploadSignature();
signatureVO.setSign(sign);
} catch (Exception ex) {
ex.printStackTrace();
// throw new MyException(ResultEnum.UNKNOWN_ERROR);
}
return signatureVO;
}
public IPage<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO) {
Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize());
return this.baseMapper.getContendVods(pager,getContendVodsDTO.getVodName(),getContendVodsDTO.getContentId());
}
public String deleteVod(VodDictDO vodDictDO) {
this.baseMapper.deleteById(vodDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateVod(VodDictDO vodDictDO) {
this.baseMapper.updateById(vodDictDO);
return ConstantUtils.SET_SUCCESS;
}
}