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