Browse Source

add:向量信息添加操作日志

zhongwei
luyie 2 months ago
parent
commit
dca6fa4a8d
  1. 7
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java
  2. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java
  3. 18
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java
  4. 9
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

7
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java

@ -1,5 +1,6 @@
package com.hnac.gglm.bigmodel.maintenance.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@ -69,11 +70,7 @@ public class VectorParamController {
@ApiOperation(value = "删除向量参数配置")
@ApiOperationSupport(order = 4)
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) {
Boolean result = vectorParamService.removeByIds(Func.toLongList(",", ids));
if (result) {
vectorParamLogService.delete(Func.toLongList(",", ids));
}
return R.status(result);
return R.status(vectorParamService.removeByIdsWithLog(Func.toLongList(",", ids)));
}
@PutMapping("/update")

2
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java

@ -21,4 +21,6 @@ public interface VectorParamService extends IService<VectorParamEntity> {
Boolean synchronization(List<Long> id ,String bladeToken, String hzinfoToken);
Boolean synchronization(Long id, String bladeToken, String hzinfoToken);
Boolean removeByIdsWithLog(List<Long> isList);
}

18
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java

@ -8,13 +8,11 @@ import com.hnac.gglm.bigmodel.maintenance.mapper.VectorParamLogMapper;
import com.hnac.gglm.bigmodel.maintenance.service.VectorParamLogService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @Author: ypj
@ -31,6 +29,7 @@ public class VectorParamLogServiceImpl extends ServiceImpl<VectorParamLogMapper,
return false;
}
req.setType(DataOperateType.CREATE.getCode());
req.setCreateUser(AuthUtil.getUserId());
return save(req);
}
@ -40,6 +39,7 @@ public class VectorParamLogServiceImpl extends ServiceImpl<VectorParamLogMapper,
return false;
}
req.setType(DataOperateType.UPDATE.getCode());
req.setCreateUser(AuthUtil.getUserId());
return save(req);
}
@ -49,18 +49,19 @@ public class VectorParamLogServiceImpl extends ServiceImpl<VectorParamLogMapper,
return false;
}
req.setType(DataOperateType.RESET.getCode());
req.setCreateUser(AuthUtil.getUserId());
return save(req);
}
@Override
public Boolean delete(List<Long> ids) {
ThreadPoolExecutor executor = new ThreadPoolExecutor(5, ids.size() > 5 ? ids.size() : 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
final Long userId = AuthUtil.getUserId();
ids.forEach(id -> {
executor.execute(() -> {
save(VectorParamLogEntity.builder()
VectorParamLogEntity log = VectorParamLogEntity.builder()
.vectorParamId(id)
.type(DataOperateType.DELETE.getCode()).build());
});
.type(DataOperateType.DELETE.getCode()).build();
log.setCreateUser(userId);
save(log);
});
return Boolean.TRUE;
}
@ -71,6 +72,7 @@ public class VectorParamLogServiceImpl extends ServiceImpl<VectorParamLogMapper,
return false;
}
req.setType(DataOperateType.SYNCHRONIZATION.getCode());
req.setCreateUser(AuthUtil.getUserId());
return save(req);
}
}

9
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java

@ -171,4 +171,13 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
}
return true;
}
@Override
public Boolean removeByIdsWithLog(List<Long> idList) {
Boolean result = baseMapper.deleteBatchIds(idList) > 0;
if (result) {
vectorParamLogService.delete(idList);
}
return result;
}
}

Loading…
Cancel
Save