统计的补充

This commit is contained in:
wangliwen 2022-05-11 16:57:59 +08:00
parent 68eeb69bc7
commit d6b9fa0677
6 changed files with 43 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package io.renren.common.controller;
import io.renren.common.utils.Result; import io.renren.common.utils.Result;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -32,6 +33,8 @@ public class CensusController {
private ResourceService resourceService; private ResourceService resourceService;
@Autowired @Autowired
private SysUserService sysUserService; private SysUserService sysUserService;
@Autowired
private TAbilityApplicationService tAbilityApplicationService;
@Value("${census.type}") @Value("${census.type}")
private String[] censusTypes; // 大数据局名称 private String[] censusTypes; // 大数据局名称
@ -93,7 +96,18 @@ public class CensusController {
} }
}); });
}); });
CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount);
CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return tAbilityApplicationService.countApplyAll();
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "资源申请量");
}
});
});
CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount);
all.join(); all.join();
return new Result<List<Map<String, Object>>>().ok(result); return new Result<List<Map<String, Object>>>().ok(result);
} }

View File

@ -275,12 +275,17 @@ public class ActHistoryService {
if (resourceDTO != null) { if (resourceDTO != null) {
dto.setName(resourceDTO.getName()); dto.setName(resourceDTO.getName());
dto.setResourceId(resourceDTO.getId().toString()); dto.setResourceId(resourceDTO.getId().toString());
dto.setResourceStatus(resourceDTO.getDelFlag());
dto.setResourceStatusTip(resourceDTO.getDelFlagTip());
} }
} }
} }
} }
if (dto.getResourceId() != null) {
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(dto.getResourceId()));
if (resourceDTO != null) {
dto.setResourceStatus(resourceDTO.getDelFlag());
dto.setResourceStatusTip(resourceDTO.getDelFlagTip());
}
}
if (dto.isEnded()) { // 已结束 if (dto.isEnded()) { // 已结束
continue; continue;
} }

View File

@ -17,4 +17,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
TAbilityApplicationEntity getByInstanceId(String instanceId); TAbilityApplicationEntity getByInstanceId(String instanceId);
TAbilityApplicationEntity getByBusinessKey(String businessKey); TAbilityApplicationEntity getByBusinessKey(String businessKey);
Long countApplyAll();
} }

View File

@ -14,10 +14,15 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
void updateInstanceId(String instanceId, Long id); void updateInstanceId(String instanceId, Long id);
/** 根据instanceId 获取申请内容 /**
* 根据instanceId 获取申请内容
*
* @param instanceId * @param instanceId
* @return * @return
*/ */
TAbilityApplicationDTO getByInstanceId(String instanceId); TAbilityApplicationDTO getByInstanceId(String instanceId);
TAbilityApplicationDTO getByBusinessKey(String businessKey); TAbilityApplicationDTO getByBusinessKey(String businessKey);
Long countApplyAll();
} }

View File

@ -52,5 +52,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
return ConvertUtils.sourceToTarget(entity, TAbilityApplicationDTO.class); return ConvertUtils.sourceToTarget(entity, TAbilityApplicationDTO.class);
} }
@Override
public Long countApplyAll() {
return baseDao.countApplyAll();
}
} }

View File

@ -24,4 +24,12 @@
WHERE WHERE
t1.id = #{businessKey} t1.id = #{businessKey}
</select> </select>
<select id="countApplyAll" resultType="java.lang.Long">
SELECT
COUNT( id )
FROM
t_ability_application
WHERE
approve_status = '通过'
</select>
</mapper> </mapper>