Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-08-15 18:56:34 +08:00
commit 367a70209c
2 changed files with 77 additions and 60 deletions

View File

@ -43,6 +43,7 @@ import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao; import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysDeptDao; 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.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
@ -180,6 +181,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired @Autowired
private TbDataResourceRelDao tbDataResourceRelDao; private TbDataResourceRelDao tbDataResourceRelDao;
@Autowired
private SysRegionDao sysRegionDao;
@Value("${census.type}") @Value("${census.type}")
private String[] censusTypes; // 需要进行统计的资源类型 private String[] censusTypes; // 需要进行统计的资源类型
@ -386,13 +390,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//默认按上架时间降序排列 //默认按上架时间降序排列
String orderField; String orderField;
if (StringUtils.isBlank(jsonObject.getString("orderField"))) { if (StringUtils.isBlank(jsonObject.getString("orderField"))) {
if ("应用资源".equals(jsonObject.getString("type"))) { orderField = "visits";
orderField = "deptSort";
} else if ("组件服务".equals(jsonObject.getString("type"))) {
orderField = "pin_top";
} else {
orderField = "total";
}
} else { } else {
orderField = jsonObject.getString("orderField"); orderField = jsonObject.getString("orderField");
} }
@ -510,7 +508,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (pinTop > 0) { if (pinTop > 0) {
return index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? 0L : index.getTotal()) : index.getPinTopTime().getTime() + +(index.getTotal() == null ? 0L : index.getTotal()); return index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? 0L : index.getTotal()) : index.getPinTopTime().getTime() + +(index.getTotal() == null ? 0L : index.getTotal());
} else { } else {
return new Date(0).getTime() + (index.getTotal() == null ? 0L : index.getTotal()); return (index.getTotal() == null ? 0L : index.getTotal());
} }
}).reversed() }).reversed()
).collect(Collectors.toList())); ).collect(Collectors.toList()));
@ -786,20 +784,24 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString())); 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 =
CompletableFuture task = CompletableFuture.runAsync(() -> { listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
HashMap<String, Object> map = new HashMap<>(); CompletableFuture task = CompletableFuture.runAsync(() -> {
map.put("type", item.getKey()); HashMap<String, Object> map = new HashMap<>();
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")); map.put("type", item.getKey());
map.put("total", integer); Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
item.getValue().forEach(item1 -> item1.remove("type")); map.put("total", integer);
map.put("dataList", item.getValue()); item.getValue().forEach(item1 -> {
if (integer != 0) { item1.remove("type");
resultList.add(map); item1.remove("regionSort");
} });
}, executor); map.put("dataList", item.getValue());
return task; if (integer != 0) {
}).collect(Collectors.toList()); resultList.add(map);
}
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join(); CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级")); Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
@ -820,12 +822,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("total", resourceDao.selectTypeCountByDist(key, jsonObject.getString("type"))); map.put("total", resourceDao.selectTypeCountByDist(key, jsonObject.getString("type")));
value.forEach(item1 -> item1.remove("type")); value.forEach(item1 -> item1.remove("type"));
map.put("dataList", value); map.put("dataList", value);
map.put("regionSort", value.get(0).get("regionSort"));
areaListTemp.add(map); areaListTemp.add(map);
}, executor); }, executor);
tasksArea.add(task); tasksArea.add(task);
}); });
CompletableFuture.allOf(tasksArea.toArray(new CompletableFuture[tasksArea.size()])).join(); 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) { if (integer != 0) {
resultList.add(areaMap); resultList.add(areaMap);
} }
@ -1057,7 +1061,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
@Override @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) { public List<Map> selectDTOPageSpecilTotal(ResourceDTO resourceDTO) {
return resourceDao.selectDTOPageSpecilTotal(resourceDTO); return resourceDao.selectDTOPageSpecilTotal(resourceDTO);
} }
@ -1065,7 +1069,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object getApplyCameraList(Long instanceId) { public Object getApplyCameraList(Long instanceId) {
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>(); 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); List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
ArrayList cameraList = new ArrayList(); ArrayList cameraList = new ArrayList();
applicationEntities.forEach(index -> { applicationEntities.forEach(index -> {
@ -1849,7 +1854,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId())); resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
} else { } else {
TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(his.getBusinessKey())); 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()); resourceIds.add(resourceMountApplyDTO.getResourceDTO().getId());
if (resourceMountApplyDTO.getResourceId() != null) { if (resourceMountApplyDTO.getResourceId() != null) {
ResourceDTO resourceDTO = get(resourceMountApplyDTO.getResourceId()); ResourceDTO resourceDTO = get(resourceMountApplyDTO.getResourceId());

View File

@ -103,6 +103,12 @@
DISTINCT tdr.id, DISTINCT tdr.id,
tdr.create_date, tdr.create_date,
tdr.visits, 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(taa2.approve_status, '未申请') AS "applyState",
IFNULL(trs.score, 0 ) AS "score", IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount", IFNULL(taa.applyCount, 0 ) AS "applyCount",
@ -132,10 +138,10 @@
AND user_id = #{dto.creator} AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id 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 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 taa3.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.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 WHERE 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
<if test="dto.type != null and dto.type != '赋能案例'"> <if test="dto.type != null and dto.type != '赋能案例'">
@ -192,7 +198,7 @@
ORDER BY ${orderField} ${orderType}, pin_top_time DESC ORDER BY ${orderField} ${orderType}, pin_top_time DESC
</if> </if>
<if test="orderField == 'deptSort'"> <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>
<if test="orderField != 'pin_top' and orderField != 'deptSort'"> <if test="orderField != 'pin_top' and orderField != 'deptSort'">
ORDER BY ${orderField} ${orderType} ORDER BY ${orderField} ${orderType}
@ -308,8 +314,6 @@
tdr.undercarriage_reason, tdr.undercarriage_reason,
tdr.undercarriage_user_name, tdr.undercarriage_user_name,
tdr.info_list, tdr.info_list,
tdr.pin_top,
tdr.pin_top_time,
IFNULL( trs.score, 0 ) AS "score", IFNULL( trs.score, 0 ) AS "score",
IFNULL( taa.applyCount, 0 ) AS "applyCount", IFNULL( taa.applyCount, 0 ) AS "applyCount",
IFNULL( trc.collectCount, 0 ) AS "collectCount", IFNULL( trc.collectCount, 0 ) AS "collectCount",
@ -389,10 +393,14 @@
tdr.total AS total, tdr.total AS total,
tdr.pin_top, tdr.pin_top,
tdr.pin_top_time, tdr.pin_top_time,
tdr.visitor,
IFNULL(trs.score, 0 ) AS "score", IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount", IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount", IFNULL(trc.collectCount, 0) AS "collectCount",
sd.name AS "deptName", sd.name AS "deptName",
sd.type AS "deptType",
sd.sort AS "deptSort",
sr.sort AS "regionSort",
IFNULL(trc2.isCollect, 'false') AS "isCollect", IFNULL(trc2.isCollect, 'false') AS "isCollect",
IFNULL(taa2.approve_status, '未申请') AS "applyState", IFNULL(taa2.approve_status, '未申请') AS "applyState",
IF ( IFNULL( trcar.car, 0 ) &gt; 0, TRUE, FALSE ) AS "isInShoppingCart", IF ( IFNULL( trcar.car, 0 ) &gt; 0, TRUE, FALSE ) AS "isInShoppingCart",
@ -415,10 +423,10 @@
AND user_id = #{dto.creator} AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id 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 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 taa3.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.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 WHERE 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
@ -465,7 +473,7 @@
ORDER BY ${orderField} ${orderType}, pin_top_time DESC ORDER BY ${orderField} ${orderType}, pin_top_time DESC
</if> </if>
<if test="orderField == 'deptSort'"> <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>
<if test="orderField != 'pin_top' and orderField != 'deptSort'"> <if test="orderField != 'pin_top' and orderField != 'deptSort'">
ORDER BY ${orderField} ${orderType} ORDER BY ${orderField} ${orderType}
@ -599,13 +607,13 @@
FROM FROM
( (
SELECT SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
"type",
sd.NAME AS "deptName", sd.NAME AS "deptName",
IFNULL( tdr.deptCount, 0 ) AS "deptCount", IFNULL( tdr.deptCount, 0 ) AS "deptCount",
sd.id AS "deptId", sd.id AS "deptId",
sr.name AS "districtName", sr.name AS "districtName",
sr.id AS "districtId" sr.id AS "districtId",
sr.sort AS "regionSort"
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 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> </if>
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
LEFT JOIN sys_region sr ON sd.district = sr.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 ) temp1
WHERE WHERE
1 = 1 1 = 1
@ -633,8 +641,7 @@
FROM FROM
( (
SELECT SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
"type",
IFNULL( tdr.deptCount, 0 ) AS "deptCount" IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM FROM
sys_dept sd sys_dept sd
@ -672,8 +679,7 @@
FROM FROM
( (
SELECT SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
"type",
IFNULL( tdr.deptCount, 0) AS "deptCount", IFNULL( tdr.deptCount, 0) AS "deptCount",
IFNULL(sr.name, '暂无该地区') AS "districtName" IFNULL(sr.name, '暂无该地区') AS "districtName"
FROM FROM
@ -1503,7 +1509,7 @@
<select id="resourceInstallationOrDataResourceDetails" parameterType="java.util.Map" resultType="java.util.Map"> <select id="resourceInstallationOrDataResourceDetails" parameterType="java.util.Map" resultType="java.util.Map">
SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName
FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
WHERE a.type = #{resourceType} AND a.del_flag = 0 WHERE a.type = #{resourceType} AND a.del_flag = 0
<if test="id != '0'.toString()"> <if test="id != '0'.toString()">
AND (b.ID = #{id} OR INSTR(b.pids,#{id})) AND (b.ID = #{id} OR INSTR(b.pids,#{id}))
@ -1513,34 +1519,39 @@
</select> </select>
<select id="selectAppList" resultType="java.util.Map"> <select id="selectAppList" resultType="java.util.Map">
SELECT SELECT
tdr.id, tdr.id,
tdr.`name`, 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 FROM
tb_data_resource tdr tb_data_resource tdr
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN sys_region sr ON sd.district = sr.id
WHERE WHERE
1 = 1 1 = 1
AND tdr.type = '应用资源' AND tdr.type = '应用资源'
AND tdr.del_flag = 0 AND tdr.del_flag = 0
<if test=" type != null and type != ''"> <if test=" type != null and type != ''">
AND sd.type = #{type} AND sd.type = #{type}
</if> </if>
ORDER BY ORDER BY
tdr.visitor sd.type, sr.sort, sd.sort, tdr.dept_id, tdr.visitor DESC, tdr.id DESC
LIMIT ${pageNum}, 9 LIMIT ${pageNum}, 9
</select> </select>
<select id="selectPicByResId" resultType="java.lang.String"> <select id="selectPicByResId" resultType="java.lang.String">
SELECT SELECT
tda.attr_value tda.attr_value
FROM FROM
tb_data_attr tda tb_data_attr tda
LEFT JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id LEFT JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id
WHERE WHERE
tda.attr_type = '应用图片' tda.attr_type = '应用图片'
AND tdr.id = #{id} AND tdr.id = #{id}
AND tda.del_flag = 0 AND tda.del_flag = 0
</select> </select>
<select id="selectTypeCountByName" resultType="java.util.Map"> <select id="selectTypeCountByName" resultType="java.util.Map">
SELECT SELECT