Commit 639e1d7d by songyinghui

Merge branch 'feature-content4-3' into developer

parents 99e39608 4c42a79f
......@@ -30,6 +30,12 @@ public class ContentMaterialROleInitQDTO implements Serializable {
*/
private Integer version;
/**
* 老版本
* null 代表是新增
*/
private Integer oldVersion;
public enum Version {
LOW(1, "基础版本"),
HIGH(2, "高级版");
......@@ -81,4 +87,12 @@ public class ContentMaterialROleInitQDTO implements Serializable {
public void setVersion(Integer version) {
this.version = version;
}
public Integer getOldVersion() {
return oldVersion;
}
public void setOldVersion(Integer oldVersion) {
this.oldVersion = oldVersion;
}
}
......@@ -538,12 +538,28 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
logger.info("企业{} 企微 {} 下没有角色 ", contentMaterialROleInitQDTO.getEnterpriseId(), wxEnterpriseId);
return;
}
if (contentMaterialROleInitQDTO.getOldVersion() != null
&& MaterialEnterpriseAdaptor.MaterialLevel.HIGH.getCode().equals(contentMaterialROleInitQDTO.getOldVersion())
&& MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode().equals(contentMaterialROleInitQDTO.getVersion()) ) {
logger.info("从高级版到低级版, 菜单不做调整 {}", JSON.toJSONString(contentMaterialROleInitQDTO));
return;
}
List<TabHaobanRoleMenu> haobanRoleMenus = new ArrayList<>();
for (HaobanRoleBO haobanRoleBO : haobanRoleBOS) {
List<String> menuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getVersion());
if (CollectionUtils.isEmpty(menuCodes)) {
continue;
}
// 处理当前版本 如果是低到高 只处理版本差异的
if (contentMaterialROleInitQDTO.getOldVersion() != null
&& MaterialEnterpriseAdaptor.MaterialLevel.LOW.getCode().equals(contentMaterialROleInitQDTO.getOldVersion())
&& MaterialEnterpriseAdaptor.MaterialLevel.HIGH.getCode().equals(contentMaterialROleInitQDTO.getVersion())) {
// 从低版本 升级到 高版本, 此时菜单code只取 版本 差异的菜单
List<String> lowMenuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getOldVersion());
List<String> highMenuCodes = menuCodeMap.get(haobanRoleBO.getClerkType() + "" + contentMaterialROleInitQDTO.getVersion());
highMenuCodes.removeAll(lowMenuCodes);
menuCodes = highMenuCodes;
}
logger.info("本次对应的menuCode:{}", JSON.toJSONString(menuCodes));
List<String> hasExistMenuCodes = haobanRoleMenuService.getByWxEnterpriseIdAndRoleId(wxEnterpriseId, haobanRoleBO.getRoleId());
if (CollectionUtils.isEmpty(hasExistMenuCodes)) {
......
......@@ -345,7 +345,7 @@ public class ContentMaterialController {
likeMap = likeList.stream().collect(Collectors.toMap(ContentMaterialLikeDTO::getContentMaterialId, t -> t));
}
//阅读、评论数据
List<ContentMaterialKnowVO> knowList = materialDataAdaptor.queryKnowData(enterpriseId, contentMaterialIdList);
List<ContentMaterialKnowVO> knowList = materialDataAdaptor.queryKnowData(enterpriseId, clerkId,contentMaterialIdList);
Map<Long, ContentMaterialKnowVO> knowMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(knowList)) {
knowMap = knowList.stream().collect(Collectors.toMap(ContentMaterialKnowVO::getContentMaterialId, t -> t));
......
......@@ -101,7 +101,7 @@ public class MaterialDataAdaptor {
/**
* 知识库素材列表数据
*/
private static final String MATERIAL_KNOWL_DATA = "data_cms_matl_knowl_list";
private static final String MATERIAL_KNOWL_HAOBAN_DATA = "data_cms_matl_knowl_haoban_list";
@Autowired
private EnterpriseService enterpriseService;
......@@ -525,7 +525,7 @@ public class MaterialDataAdaptor {
* @param materialIdList 素材id列表
* @return
*/
public List<ContentMaterialKnowVO> queryKnowData(String enterpriseId, List<Long> materialIdList) {
public List<ContentMaterialKnowVO> queryKnowData(String enterpriseId, String clerkId,List<Long> materialIdList) {
Map<String, Object> inlineParams = new HashMap<>();
if (CollectionUtils.isEmpty(materialIdList)) {
......@@ -533,13 +533,12 @@ public class MaterialDataAdaptor {
}
inlineParams.put("enterpriseId", enterpriseId);
inlineParams.put("contentMaterialId", StringUtils.join(materialIdList, ","));
//只查询公开的评论
inlineParams.put("showFlag", 1);
inlineParams.put("visibleClerkId", clerkId);
inlineParams.put("pageNum", 1);
inlineParams.put("pageSize", materialIdList.size());
Map<String, Object> result = null;
try {
result = DataApiUtils.http(JSON.toJSONString(inlineParams), MATERIAL_KNOWL_DATA);
result = DataApiUtils.http(JSON.toJSONString(inlineParams), MATERIAL_KNOWL_HAOBAN_DATA);
} catch (Exception e) {
log.error("获取知识库数据异常",e);
return new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment