fix: 体系数据列表数据条数错误
This commit is contained in:
+1
@@ -37,4 +37,5 @@ public interface SarBussStandMenuDao extends BaseMapper<SarBussStandMenu> {
|
|||||||
|
|
||||||
int updateMenuidByMenuid (@Param("oldMenuid") String oldMenuid ,@Param("newMenuid") String newMenuid);
|
int updateMenuidByMenuid (@Param("oldMenuid") String oldMenuid ,@Param("newMenuid") String newMenuid);
|
||||||
|
|
||||||
|
List<SarBussStandMenu> getESStandMenu();
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-11
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarMenuStandard.service.impl;
|
|||||||
|
|
||||||
import com.adc.da.exception.AdcDaBaseException;
|
import com.adc.da.exception.AdcDaBaseException;
|
||||||
import com.adc.da.scheduled.dao.SarStandardInfoDao;
|
import com.adc.da.scheduled.dao.SarStandardInfoDao;
|
||||||
|
import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao;
|
||||||
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
|
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
|
||||||
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
|
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
|
||||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||||
@@ -74,7 +75,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
private ITsDicTypeService dicItemService;
|
private ITsDicTypeService dicItemService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITsDictionaryService dicService;
|
private SarBussStandMenuDao sarBussStandMenuDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
|
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
|
||||||
@@ -171,18 +172,20 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
}
|
}
|
||||||
// 把所有关联表中的数据拉出来
|
// 把所有关联表中的数据拉出来
|
||||||
// 国标
|
// 国标
|
||||||
List<SarStandMenu> gbStandMenu = sarStandMenuDao.getGBStandMenu();
|
List<SarStandMenu> gbStandMenu = sarStandMenuDao.getGBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());
|
||||||
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
|
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
|
||||||
|
|
||||||
// 外标
|
// 外标
|
||||||
List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu();
|
List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());;
|
||||||
List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class);
|
List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class);
|
||||||
|
|
||||||
// 企标
|
// 企标
|
||||||
LambdaQueryWrapper<SarBussStandMenu> bussWrapper = new LambdaQueryWrapper<>();
|
List<SarBussStandMenu> esStandMenu = sarBussStandMenuDao.getESStandMenu().stream().filter(item -> item.getBussStandId() != null).collect(Collectors.toList());
|
||||||
bussWrapper.apply("LENGTH(menu_id) > {0}", 30);
|
List<StandMenuRelation> esRelations = new ArrayList<>();
|
||||||
List<SarBussStandMenu> esStandMenu = sarBussStandMenuService.list(bussWrapper);
|
for (SarBussStandMenu s : esStandMenu) {
|
||||||
List<StandMenuRelation> esRelations = BeanCopyUtils.copyBeanList(esStandMenu, StandMenuRelation.class);
|
StandMenuRelation standMenuRelation = new StandMenuRelation(s.getBussStandId(), s.getMenuId());
|
||||||
|
esRelations.add(standMenuRelation);
|
||||||
|
}
|
||||||
// 计算每个节点的数值
|
// 计算每个节点的数值
|
||||||
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
|
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
|
||||||
// 拼接返回
|
// 拼接返回
|
||||||
@@ -191,6 +194,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
|
public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
|
||||||
|
boolean select = standSystemDTO.getSelectIdList() != null;
|
||||||
String menuId = standSystemDTO.getMenuId();
|
String menuId = standSystemDTO.getMenuId();
|
||||||
// 校验menuId不能为空
|
// 校验menuId不能为空
|
||||||
if (StringUtils.isBlank(menuId)) {
|
if (StringUtils.isBlank(menuId)) {
|
||||||
@@ -207,13 +211,21 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
List<String> childIds = new ArrayList<>();
|
List<String> childIds = new ArrayList<>();
|
||||||
targetNode.collectChildIds(childIds);
|
targetNode.collectChildIds(childIds);
|
||||||
standSystemDTO.setMenuIdList(childIds);
|
standSystemDTO.setMenuIdList(childIds);
|
||||||
|
if (!select) {
|
||||||
|
standSystemDTO.setSelectIdList(targetNode.getGbStandIdList());
|
||||||
|
}
|
||||||
// 查国标
|
// 查国标
|
||||||
List<StandSystemDTO> gbList = sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "INLAND");
|
Set<StandSystemDTO> gbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "INLAND"));
|
||||||
|
if (!select) {
|
||||||
|
standSystemDTO.setSelectIdList(targetNode.getFbStandIdList());
|
||||||
|
}
|
||||||
// 查外标
|
// 查外标
|
||||||
List<StandSystemDTO> fbList = sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "FOREIGN");
|
Set<StandSystemDTO> fbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "FOREIGN"));
|
||||||
|
if (!select) {
|
||||||
|
standSystemDTO.setSelectIdList(targetNode.getEsStandIdList());
|
||||||
|
}
|
||||||
// 查企标
|
// 查企标
|
||||||
List<StandSystemDTO> esList = sarBussionessStandDao.getESSystemData(standSystemDTO);
|
Set<StandSystemDTO> esList = new HashSet<>(sarBussionessStandDao.getESSystemData(standSystemDTO));
|
||||||
// 数据转换后整合
|
// 数据转换后整合
|
||||||
List<StandSystemDTO> resultList = new ArrayList<>();
|
List<StandSystemDTO> resultList = new ArrayList<>();
|
||||||
resultList.addAll(gbList);
|
resultList.addAll(gbList);
|
||||||
|
|||||||
@@ -145,15 +145,35 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getGBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
|
<select id="getGBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
|
||||||
select sm.MENU_ID, sm.STAND_ID from SAR_STAND_MENU AS sm
|
select
|
||||||
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID
|
DISTINCT
|
||||||
where stand.STAND_TYPE = 'INLAND' AND LENGTH(sm.MENU_ID) > 30
|
sms.ID AS menuId,
|
||||||
|
stand.ID as standId
|
||||||
|
from SAR_STAND_MENU AS sm
|
||||||
|
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
|
||||||
|
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
|
||||||
|
where stand.STAND_TYPE = 'INLAND'
|
||||||
|
AND sms.MENU_NAME IS NOT NULL
|
||||||
|
AND LENGTH(sm.MENU_ID) > 30
|
||||||
|
AND sm.VALID_FLAG = '0'
|
||||||
|
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
|
||||||
|
group by stand.ID
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getFBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
|
<select id="getFBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
|
||||||
select sm.MENU_ID, sm.STAND_ID from SAR_STAND_MENU AS sm
|
select
|
||||||
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID
|
DISTINCT
|
||||||
where stand.STAND_TYPE = 'FOREIGN' AND LENGTH(sm.MENU_ID) > 30
|
sms.ID AS menuId,
|
||||||
|
stand.ID as standId
|
||||||
|
from SAR_STAND_MENU AS sm
|
||||||
|
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
|
||||||
|
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
|
||||||
|
where stand.STAND_TYPE = 'FOREIGN'
|
||||||
|
AND sms.MENU_NAME IS NOT NULL
|
||||||
|
AND LENGTH(sm.MENU_ID) > 30
|
||||||
|
AND sm.VALID_FLAG = '0'
|
||||||
|
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
|
||||||
|
group by stand.ID
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getStandInfoSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
<select id="getStandInfoSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
||||||
@@ -173,12 +193,14 @@
|
|||||||
WHEN gb.STAND_TYPE = 'INLAND' THEN 1
|
WHEN gb.STAND_TYPE = 'INLAND' THEN 1
|
||||||
WHEN gb.STAND_TYPE = 'FOREIGN' THEN 2
|
WHEN gb.STAND_TYPE = 'FOREIGN' THEN 2
|
||||||
END AS standTypeSort,
|
END AS standTypeSort,
|
||||||
m.MENU_ID AS menuId
|
sms.ID AS menuId
|
||||||
FROM
|
FROM
|
||||||
`sar_standards_info` AS gb
|
`sar_standards_info` AS gb
|
||||||
LEFT JOIN `sar_stand_attr_info` AS gba ON gb.ID = gba.STAND_ID
|
LEFT JOIN `sar_stand_attr_info` AS gba ON gb.ID = gba.STAND_ID
|
||||||
LEFT JOIN `sar_stand_menu` AS m ON gb.ID = m.STAND_ID AND LENGTH(m.MENU_ID) > 30
|
LEFT JOIN `sar_stand_menu` AS m ON gb.ID = m.STAND_ID AND LENGTH(m.MENU_ID) > 30
|
||||||
WHERE 1 = 1
|
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
|
||||||
|
WHERE gb.VALID_FLAG = '0'
|
||||||
|
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
|
||||||
<!--国标/外标-->
|
<!--国标/外标-->
|
||||||
<if test="param.standNo != null and param.standNo != ''">
|
<if test="param.standNo != null and param.standNo != ''">
|
||||||
AND gb.STAND_TYPE = #{dataSource}
|
AND gb.STAND_TYPE = #{dataSource}
|
||||||
@@ -233,6 +255,7 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
group by gb.ID
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+18
@@ -203,6 +203,24 @@
|
|||||||
where buss_stand_id = #{bussStandId} and valid_flag=0
|
where buss_stand_id = #{bussStandId} and valid_flag=0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getESStandMenu" resultType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
|
||||||
|
select
|
||||||
|
DISTINCT
|
||||||
|
sms.ID AS menuId,
|
||||||
|
stand.ID AS bussStandId
|
||||||
|
from sar_buss_stand_menu AS sm
|
||||||
|
LEFT JOIN sar_bussioness_stand AS stand
|
||||||
|
ON sm.BUSS_STAND_ID = stand.ID AND
|
||||||
|
stand.VALID_FLAG = 0
|
||||||
|
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
|
||||||
|
where LENGTH(sm.MENU_ID) > 30
|
||||||
|
AND sms.MENU_NAME IS NOT NULL
|
||||||
|
AND sm.VALID_FLAG = 0
|
||||||
|
AND sm.TREE_TYPE is null
|
||||||
|
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
|
||||||
|
group by stand.ID
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
|
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
|
||||||
delete from SAR_BUSS_STAND_MENU
|
delete from SAR_BUSS_STAND_MENU
|
||||||
where buss_stand_id = #{bussStandId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
|
where buss_stand_id = #{bussStandId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
|
||||||
|
|||||||
+9
-2
@@ -1269,6 +1269,7 @@
|
|||||||
|
|
||||||
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
||||||
SELECT
|
SELECT
|
||||||
|
DISTINCT
|
||||||
es.ID AS standId,
|
es.ID AS standId,
|
||||||
es.STAND_CODE AS standNo,
|
es.STAND_CODE AS standNo,
|
||||||
es.STAND_NAME AS standName,
|
es.STAND_NAME AS standName,
|
||||||
@@ -1279,7 +1280,7 @@
|
|||||||
esa.QCDW AS dept,
|
esa.QCDW AS dept,
|
||||||
esa.QCRBUSS AS draftUserName,
|
esa.QCRBUSS AS draftUserName,
|
||||||
'ENTERPRISE' AS dataSource,
|
'ENTERPRISE' AS dataSource,
|
||||||
m.MENU_ID AS menuId,
|
sms.ID AS menuId,
|
||||||
3 AS standTypeSort,
|
3 AS standTypeSort,
|
||||||
CASE
|
CASE
|
||||||
when es.stand_code like concat('%', 'Q/FT A', '%') THEN 0
|
when es.stand_code like concat('%', 'Q/FT A', '%') THEN 0
|
||||||
@@ -1304,8 +1305,13 @@
|
|||||||
FROM
|
FROM
|
||||||
`sar_bussioness_stand` AS es
|
`sar_bussioness_stand` AS es
|
||||||
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
|
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
|
||||||
LEFT JOIN `sar_buss_stand_menu` AS m ON es.ID = m.BUSS_STAND_ID AND LENGTH(m.MENU_ID) > 30
|
LEFT JOIN `sar_buss_stand_menu` AS m ON es.ID = m.BUSS_STAND_ID
|
||||||
|
AND LENGTH(m.MENU_ID) > 30
|
||||||
|
AND m.TREE_TYPE is null
|
||||||
|
AND m.VALID_FLAG = 0
|
||||||
|
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
|
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
|
||||||
<!--标准编号-->
|
<!--标准编号-->
|
||||||
<if test="param.standNo != null and param.standNo != ''">
|
<if test="param.standNo != null and param.standNo != ''">
|
||||||
AND es.STAND_CODE LIKE CONCAT('%',#{param.standNo},'%')
|
AND es.STAND_CODE LIKE CONCAT('%',#{param.standNo},'%')
|
||||||
@@ -1351,5 +1357,6 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
group by es.ID
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+21
-4
@@ -15,6 +15,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -125,28 +126,44 @@ public class SarMenuStandard extends BaseEntity {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer esStandCount;
|
private Integer esStandCount;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> gbStandIdList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> fbStandIdList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> esStandIdList;
|
||||||
|
|
||||||
// 添加用于计算和设置关联关系数量的方法
|
// 添加用于计算和设置关联关系数量的方法
|
||||||
// 添加用于计算和设置关联关系数量的方法
|
// 添加用于计算和设置关联关系数量的方法
|
||||||
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu, Integer curLevel) {
|
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu, Integer curLevel) {
|
||||||
|
this.gbStandIdList = new ArrayList<>();
|
||||||
|
this.fbStandIdList = new ArrayList<>();
|
||||||
|
this.esStandIdList = new ArrayList<>();
|
||||||
this.level = curLevel;
|
this.level = curLevel;
|
||||||
this.gbStandCount = countMatches(gbStandMenu, this.id);
|
this.gbStandCount = countMatches(gbStandMenu, this.id, gbStandIdList);
|
||||||
this.fbStandCount = countMatches(fbStandMenu, this.id);
|
this.fbStandCount = countMatches(fbStandMenu, this.id, fbStandIdList);
|
||||||
this.esStandCount = countMatches(esStandMenu, this.id);
|
this.esStandCount = countMatches(esStandMenu, this.id, esStandIdList);
|
||||||
|
|
||||||
for (SarMenuStandard child : children) {
|
for (SarMenuStandard child : children) {
|
||||||
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
|
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
|
||||||
this.gbStandCount += child.gbStandCount;
|
this.gbStandCount += child.gbStandCount;
|
||||||
|
this.gbStandIdList.addAll(child.gbStandIdList);
|
||||||
this.fbStandCount += child.fbStandCount;
|
this.fbStandCount += child.fbStandCount;
|
||||||
|
this.fbStandIdList.addAll(child.fbStandIdList);
|
||||||
this.esStandCount += child.esStandCount;
|
this.esStandCount += child.esStandCount;
|
||||||
|
this.esStandIdList.addAll(child.esStandIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int countMatches(List<StandMenuRelation> standMenuList, String menuId) {
|
private int countMatches(List<StandMenuRelation> standMenuList, String menuId, List<String> standIdList) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// 计算与menuId匹配的项的数量
|
// 计算与menuId匹配的项的数量
|
||||||
for (StandMenuRelation standMenu : standMenuList) {
|
for (StandMenuRelation standMenu : standMenuList) {
|
||||||
if (standMenu.getMenuId().equals(menuId)) {
|
if (standMenu.getMenuId().equals(menuId)) {
|
||||||
count++;
|
count++;
|
||||||
|
standIdList.add(standMenu.getStandId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
package com.adc.da.sys.sarMenuStandard.entity;
|
package com.adc.da.sys.sarMenuStandard.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: Mzaxd
|
* @author: Mzaxd
|
||||||
* @Date: 2023/11/14 16:31
|
* @Date: 2023/11/14 16:31
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class StandMenuRelation {
|
public class StandMenuRelation {
|
||||||
|
|
||||||
private String standId;
|
private String standId;
|
||||||
|
|||||||
Reference in New Issue
Block a user