统计各类资源申请数目
This commit is contained in:
parent
1abc8a883e
commit
77628f982b
|
@ -134,4 +134,21 @@ public class CensusController {
|
||||||
all.join();
|
all.join();
|
||||||
return new Result<List<Map<String, Object>>>().ok(result);
|
return new Result<List<Map<String, Object>>>().ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/apply_amount")
|
||||||
|
@ApiOperation("各类资源申请成功数目")
|
||||||
|
public Result<List<Map<String, Object>>> applyAmount() {
|
||||||
|
List<Map<String, Object>> dbAmount = tAbilityApplicationService.getAmountGroupByType();
|
||||||
|
List<String> temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList());
|
||||||
|
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型
|
||||||
|
Map<String, Object> nullMap = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", 0);
|
||||||
|
put("type", index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dbAmount.add(nullMap);
|
||||||
|
});
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(dbAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import io.renren.common.dao.BaseDao;
|
||||||
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 能力申请表单
|
* 能力申请表单
|
||||||
*
|
*
|
||||||
|
@ -19,4 +22,6 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
|
||||||
TAbilityApplicationEntity getByBusinessKey(String businessKey);
|
TAbilityApplicationEntity getByBusinessKey(String businessKey);
|
||||||
|
|
||||||
Long countApplyAll();
|
Long countApplyAll();
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAmountGroupByType();
|
||||||
}
|
}
|
|
@ -4,6 +4,9 @@ import io.renren.common.service.CrudService;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 能力申请表单
|
* 能力申请表单
|
||||||
*
|
*
|
||||||
|
@ -25,4 +28,6 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
|
||||||
TAbilityApplicationDTO getByBusinessKey(String businessKey);
|
TAbilityApplicationDTO getByBusinessKey(String businessKey);
|
||||||
|
|
||||||
Long countApplyAll();
|
Long countApplyAll();
|
||||||
|
|
||||||
|
List<Map<String, Object>> getAmountGroupByType();
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,5 +58,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
|
||||||
return baseDao.countApplyAll();
|
return baseDao.countApplyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAmountGroupByType() {
|
||||||
|
return baseDao.getAmountGroupByType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -253,7 +253,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
object.put("pageSize", 9);
|
object.put("pageSize", 9);
|
||||||
object.put("orderFiled", "total");
|
object.put("orderFiled", "total");
|
||||||
object.put("orderType", "DESC");
|
object.put("orderType", "DESC");
|
||||||
Page<ResourceDTO> resultPage = (Page<ResourceDTO>)this.selectMostPopular(object);
|
Page<ResourceDTO> resultPage = (Page<ResourceDTO>) this.selectMostPopular(object);
|
||||||
if (!applyAreaList.isEmpty()) {
|
if (!applyAreaList.isEmpty()) {
|
||||||
ResourceDTO resourceDTO = new ResourceDTO();
|
ResourceDTO resourceDTO = new ResourceDTO();
|
||||||
ArrayList<AttrEntity> list = new ArrayList<>();
|
ArrayList<AttrEntity> list = new ArrayList<>();
|
||||||
|
@ -267,7 +267,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
jsonObject.put("pageSize", 9);
|
jsonObject.put("pageSize", 9);
|
||||||
jsonObject.put("orderField", "total");
|
jsonObject.put("orderField", "total");
|
||||||
jsonObject.put("orderType", "DESC");
|
jsonObject.put("orderType", "DESC");
|
||||||
Page<ResourceDTO> Page = (Page<ResourceDTO>)this.pageWithAttrs(jsonObject);
|
Page<ResourceDTO> Page = (Page<ResourceDTO>) this.pageWithAttrs(jsonObject);
|
||||||
//若查出数据不足9条则在热门能力补充缺少的数量
|
//若查出数据不足9条则在热门能力补充缺少的数量
|
||||||
if (Page.getRecords().size() < 9) {
|
if (Page.getRecords().size() < 9) {
|
||||||
for (int i = 0; Page.getRecords().size() < 9; i++) {
|
for (int i = 0; Page.getRecords().size() < 9; i++) {
|
||||||
|
|
|
@ -32,4 +32,16 @@
|
||||||
WHERE
|
WHERE
|
||||||
approve_status = '通过'
|
approve_status = '通过'
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAmountGroupByType" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
tbr.type AS type,
|
||||||
|
COUNT( taa.id ) AS amount
|
||||||
|
FROM
|
||||||
|
t_ability_application AS taa
|
||||||
|
INNER JOIN tb_data_resource AS tbr ON taa.resource_id = tbr.id
|
||||||
|
WHERE
|
||||||
|
taa.approve_status = '通过'
|
||||||
|
GROUP BY
|
||||||
|
tbr.type
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue