五方主体修改

This commit is contained in:
pengjie 2024-06-19 13:59:00 +08:00
parent 5c13c0ca0e
commit 285b64149a
4 changed files with 14 additions and 26 deletions

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "在建项目指标",
"createTime" : null,
"updateTime" : 1716110822712,
"updateTime" : 1718613929985,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -35,7 +35,7 @@
}
================================
import java.math.BigDecimal
Map map = db.selectOne("SELECT COUNT( id ) num,SUM( engineering_cost ) cost,IFNULL( SUM( IF ( is_important = 1 AND examine_state = 3, 1, 0 )), 0 ) importance,IFNULL( SUM( IF ( engineering_type = 2, 1, 0 )), 0 ) bridge,IFNULL( SUM( IF ( engineering_type = 3, 1, 0 )), 0 ) tunnel,IFNULL( SUM( IF ( engineering_type = 4, 1, 0 )), 0 ) station,IFNULL( SUM( IF ( nature = 1, 1, 0 )), 0 ) newBuild, IFNULL( SUM( IF ( nature = 2, 1, 0 )), 0 ) reBuild,IFNULL( SUM( IF ( nature = 3, 1, 0 )), 0 ) extension,IFNULL( SUM( IF ( state = 4, 1, 0 )), 0 ) finished,IFNULL( SUM( IF ( state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( state = 3, 1, 0 )), 0 ) shutdown FROM engineering WHERE #project ")
Map map = db.selectOne("SELECT COUNT( id ) num,SUM( engineering_cost ) cost,IFNULL( SUM( IF ( is_important = 1 AND examine_state = 3, 1, 0 )), 0 ) importance,IFNULL( SUM( IF ( engineering_type = 2, 1, 0 )), 0 ) bridge,IFNULL( SUM( IF ( engineering_type = 3, 1, 0 )), 0 ) tunnel,IFNULL( SUM( IF ( engineering_type = 4, 1, 0 )), 0 ) station,IFNULL( SUM( IF ( nature = 1, 1, 0 )), 0 ) newBuild, IFNULL( SUM( IF ( state = 1, 1, 0 )), 0 ) unStart, IFNULL( SUM( IF ( nature = 2, 1, 0 )), 0 ) reBuild,IFNULL( SUM( IF ( nature = 3, 1, 0 )), 0 ) extension,IFNULL( SUM( IF ( state = 4, 1, 0 )), 0 ) finished,IFNULL( SUM( IF ( state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( state = 3, 1, 0 )), 0 ) shutdown FROM engineering WHERE #project ")
var cost = map.get("cost");
map.put("cost", new BigDecimal(cost).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP))
return map;

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "进度管理",
"createTime" : null,
"updateTime" : 1691140680204,
"updateTime" : 1718709176045,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -23,7 +23,7 @@
}
================================
import java.math.BigDecimal
Map scheduleMap = db.selectOne("SELECT COUNT( * ) scheduleTotal, IFNULL(SUM(IF(state = 2, 1, 0)), 0) scheduleExecuting, IFNULL(SUM(IF(state = 3, 1, 0)), 0) scheduleCompleted, IFNULL(SUM(IF(state = 4, 1, 0)), 0) scheduleOverdue FROM project_sub_item WHERE parent_id = 0 AND #project ")
Map scheduleMap = db.selectOne("SELECT COUNT( * ) scheduleTotal, IFNULL( SUM( IF ( state = 1, 1, 0 )), 0 ) unStart, IFNULL(SUM(IF(state in (2, 4), 1, 0)), 0) scheduleExecuting, IFNULL(SUM(IF(state in (3, 6), 1, 0)), 0) scheduleCompleted, IFNULL(SUM(IF(state = 5, 1, 0)), 0) scheduleOverdue,IFNULL( SUM( IF ( state = 7, 1, 0 )), 0 ) stop FROM project_sub_item WHERE parent_id = 0 AND #project ")
var completed = scheduleMap.get("scheduleCompleted")::int
var total = scheduleMap.get("scheduleTotal")::int
BigDecimal completedNum = new BigDecimal(completed);

View File

@ -5,7 +5,7 @@
"groupId" : "485e36d471af4f809398babc4abadafe",
"name" : "查询工程分类统计",
"createTime" : null,
"updateTime" : 1716214710069,
"updateTime" : 1718610473884,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -85,7 +85,7 @@
import java.math.BigDecimal
List list = db.select("SELECT d.dict_value, COUNT( a.id ) num FROM engineering a RIGHT JOIN system_dict_data d ON a.engineering_type = d.dict_label AND #projectalias WHERE a.examine_state = 3 AND d.dict_type = 'engineering_type' GROUP BY d.dict_value ORDER BY d.dict_sort")
List dictList = db.select("SELECT dict_value, dict_label num FROM system_dict_data where dict_type = 'engineering_type' ORDER BY dict_sort")
List dictList = db.select("SELECT dict_value, dict_label num FROM system_dict_data where dict_type = 'engineering_type' and status = 1 ORDER BY dict_sort")
Map totalMap = db.selectOne("SELECT COUNT(id) num FROM engineering WHERE examine_state = 3 AND #project")
String total = totalMap.get("num")
@ -97,23 +97,11 @@ for (item in dictList) {
var dict_value = map.get("dict_value")
var num = list.filter(item => item.dict_value.equals(dict_value)).size()
Map resultMap = new HashMap();
if (index < 2){
resultMap.put("dict_value" ,dict_value)
resultMap.put("num" ,num)
BigDecimal totalNum = new BigDecimal(total);
BigDecimal typeNum = new BigDecimal(num);
resultMap.put("ratio", typeNum == 0 ? 0 : typeNum.divide(totalNum, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.add(resultMap);
} else {
other = other + num;
}
index = index + 1
resultMap.put("dict_value" ,dict_value)
resultMap.put("num" ,num)
BigDecimal totalNum = new BigDecimal(total);
BigDecimal typeNum = new BigDecimal(num);
resultMap.put("ratio", typeNum == 0 ? 0 : typeNum.divide(totalNum, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.add(resultMap);
}
Map otherMap = new HashMap();
otherMap.put("dict_value" , "其他")
otherMap.put("num" ,other)
BigDecimal totalNum = new BigDecimal(total);
BigDecimal typeNum = new BigDecimal(other);
otherMap.put("ratio", typeNum == 0 ? 0 : typeNum.divide(totalNum, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.add(otherMap)
return result

View File

@ -5,7 +5,7 @@
"groupId" : "485e36d471af4f809398babc4abadafe",
"name" : "顶部查询工程统计信息",
"createTime" : null,
"updateTime" : 1716214733431,
"updateTime" : 1718603379594,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -34,4 +34,4 @@
"responseBodyDefinition" : null
}
================================
return db.selectOne("SELECT IFNULL(SUM(IF(examine_state = 3, 1, 0)),0) total,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state > 1, 1, 0)),0) newBuild,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state = 7, 1, 0)),0) finish,IFNULL(SUM(IF(is_important = 1 AND state > 1, 1, 0)),0) important,IFNULL( SUM( IF ( examine_state = 3 AND state = 1, 1, 0 )), 0 ) unStart,IFNULL( SUM( IF ( examine_state = 3 AND state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( examine_state = 3 AND state = 4, 1, 0 )), 0 ) complete FROM engineering WHERE #project")
return db.selectOne("SELECT IFNULL(SUM(IF(examine_state = 3, 1, 0)),0) total,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state > 1, 1, 0)),0) newBuild,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state = 7, 1, 0)),0) finish,IFNULL(SUM(IF(is_important = 1 AND state > 1, 1, 0)),0) important,IFNULL( SUM( IF ( examine_state = 3 AND state = 1, 1, 0 )), 0 ) unStart,IFNULL( SUM( IF ( examine_state = 3 AND state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( examine_state = 3 AND state = 4, 1, 0 )), 0 ) complete,IFNULL( SUM( IF ( examine_state = 3 AND state = 3, 1, 0 )), 0 ) shutdown FROM engineering WHERE #project")