feat:(REQ-2720) 菜单节点跟元素绑定关系更新后,根据修改发送mq的payload,减少日子大小
This commit is contained in:
parent
a023d39607
commit
bdf274a33d
@ -47,4 +47,7 @@ public class PageProductFeatureRelationReq implements IPageReq {
|
||||
*/
|
||||
@CriteriaField(field = "featureType", operator = Operator.IN)
|
||||
private List<Integer> featureResourceTypes;
|
||||
|
||||
@CriteriaField(field = "terminal", operator = Operator.EQ)
|
||||
private String terminal;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import cn.axzo.tyr.server.service.SaasFeatureResourceService;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -82,6 +83,10 @@ public class CacheProductPermissionHandler implements InitializingBean {
|
||||
.build();
|
||||
List<SaasProductModuleFeatureRelation> productFeatures = productFeatureRelationService.list(pageProductFeatureRelationReq);
|
||||
|
||||
if (CollectionUtils.isEmpty(productFeatures)) {
|
||||
return;
|
||||
}
|
||||
|
||||
storeProductPermission(productFeatures);
|
||||
log.info("end cached product permission handler rocketmq event: {}", event);
|
||||
}
|
||||
@ -90,7 +95,7 @@ public class CacheProductPermissionHandler implements InitializingBean {
|
||||
log.info("begin cached product permission handler rocketmq event: {}", event);
|
||||
PageElementFeatureResourceUpsertPayload payload = event.normalizedData(PageElementFeatureResourceUpsertPayload.class);
|
||||
|
||||
if (CollectionUtils.isEmpty(payload.getRelations())) {
|
||||
if (StringUtils.isBlank(payload.getTerminal())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,6 +103,9 @@ public class CacheProductPermissionHandler implements InitializingBean {
|
||||
.build();
|
||||
List<SaasProductModuleFeatureRelation> productFeatures = productFeatureRelationService.list(pageProductFeatureRelationReq);
|
||||
|
||||
if (CollectionUtils.isEmpty(productFeatures)) {
|
||||
return;
|
||||
}
|
||||
storeProductPermission(productFeatures);
|
||||
log.info("end cached product permission handler rocketmq event: {}", event);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class CacheProductSaasFeatureResourceHandler implements InitializingBean
|
||||
log.info("begin cached product featureResource handler rocketmq event: {}", event);
|
||||
PageElementFeatureResourceUpsertPayload payload = event.normalizedData(PageElementFeatureResourceUpsertPayload.class);
|
||||
|
||||
if (CollectionUtils.isEmpty(payload.getRelations())) {
|
||||
if (StringUtils.isBlank(payload.getTerminal())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -103,6 +103,9 @@ public class CacheProductSaasFeatureResourceHandler implements InitializingBean
|
||||
.build();
|
||||
List<SaasProductModuleFeatureRelation> productFeatures = productFeatureRelationService.list(pageProductFeatureRelationReq);
|
||||
|
||||
if (CollectionUtils.isEmpty(productFeatures)) {
|
||||
return;
|
||||
}
|
||||
storeProductFeatureResource(productFeatures);
|
||||
log.info("end cached product featureResource handler rocketmq event: {}", event);
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import cn.axzo.tyr.server.service.SaasFeatureResourceService;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -94,7 +95,7 @@ public class CacheRolePermissionHandler implements InitializingBean {
|
||||
public void onPageElementFeatureResourceUpsert(Event event, EventConsumer.Context context) {
|
||||
PageElementFeatureResourceUpsertPayload payload = event.normalizedData(PageElementFeatureResourceUpsertPayload.class);
|
||||
|
||||
if (CollectionUtils.isEmpty(payload.getRelations())) {
|
||||
if (StringUtils.isBlank(payload.getTerminal())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ public class CacheRoleSaasFeatureResourceHandler implements InitializingBean {
|
||||
public void onPageElementFeatureResourceUpsert(Event event, EventConsumer.Context context) {
|
||||
PageElementFeatureResourceUpsertPayload payload = event.normalizedData(PageElementFeatureResourceUpsertPayload.class);
|
||||
|
||||
if (CollectionUtils.isEmpty(payload.getRelations())) {
|
||||
if (StringUtils.isBlank(payload.getTerminal())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -15,5 +15,5 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class PageElementFeatureResourceUpsertPayload implements Serializable {
|
||||
|
||||
private List<SaasPageElementFeatureResourceRelation> relations;
|
||||
private String terminal;
|
||||
}
|
||||
|
||||
@ -169,25 +169,23 @@ public class SaasPageElementServiceImpl implements SaasPageElementService {
|
||||
Lists.newArrayList(modifyPageElementRelation.getFeatureResourceUniCode()), Lists.newArrayList(modifyPageElementRelation.getRelationType()), modifyPageElementRelation.getOperatorId());
|
||||
|
||||
// 保存新的绑定关系
|
||||
if (CollectionUtils.isEmpty(modifyPageElementRelation.getPageElementCodes())) {
|
||||
return;
|
||||
if (CollectionUtils.isNotEmpty(modifyPageElementRelation.getPageElementCodes())) {
|
||||
List<SaasPageElementFeatureResourceRelation> relations = modifyPageElementRelation.getPageElementCodes().stream().map(e -> SaasPageElementFeatureResourceRelation.builder()
|
||||
.pageElementCode(e)
|
||||
.featureResourceUniCode(modifyPageElementRelation.getFeatureResourceUniCode())
|
||||
.terminal(modifyPageElementRelation.getTerminal())
|
||||
.type(modifyPageElementRelation.getRelationType())
|
||||
.createBy(modifyPageElementRelation.getOperatorId())
|
||||
.build()).collect(Collectors.toList());
|
||||
saasPageElementFeatureResourceRelationDao.saveBatch(relations);
|
||||
}
|
||||
|
||||
// 保存新的绑定关系
|
||||
List<SaasPageElementFeatureResourceRelation> relations = modifyPageElementRelation.getPageElementCodes().stream().map(e -> SaasPageElementFeatureResourceRelation.builder()
|
||||
.pageElementCode(e)
|
||||
.featureResourceUniCode(modifyPageElementRelation.getFeatureResourceUniCode())
|
||||
.terminal(modifyPageElementRelation.getTerminal())
|
||||
.type(modifyPageElementRelation.getRelationType())
|
||||
.createBy(modifyPageElementRelation.getOperatorId())
|
||||
.build()).collect(Collectors.toList());
|
||||
saasPageElementFeatureResourceRelationDao.saveBatch(relations);
|
||||
|
||||
Event event = Event.builder()
|
||||
.targetType(TARGET_TYPE)
|
||||
.eventCode(PAGE_ELEMENT_FEATURE_RESOURCE_UPSERT.getEventCode())
|
||||
.data(PageElementFeatureResourceUpsertPayload.builder()
|
||||
.relations(relations)
|
||||
.terminal(modifyPageElementRelation.getTerminal())
|
||||
.build())
|
||||
.build();
|
||||
mqProducer.send(event);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user