1、需求拓展属性 bugfix
This commit is contained in:
@@ -31,4 +31,6 @@ public interface SimulationDemandMapper extends BaseMapper<SimulationDemand> {
|
||||
List<SpdmDemandMemberVo> getMemberList(@Param("demandIdList") List<String> demandIdList, @Param("memberType") Integer memberType);
|
||||
|
||||
SpdmDemandVo getDemandByName(@Param("tenantId") Long tenantId,@Param("demandName") String demandName);
|
||||
|
||||
List<SpdmDemandExtraVo> getDemandExtraList(@Param("demandIdList") List<String> demandIdList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.sdm.project.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sdm.common.entity.pojo.BaseEntity;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.project.model.req.SpdmDemandExtraReq;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpdmDemandExtraVo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 关联的需求id
|
||||
*/
|
||||
private String demandId;
|
||||
|
||||
/**
|
||||
* 需求拓展属性编码
|
||||
*/
|
||||
private String propertyName;
|
||||
|
||||
/**
|
||||
* 需求拓展属性值
|
||||
*/
|
||||
private String propertyValue;
|
||||
|
||||
|
||||
/**
|
||||
* 需求拓展属性值类型
|
||||
*/
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 需求拓展属性class
|
||||
*/
|
||||
private Integer propertyClass;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class SpdmDemandVo extends BaseEntity {
|
||||
/**
|
||||
* 预留拓展属性
|
||||
*/
|
||||
private List<SpdmDemandExtraReq> extraList;
|
||||
private List<SpdmDemandExtraVo> extraList;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
|
||||
@@ -439,7 +439,12 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
userMap = userList.stream().collect(Collectors.groupingBy(CIDUserResp::getUserId));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> demandIdList = demandList.stream().map(SpdmDemandVo::getUuid).toList();
|
||||
List<SpdmDemandExtraVo> demandExtraList = mapper.getDemandExtraList(demandIdList);
|
||||
Map<String, List<SpdmDemandExtraVo>> demandExtraMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(demandExtraList)) {
|
||||
demandExtraMap = demandExtraList.stream().collect(Collectors.groupingBy(SpdmDemandExtraVo::getDemandId));
|
||||
}
|
||||
for (SpdmDemandVo spdmDemandVo : demandList) {
|
||||
eachTaskList = taskMap.get(spdmDemandVo.getUuid());
|
||||
spdmDemandVo.setProgress(CollectionUtils.isEmpty(eachTaskList) ? 0 : eachTaskList.stream().mapToInt(SpdmTaskVo::getProgress).sum() / eachTaskList.size());
|
||||
@@ -467,6 +472,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
}
|
||||
}
|
||||
spdmDemandVo.setEMemberList(spdmEUserVoList);
|
||||
spdmDemandVo.setExtraList(demandExtraMap.get(spdmDemandVo.getUuid()));
|
||||
}
|
||||
jsonObject.put("data", demandList);
|
||||
return SdmResponse.success(jsonObject);
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
</insert>
|
||||
|
||||
<insert id="addDemandExtra">
|
||||
insert into simulation_demand_extra (uuid,demand_id,nodeId,property_name,property_value,value_type,property_class,creator,create_time) values
|
||||
insert into simulation_demand_extra (demand_id,property_name,property_value,value_type,property_class,creator,create_time) values
|
||||
<foreach collection='demandExtraList' item='extra' index='index' separator=','>
|
||||
(#{extra.uuid},#{extra.demandId},#{extra.nodeId},#{extra.propertyName},#{extra.propertyValue},#{extra.valueType},#{extra.propertyClass},#{extra.creator},#{extra.createTime})
|
||||
(#{extra.demandId},#{extra.propertyName},#{extra.propertyValue},#{extra.valueType},#{extra.propertyClass},#{extra.creator},#{extra.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -152,4 +152,12 @@
|
||||
select * from simulation_demand where tenant_id = #{tenantId} and demand_name = #{demandName} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getDemandExtraList" resultType="com.sdm.project.model.vo.SpdmDemandExtraVo">
|
||||
select * from simulation_demand_extra where demand_id in (
|
||||
<foreach collection='demandIdList' item='demandId' index='index' separator=','>
|
||||
#{demandId}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user