Browse Source

fix:问题标注,标注人显示

zhongwei
luyie 2 months ago
parent
commit
ce176912be
  1. 20
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/AgentLogController.java
  2. 7
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/AgentLogEntity.java
  3. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/AgentLogMapper.java
  4. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/AgentLogService.java
  5. 34
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java

20
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 lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; 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.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Author: ypj * @Author: ypj
* @Date: 2024/9/9 10:37 * @Date: 2024/9/9 10:37
@ -40,7 +45,11 @@ public class AgentLogController {
@ApiOperation(value = "查看详情") @ApiOperation(value = "查看详情")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<AgentLogEntity> detail(@RequestParam @ApiParam("主键ID") Long id) { public R<AgentLogEntity> 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") @PostMapping("/save")
@ -77,4 +86,13 @@ public class AgentLogController {
public R label(@RequestBody LabelRequest req) { public R label(@RequestBody LabelRequest req) {
return R.status(agentLogService.label(req)); return R.status(agentLogService.label(req));
} }
@GetMapping("/test")
public R test(@RequestHeader("Hzinfo-Auth") String token) {
BladeUser user = AuthUtil.getUser();
Map<String, Object> result = new HashMap<>();
result.put("user", user);
result.put("token", token);
return R.data(result);
}
} }

7
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") @TableField("label_content")
private String labelContent; private String labelContent;
@ApiModelProperty("标注人id")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("label_operator")
private String labelOperatorId;
@ApiModelProperty("标注人名称") @ApiModelProperty("标注人名称")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
@TableField("label_operator") @TableField(exist = false)
private String labelOperator; private String labelOperator;
@ApiModelProperty("标注时间") @ApiModelProperty("标注时间")

3
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; package com.hnac.gglm.bigmodel.maintenance.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity;
@ -7,5 +8,7 @@ import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity;
* @Author: ypj * @Author: ypj
* @Date: 2024/9/9 11:07 * @Date: 2024/9/9 11:07
*/ */
@DS("hznlm")
public interface AgentLogMapper extends BaseMapper<AgentLogEntity> { public interface AgentLogMapper extends BaseMapper<AgentLogEntity> {
} }

2
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<AgentLogEntity> {
Boolean label(LabelRequest req); Boolean label(LabelRequest req);
IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req); IPage<AgentLogEntity> listPage(IPage<AgentLogEntity> page, AgentLogEntity req);
String getUsername(String userIdStr);
} }

34
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; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -13,8 +12,11 @@ import com.hnac.gglm.bigmodel.maintenance.vo.LabelRequest;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil; 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.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; 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 org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
@ -26,8 +28,8 @@ import java.util.Date;
@Service @Service
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@DS("hznlm")
public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService { public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService {
private final IUserClient userClient;
@Override @Override
public Boolean BatchLabel(IdsRequest ids) { public Boolean BatchLabel(IdsRequest ids) {
@ -35,7 +37,7 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
return this.update(Wrappers.<AgentLogEntity>lambdaUpdate() return this.update(Wrappers.<AgentLogEntity>lambdaUpdate()
.set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, 1) .set(AgentLogEntity::getLabelResult, 1)
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserName()) .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId())
.set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now) .set(AgentLogEntity::getUpdateTime, now)
.in(AgentLogEntity::getId, ids.getIds())); .in(AgentLogEntity::getId, ids.getIds()));
@ -51,7 +53,7 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
.set(AgentLogEntity::getLabelStatus, 1) .set(AgentLogEntity::getLabelStatus, 1)
.set(AgentLogEntity::getLabelResult, labelResult) .set(AgentLogEntity::getLabelResult, labelResult)
.set(StringUtil.isNotBlank(req.getLabelContent()), AgentLogEntity::getLabelContent, req.getLabelContent()) .set(StringUtil.isNotBlank(req.getLabelContent()), AgentLogEntity::getLabelContent, req.getLabelContent())
.set(AgentLogEntity::getLabelOperator, AuthUtil.getUserAccount()) .set(AgentLogEntity::getLabelOperatorId, AuthUtil.getUserId())
.set(AgentLogEntity::getLabelTime, now) .set(AgentLogEntity::getLabelTime, now)
.set(AgentLogEntity::getUpdateTime, now) .set(AgentLogEntity::getUpdateTime, now)
.eq(AgentLogEntity::getId, req.getId())); .eq(AgentLogEntity::getId, req.getId()));
@ -70,7 +72,29 @@ public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEnt
.eq(ObjectUtil.isNotEmpty(req.getLabelStatus()), AgentLogEntity::getLabelStatus, req.getLabelStatus()) .eq(ObjectUtil.isNotEmpty(req.getLabelStatus()), AgentLogEntity::getLabelStatus, req.getLabelStatus())
.orderByAsc(AgentLogEntity::getCreateTime) .orderByAsc(AgentLogEntity::getCreateTime)
.orderByAsc(AgentLogEntity::getChatId); .orderByAsc(AgentLogEntity::getChatId);
return this.page(page, queryWrapper); IPage<AgentLogEntity> 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<User> userR = userClient.userInfoById(userId);
if (userR.isSuccess() && userR.getData() != null) {
userName = userR.getData().getName();
}
} catch (Exception ignore) {
}
}
return userName;
} }
} }

Loading…
Cancel
Save