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