Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -4,6 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户组任务完成情况统计请求参数
|
||||
*/
|
||||
@@ -16,6 +19,9 @@ public class GetUserGroupTaskCompleteStatisticsReq {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户")
|
||||
private Set<Long> userIds;
|
||||
|
||||
@Schema(description = "标签1")
|
||||
private String tag1;
|
||||
|
||||
@@ -4,7 +4,7 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserGroupDifficultyVo {
|
||||
private float difficulty;
|
||||
private float difficult;
|
||||
private Long userId;
|
||||
private String nickname;
|
||||
private Long groupId;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.sdm.common.entity.resp.system.SysUserGroupDetailResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.utils.DateUtils;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.project.dao.SimulationDemandMapper;
|
||||
import com.sdm.project.dao.SimulationNodeMapper;
|
||||
@@ -104,8 +105,11 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
if (CollectionUtils.isNotEmpty(this.lambdaQuery().eq(SimulationNode::getNodeName, addNode.getNodeName()).list())) {
|
||||
if (NodeTypeEnum.PROJECT.getValue().equals(addNode.getNodeType())) {
|
||||
return SdmResponse.failed("同名项目已存在,请检查");
|
||||
} else if (NodeTypeEnum.PHASE.getValue().equals(addNode.getNodeType())) {
|
||||
return SdmResponse.failed("同名阶段已存在,请检查");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(addNode.getEndTime()) && StringUtils.isNotBlank(addNode.getBeginTime())) {
|
||||
if (DateUtils.parse(addNode.getEndTime(), DateUtils.PATTERN_DEFAULT).before(DateUtils.parse(addNode.getBeginTime(), DateUtils.PATTERN_DEFAULT))) {
|
||||
return SdmResponse.failed("计划结束时间不能早于计划开始时间");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,6 +296,13 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
break;
|
||||
}
|
||||
}
|
||||
Long creator = spdmNodeVo.getCreator();
|
||||
if (ObjectUtils.isNotEmpty(creator)) {
|
||||
SdmResponse<CIDUserResp> cidUserRespSdmResponse = sysUserFeignClient.queryUserDetail(UserQueryReq.builder().userId(creator).build());
|
||||
if (cidUserRespSdmResponse.isSuccess()) {
|
||||
spdmNodeVo.setCreatorObj(cidUserRespSdmResponse.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data", nodeList);
|
||||
@@ -709,20 +720,10 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
@Override
|
||||
public SdmResponse getUserGroupProjectStatistics(Long userGroupId, Long userId) {
|
||||
QueryGroupDetailReq req = new QueryGroupDetailReq();
|
||||
req.setCurrent(1);
|
||||
req.setSize(1000);
|
||||
req.setId(userGroupId);
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
SdmResponse<SysUserGroupDetailResp> sysUserGroupDetailRespSdmResponse = sysUserFeignClient.queryGroupDetail(req);
|
||||
if (!sysUserGroupDetailRespSdmResponse.isSuccess()
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData())
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData().getUsers())
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData().getUsers().getData())) {
|
||||
Map<Long, String> userId2Nickname = getUserIdToNicknameMap(userGroupId);
|
||||
if (MapUtils.isEmpty(userId2Nickname)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
Map<Long, String> userId2Nickname = sysUserGroupDetailRespSdmResponse.getData().getUsers().getData().stream().collect(Collectors.toMap(CIDUserResp::getUserId, CIDUserResp::getNickname));
|
||||
|
||||
|
||||
Set<Long> userIds = new HashSet<>();
|
||||
if (ObjectUtils.isEmpty(userId)) {
|
||||
@@ -731,7 +732,6 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
userIds.add(userId);
|
||||
}
|
||||
|
||||
|
||||
List<UserGroupProjectVo> userGroupProjectStatistics = this.baseMapper.getUserGroupProjectStatistics(userIds);
|
||||
if (CollectionUtils.isEmpty(userGroupProjectStatistics)) {
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
@@ -758,8 +758,45 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return SdmResponse.success(userResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户组内用户ID到昵称的映射
|
||||
*
|
||||
* @param userGroupId 用户组ID
|
||||
* @return 用户ID到昵称的映射
|
||||
*/
|
||||
private Map<Long, String> getUserIdToNicknameMap(Long userGroupId) {
|
||||
QueryGroupDetailReq req = new QueryGroupDetailReq();
|
||||
req.setCurrent(1);
|
||||
req.setSize(1000);
|
||||
req.setId(userGroupId);
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
SdmResponse<SysUserGroupDetailResp> sysUserGroupDetailRespSdmResponse = sysUserFeignClient.queryGroupDetail(req);
|
||||
if (!sysUserGroupDetailRespSdmResponse.isSuccess()
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData())
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData().getUsers())
|
||||
|| ObjectUtils.isEmpty(sysUserGroupDetailRespSdmResponse.getData().getUsers().getData())) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return sysUserGroupDetailRespSdmResponse.getData().getUsers().getData().stream().collect(Collectors.toMap(CIDUserResp::getUserId, CIDUserResp::getNickname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getUserGroupTaskCompleteStatistics(GetUserGroupTaskCompleteStatisticsReq req) {
|
||||
Map<Long, String> userId2Nickname = getUserIdToNicknameMap(req.getUserGroupId());
|
||||
if (MapUtils.isEmpty(userId2Nickname)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
// 设置用户ID列表
|
||||
Set<Long> userIds = new HashSet<>();
|
||||
if (ObjectUtils.isEmpty(req.getUserId())) {
|
||||
userIds = userId2Nickname.keySet();
|
||||
} else {
|
||||
userIds.add(req.getUserId());
|
||||
}
|
||||
|
||||
req.setUserIds(userIds);
|
||||
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getUserGroupTaskCompleteStatistics(req);
|
||||
|
||||
// 按用户分组统计任务状态
|
||||
@@ -776,7 +813,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
UserGroupTaskCompleteStatisticsVo userStat = userStatisticsMap.getOrDefault(userId, new UserGroupTaskCompleteStatisticsVo());
|
||||
userStat.setUserId(userId);
|
||||
userStat.setUserName(item.getNickname());
|
||||
userStat.setUserName(userId2Nickname.getOrDefault(userId, "Unknown User"));
|
||||
|
||||
Map<String, Integer> statusCount = userStat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
@@ -800,6 +837,20 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
@Override
|
||||
public SdmResponse getUserGroupDifficultyStatistics(GetUserGroupTaskCompleteStatisticsReq req) {
|
||||
Map<Long, String> userId2Nickname = getUserIdToNicknameMap(req.getUserGroupId());
|
||||
if (MapUtils.isEmpty(userId2Nickname)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
// 设置用户ID列表
|
||||
Set<Long> userIds = new HashSet<>();
|
||||
if (ObjectUtils.isEmpty(req.getUserId())) {
|
||||
userIds = userId2Nickname.keySet();
|
||||
} else {
|
||||
userIds.add(req.getUserId());
|
||||
}
|
||||
req.setUserIds(userIds);
|
||||
|
||||
List<UserGroupDifficultyVo> userGroupDifficultyStatistics = this.baseMapper.getUserGroupDifficultyStatistics(req);
|
||||
|
||||
// 按用户分组统计任务状态
|
||||
@@ -811,12 +862,12 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// 统计每个用户的各种状态任务数量
|
||||
for (UserGroupDifficultyVo item : userGroupDifficultyStatistics) {
|
||||
Long userId = item.getUserId();
|
||||
Float difficulty = item.getDifficulty();
|
||||
Float difficulty = item.getDifficult();
|
||||
alldifficultyValue.add(difficulty);
|
||||
|
||||
UserGroupDifficultyStatisticsVo userStat = userStatisticsMap.getOrDefault(userId, new UserGroupDifficultyStatisticsVo());
|
||||
userStat.setUserId(userId);
|
||||
userStat.setUserName(item.getNickname());
|
||||
userStat.setUserName(userId2Nickname.getOrDefault(userId, "Unknown User"));
|
||||
|
||||
Map<Float, Integer> statusCount = userStat.getDifficultyCount();
|
||||
if (statusCount == null) {
|
||||
@@ -843,7 +894,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// 所有任务执行状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
|
||||
if ("task".equals(req.getQueryType())) {
|
||||
if (NodeTypeEnum.TASK.getValue().equals(req.getQueryType())) {
|
||||
// 处理任务完成情况统计
|
||||
List<CommonGetCompleteFromTaskVo> commonCompleteStatisticsFromTask = this.baseMapper.getCommonCompleteStatisticsFromTask(req);
|
||||
|
||||
@@ -875,7 +926,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
resultResponse.put("allExeStatus", allExeStatus);
|
||||
resultResponse.put("result", taskResult);
|
||||
return SdmResponse.success(resultResponse);
|
||||
} else if ("performance".equals(req.getQueryType())) {
|
||||
} else if (NodeTypeEnum.PERFORMANCE.getValue().equals(req.getQueryType())) {
|
||||
// 处理指标完成情况统计
|
||||
List<CommonGetCompleteFromPerformanceVo> commonCompleteStatisticsFromPerformance = this.baseMapper.getCommonCompleteStatisticsFromPerformance(req);
|
||||
|
||||
|
||||
@@ -83,9 +83,7 @@ mybatis-plus:
|
||||
logic-delete-value: 0
|
||||
|
||||
#showSql
|
||||
logging:
|
||||
level:
|
||||
com.sdm.dao: debug
|
||||
# MyBatis SQL日志通过logback.xml配置控制
|
||||
|
||||
lombok:
|
||||
anyConstructor:
|
||||
|
||||
@@ -59,6 +59,12 @@
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
<!-- 绑定 FeignClient → 输出到日志文件 -->
|
||||
<logger name="FeignClient" level="INFO" additivity="false">
|
||||
<appender-ref ref="FILE" />
|
||||
@@ -71,17 +77,39 @@
|
||||
<appender-ref ref="STDOUT" /> <!-- 同时输出到控制台(显示 CoreLogger) -->
|
||||
</logger>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
<!-- MyBatis SQL语句输出配置 -->
|
||||
<logger name="org.apache.ibatis" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.session.AutoMappingUnknownColumnBehavior" level="ERROR"/>
|
||||
|
||||
<!-- local环境使用DEBUG级别 -->
|
||||
<springProfile name="local">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- MyBatis SQL语句详细输出 -->
|
||||
<logger name="org.apache.ibatis.logging" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.logging.jdbc" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.logging.jdbc.BaseJdbcLogger" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.datasource" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.transaction" level="DEBUG"/>
|
||||
<logger name="org.apache.ibatis.cache" level="DEBUG"/>
|
||||
|
||||
<logger name="org.mybatis" level="DEBUG"/>
|
||||
<logger name="org.mybatis.spring" level="DEBUG"/>
|
||||
<logger name="org.mybatis.spring.SqlSessionUtils" level="DEBUG"/>
|
||||
<logger name="org.mybatis.spring.transaction" level="DEBUG"/>
|
||||
|
||||
<!-- MyBatis-Plus 相关日志配置 -->
|
||||
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.core" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.core.MybatisConfiguration" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.core.MybatisMapperRegistry" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.core.override.MybatisMapperProxy" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.extension" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.extension.spring" level="DEBUG"/>
|
||||
<logger name="com.baomidou.mybatisplus.extension.MybatisPlusProperties" level="DEBUG"/>
|
||||
|
||||
<logger name="java.sql" level="DEBUG"/>
|
||||
<logger name="java.sql.Connection" level="DEBUG"/>
|
||||
<logger name="java.sql.Statement" level="DEBUG"/>
|
||||
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
|
||||
<logger name="java.sql.ResultSet" level="DEBUG"/>
|
||||
|
||||
<logger name="com.sdm.project" level="INFO"/>
|
||||
<logger name="com.sdm.project.dao" level="DEBUG"/>
|
||||
</configuration>
|
||||
@@ -344,21 +344,17 @@
|
||||
parameterType="com.sdm.project.model.req.GetUserGroupTaskCompleteStatisticsReq"
|
||||
resultType="com.sdm.project.model.vo.UserGroupTaskCompleteVo">
|
||||
select task.exe_status as exeStatus,
|
||||
task_member.user_id as userId,
|
||||
su.nickname,
|
||||
sur.groupId
|
||||
task_member.user_id as userId
|
||||
from simulation_task task
|
||||
left join simulation_task_member task_member on task.uuid = task_member.task_id
|
||||
LEFT JOIN sys_user su on task_member.user_id = su.id
|
||||
left join sys_user_group_relation sur on sur.userId = su.id
|
||||
<where>
|
||||
task_member.user_id is not null and sur.groupId is not null
|
||||
<if test="req.userGroupId != null">
|
||||
and sur.groupId = #{req.userGroupId}
|
||||
</if>
|
||||
<if test="req.userId != null">
|
||||
and task_member.user_id = #{req.userId}
|
||||
</if>
|
||||
task_member.user_id in
|
||||
(
|
||||
<foreach collection='req.userIds' item='userId' index='index' separator=','>
|
||||
#{userId}
|
||||
</foreach>
|
||||
)
|
||||
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
</if>
|
||||
@@ -397,21 +393,16 @@
|
||||
resultType="com.sdm.project.model.vo.UserGroupDifficultyVo">
|
||||
select
|
||||
task.difficult,
|
||||
task_member.user_id as userId,
|
||||
su.nickname,
|
||||
sur.groupId
|
||||
task_member.user_id as userId
|
||||
from simulation_task task
|
||||
left join simulation_task_member task_member on task.uuid = task_member.task_id
|
||||
LEFT JOIN sys_user su on task_member.user_id = su.id
|
||||
left join sys_user_group_relation sur on sur.userId = su.id
|
||||
<where>
|
||||
task_member.user_id is not null and sur.groupId is not null
|
||||
<if test="req.userGroupId != null">
|
||||
and sur.groupId = #{req.userGroupId}
|
||||
</if>
|
||||
<if test="req.userId != null">
|
||||
and task_member.user_id = #{req.userId}
|
||||
</if>
|
||||
task_member.user_id in
|
||||
(
|
||||
<foreach collection='req.userIds' item='userId' index='index' separator=','>
|
||||
#{userId}
|
||||
</foreach>
|
||||
)
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
</if>
|
||||
@@ -455,7 +446,9 @@
|
||||
from simulation_task task
|
||||
left join simulation_node node on task.${req.resultTagType} = node.uuid
|
||||
<where>
|
||||
1=1 and task.exe_status is not null
|
||||
1=1
|
||||
and node.nodeName is not null and node.nodeName != ''
|
||||
and task.exe_status is not null
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
</if>
|
||||
@@ -501,6 +494,8 @@
|
||||
left join simulation_task task on performance.taskId = task.uuid
|
||||
left join simulation_node node on task.${req.resultTagType} = node.uuid
|
||||
<where>
|
||||
node.nodeName is not null and node.nodeName != ''
|
||||
and
|
||||
performance.completeStatus is not null
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
@@ -545,7 +540,9 @@
|
||||
from simulation_task task
|
||||
left join simulation_node node on task.${req.resultTagType} = node.uuid
|
||||
<where>
|
||||
1=1 and task.approval_status is not null
|
||||
1=1
|
||||
and node.nodeName is not null and node.nodeName != ''
|
||||
and task.approval_status is not null
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user