Merge branch 'feature/arthas' into 'master'

Feature/arthas

See merge request universal/infrastructure/backend/nanopart!41
This commit is contained in:
金海洋 2024-07-31 05:58:03 +00:00
commit b1def74668
4 changed files with 26 additions and 4 deletions

View File

@ -40,7 +40,7 @@ public enum MaterialTargetUserTypeEnum {
JoinedWorkspaceOuJob workspaceOuJob) {
Map<Long, List<String>> workspaceJobMap = workspaceOuJob.getWorkspaceJobMap();
log.info("投放项目:{},投放岗位岗位{},当前登录单位:{},用户加入项目及担任岗位:{},单位加入的项目:{},项目下的单位:{}",
log.info("投放项目:{},投放岗位{},当前登录单位:{},用户加入项目及担任岗位:{},单位加入的项目:{},项目下的单位:{}",
JSONUtil.toJsonStr(workspaceIds), JSONUtil.toJsonStr(jobCodes),
loginOuid,
JSONUtil.toJsonStr(workspaceJobMap),
@ -105,7 +105,7 @@ public enum MaterialTargetUserTypeEnum {
JoinedWorkspaceOuJob workspaceOuJob) {
Map<Long, List<String>> ouJobMap = workspaceOuJob.getOuJobMap();
log.info("投放单位:{},投放岗位岗位{},当前登录单位:{},用户加入单位及担任岗位:{}",
log.info("投放单位:{},投放岗位{},当前登录单位:{},用户加入单位及担任岗位:{}",
JSONUtil.toJsonStr(ouIds), JSONUtil.toJsonStr(jobCodes),
loginOuid,
JSONUtil.toJsonStr(ouJobMap));

View File

@ -104,20 +104,29 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialDao, Material> impl
@Transactional(rollbackFor = Exception.class)
@Override
public List<MaterialResp> listMaterialByBannerCode(ListMaterialByBannerCodeReq req, String traceId) {
long methodStartTime = System.currentTimeMillis();
log.info("enter method {} : {}", "listMaterialByBannerCode", methodStartTime);
// 获取广告位并校验(是否存在是否启用是否在有效期)
if (Objects.isNull(validateBanner(req.getBannerCode()))) {
return Collections.emptyList();
}
log.info("step 1 banner check finished: {}, duration: {}", System.currentTimeMillis(), System.currentTimeMillis() - methodStartTime);
// 获取该广告位下已上架且在有效期内的所有素材
List<Material> materialList = list(buildListByBannerCodeQueryWrapper(req));
if (CollectionUtils.isEmpty(materialList)) {
return Collections.emptyList();
}
log.info("上架且有效广告位:{}", JSONUtil.toJsonStr(materialList));
log.info("上架且有效素材:{}", JSONUtil.toJsonStr(materialList));
log.info("step 2 get valid materials finished: {}, duration: {}", System.currentTimeMillis(), System.currentTimeMillis() - methodStartTime);
// 获取当前登录用户加入的所有项目单位及其在项目或在单位下担任的岗位
JoinedWorkspaceOuJob personJoinedWorkspaceOuJob = getPersonJoinedWorkspaceOuJob(req.getPersonId());
log.info("当前登录用户加入的所有项目,单位及其在项目或在单位下担任的岗位:{}", JSONUtil.toJsonStr(personJoinedWorkspaceOuJob));
log.info("step 3 get joined jobs finished: {}, duration: {}", System.currentTimeMillis(), System.currentTimeMillis() - methodStartTime);
// 根据素材投放规则进行过滤
List<Material> list = materialList.stream()
@ -135,6 +144,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialDao, Material> impl
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
log.info("step 4 filter by rules finished: {}, duration: {}", System.currentTimeMillis(), System.currentTimeMillis() - methodStartTime);
// 记录素材投放日志
CreateMaterialPutLogReq materialPutLogReq = new CreateMaterialPutLogReq();
@ -144,6 +154,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialDao, Material> impl
.setMaterialIds(list.stream().map(Material::getId).collect(Collectors.toList()));
materialPutLogService.create(materialPutLogReq);
log.info("step 5 record log finished: {}, duration: {}", System.currentTimeMillis(), System.currentTimeMillis() - methodStartTime);
return BeanUtil.copyToList(list, MaterialResp.class);
}
@ -468,7 +480,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialDao, Material> impl
.distinct()
.collect(Collectors.toList())));
return new JoinedWorkspaceOuJob(workspaceToJobCodeMap, ouIdToJobCodeMap,ouIdToWorkspaceMap,workspaceToOuIdMap);
return new JoinedWorkspaceOuJob(workspaceToJobCodeMap, ouIdToJobCodeMap, ouIdToWorkspaceMap, workspaceToOuIdMap);
}
/**

View File

@ -13,3 +13,8 @@ spring:
include: swagger
main:
allow-bean-definition-overriding: true
arthas:
app-name: ${spring.application.name}
agent-id: ${ARTHAS_AGENT_ID:${spring.profiles.active}-${spring.application.name}}
tunnel-server: ${ARTHAS_TUNNEL_SERVER:ws://localhost:7777/ws}

View File

@ -69,6 +69,11 @@
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.taobao.arthas</groupId>
<artifactId>arthas-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>