Merge branch 'dev' of http://221.0.232.152:9393/ability-center/share-platform into dev
This commit is contained in:
commit
4000c2d30e
|
@ -43,6 +43,7 @@ import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
|||
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.dao.SysDeptDao;
|
||||
import io.renren.modules.sys.dao.SysRegionDao;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
|
@ -180,6 +181,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Autowired
|
||||
private TbDataResourceRelDao tbDataResourceRelDao;
|
||||
|
||||
@Autowired
|
||||
private SysRegionDao sysRegionDao;
|
||||
|
||||
@Value("${census.type}")
|
||||
private String[] censusTypes; // 需要进行统计的资源类型
|
||||
|
||||
|
@ -386,13 +390,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
//默认按上架时间降序排列
|
||||
String orderField;
|
||||
if (StringUtils.isBlank(jsonObject.getString("orderField"))) {
|
||||
if ("应用资源".equals(jsonObject.getString("type"))) {
|
||||
orderField = "deptSort";
|
||||
} else if ("组件服务".equals(jsonObject.getString("type"))) {
|
||||
orderField = "pin_top";
|
||||
} else {
|
||||
orderField = "total";
|
||||
}
|
||||
orderField = "visits";
|
||||
} else {
|
||||
orderField = jsonObject.getString("orderField");
|
||||
}
|
||||
|
@ -786,13 +784,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
|
||||
//区级要根据行政区划多加一层结构
|
||||
List<CompletableFuture> tasks = listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
List<CompletableFuture> tasks =
|
||||
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
CompletableFuture task = CompletableFuture.runAsync(() -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
map.put("total", integer);
|
||||
item.getValue().forEach(item1 -> item1.remove("type"));
|
||||
item.getValue().forEach(item1 -> {
|
||||
item1.remove("type");
|
||||
item1.remove("regionSort");
|
||||
});
|
||||
map.put("dataList", item.getValue());
|
||||
if (integer != 0) {
|
||||
resultList.add(map);
|
||||
|
@ -820,12 +822,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
map.put("total", resourceDao.selectTypeCountByDist(key, jsonObject.getString("type")));
|
||||
value.forEach(item1 -> item1.remove("type"));
|
||||
map.put("dataList", value);
|
||||
map.put("regionSort", value.get(0).get("regionSort"));
|
||||
areaListTemp.add(map);
|
||||
}, executor);
|
||||
tasksArea.add(task);
|
||||
});
|
||||
CompletableFuture.allOf(tasksArea.toArray(new CompletableFuture[tasksArea.size()])).join();
|
||||
areaMap.put("dataList", areaListTemp);
|
||||
List<Map> collect = areaListTemp.stream().sorted(Comparator.comparingInt(m -> Integer.parseInt(m.get("regionSort").toString()))).collect(Collectors.toList());
|
||||
areaMap.put("dataList", collect);
|
||||
if (integer != 0) {
|
||||
resultList.add(areaMap);
|
||||
}
|
||||
|
@ -1057,7 +1061,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, key = "#p0")
|
||||
//@Cacheable(value = SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, key = "#p0")
|
||||
public List<Map> selectDTOPageSpecilTotal(ResourceDTO resourceDTO) {
|
||||
return resourceDao.selectDTOPageSpecilTotal(resourceDTO);
|
||||
}
|
||||
|
@ -1065,7 +1069,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object getApplyCameraList(Long instanceId) {
|
||||
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("instance_id", instanceId).eq("approve_status", "通过");
|
||||
queryWrapper.eq("instance_id", instanceId)
|
||||
.eq("approve_status", "通过");
|
||||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> {
|
||||
|
@ -1849,7 +1854,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
|
||||
} else {
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(his.getBusinessKey()));
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null && resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null
|
||||
&& resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
resourceIds.add(resourceMountApplyDTO.getResourceDTO().getId());
|
||||
if (resourceMountApplyDTO.getResourceId() != null) {
|
||||
ResourceDTO resourceDTO = get(resourceMountApplyDTO.getResourceId());
|
||||
|
|
|
@ -103,6 +103,12 @@
|
|||
DISTINCT tdr.id,
|
||||
tdr.create_date,
|
||||
tdr.visits,
|
||||
tdr.visitor,
|
||||
tdr.pin_top,
|
||||
tdr.pin_top_time,
|
||||
sd.type AS "deptType",
|
||||
sd.sort AS "deptSort",
|
||||
sr.sort AS "regionSort",
|
||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
|
@ -132,10 +138,10 @@
|
|||
AND user_id = #{dto.creator}
|
||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id
|
||||
=
|
||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id =
|
||||
taa3.resource_id
|
||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
WHERE 1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
<if test="dto.type != null and dto.type != '赋能案例'">
|
||||
|
@ -192,7 +198,7 @@
|
|||
ORDER BY ${orderField} ${orderType}, pin_top_time DESC
|
||||
</if>
|
||||
<if test="orderField == 'deptSort'">
|
||||
ORDER BY sd.type, sd.sort
|
||||
ORDER BY sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
|
||||
</if>
|
||||
<if test="orderField != 'pin_top' and orderField != 'deptSort'">
|
||||
ORDER BY ${orderField} ${orderType}
|
||||
|
@ -308,8 +314,6 @@
|
|||
tdr.undercarriage_reason,
|
||||
tdr.undercarriage_user_name,
|
||||
tdr.info_list,
|
||||
tdr.pin_top,
|
||||
tdr.pin_top_time,
|
||||
IFNULL( trs.score, 0 ) AS "score",
|
||||
IFNULL( taa.applyCount, 0 ) AS "applyCount",
|
||||
IFNULL( trc.collectCount, 0 ) AS "collectCount",
|
||||
|
@ -389,10 +393,14 @@
|
|||
tdr.total AS total,
|
||||
tdr.pin_top,
|
||||
tdr.pin_top_time,
|
||||
tdr.visitor,
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||
sd.name AS "deptName",
|
||||
sd.type AS "deptType",
|
||||
sd.sort AS "deptSort",
|
||||
sr.sort AS "regionSort",
|
||||
IFNULL(trc2.isCollect, 'false') AS "isCollect",
|
||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
||||
IF ( IFNULL( trcar.car, 0 ) > 0, TRUE, FALSE ) AS "isInShoppingCart",
|
||||
|
@ -415,10 +423,10 @@
|
|||
AND user_id = #{dto.creator}
|
||||
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1
|
||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id
|
||||
=
|
||||
AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id =
|
||||
taa3.resource_id
|
||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
WHERE 1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
|
||||
|
@ -465,7 +473,7 @@
|
|||
ORDER BY ${orderField} ${orderType}, pin_top_time DESC
|
||||
</if>
|
||||
<if test="orderField == 'deptSort'">
|
||||
ORDER BY sd.type, sd.sort
|
||||
ORDER BY sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
|
||||
</if>
|
||||
<if test="orderField != 'pin_top' and orderField != 'deptSort'">
|
||||
ORDER BY ${orderField} ${orderType}
|
||||
|
@ -599,13 +607,13 @@
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||
"type",
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||
sd.NAME AS "deptName",
|
||||
IFNULL( tdr.deptCount, 0 ) AS "deptCount",
|
||||
sd.id AS "deptId",
|
||||
sr.name AS "districtName",
|
||||
sr.id AS "districtId"
|
||||
sr.id AS "districtId",
|
||||
sr.sort AS "regionSort"
|
||||
FROM
|
||||
sys_dept sd
|
||||
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
|
||||
|
@ -614,7 +622,7 @@
|
|||
</if>
|
||||
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
|
||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
ORDER BY sd.type, sr.sort, sd.sort
|
||||
ORDER BY sd.type, sd.sort
|
||||
) temp1
|
||||
WHERE
|
||||
1 = 1
|
||||
|
@ -633,8 +641,7 @@
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||
"type",
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
|
||||
FROM
|
||||
sys_dept sd
|
||||
|
@ -672,8 +679,7 @@
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||
"type",
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||
IFNULL( tdr.deptCount, 0) AS "deptCount",
|
||||
IFNULL(sr.name, '暂无该地区') AS "districtName"
|
||||
FROM
|
||||
|
@ -1515,10 +1521,15 @@
|
|||
SELECT
|
||||
tdr.id,
|
||||
tdr.`name`,
|
||||
sd.name AS "deptName"
|
||||
sd.name AS "deptName",
|
||||
sd.sort AS "deptSort",
|
||||
sd.type AS "deptType",
|
||||
sr.sort AS "regionSort",
|
||||
tdr.visitor
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
|
||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.type = '应用资源'
|
||||
|
@ -1527,7 +1538,7 @@
|
|||
AND sd.type = #{type}
|
||||
</if>
|
||||
ORDER BY
|
||||
tdr.visitor
|
||||
sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
|
||||
LIMIT ${pageNum}, 9
|
||||
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue