diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java index 04d3510..34ee1ec 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java @@ -13,10 +13,15 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; +import java.util.Map; + /** * @Author: ypj * @Date: 2024/9/9 10:37 @@ -40,7 +45,11 @@ public class AgentLogController { @ApiOperation(value = "查看详情") @ApiOperationSupport(order = 2) public R detail(@RequestParam @ApiParam("主键ID") Long id) { - return R.data(agentLogService.getById(id)); + AgentLogEntity result = agentLogService.getById(id); + if (result != null) { + result.setLabelOperator(agentLogService.getUsername(result.getLabelOperatorId())); + } + return R.data(result); } @PostMapping("/save") @@ -77,4 +86,13 @@ public class AgentLogController { public R label(@RequestBody LabelRequest req) { return R.status(agentLogService.label(req)); } + + @GetMapping("/test") + public R test(@RequestHeader("Hzinfo-Auth") String token) { + BladeUser user = AuthUtil.getUser(); + Map result = new HashMap<>(); + result.put("user", user); + result.put("token", token); + return R.data(result); + } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java index 0df71b8..aa31bc1 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java @@ -82,9 +82,14 @@ public class AgentLogEntity extends TenantEntity implements Serializable { @TableField("label_content") private String labelContent; + @ApiModelProperty("标注人id") + @QueryField(condition = SqlCondition.EQUAL) + @TableField("label_operator") + private String labelOperatorId; + @ApiModelProperty("标注人名称") @QueryField(condition = SqlCondition.LIKE) - @TableField("label_operator") + @TableField(exist = false) private String labelOperator; @ApiModelProperty("标注时间") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java index 7a1ede1..332a7de 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.maintenance.mapper; +import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; @@ -7,5 +8,7 @@ import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; * @Author: ypj * @Date: 2024/9/9 11:07 */ + +@DS("hznlm") public interface AgentLogMapper extends BaseMapper { } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java index 3f9a059..e7dc769 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java @@ -16,4 +16,6 @@ public interface AgentLogService extends IService { Boolean label(LabelRequest req); IPage listPage(IPage page, AgentLogEntity req); + + String getUsername(String userIdStr); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 64b1848..cdb7a6f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -1,6 +1,5 @@ package com.hnac.gglm.bigmodel.maintenance.service.impl; -import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -13,8 +12,11 @@ import com.hnac.gglm.bigmodel.maintenance.vo.LabelRequest; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import java.util.Date; @@ -26,8 +28,8 @@ import java.util.Date; @Service @Slf4j @AllArgsConstructor -@DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { + private final IUserClient userClient; @Override public Boolean BatchLabel(IdsRequest ids) { @@ -35,7 +37,7 @@ public class AgentLogServiceImpl extends ServiceImpllambdaUpdate() .set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelResult, 1) - .set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName()) + .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId()) .set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getUpdateTime, now) .in(AgentLogEntity::getId, ids.getIds())); @@ -51,7 +53,7 @@ public class AgentLogServiceImpl extends ServiceImpl pageResult = baseMapper.selectPage(page, queryWrapper); + pageResult.getRecords().forEach(item -> { + String userIdStr = item.getLabelOperatorId(); + String userName = getUsername(userIdStr); + item.setLabelOperator(userName == null ? userIdStr : userName); + }); + return pageResult; + } + + @Override + public String getUsername(String userIdStr) { + String userName = null; + if (null != userIdStr) { + try { + Long userId = Long.parseLong(userIdStr); + R userR = userClient.userInfoById(userId); + if (userR.isSuccess() && userR.getData() != null) { + userName = userR.getData().getName(); + } + } catch (Exception ignore) { + } + } + return userName; } }