zhangjinli 3 years ago
parent b88f896262
commit 064206442b

@ -189,19 +189,15 @@ public class UtilsController {
@PostMapping("/test") @PostMapping("/test")
@ResponseBody @ResponseBody
public Result test() { public Result test() {
String url = "http://www.baidu.com/#wd=%E6%88%91%E6%98%AF%E6%AD%8C%E6%89%8B&rsv_bp=0&tn=baidu&rsv_spt=3&ie=utf-8&rsv_sug3=11&rsv_sug4=643&rsv_sug1=11&inputT=5484&rsv_sug2=0"; return Result.success();
Pattern p = Pattern.compile("(http://|https://)?([^/]*)", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(url);
String a = m.find() ? m.group(2) : url;
// (https://)+\S*\s
return Result.success(a);
} }
public static void main(String[] args) { public static void main(String[] args) {
String url = "4.38 wfb:/ 复制打开抖音身 https://v.douyin.com/YT98hjf/,看看【酸味真火的作品】坚持总会有收获的# 意想不到的情侣健身 https://v.douyin.com/YT982Sf/"; File file = new File("/Users/apple/Pictures/ss/tt/default (10).xlsx");
System.out.println( RegexUtils.get("(https://)(.*?)(/)(.*?)(/)",url,0)); file.delete();
// String url = "4.38 wfb:/ 复制打开抖音身 https://v.douyin.com/YT98hjf/,看看【酸味真火的作品】坚持总会有收获的# 意想不到的情侣健身 https://v.douyin.com/YT982Sf/";
// System.out.println( RegexUtils.get("(https://)(.*?)(/)(.*?)(/)",url,0));
// String a = m.find() ? m.group(1) : url; // String a = m.find() ? m.group(1) : url;
// System.out.println(a); // System.out.println(a);
// int b = StringUtils.countOccurrencesOf(a, "https://v.douyin"); // int b = StringUtils.countOccurrencesOf(a, "https://v.douyin");

@ -12,10 +12,7 @@ import com.zh.project0512.annotation.AdminCheckAuthorityAnnotation;
import com.zh.project0512.annotation.AdminTokenValid; import com.zh.project0512.annotation.AdminTokenValid;
import com.zh.project0512.model.*; import com.zh.project0512.model.*;
import com.zh.project0512.model.vo.FileUploadParamVo; import com.zh.project0512.model.vo.FileUploadParamVo;
import com.zh.project0512.service.IReferenceBrandService; import com.zh.project0512.service.*;
import com.zh.project0512.service.IReferenceService;
import com.zh.project0512.service.IReferenceTagService;
import com.zh.project0512.service.ITopicActivityService;
import com.zh.project0512.utils.FileTypeUtil; import com.zh.project0512.utils.FileTypeUtil;
import com.zh.project0512.utils.MybatisPlusUtil; import com.zh.project0512.utils.MybatisPlusUtil;
import com.zh.project0512.utils.result.HttpStatusEnum; import com.zh.project0512.utils.result.HttpStatusEnum;
@ -25,6 +22,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -32,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.File;
import java.sql.Ref; import java.sql.Ref;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -54,11 +53,15 @@ public class ReferenceController {
@Autowired @Autowired
private IReferenceService referenceService; private IReferenceService referenceService;
@Autowired @Autowired
private ITaskReferenceService taskReferenceService;
@Autowired
private IReferenceTagService referenceTagService; private IReferenceTagService referenceTagService;
@Autowired @Autowired
private IReferenceBrandService referenceBrandService; private IReferenceBrandService referenceBrandService;
@Autowired @Autowired
private ITopicActivityService topicActivityService; private ITopicActivityService topicActivityService;
@Value("${web.uploadPath}")
private String path;
@Data @Data
static class AddRParam { static class AddRParam {
@ -188,12 +191,28 @@ public class ReferenceController {
private List<Integer> idList; private List<Integer> idList;
} }
@Operation(summary = "删除素材(软删除)") @Operation(summary = "删除素材(软删除),文件会清除")
@PostMapping("/del") @PostMapping("/del")
@AdminTokenValid @AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "109") @AdminCheckAuthorityAnnotation(jurisdictionId = "109")
public Result del(@Validated @RequestBody DelRParam param) { public Result del(@Validated @RequestBody DelRParam param) {
return MybatisPlusUtil.sqlResult(referenceService.update(new UpdateWrapper<Reference>().in("id", param.getIdList()).set("isDeleted", 1)), "删除"); List<Reference> rList = referenceService.list(new QueryWrapper<Reference>().in("id", param.getIdList()));
// 删除素材字段
referenceService.update(new UpdateWrapper<Reference>().in("id", param.getIdList()).set("isDeleted", 1));
//删除素材文件
for (Reference r : rList) {
if (path != null) {
if (r.getFileUrl() != null) {
new File(path + "/upload" + r.getFileUrl()).delete();
}
if (r.getCoverUrl() != null) {
new File(path + "/upload" + r.getCoverUrl()).delete();
}
}
}
//删除素材任务关联
taskReferenceService.remove(new UpdateWrapper<TaskReference>().in("referenceId", param.getIdList()));
return Result.success();
} }

Loading…
Cancel
Save