33333333333
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
|
||||
package com.ruoyi.consumer;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.cai.mq.constant.FileDeleteHttpMqConstant;
|
||||
import com.ruoyi.cai.mq.dto.FileDeleteDTO;
|
||||
import com.ruoyi.oss.core.OssClient;
|
||||
import com.ruoyi.oss.factory.OssFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class FileDeleteConsumer {
|
||||
|
||||
private final static String SERVICE = "tengxunyun";
|
||||
|
||||
|
||||
// ,containerFactory = "customContainerFactory"
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = FileDeleteHttpMqConstant.FILE_DELETE_QUEUE, durable = "false", autoDelete = "false"),
|
||||
exchange = @Exchange(value = FileDeleteHttpMqConstant.FILE_DELETE_EXCHANGE),
|
||||
key = FileDeleteHttpMqConstant.FILE_DELETE_KEY))
|
||||
public void calculateSalesQueue(String message) {
|
||||
log.info("删除图片: message={}", message);
|
||||
try {
|
||||
OssClient storage = OssFactory.instance();
|
||||
FileDeleteDTO fileDeleteDTO = JSON.parseObject(message, FileDeleteDTO.class);
|
||||
List<String> deleteFilePathList = fileDeleteDTO.getDeleteFilePathList();
|
||||
if(CollectionUtils.isEmpty(deleteFilePathList)){
|
||||
return;
|
||||
}
|
||||
for (String filePath : deleteFilePathList) {
|
||||
storage.delete(filePath);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("删除图片-失败: message=" + message,e);
|
||||
}
|
||||
log.info("删除图片-结束: message=" + message);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,8 @@ public class UserCameraAuditController extends BaseController {
|
||||
@Log(title = "自拍认证", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Integer[] ids) {
|
||||
return toAjax(userCameraAuditService.removeBatchByIds(Arrays.asList(ids)));
|
||||
@PathVariable Long[] ids) {
|
||||
userCameraAuditService.deleteBatch(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user