| | |
| | | import com.aliyun.oss.common.auth.EnvironmentVariableCredentialsProvider; |
| | | import com.aliyun.oss.common.comm.SignVersion; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dahua.netsdk.lib.callback.impl.AnalyzerDataCB; |
| | | import com.ycl.common.util.UtilNumber; |
| | | import com.ycl.entity.dingding.DingUserInfo; |
| | | import com.ycl.entity.user.UmsAdmin; |
| | | import com.ycl.mapper.unlawful.UnlawfulMapper; |
| | | import com.ycl.service.caseHandler.IBaseCaseService; |
| | | import com.ycl.service.caseHandler.IViolationsService; |
| | | import com.ycl.service.oss.OssService; |
| | | import com.ycl.service.resources.IImageResourcesService; |
| | | import com.ycl.utils.ConstantPropertiesUtils; |
| | | import com.ycl.vo.casePool.BaseCaseVO; |
| | | import net.coobird.thumbnailator.Thumbnails; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.io.*; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | @ComponentScan("com.dahua.netsdk") |
| | |
| | | public class Test1 { |
| | | |
| | | @Autowired |
| | | private IBaseCaseService baseCaseService; |
| | | |
| | | @Autowired |
| | | private OssService ossService; |
| | | |
| | | @Autowired |
| | | private IViolationsService violationsService; |
| | | |
| | | @Autowired |
| | | private IImageResourcesService imageService; |
| | | @Resource |
| | | private UnlawfulMapper unlawfuldao; |
| | | @Autowired |
| | |
| | | |
| | | @Test |
| | | void test() { |
| | | String fileUrl = "https://huachuang-resource.oss-cn-beijing.aliyuncs.com/家庭教育/中国陶行知协会家庭教育专委会.doc?Expires=1738857178&OSSAccessKeyId=LTAIxtcfDe3fgfcf&Signature=wTwx6JA6VWbPB0skVySy9MCexog="; |
| | | String fileUrl = "https://xshlivelesson.oss-cn-shenzhen.aliyuncs.com/2.pptx?Expires=1738857178&OSSAccessKeyId=LTAIxtcfDe3fgfcf&Signature=wTwx6JA6VWbPB0skVySy9MCexog="; |
| | | // http://zhzfptoss.oss-cn-zjls-lszwy-d01-a.ops.zjlscloud.com/sczf/2023062950465224.jpg?Expires=2634106907&OSSAccessKeyId=Tkf72Q1gdzETsZf6&Signature=ttME%2BeFhss8wPbkRCxAsV%2FPNWGQ%3D |
| | | |
| | | OSS ossClient = null; |
| | |
| | | |
| | | String[] urlArray = fileUrl.split("Expires="); |
| | | |
| | | String[] urlArray2 = urlArray[0].split("aliyuncs.com/"); |
| | | |
| | | String objectName = urlArray2[1].replace("?", ""); |
| | | |
| | | String objectName = urlArray[0].replace(ConstantPropertiesUtils.PREFIX_URL, ""); |
| | | objectName = objectName.replace("?", ""); |
| | | |
| | | ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); |
| | | |
| | |
| | | // AnalyzerDataCB analyzerDataCB; |
| | | |
| | | @Test |
| | | void alarmTest() { |
| | | void alarmTest() throws UnsupportedEncodingException { |
| | | |
| | | // analyzerDataCB.invoke(null, 0, null, null, 0, null, 0, null); |
| | | |
| | |
| | | // AlarmListenModule.startListen(cbMessage); |
| | | // |
| | | // System.out.println(cbMessage.data); |
| | | |
| | | // https://xshlivelesson.oss-accelerate.aliyuncs.com/sczf/2025-02-28%2015%3A53%3A293732..JPG?Expires=2686809213&OSSAccessKeyId=LTAIDlTWjHW0IVyW&Signature=Q5WO2kQcWRpq0SQiYjBCo6rGyJE%3D" |
| | | |
| | | // ossService.deleteImages("https://xshlivelesson.oss-cn-shenzhen.aliyuncs.com/sczf/2025022845414037.JPG?Expires=2686811218&OSSAccessKeyId=LTAIDlTWjHW0IVyW&Signature=5SQ7PInLkbd62zJ1aurljeO0c%2Bw%3D"); |
| | | // |
| | | int i = 1; |
| | | while (true) { |
| | | String beginTime = "2025-01-01 00:00:00"; |
| | | String endTime = LocalDateTime.now().plusDays(-4).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | Page<BaseCaseVO> page = baseCaseService.selectVideoInspection(i, 10, null, null, beginTime, endTime, null); |
| | | if (page.getRecords().size() > 0) { |
| | | page.getRecords().forEach(baseCaseVO -> { |
| | | // String picData = baseCaseVO.getPicData(); |
| | | // String[] urls = picData.split(","); |
| | | // for (String url : urls) { |
| | | // ossService.deleteImages(url); |
| | | // |
| | | // } |
| | | baseCaseService.removeById(baseCaseVO.getBaseId()); |
| | | violationsService.removeById(baseCaseVO.getBaseId()); |
| | | imageService.removeById(baseCaseVO.getImageId()); |
| | | }); |
| | | } else { |
| | | break; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | |