Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-05 16:09:08 +08:00
commit dbc8759760
4 changed files with 144 additions and 64 deletions

View File

@ -384,6 +384,15 @@ public class TAbilityApplicationController {
AtomicReference<Boolean> doneReminders = new AtomicReference<>(Boolean.FALSE); // 是否已执行过催办 AtomicReference<Boolean> doneReminders = new AtomicReference<>(Boolean.FALSE); // 是否已执行过催办
AtomicReference<Integer> nextRemindersDays = new AtomicReference<>(0); // 下次催办多少天后 AtomicReference<Integer> nextRemindersDays = new AtomicReference<>(0); // 下次催办多少天后
final Optional<Task> nowTaskRoot = taskService.createTaskQuery()
.processInstanceId(tAbilityApplicationDTOList.get(0).getInstanceId())
.orderByTaskCreateTime()
.desc()
.active()
.list()
.stream()
.findFirst(); // 尝试获取当前task
taskHandleDetailInfo = taskHandleDetailInfo.stream().map(index_ -> { // 补充审核人部门名称 taskHandleDetailInfo = taskHandleDetailInfo.stream().map(index_ -> { // 补充审核人部门名称
if (StringUtils.isNumeric(index_.getAssignee())) { if (StringUtils.isNumeric(index_.getAssignee())) {
SysUserDTO userDTO = sysUserService.get(Long.valueOf(index_.getAssignee())); SysUserDTO userDTO = sysUserService.get(Long.valueOf(index_.getAssignee()));
@ -399,6 +408,7 @@ public class TAbilityApplicationController {
*/ */
Optional<Task> nowTask = taskService.createTaskQuery() Optional<Task> nowTask = taskService.createTaskQuery()
.processInstanceId(index_.getProcessInstanceId()) .processInstanceId(index_.getProcessInstanceId())
.taskId(index_.getTaskId()) // 每个任务
.orderByTaskCreateTime() .orderByTaskCreateTime()
.desc() .desc()
.active() .active()
@ -413,16 +423,20 @@ public class TAbilityApplicationController {
long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now()); long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now());
if (between <= interval) { if (between <= interval) {
logger.info("该任务未到允许催办的日期"); logger.info("该任务未到允许催办的日期");
index_.setAllowReminders(Boolean.FALSE); // 不允许催办 if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录 index_.setAllowReminders(Boolean.FALSE); // 不允许催办
index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为 index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录
index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为
}
allowReminders.set(Boolean.FALSE); allowReminders.set(Boolean.FALSE);
doneReminders.set(Boolean.FALSE); doneReminders.set(Boolean.FALSE);
nextRemindersDays.set((int) (interval - between)); nextRemindersDays.set((int) (interval - between));
} else { } else {
allowReminders.set(Boolean.TRUE); if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
doneReminders.set(Boolean.FALSE); allowReminders.set(Boolean.TRUE);
nextRemindersDays.set(0); doneReminders.set(Boolean.FALSE);
nextRemindersDays.set(0);
}
index_.setAllowReminders(Boolean.TRUE); // 允许催办 index_.setAllowReminders(Boolean.TRUE); // 允许催办
index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录 index_.setDoneReminders(Boolean.FALSE); // 不存在催办记录
index_.setNextRemindersDays(0); // 距离下次催办天数为0 index_.setNextRemindersDays(0); // 距离下次催办天数为0
@ -430,25 +444,26 @@ public class TAbilityApplicationController {
} else { // 进行过催办 } else { // 进行过催办
long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数
if (between <= interval) { // 间隔天数小于限制天数 if (between <= interval) { // 间隔天数小于限制天数
allowReminders.set(Boolean.FALSE); if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
doneReminders.set(Boolean.TRUE); allowReminders.set(Boolean.FALSE);
nextRemindersDays.set((int) (interval - between)); doneReminders.set(Boolean.TRUE);
nextRemindersDays.set((int) (interval - between));
}
index_.setAllowReminders(Boolean.FALSE); // 不允许催办 index_.setAllowReminders(Boolean.FALSE); // 不允许催办
index_.setDoneReminders(Boolean.TRUE); // 存在催办记录 index_.setDoneReminders(Boolean.TRUE); // 存在催办记录
index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数 index_.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数
} else { } else {
allowReminders.set(Boolean.TRUE); if (nowTask.get().getId().equals(nowTaskRoot.get().getId())) {
doneReminders.set(Boolean.TRUE); allowReminders.set(Boolean.TRUE);
nextRemindersDays.set(0); doneReminders.set(Boolean.TRUE);
nextRemindersDays.set(0);
}
index_.setAllowReminders(Boolean.TRUE); // 不允许催办 index_.setAllowReminders(Boolean.TRUE); // 不允许催办
index_.setDoneReminders(Boolean.TRUE); // 存在催办记录 index_.setDoneReminders(Boolean.TRUE); // 存在催办记录
index_.setNextRemindersDays(0); // 距离下次催办天数为0 index_.setNextRemindersDays(0); // 距离下次催办天数为0
} }
} }
} else { } else {
// allowReminders.set(Boolean.FALSE);
// doneReminders.set(Boolean.FALSE);
// nextRemindersDays.set(0);
index_.setAllowReminders(Boolean.FALSE); index_.setAllowReminders(Boolean.FALSE);
index_.setDoneReminders(Boolean.FALSE); index_.setDoneReminders(Boolean.FALSE);
index_.setNextRemindersDays(0); index_.setNextRemindersDays(0);

View File

@ -80,4 +80,8 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
List<Map> getProvideDistrictFundStatement(); List<Map> getProvideDistrictFundStatement();
List<Map> getApplyDistrictFundStatement(); List<Map> getApplyDistrictFundStatement();
Long getApplyPriceCount();
Long getResourceFundStatementTotal();
} }

View File

@ -234,13 +234,9 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
@Override @Override
public Object getResourceFundStatement(Map<String, Object> params) { public Object getResourceFundStatement(Map<String, Object> params) {
List<Map> list = abilityApplicationDao.getResourceFundStatement(); List<Map> list = abilityApplicationDao.getResourceFundStatement();
BigDecimal total = BigDecimal.ZERO;
for (Map map : list) {
total = total.add((BigDecimal) map.get("applyPrice"));
}
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("list", list); resultMap.put("list", list);
resultMap.put("total", total); resultMap.put("total", abilityApplicationDao.getResourceFundStatementTotal());
return resultMap; return resultMap;
} }
@ -292,12 +288,10 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
@Override @Override
public Object getApplyPriceCount() { public Object getApplyPriceCount() {
Map<String, Object> map = new HashMap<>();
map.put("applyResult", "通过"); Long sum = 0L;
Long sum = abilityApplicationDao.getFundStatementSum(map); sum = sum + abilityApplicationDao.getApplyPriceCount();
BigDecimal result = new BigDecimal(sum).divide(new BigDecimal(10000)); return sum ;
result = result.setScale(1, BigDecimal.ROUND_HALF_UP);
return result ;
} }
} }

View File

@ -365,6 +365,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose> <choose>
<when test="params.applyResult == null or params.applyResult == ''"> <when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' ) AND taa.approve_status IN ( '审核中', '通过' )
@ -453,6 +456,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose> <choose>
<when test="params.applyResult == null or params.applyResult == ''"> <when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' ) AND taa.approve_status IN ( '审核中', '通过' )
@ -539,6 +545,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose> <choose>
<when test="params.applyResult == null or params.applyResult == ''"> <when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' ) AND taa.approve_status IN ( '审核中', '通过' )
@ -627,6 +636,9 @@
LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id LEFT JOIN ( SELECT data_resource_id, attr_type, attr_value FROM tb_data_attr tda WHERE del_flag = 0 AND attr_type = '组件类型' ) attr ON tdr.id = attr.data_resource_id
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0
AND taa.del_flag = 0
AND (taa.camera_list IS NULL OR taa.camera_list = '')
<choose> <choose>
<when test="params.applyResult == null or params.applyResult == ''"> <when test="params.applyResult == null or params.applyResult == ''">
AND taa.approve_status IN ( '审核中', '通过' ) AND taa.approve_status IN ( '审核中', '通过' )
@ -702,7 +714,7 @@
SELECT SELECT
districtId, districtId,
districtName, districtName,
SUM(applyPrice) AS "applyPrice" SUM( applyPrice ) AS "applyPrice"
FROM FROM
( (
SELECT SELECT
@ -715,21 +727,24 @@
FROM FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg ( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id LEFT JOIN sys_user su ON su.dept_id = sd.id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
resource_id, user_id,
SUM( apply_price ) AS "apply_price" SUM( apply_price ) AS "apply_price",
COUNT( id ) AS "applyCount"
FROM FROM
t_ability_application taa t_ability_application taa
WHERE WHERE
taa.del_flag = 0 taa.del_flag = 0
AND taa.approve_status = '通过' AND taa.approve_status = '通过'
GROUP BY GROUP BY
resource_id user_id
) taa ON taa.resource_id = tdr.id ) taa ON taa.user_id = su.id
GROUP BY GROUP BY
srg.id UNION ALL srg.id
UNION ALL
SELECT SELECT
tmb.district AS "districtId", tmb.district AS "districtId",
srg.NAME AS "districtName", srg.NAME AS "districtName",
@ -851,18 +866,16 @@
SELECT SELECT
sd.id AS "deptId", sd.id AS "deptId",
sd.NAME AS "deptName", sd.NAME AS "deptName",
COUNT( tdr.id ) AS "resourceCount", sum( taa.applyCount ) AS "resourceCount",
CONVERT ( CONVERT (
IFNULL( SUM( taa.price ), 0 ) / 10000, IFNULL( SUM( taa.price ), 0 ) / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice" DECIMAL ( 15, 1 )) AS "applyPrice"
FROM FROM
sys_dept sd (
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN (
SELECT SELECT
resource_id, resource_id,
SUM( apply_price ) AS "price", SUM( apply_price ) AS "price",
COUNT( resource_id ) AS "applyCount" COUNT( id ) AS "applyCount"
FROM FROM
t_ability_application taa t_ability_application taa
WHERE WHERE
@ -870,7 +883,9 @@
AND taa.approve_status = '通过' AND taa.approve_status = '通过'
GROUP BY GROUP BY
resource_id resource_id
) taa ON taa.resource_id = tdr.id ) taa
LEFT JOIN tb_data_resource tdr ON tdr.id = taa.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE WHERE
tdr.del_flag = 0 tdr.del_flag = 0
AND sd.type = 2 AND sd.type = 2
@ -879,16 +894,14 @@
SELECT SELECT
1067246875800000066 AS "deptId", 1067246875800000066 AS "deptId",
'青岛市大数据发展管理局' AS "deptName", '青岛市大数据发展管理局' AS "deptName",
( SELECT COUNT( id ) FROM t_meetingroom ) AS "resourceCount", COUNT( tmb.id ) AS "resourceCount",
CONVERT ( CONVERT (
IFNULL( SUM( tmb.apply_price ), 0 ) / 10000, IFNULL( SUM( tmb.apply_price ), 0 ) / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice" DECIMAL ( 15, 1 )) AS "applyPrice"
FROM FROM
t_meetingroom tm t_meetingroom_book tmb
LEFT JOIN t_meetingroom_book tmb ON tmb.room_id = tm.id
WHERE WHERE
tm.del_flag = 0 tmb.state = 2
AND tmb.state = 2
) temp ) temp
GROUP BY GROUP BY
deptId, deptId,
@ -924,6 +937,7 @@
WHERE WHERE
taa.del_flag = 0 taa.del_flag = 0
AND taa.approve_status = '通过' AND taa.approve_status = '通过'
AND ( taa.camera_list IS NULL OR camera_list = '' )
GROUP BY GROUP BY
user_id user_id
) taa ) taa
@ -950,7 +964,8 @@
tmb.dept tmb.dept
) temp ) temp
GROUP BY GROUP BY
deptName, deptId deptName,
deptId
ORDER BY ORDER BY
SUM( applyPrice ) DESC SUM( applyPrice ) DESC
LIMIT 10 LIMIT 10
@ -958,20 +973,20 @@
<select id="getProvideDistrictFundStatement" resultType="java.util.Map"> <select id="getProvideDistrictFundStatement" resultType="java.util.Map">
SELECT SELECT
srg.id AS "districtId ", srg.id AS "districtId ",
srg.NAME AS "districtName", srg.NAME AS "districtName",
IFNULL(SUM(taa.applyCount), 0) AS "applyCount", IFNULL(SUM(taa.applyCount), 0) AS "applyCount",
convert(IFNULL( SUM( taa.apply_price ), 0 ) / 10000, decimal(15,1)) AS "applyPrice", convert(IFNULL( SUM( taa.apply_price ), 0 ) / 10000, decimal(15,1)) AS "applyPrice",
srg.sort srg.sort
FROM FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg ( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN sys_user su ON su.dept_id = sd.id LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id
LEFT JOIN (SELECT user_id, SUM(apply_price) AS "apply_price", COUNT(id) AS "applyCount" FROM t_ability_application taa WHERE LEFT JOIN (SELECT resource_id, SUM(apply_price) AS "apply_price", COUNT(id) AS "applyCount" FROM t_ability_application taa WHERE
taa.del_flag = 0 taa.del_flag = 0
AND taa.approve_status = '通过' GROUP BY user_id ) taa ON taa.user_id = su.id AND taa.approve_status = '通过' AND (taa.camera_list IS NULL OR taa.camera_list = '') GROUP BY resource_id ) taa ON taa.resource_id = tdr.id
GROUP BY GROUP BY
srg.id srg.id
ORDER BY srg.sort ORDER BY srg.sort
</select> </select>
@ -979,8 +994,8 @@
SELECT SELECT
districtId, districtId,
districtName, districtName,
SUM( applyCount ) AS "applyCount", SUM( applyCount ) AS "applyCount",
SUM( applyPrice ) AS "applyPrice" SUM( applyPrice ) AS "applyPrice"
FROM FROM
( (
SELECT SELECT
@ -994,10 +1009,10 @@
FROM FROM
( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg ( SELECT id, NAME, sort FROM sys_region WHERE tree_level = 3 AND 9 >= sort ) srg
LEFT JOIN sys_dept sd ON sd.district = srg.id LEFT JOIN sys_dept sd ON sd.district = srg.id
LEFT JOIN tb_data_resource tdr ON tdr.dept_id = sd.id LEFT JOIN sys_user su ON su.dept_id = sd.id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
resource_id, user_id,
SUM( apply_price ) AS "apply_price", SUM( apply_price ) AS "apply_price",
COUNT( id ) AS "applyCount" COUNT( id ) AS "applyCount"
FROM FROM
@ -1006,10 +1021,12 @@
taa.del_flag = 0 taa.del_flag = 0
AND taa.approve_status = '通过' AND taa.approve_status = '通过'
GROUP BY GROUP BY
resource_id user_id
) taa ON taa.resource_id = tdr.id ) taa ON taa.user_id = su.id
GROUP BY GROUP BY
srg.id UNION ALL srg.id
UNION ALL
SELECT SELECT
tmb.district AS "districtId", tmb.district AS "districtId",
srg.NAME AS "districtName", srg.NAME AS "districtName",
@ -1051,5 +1068,55 @@
temp.sort temp.sort
</select> </select>
<select id="getApplyPriceCount" resultType="java.lang.Long">
SELECT CONVERT
(
SUM( temp.applyPrice ) / 10000,
DECIMAL ( 15, 1 ))
FROM
(
SELECT
taa.apply_price AS "applyPrice"
FROM
t_ability_application taa
WHERE
1 = 1
AND taa.approve_status = '通过' UNION ALL
SELECT
tmb.apply_price AS "applyPrice"
FROM
t_meetingroom_book tmb
WHERE
tmb.state = 2
) temp
</select>
<select id="getResourceFundStatementTotal" resultType="java.lang.Long">
SELECT SUM(applyPrice) FROM (
SELECT
CONVERT (
taa.price / 10000,
DECIMAL ( 15, 1 )) AS "applyPrice"
FROM
(
SELECT
resource_id,
SUM( apply_price ) AS "price",
COUNT( resource_id ) AS "applyCount"
FROM
t_ability_application taa
WHERE
taa.del_flag = 0
AND taa.approve_status = '通过'
GROUP BY
resource_id
) taa
LEFT JOIN tb_data_resource tdr ON taa.resource_id = tdr.id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE
tdr.del_flag = 0
AND tdr.type = '应用资源' ) tmp
</select>
</mapper> </mapper>