diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index df83c906..8371388b 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -134,4 +134,21 @@ public class CensusController { all.join(); return new Result>>().ok(result); } + + @GetMapping(value = "/apply_amount") + @ApiOperation("各类资源申请成功数目") + public Result>> applyAmount() { + List> dbAmount = tAbilityApplicationService.getAmountGroupByType(); + List temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList()); + Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型 + Map nullMap = new HashMap() { + { + put("amount", 0); + put("type", index); + } + }; + dbAmount.add(nullMap); + }); + return new Result>>().ok(dbAmount); + } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java b/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java index 1020534b..b62a4387 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java @@ -4,6 +4,9 @@ import io.renren.common.dao.BaseDao; import io.renren.modules.processForm.entity.TAbilityApplicationEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; +import java.util.Map; + /** * 能力申请表单 * @@ -19,4 +22,6 @@ public interface TAbilityApplicationDao extends BaseDao> getAmountGroupByType(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java index e60cc7f1..dd08c153 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java @@ -4,6 +4,9 @@ import io.renren.common.service.CrudService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.entity.TAbilityApplicationEntity; +import java.util.List; +import java.util.Map; + /** * 能力申请表单 * @@ -25,4 +28,6 @@ public interface TAbilityApplicationService extends CrudService> getAmountGroupByType(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java index c371c78d..7875a249 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java @@ -10,6 +10,7 @@ import io.renren.modules.processForm.service.TAbilityApplicationService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -57,5 +58,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl> getAmountGroupByType() { + return baseDao.getAmountGroupByType(); + } + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 7179ae30..95d7ad13 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -253,7 +253,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resultPage = (Page)this.selectMostPopular(object); + Page resultPage = (Page) this.selectMostPopular(object); if (!applyAreaList.isEmpty()) { ResourceDTO resourceDTO = new ResourceDTO(); ArrayList list = new ArrayList<>(); @@ -267,7 +267,7 @@ public class ResourceServiceImpl extends CrudServiceImpl Page = (Page)this.pageWithAttrs(jsonObject); + Page Page = (Page) this.pageWithAttrs(jsonObject); //若查出数据不足9条则在热门能力补充缺少的数量 if (Page.getRecords().size() < 9) { for (int i = 0; Page.getRecords().size() < 9; i++) { diff --git a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml index 3ba8b684..d5b638d2 100644 --- a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml +++ b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml @@ -32,4 +32,16 @@ WHERE approve_status = '通过' + \ No newline at end of file