Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
6946f063
由
张雷
编写于
2024-10-21 15:20:37 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge remote-tracking branch 'origin/master' into master
2 个父辈
3944f075
ad045639
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
677 行增加
和
92 行删除
sk-base-common/src/main/java/com/skua/tool/util/DigitalUtils.java
sk-base-common/src/main/java/com/skua/tool/util/JSUtils.java
sk-module-biz/src/main/java/com/skua/SkApplication.java
sk-module-biz/src/main/java/com/skua/modules/ajh/controller/AjhMeetingSendController.java
sk-module-biz/src/main/java/com/skua/modules/edu/mapper/xml/UserAnswerMapper.xml
sk-module-biz/src/main/java/com/skua/modules/emergency/controller/EmergencyRiskEventController.java
sk-module-biz/src/main/java/com/skua/modules/emergency/entity/EmergencyRiskEvent.java
sk-module-biz/src/main/java/com/skua/modules/process/controller/ProcessStatisticsController.java
sk-module-biz/src/main/java/com/skua/modules/process/vo/ProcessStatisticsVO.java
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerLevelManageController.java
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
sk-module-datafill/src/main/java/com/skua/modules/report/vo/JnhbLargeScreenVO.java
sk-module-datafill/src/main/java/com/skua/modules/report/vo/largeScreen/ResultChartsVO.java
sk-module-datafill/src/main/java/com/skua/modules/report/vo/largeScreen/ResultNumberVO.java
sk-base-common/src/main/java/com/skua/tool/util/DigitalUtils.java
查看文件 @
6946f06
...
...
@@ -108,7 +108,9 @@ public class DigitalUtils {
*/
public
static
String
division
(
String
dividend
,
String
divisor
){
String
resultStr
=
null
;
try
{
String
expression
=
dividend
+
"/ "
+
divisor
;
resultStr
=
JSUtils
.
executeExpression
(
expression
,
"0.00"
);
/* try{
if( isNumber(dividend) && isNumber( divisor) && Double.parseDouble(divisor) != 0 ){
BigDecimal dividend_BD = new BigDecimal(dividend);
BigDecimal divisor_BD = new BigDecimal(divisor);
...
...
@@ -116,8 +118,9 @@ public class DigitalUtils {
resultStr = result.toString();
}
}catch(Exception e){
System.out.println("dividend = "+ dividend +"; divisor = "+ divisor);
e.printStackTrace();
}
}
*/
//System.out.print("请输入被除数:");double dividend =scanner.nextDouble();
// System.out.print("请输入除数:");double divisor =scanner.nextDouble();
...
...
sk-base-common/src/main/java/com/skua/tool/util/JSUtils.java
0 → 100644
查看文件 @
6946f06
package
com
.
skua
.
tool
.
util
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
javax.script.ScriptException
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Scanner
;
import
java.util.Stack
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 加减乘除表达式求值算法
* @version 1.0
*/
public
class
JSUtils
{
// 表达式字符合法性校验正则模式,静态常量化可以降低每次使用都要编译地消耗
private
static
final
Pattern
EXPRESSION_PATTERN
=
Pattern
.
compile
(
"[0-9\\.+-/*()= ]+"
);
// 运算符优先级map
private
static
final
Map
<
String
,
Integer
>
OPT_PRIORITY_MAP
=
new
HashMap
<
String
,
Integer
>()
{
private
static
final
long
serialVersionUID
=
6968472606692771458L
;
{
put
(
"("
,
0
);
put
(
"+"
,
2
);
put
(
"-"
,
2
);
put
(
"*"
,
3
);
put
(
"/"
,
3
);
put
(
")"
,
7
);
put
(
"="
,
20
);
}
};
/**
* 输入加减乘除表达式字符串,返回计算结果
*
* @param expression 表达式字符串
* @return 返回计算结果
*/
public
static
String
executeExpression
(
String
expression
,
String
decimalFormat
)
{
String
result
=
"0"
;
if
(
decimalFormat
==
null
)
decimalFormat
=
"0.00"
;
try
{
Double
aDouble
=
executeExpression
(
expression
);
DecimalFormat
df
=
new
DecimalFormat
(
decimalFormat
);
result
=
df
.
format
(
aDouble
);
}
catch
(
Exception
e
){
// e.printStackTrace();
}
return
result
;
}
public
static
double
executeExpression
(
String
expression
)
{
// 非空校验
if
(
null
==
expression
||
""
.
equals
(
expression
.
trim
()))
{
throw
new
IllegalArgumentException
(
"表达式不能为空!"
);
}
// 表达式字符合法性校验
Matcher
matcher
=
EXPRESSION_PATTERN
.
matcher
(
expression
);
if
(!
matcher
.
matches
())
{
throw
new
IllegalArgumentException
(
"表达式含有非法字符!"
);
}
Stack
<
String
>
optStack
=
new
Stack
<>();
// 运算符栈
Stack
<
BigDecimal
>
numStack
=
new
Stack
<>();
// 数值栈,数值以BigDecimal存储计算,避免精度计算问题
StringBuilder
curNumBuilder
=
new
StringBuilder
(
16
);
// 当前正在读取中的数值字符追加器
// 逐个读取字符,并根据运算符判断参与何种计算
for
(
int
i
=
0
;
i
<
expression
.
length
();
i
++)
{
char
c
=
expression
.
charAt
(
i
);
if
(
c
!=
' '
)
{
// 空白字符直接丢弃掉
if
((
c
>=
'0'
&&
c
<=
'9'
)
||
c
==
'.'
)
{
curNumBuilder
.
append
(
c
);
// 持续读取一个数值的各个字符
}
else
{
if
(
curNumBuilder
.
length
()
>
0
)
{
// 如果追加器有值,说明之前读取的字符是数值,而且此时已经完整读取完一个数值
numStack
.
push
(
new
BigDecimal
(
curNumBuilder
.
toString
()));
curNumBuilder
.
delete
(
0
,
curNumBuilder
.
length
());
}
String
curOpt
=
String
.
valueOf
(
c
);
if
(
optStack
.
empty
())
{
// 运算符栈栈顶为空则直接入栈
optStack
.
push
(
curOpt
);
}
else
{
if
(
curOpt
.
equals
(
"("
))
{
// 当前运算符为左括号,直接入运算符栈
optStack
.
push
(
curOpt
);
}
else
if
(
curOpt
.
equals
(
")"
))
{
// 当前运算符为右括号,触发括号内的字表达式进行计算
directCalc
(
optStack
,
numStack
,
true
);
}
else
if
(
curOpt
.
equals
(
"="
))
{
// 当前运算符为等号,触发整个表达式剩余计算,并返回总的计算结果
directCalc
(
optStack
,
numStack
,
false
);
return
numStack
.
pop
().
doubleValue
();
}
else
{
// 当前运算符为加减乘除之一,要与栈顶运算符比较,判断是否要进行一次二元计算
compareAndCalc
(
optStack
,
numStack
,
curOpt
);
}
}
}
}
}
// 表达式不是以等号结尾的场景
if
(
curNumBuilder
.
length
()
>
0
)
{
// 如果追加器有值,说明之前读取的字符是数值,而且此时已经完整读取完一个数值
numStack
.
push
(
new
BigDecimal
(
curNumBuilder
.
toString
()));
}
directCalc
(
optStack
,
numStack
,
false
);
return
numStack
.
pop
().
doubleValue
();
}
/**
* 拿当前运算符和栈顶运算符对比,如果栈顶运算符优先级高于或同级于当前运算符,
* 则执行一次二元运算(递归比较并计算),否则当前运算符入栈
*
* @param optStack 运算符栈
* @param numStack 数值栈
* @param curOpt 当前运算符
*/
public
static
void
compareAndCalc
(
Stack
<
String
>
optStack
,
Stack
<
BigDecimal
>
numStack
,
String
curOpt
)
{
// 比较当前运算符和栈顶运算符的优先级
String
peekOpt
=
optStack
.
peek
();
int
priority
=
getPriority
(
peekOpt
,
curOpt
);
if
(
priority
==
-
1
||
priority
==
0
)
{
// 栈顶运算符优先级大或同级,触发一次二元运算
String
opt
=
optStack
.
pop
();
// 当前参与计算运算符
BigDecimal
num2
=
numStack
.
pop
();
// 当前参与计算数值2
BigDecimal
num1
=
numStack
.
pop
();
// 当前参与计算数值1
BigDecimal
bigDecimal
=
floatingPointCalc
(
opt
,
num1
,
num2
);
// 计算结果当做操作数入栈
numStack
.
push
(
bigDecimal
);
// 运算完栈顶还有运算符,则还需要再次触发一次比较判断是否需要再次二元计算
if
(
optStack
.
empty
())
{
optStack
.
push
(
curOpt
);
}
else
{
compareAndCalc
(
optStack
,
numStack
,
curOpt
);
}
}
else
{
// 当前运算符优先级高,则直接入栈
optStack
.
push
(
curOpt
);
}
}
/**
* 遇到右括号和等号执行的连续计算操作(递归计算)
*
* @param optStack 运算符栈
* @param numStack 数值栈
* @param isBracket true表示为括号类型计算
*/
public
static
void
directCalc
(
Stack
<
String
>
optStack
,
Stack
<
BigDecimal
>
numStack
,
boolean
isBracket
)
{
String
opt
=
optStack
.
pop
();
// 当前参与计算运算符
BigDecimal
num2
=
numStack
.
pop
();
// 当前参与计算数值2
BigDecimal
num1
=
numStack
.
pop
();
// 当前参与计算数值1
BigDecimal
bigDecimal
=
floatingPointCalc
(
opt
,
num1
,
num2
);
// 计算结果当做操作数入栈
numStack
.
push
(
bigDecimal
);
if
(
isBracket
)
{
if
(
"("
.
equals
(
optStack
.
peek
()))
{
// 括号类型则遇左括号停止计算,同时将左括号从栈中移除
optStack
.
pop
();
}
else
{
directCalc
(
optStack
,
numStack
,
isBracket
);
}
}
else
{
if
(!
optStack
.
empty
())
{
// 等号类型只要栈中还有运算符就继续计算
directCalc
(
optStack
,
numStack
,
isBracket
);
}
}
}
/**
* 不丢失精度的二元运算,支持高精度计算
*
* @param opt
* @return
*/
public
static
BigDecimal
floatingPointCalc
(
String
opt
,
BigDecimal
bigDecimal1
,
BigDecimal
bigDecimal2
)
{
BigDecimal
resultBigDecimal
=
new
BigDecimal
(
0
);
switch
(
opt
)
{
case
"+"
:
resultBigDecimal
=
bigDecimal1
.
add
(
bigDecimal2
);
break
;
case
"-"
:
resultBigDecimal
=
bigDecimal1
.
subtract
(
bigDecimal2
);
break
;
case
"*"
:
resultBigDecimal
=
bigDecimal1
.
multiply
(
bigDecimal2
);
break
;
case
"/"
:
resultBigDecimal
=
bigDecimal1
.
divide
(
bigDecimal2
,
10
,
BigDecimal
.
ROUND_HALF_DOWN
);
// 注意此处用法
break
;
default
:
break
;
}
return
resultBigDecimal
;
}
/**
* priority = 0 表示两个运算符同级别
* priority = 1 第二个运算符级别高,负数则相反
*
* @param opt1
* @param opt2
* @return
*/
public
static
int
getPriority
(
String
opt1
,
String
opt2
)
{
int
priority
=
OPT_PRIORITY_MAP
.
get
(
opt2
)
-
OPT_PRIORITY_MAP
.
get
(
opt1
);
return
priority
;
}
/**
* 浮点数相等比较函数
*
* @param value1
* @param value2
* @return
*/
private
static
boolean
isDoubleEquals
(
double
value1
,
double
value2
)
{
System
.
out
.
println
(
"正确结果="
+
value1
+
", 实际计算结果="
+
value2
);
return
Math
.
abs
(
value1
-
value2
)
<=
0.0001
;
}
/* public static void main(String[] args) throws ScriptException {
Scanner in = new Scanner(System.in);
System.out.println("请输入一个算法表达式:");
String str = in.next();
// 表达式字符合法性校验
Matcher matcher = EXPRESSION_PATTERN.matcher(str);
if (!matcher.matches()) {
System.out.println("aaaaa");
return;
}
ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
Object eval = se.eval(str);
Double aDouble = Double.valueOf(eval.toString());
BigDecimal b = new BigDecimal(aDouble);
double doubleRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
str +="=";
double aa = executeExpression(str);
System.out.println("js算:"+doubleRate+"---算法:"+aa);
// // 几个测试数据
// System.out.println(isDoubleEquals(-39.5, executeExpression(" 2 + 3/2 * 3 - 4 *(2 + 5 -2*4/2+9) + 3 + (2*1)-3= ")));
// System.out.println(isDoubleEquals(60.3666, executeExpression("9*2+1/3*2-4+(3*2/5+3+3*6)+3*5-1+3+(4+5*1/2)=")));
// System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199 = ")));
// System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199 ")));
// System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199")));
// System.out.println(isDoubleEquals(-29, executeExpression(" 9 *(20-1)-(1+199) ")));
// System.out.println(isDoubleEquals(1.0E24, executeExpression("1000000000000*1000000000000 = ")));
}*/
public
static
Boolean
executeExpressionForBoolean
(
String
expression
){
ScriptEngine
se
=
new
ScriptEngineManager
().
getEngineByName
(
"JavaScript"
);
Object
eval
=
null
;
Boolean
result
=
null
;
try
{
eval
=
se
.
eval
(
expression
);
result
=
Boolean
.
parseBoolean
(
eval
.
toString
());
}
catch
(
ScriptException
e
)
{
//e.printStackTrace();
return
null
;
}
return
result
;
}
public
static
String
executeExpressionForString
(
String
expression
){
ScriptEngine
se
=
new
ScriptEngineManager
().
getEngineByName
(
"JavaScript"
);
Object
eval
=
null
;
String
result
=
null
;
try
{
eval
=
se
.
eval
(
expression
);
result
=
eval
.
toString
();
}
catch
(
ScriptException
e
)
{
//e.printStackTrace();
return
null
;
}
return
result
;
}
/* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
Object eval = null;
try {
eval = se.eval("1+2+(1*3)");
Double aDouble = Double.valueOf(eval.toString());
DecimalFormat df = new DecimalFormat("0.00");
String amountstr = df.format(aDouble);
//amount = new BigDecimal(amountstr);
System.out.println("amountstr = "+amountstr);
} catch (ScriptException e) {
e.printStackTrace();
}*/
}
sk-module-biz/src/main/java/com/skua/SkApplication.java
查看文件 @
6946f06
...
...
@@ -29,7 +29,6 @@ public class SkApplication {
"swagger-ui: \thttp://"
+
ip
+
":"
+
port
+
path
+
"/swagger-ui.html\n\t"
+
"Doc: \t\thttp://"
+
ip
+
":"
+
port
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
}
// @Configuration
...
...
sk-module-biz/src/main/java/com/skua/modules/ajh/controller/AjhMeetingSendController.java
查看文件 @
6946f06
...
...
@@ -55,8 +55,6 @@ import io.swagger.annotations.ApiOperation;
public
class
AjhMeetingSendController
{
@Autowired
private
IAjhMeetingSendService
ajhMeetingSendService
;
@Autowired
private
IAjhMeetingService
ajhMeetingService
;
@Value
(
"${skua.path.upload}"
)
private
String
upLoadPath
;
...
...
sk-module-biz/src/main/java/com/skua/modules/edu/mapper/xml/UserAnswerMapper.xml
查看文件 @
6946f06
...
...
@@ -6,7 +6,7 @@
<update
id=
"checkAnswerByUserPaperId"
>
update edu_user_answer ua
set ua.score = IFNULL((select pq.score from edu_question q ,edu_paper_question pq where q.id = pq.question_id and ua.answer = q.question_answer and ua.paper_id= pq.paper_id and ua.question_id = q.id) , 0)
where ua.user_paper_id
=
= #{userPaperId}
where ua.user_paper_id = #{userPaperId}
</update>
</mapper>
\ No newline at end of file
</mapper>
...
...
sk-module-biz/src/main/java/com/skua/modules/emergency/controller/EmergencyRiskEventController.java
查看文件 @
6946f06
...
...
@@ -59,8 +59,7 @@ public class EmergencyRiskEventController {
Result
<
List
<
Map
<
String
,
Object
>>>
result
=
new
Result
<>();
QueryWrapper
<
EmergencyRiskEvent
>
queryWrapper
=
new
QueryWrapper
<
EmergencyRiskEvent
>();
//QueryGenerator.initQueryWrapper(equipmentDefectManagement, req.getParameterMap());
queryWrapper
.
select
(
"count(id) count,handle_result handleResult"
);
queryWrapper
.
ge
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getStartTime
()),
"report_date"
,
equipmentDefectManagement
.
getStartTime
());
queryWrapper
.
le
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getEndTime
()),
"report_date"
,
equipmentDefectManagement
.
getEndTime
());
queryWrapper
.
groupBy
(
"handle_result"
);
List
<
Map
<
String
,
Object
>>
list
=
emergencyRiskEventService
.
listMaps
(
queryWrapper
);
result
.
setSuccess
(
true
);
...
...
@@ -79,8 +78,7 @@ public class EmergencyRiskEventController {
emergencyRiskEventQueryWrapper
.
eq
(
"handle_result"
,
"1"
);
emergencyRiskEventQueryWrapper
.
ne
(
"event_type"
,
""
);
emergencyRiskEventQueryWrapper
.
isNotNull
(
"event_type"
);
emergencyRiskEventQueryWrapper
.
ge
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getStartTime
()),
"report_date"
,
equipmentDefectManagement
.
getStartTime
());
emergencyRiskEventQueryWrapper
.
le
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getEndTime
()),
"report_date"
,
equipmentDefectManagement
.
getEndTime
());
emergencyRiskEventQueryWrapper
.
groupBy
(
"handle_result"
,
"event_type"
);
List
<
Map
<
String
,
Object
>>
list
=
emergencyRiskEventService
.
listMaps
(
emergencyRiskEventQueryWrapper
);
//已处理应急事件
...
...
@@ -89,8 +87,7 @@ public class EmergencyRiskEventController {
emergencyRiskEventQueryWrapper
.
eq
(
"handle_result"
,
"3"
);
emergencyRiskEventQueryWrapper
.
ne
(
"event_type"
,
""
);
emergencyRiskEventQueryWrapper
.
isNotNull
(
"event_type"
);
emergencyRiskEventQueryWrapper
.
ge
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getStartTime
()),
"report_date"
,
equipmentDefectManagement
.
getStartTime
());
emergencyRiskEventQueryWrapper
.
le
(
StringUtils
.
isNotEmpty
(
equipmentDefectManagement
.
getEndTime
()),
"report_date"
,
equipmentDefectManagement
.
getEndTime
());
emergencyRiskEventQueryWrapper
.
groupBy
(
"handle_result"
,
"event_type"
);
List
<
Map
<
String
,
Object
>>
yclList
=
emergencyRiskEventService
.
listMaps
(
emergencyRiskEventQueryWrapper
);
//获取未处理、已处理中的应急事件类型
...
...
@@ -133,40 +130,40 @@ public class EmergencyRiskEventController {
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
{
Result
<
IPage
<
EmergencyRiskEvent
>>
result
=
new
Result
<
IPage
<
EmergencyRiskEvent
>>();
//2023-10-05 00:00:00 2023-10-05 23:59:59
QueryWrapper
<
EmergencyRiskEvent
>
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
emergencyRiskEvent
,
req
.
getParameterMap
());
Page
<
EmergencyRiskEvent
>
page
=
new
Page
<
EmergencyRiskEvent
>(
pageNo
,
pageSize
);
if
(
StringUtils
.
isNotEmpty
(
emergencyRiskEvent
.
getStartTime
())){
queryWrapper
.
ge
(
"report_date"
,
emergencyRiskEvent
.
getStartTime
());
}
if
(
StringUtils
.
isNotEmpty
(
emergencyRiskEvent
.
getEndTime
())){
queryWrapper
.
le
(
"report_date"
,
emergencyRiskEvent
.
getEndTime
());
}
IPage
<
EmergencyRiskEvent
>
pageList
=
emergencyRiskEventService
.
page
(
page
,
queryWrapper
);
//获取流程状态
List
<
EmergencyRiskEvent
>
records
=
pageList
.
getRecords
();
Set
<
String
>
processInstanceIdSet
=
records
.
stream
().
filter
(
data
->
StringUtils
.
isNotBlank
(
data
.
getProcessInstanceId
()))
.
map
(
EmergencyRiskEvent:
:
getProcessInstanceId
).
collect
(
Collectors
.
toSet
());
Map
<
String
,
Map
<
String
,
String
>>
processInstanceMap
;
try
{
processInstanceMap
=
flowBusinessService
.
getProcessState
(
processInstanceIdSet
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
processInstanceMap
=
new
HashMap
<>();
}
for
(
EmergencyRiskEvent
record
:
records
)
{
record
.
getFlow
().
setProcessDefinitionKey
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"processDefinitionKey"
));
record
.
getFlow
().
setTaskDefinitionKey
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"taskDefinitionKey"
));
record
.
getFlow
().
setStatus
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"state"
));
record
.
getFlow
().
setTaskName
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"processDefinitionName"
));
}
if
(
records
!=
null
&&
!
records
.
isEmpty
()){
Set
<
String
>
processInstanceIdSet
=
records
.
stream
().
filter
(
data
->
StringUtils
.
isNotBlank
(
data
.
getProcessInstanceId
()))
.
map
(
EmergencyRiskEvent:
:
getProcessInstanceId
).
collect
(
Collectors
.
toSet
());
Map
<
String
,
Map
<
String
,
String
>>
processInstanceMap
;
try
{
processInstanceMap
=
flowBusinessService
.
getProcessState
(
processInstanceIdSet
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
processInstanceMap
=
new
HashMap
<>();
}
for
(
EmergencyRiskEvent
record
:
records
)
{
record
.
getFlow
().
setProcessDefinitionKey
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"processDefinitionKey"
));
record
.
getFlow
().
setTaskDefinitionKey
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"taskDefinitionKey"
));
record
.
getFlow
().
setStatus
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"state"
));
record
.
getFlow
().
setTaskName
(
processInstanceMap
.
getOrDefault
(
record
.
getProcessInstanceId
(),
new
HashMap
<>()).
get
(
"processDefinitionName"
));
}
}
result
.
setSuccess
(
true
);
result
.
setResult
(
pageList
);
return
result
;
}
/**
/**
...
...
sk-module-biz/src/main/java/com/skua/modules/emergency/entity/EmergencyRiskEvent.java
查看文件 @
6946f06
...
...
@@ -143,10 +143,5 @@ public class EmergencyRiskEvent extends FlowEntity {
@Excel
(
name
=
"删除标识,0:正常,1:删除"
,
width
=
15
)
@ApiModelProperty
(
value
=
"删除标识,0:正常,1:删除"
)
private
Integer
delFlag
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"开始时间"
)
private
String
startTime
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"结束时间"
)
private
String
endTime
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/process/controller/ProcessStatisticsController.java
0 → 100644
查看文件 @
6946f06
package
com
.
skua
.
modules
.
process
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.skua.core.api.vo.Result
;
import
com.skua.core.aspect.annotation.AutoLog
;
import
com.skua.core.context.BaseContextHandler
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.modules.equipment.entity.EquipmentMaintainTask
;
import
com.skua.modules.equipment.service.IEquipmentMaintainTaskService
;
import
com.skua.modules.flow.core.utils.TaskUtil
;
import
com.skua.modules.flow.utils.Func
;
import
com.skua.modules.inspection.entity.InspectionUserWorkingGroup
;
import
com.skua.modules.inspection.service.IInspectionTaskService
;
import
com.skua.modules.inspection.service.IInspectionUserWorkingGroupService
;
import
com.skua.modules.process.vo.ProcessStatisticsVO
;
import
com.skua.modules.quartz.util.BaseUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.flowable.task.api.TaskQuery
;
import
org.flowable.engine.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
@Slf4j
@Api
(
tags
=
"测试流程"
)
@RestController
(
"testProcessController"
)
@RequestMapping
(
"/web/process"
)
public
class
ProcessStatisticsController
{
// 注入TaskService
@Autowired
private
TaskService
taskService
;
@Autowired
private
IEquipmentMaintainTaskService
equipMaintainExecuteService
;
@Autowired
private
IInspectionTaskService
inspectionTaskService
;
@Autowired
private
IInspectionUserWorkingGroupService
inspectionUserWorkingGroupService
;
/* 问题上报流程 problemReport
设备维修流程 EquipmentRepair
设备缺陷管理 EquipmentDefectManagement
事故事件流程 EmergencyRiskEvent
生产任务流程 productive_task
数据报警工单 productAlarmProcess
安全隐患流程 AjhRectification
考核评价流程 dataAssessmentSocreMaster
危险作业流程 DangerousOperationManage*/
@AutoLog
(
value
=
"测试流程"
)
@ApiOperation
(
value
=
"测试流程-统计"
,
notes
=
"测试流程-统计"
)
@GetMapping
(
value
=
"/statistics"
)
public
Result
<
List
<
ProcessStatisticsVO
>>
statistics
()
{
Result
<
List
<
ProcessStatisticsVO
>>
result
=
new
Result
<
List
<
ProcessStatisticsVO
>>();
List
<
ProcessStatisticsVO
>
processStatisticsList
=
new
ArrayList
<>();
String
taskUser
=
TaskUtil
.
getTaskUser
();
String
taskGroup
=
TaskUtil
.
getCandidateGroup
();
List
<
String
>
userGroupList
=
Func
.
toStrList
(
taskGroup
);
try
{
//巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库
// 、、、、、药剂入库
String
process_key
=
"AjhRectification"
;
processStatisticsList
.
add
(
queryProcessStatistics
(
"安全隐患"
,
process_key
,
taskUser
,
taskGroup
)
)
;
process_key
=
"problemReport"
;
processStatisticsList
.
add
(
queryProcessStatistics
(
"问题上报"
,
process_key
,
taskUser
,
taskGroup
))
;
process_key
=
"EmergencyRiskEvent"
;
processStatisticsList
.
add
(
queryProcessStatistics
(
"事故事件"
,
process_key
,
taskUser
,
taskGroup
)
)
;
process_key
=
"DangerousOperationManage"
;
processStatisticsList
.
add
(
queryProcessStatistics
(
"危险作业"
,
process_key
,
taskUser
,
taskGroup
)
)
;
process_key
=
"EquipmentRepair"
;
processStatisticsList
.
add
(
queryProcessStatistics
(
"维修任务"
,
process_key
,
taskUser
,
taskGroup
))
;
Integer
todoCount
=
0
;
QueryWrapper
equipmentMaintainTaskQueryWrapper
=
new
QueryWrapper
<
EquipmentMaintainTask
>();
equipmentMaintainTaskQueryWrapper
.
eq
(
"maintainer_id"
,
taskUser
);
equipmentMaintainTaskQueryWrapper
.
eq
(
"results_enforcement"
,
1
);
todoCount
=
equipMaintainExecuteService
.
count
(
equipmentMaintainTaskQueryWrapper
);
ProcessStatisticsVO
maintainerProcessStatisticsVO
=
new
ProcessStatisticsVO
(
"保养任务"
,
""
,
"0"
,
todoCount
.
toString
()
);
processStatisticsList
.
add
(
maintainerProcessStatisticsVO
);
//巡检
//得到巡检任务
//得到进行中的任务
//获取用户所在的班组
Integer
xunjian_count
=
0
;
String
userId
=
BaseContextHandler
.
getUserId
();
QueryWrapper
<
InspectionUserWorkingGroup
>
inspectionUserWorkingGroupQueryWrapper
=
new
QueryWrapper
<>();
inspectionUserWorkingGroupQueryWrapper
.
eq
(
"user_id"
,
userId
);
List
<
InspectionUserWorkingGroup
>
inspectionUserWorkingGroupList
=
inspectionUserWorkingGroupService
.
list
(
inspectionUserWorkingGroupQueryWrapper
);
List
<
String
>
inspectionWorkingGroupIdList
=
new
ArrayList
<>();
for
(
InspectionUserWorkingGroup
inspectionUserWorkingGroup
:
inspectionUserWorkingGroupList
)
{
inspectionWorkingGroupIdList
.
add
(
inspectionUserWorkingGroup
.
getInspectionWorkingGroupId
());
}
if
(
inspectionWorkingGroupIdList
.
size
()
>
0
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"task_state"
,
"1"
);
queryWrapper
.
in
(
"inspection_working_group_id"
,
inspectionWorkingGroupIdList
);
xunjian_count
=
inspectionTaskService
.
count
(
queryWrapper
);
}
else
{
xunjian_count
=
0
;
}
ProcessStatisticsVO
xunjianProcessStatisticsVO
=
new
ProcessStatisticsVO
(
"巡检任务"
,
""
,
"0"
,
xunjian_count
.
toString
()
);
processStatisticsList
.
add
(
xunjianProcessStatisticsVO
);
//药剂入库
String
userRoleIds
=
BaseContextHandler
.
getRoles
();
String
roleIds
=
BaseUtil
.
quoteEach
(
userRoleIds
,
","
);
Integer
materialINCount
=
0
;
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
StringBuffer
sql
=
new
StringBuffer
(
" select count(1) from sys_role_permission rp ,sys_config c "
);
sql
.
append
(
" where rp.permission_id = c.config_value and c.config_id = 'MaterialIN_ID' and rp.role_id in ("
+
roleIds
+
") "
);
Integer
authFlag
=
masterDB
.
queryForObject
(
sql
.
toString
(),
Integer
.
class
);
if
(
authFlag
.
intValue
()
>
0
){
String
sql2
=
"select count(1) from erp_material_in where confirm_status =2 and audit_status>0 and audit_status<3"
;
materialINCount
=
masterDB
.
queryForObject
(
sql2
,
Integer
.
class
);
}
ProcessStatisticsVO
materialINProcessStatisticsVO
=
new
ProcessStatisticsVO
(
"药剂入库"
,
""
,
"0"
,
materialINCount
.
toString
()
);
processStatisticsList
.
add
(
materialINProcessStatisticsVO
);
result
.
setResult
(
processStatisticsList
);
result
.
success
(
"获取统计数据"
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
result
.
error500
(
"操作失败"
);
}
return
result
;
}
/***
* @param process_key
* @return
*/
private
ProcessStatisticsVO
queryProcessStatistics
(
String
processName
,
String
process_key
,
String
taskUser
,
String
taskGroup
){
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
();
taskQuery
.
processDefinitionKey
(
process_key
);
Long
todoCount
=
taskQuery
.
taskAssignee
(
taskUser
).
count
();
//代办人数
Long
claimCount
=
taskQuery
.
taskCandidateGroupIn
(
Func
.
toStrList
(
taskGroup
)
).
count
()
;
//todoCount
return
new
ProcessStatisticsVO
(
processName
,
process_key
,
todoCount
.
toString
(),
claimCount
.
toString
()
);
}
}
sk-module-biz/src/main/java/com/skua/modules/process/vo/ProcessStatisticsVO.java
0 → 100644
查看文件 @
6946f06
package
com
.
skua
.
modules
.
process
.
vo
;
import
com.skua.tool.util.DigitalUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
value
=
"production_duty_group_user数据传输对象"
,
description
=
"生产值班班组-用户"
)
public
class
ProcessStatisticsVO
{
@ApiModelProperty
(
value
=
"流程名称"
)
private
String
processName
;
@ApiModelProperty
(
value
=
"流程key"
)
private
String
processKey
;
@ApiModelProperty
(
value
=
"未签到数量"
)
private
String
claimCount
;
@ApiModelProperty
(
value
=
"代办任务数量"
)
private
String
todoCount
;
@ApiModelProperty
(
value
=
"总数"
)
private
String
totalCount
;
public
String
getTotalCount
()
{
return
DigitalUtils
.
add
(
this
.
getTotalCount
()
,
this
.
getClaimCount
()
)
;
}
public
ProcessStatisticsVO
(){
}
public
ProcessStatisticsVO
(
String
processName
,
String
processKey
,
String
claimCount
,
String
todoCount
)
{
this
.
processName
=
processName
;
this
.
processKey
=
processKey
;
this
.
claimCount
=
claimCount
;
this
.
todoCount
=
todoCount
;
}
}
sk-module-biz/src/main/java/com/skua/modules/safe/controller/DangerLevelManageController.java
查看文件 @
6946f06
...
...
@@ -52,7 +52,9 @@ public class DangerLevelManageController {
@Autowired
private
IDangerLevelManageService
dangerLevelManageService
;
@Value
(
"${skua.path.upload}"
)
private
String
uploadpath
;
private
String
upLoadPath
;
@Value
(
"${skua.web-url}"
)
private
String
webUrl
;
@Autowired
private
ISysConfigService
configService
;
/**
...
...
@@ -104,7 +106,6 @@ public class DangerLevelManageController {
public
Result
<
DangerLevelManage
>
add
(
@RequestBody
DangerLevelManage
dangerLevelManage
)
{
Result
<
DangerLevelManage
>
result
=
new
Result
<
DangerLevelManage
>();
try
{
dangerLevelManageService
.
save
(
dangerLevelManage
);
dangerLevelManage
.
setQrCode
(
this
.
createQR
(
dangerLevelManage
.
getId
()))
;
dangerLevelManageService
.
updateById
(
dangerLevelManage
)
;
...
...
@@ -148,15 +149,17 @@ public class DangerLevelManageController {
* @return
*/
private
String
createQR
(
String
dangerLevelId
){
String
qrCodePath
=
"files"
+
File
.
separator
+
"qrcode"
+
File
.
separator
+
dangerLevelId
+
".png"
;
String
qrCodePath
=
null
;
try
{
String
filePath
=
upLoadPath
+
File
.
separator
+
"qrcode"
;
String
qrUrl
=
configService
.
queryValueByKey
(
"DANGER_LEVLE_QRURL"
);
QRCodeUtil
.
encode
(
qrUrl
,
""
,
uploadpath
+
File
.
separator
+
qrCodePath
,
true
);
qrUrl
=
qrUrl
+
dangerLevelId
;
//风险巡检二维码地址
qrCodePath
=
com
.
skua
.
tool
.
util
.
QRCodeUtil
.
getQRCodeImage
(
qrUrl
,
filePath
,
"DL-"
+
dangerLevelId
);
//QRCodeUtil.encode(qrUrl, "", uploadpath+File.separator+qrCodePath, true);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成二维码失败"
);
qrCodePath
=
null
;
}
return
qrCodePath
;
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
查看文件 @
6946f06
...
...
@@ -7,19 +7,16 @@ import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
import
com.skua.modules.custom.service.IFCustomReportDatasetService
;
import
com.skua.modules.custom.vo.DepartWeekReportVO
;
import
com.skua.modules.custom.vo.FCustomReportDatasetVO
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.TemporalAdjusters
;
import
java.time.temporal.WeekFields
;
import
java.util.*
;
import
com.skua.modules.report.vo.*
;
import
com.skua.modules.report.vo.largeScreen.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
/**
...
...
@@ -276,24 +273,28 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
//节能环保 大屏展示
public
JnhbLargeScreenVO
jnhbLargeScreenShow
(
DataVO
dataVO
){
//long startTime = System.nanoTime();
JnhbLargeScreenVO
largeScreenVO
=
new
JnhbLargeScreenVO
();
//当月数据
String
dataViewName2
=
ReportViewUtil
.
buildView
(
"2119ecbf53a1d2d0708258ff67cfd9e1"
,
"CSL"
,
null
,
dataVO
.
getNowStartTime
(),
dataVO
.
getNowEndTime
());
String
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getNowStartTime
(),
dataVO
.
getNowEndTime
());
String
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY,
YSL,
WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getNowStartTime
(),
dataVO
.
getNowEndTime
());
List
<
JnhbReportData
>
jnhbReportDataList
=
mapper
.
getJnhbReport
(
dataViewName2
,
dataViewName3
,
dataVO
.
getNowStartTime
(),
dataVO
.
getNowEndTime
(),
null
);
//System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 上月数据 同比
dataViewName2
=
ReportViewUtil
.
buildView
(
"2119ecbf53a1d2d0708258ff67cfd9e1"
,
"CSL"
,
null
,
dataVO
.
getLastMonthStartTime
(),
dataVO
.
getLastMonthEndTime
());
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getLastMonthStartTime
(),
dataVO
.
getLastMonthEndTime
());
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY,
YSL,
WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getLastMonthStartTime
(),
dataVO
.
getLastMonthEndTime
());
List
<
JnhbReportData
>
lastMonthReportDataList
=
mapper
.
getJnhbReport
(
dataViewName2
,
dataViewName3
,
dataVO
.
getLastMonthStartTime
(),
dataVO
.
getLastMonthEndTime
(),
null
);
//System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
Map
<
String
,
JnhbReportData
>
lastMonthMapData
=
convertJnhbReportDataMap
(
lastMonthReportDataList
);
// 去年数据 环比
dataViewName2
=
ReportViewUtil
.
buildView
(
"2119ecbf53a1d2d0708258ff67cfd9e1"
,
"CSL"
,
null
,
dataVO
.
getLastYearStartTime
(),
dataVO
.
getLastYearEndTime
());
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY
,WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getLastYearStartTime
(),
dataVO
.
getLastYearEndTime
());
dataViewName3
=
ReportViewUtil
.
buildView
(
"3a243d5715b9e1a3753c180872ca0df9"
,
"DLHJ,GFFDL,QY,YSL
,WNL,WNHSL,GFCZL,WFCSL,WFCZL"
,
null
,
dataVO
.
getLastYearStartTime
(),
dataVO
.
getLastYearEndTime
());
List
<
JnhbReportData
>
lastYearReportDataList
=
mapper
.
getJnhbReport
(
dataViewName2
,
dataViewName3
,
dataVO
.
getLastYearStartTime
(),
dataVO
.
getLastYearEndTime
(),
null
);
Map
<
String
,
JnhbReportData
>
lastYearMapData
=
convertJnhbReportDataMap
(
lastYearReportDataList
);
//System.out.println("333333---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
LoadRateVO
loadRateVO
=
null
;
PowerConsumeVO
powerConsumeVO
=
null
;
ResultNumberVO
c02NumberVO
=
null
;
//CO2排放对象
...
...
@@ -302,6 +303,11 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
ResultNumberVO
tp_NumberVO
=
null
;
//TP
ResultNumberVO
tn_NumberVO
=
null
;
//TN
List
<
PowerConsumeVO
>
powerConsumeVOList
=
new
ArrayList
();
//各站点能源消耗排名
List
<
LoadRateVO
>
loadRateVOList
=
new
ArrayList
<>();
//负荷率对象
List
<
ResultNumberVO
>
co2DataList
=
new
ArrayList
<>();
//CO2排放排名
List
<
WasteMaterialVO
>
wasteMaterialList
=
new
ArrayList
<>();
//废物处理对象集合
JnhbReportData
lastMonthReportDataTemp
;
//lastMonthMapData
JnhbReportData
lastYearReportDataTemp
;
//lastYearMapData
ResultChartsVO
energyConsumeChart
=
null
;
...
...
@@ -315,7 +321,9 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
//各站点能源消耗排名:
powerConsumeVO
=
new
PowerConsumeVO
(
reportData
.
getDepartId
(),
reportData
.
getDepartName
(),
reportData
.
getDh
(),
reportData
.
getGffdl
(),
reportData
.
getQy
(),
reportData
.
getZhnyxhl
()
,
reportData
.
getEyhtpfl
()
,
reportData
.
getDsdh
()
);
c02NumberVO
=
new
ResultNumberVO
();
c02NumberVO
.
setName
(
reportData
.
getDepartName
()
);
c02NumberVO
.
setValue
(
reportData
.
getCodxjl
()
);
cod_NumberVO
=
new
ResultNumberVO
();
cod_NumberVO
.
setValue
(
reportData
.
getCodxjl
());
nh3n_NumberVO
=
new
ResultNumberVO
();
nh3n_NumberVO
.
setValue
(
reportData
.
getTnxjl
());
...
...
@@ -370,16 +378,45 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
largeScreenVO
.
getCo2DataList
().
add
(
c02NumberVO
)
;
//排放指标
// String ybgfcsl, String ybgfczl, String jgwnl, String wfcsl, String wfczl
largeScreenVO
.
getWasteMaterialList
()
.
add
(
new
WasteMaterialVO
(
reportData
.
getDepartId
(),
reportData
.
getDepartName
(),
reportData
.
getYbgfcsl
(),
reportData
.
getYbgfczl
(),
reportData
.
getJgwnl
(),
reportData
.
getWfcsl
(),
reportData
.
getWfczl
()
)
)
;
wasteMaterialList
.
add
(
new
WasteMaterialVO
(
reportData
.
getDepartId
(),
reportData
.
getDepartName
(),
reportData
.
getYbgfcsl
(),
reportData
.
getYbgfczl
(),
reportData
.
getJgwnl
(),
reportData
.
getWfcsl
(),
reportData
.
getWfczl
()
)
)
;
}
largeScreenVO
.
getCo2DataList
().
add
(
c02NumberVO
)
;
largeScreenVO
.
setWasteMaterialList
(
wasteMaterialList
)
;
//System.out.println("44444444---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
//主库数据源
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
int
count1
=
masterDB
.
queryForObject
(
"select count(1) from equipment_info where energy_level = 1"
,
Integer
.
class
);
largeScreenVO
.
setEquipmentL1
(
count1
);
//System.out.println("55555---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
int
count2
=
masterDB
.
queryForObject
(
"select count(1) from equipment_info where energy_level = 2"
,
Integer
.
class
);
largeScreenVO
.
setEquipmentL2
(
count2
);
//System.out.println("666666---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 各站点系统负荷率排名:负荷率排序、设置排名
/* if(largeScreenVO.getLoadRateVOList() != null && !largeScreenVO.getLoadRateVOList().isEmpty()){
// 根据分数排序
Collections.sort(largeScreenVO.getLoadRateVOList(), new Comparator<LoadRateVO>() {
public int compare(LoadRateVO s1, LoadRateVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getWsfhl(),0d), ConvertUtils.getDouble(s1.getWsfhl(),0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
//各站点能源消耗排名 吨水电耗
/*if(largeScreenVO.getPowerConsumeVOList() != null && !largeScreenVO.getPowerConsumeVOList().isEmpty()) {
// 根据分数排序
Collections.sort(largeScreenVO.getPowerConsumeVOList(), new Comparator<PowerConsumeVO>() {
public int compare(PowerConsumeVO s1, PowerConsumeVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getDh(), 0d), ConvertUtils.getDouble(s1.getDh(), 0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
return
largeScreenVO
;
}
/**转换为Map<部门编号,JnhbReportData> */
...
...
@@ -415,6 +452,4 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
map
.
put
(
"qt"
,
"(1)本周暂无其他情况说明"
);
//其他
return
map
;
}
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/vo/JnhbLargeScreenVO.java
查看文件 @
6946f06
...
...
@@ -50,38 +50,39 @@ public class JnhbLargeScreenVO {
public
void
setHeadStatisticsValue
(
JnhbReportData
reportData
){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this
.
getHeadStatisticsList
().
get
(
0
).
setValue
(
reportData
.
getWssjcll
(
)
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValue
(
reportData
.
getWsfhl
(
)
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValue
(
reportData
.
getDh
()
);
this
.
getHeadStatisticsList
().
get
(
3
).
setValue
(
reportData
.
getQy
(
)
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValue
(
reportData
.
getXssyl
(
)
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValue
(
reportData
.
getZhnyxhl
(
)
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValue
(
reportData
.
getEyhtpfl
()
);
this
.
getHeadStatisticsList
().
get
(
7
).
setValue
(
reportData
.
getDsdh
()
);
this
.
getHeadStatisticsList
().
get
(
0
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
0
).
getValue
()
,
reportData
.
getWssjcll
()
)
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
1
).
getValue
()
,
reportData
.
getWsfhl
()
)
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
2
).
getValue
()
,
reportData
.
getDh
()
)
);
this
.
getHeadStatisticsList
().
get
(
3
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
3
).
getValue
()
,
reportData
.
getQy
()
)
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
4
).
getValue
()
,
reportData
.
getXssyl
()
)
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
5
).
getValue
()
,
reportData
.
getZhnyxhl
()
)
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
6
).
getValue
()
,
reportData
.
getEyhtpfl
()
)
);
this
.
getHeadStatisticsList
().
get
(
7
).
setValue
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
7
).
getValue
()
,
reportData
.
getDsdh
()
)
);
}
public
void
setHeadStatisticsValueTB
(
JnhbReportData
reportData
){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this
.
getHeadStatisticsList
().
get
(
0
).
setValueTb
(
reportData
.
getWssjcll
()
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValueTb
(
reportData
.
getWsfhl
()
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValueTb
(
reportData
.
getDh
()
);
this
.
getHeadStatisticsList
().
get
(
3
).
setValueTb
(
reportData
.
getQy
()
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValueTb
(
reportData
.
getXssyl
()
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValueTb
(
reportData
.
getZhnyxhl
()
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValueTb
(
reportData
.
getEyhtpfl
()
);
this
.
getHeadStatisticsList
().
get
(
7
).
setValueTb
(
reportData
.
getDsdh
()
);
this
.
getHeadStatisticsList
().
get
(
0
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
0
).
getValueTb
()
,
reportData
.
getWssjcll
())
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
1
).
getValueTb
()
,
reportData
.
getWsfhl
())
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
2
).
getValueTb
()
,
reportData
.
getDh
()
));
this
.
getHeadStatisticsList
().
get
(
3
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
3
).
getValueTb
()
,
reportData
.
getQy
())
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
4
).
getValueTb
()
,
reportData
.
getXssyl
())
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
5
).
getValueTb
()
,
reportData
.
getZhnyxhl
())
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
6
).
getValueTb
()
,
reportData
.
getEyhtpfl
()
));
this
.
getHeadStatisticsList
().
get
(
7
).
setValueTb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
7
).
getValueTb
()
,
reportData
.
getDsdh
()
));
}
public
void
setHeadStatisticsValueHB
(
JnhbReportData
reportData
){
// wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
this
.
getHeadStatisticsList
().
get
(
0
).
setValueHb
(
reportData
.
getWssjcll
(
)
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValueHb
(
reportData
.
getWsfhl
(
)
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValueHb
(
reportData
.
getDh
()
);
this
.
getHeadStatisticsList
().
get
(
3
).
setValueHb
(
reportData
.
getQy
(
)
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValueHb
(
reportData
.
getXssyl
(
)
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValueHb
(
reportData
.
getZhnyxhl
(
)
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValueHb
(
reportData
.
getEyhtpfl
()
);
this
.
getHeadStatisticsList
().
get
(
7
).
setValueHb
(
reportData
.
getDsdh
()
);
this
.
getHeadStatisticsList
().
get
(
0
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
0
).
getValueHb
()
,
reportData
.
getWssjcll
()
)
);
this
.
getHeadStatisticsList
().
get
(
1
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
1
).
getValueHb
()
,
reportData
.
getWsfhl
()
)
);
this
.
getHeadStatisticsList
().
get
(
2
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
2
).
getValueHb
()
,
reportData
.
getDh
()
)
);
this
.
getHeadStatisticsList
().
get
(
3
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
3
).
getValueHb
()
,
reportData
.
getQy
()
)
);
this
.
getHeadStatisticsList
().
get
(
4
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
4
).
getValueHb
()
,
reportData
.
getXssyl
()
)
);
this
.
getHeadStatisticsList
().
get
(
5
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
5
).
getValueHb
()
,
reportData
.
getZhnyxhl
()
)
);
this
.
getHeadStatisticsList
().
get
(
6
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
6
).
getValueHb
()
,
reportData
.
getEyhtpfl
()
)
);
this
.
getHeadStatisticsList
().
get
(
7
).
setValueHb
(
DigitalUtils
.
add
(
this
.
getHeadStatisticsList
().
get
(
7
).
getValueHb
()
,
reportData
.
getDsdh
()
)
);
}
/***
...
...
@@ -98,13 +99,17 @@ public class JnhbLargeScreenVO {
public
JnhbLargeScreenVO
(){
//头部数值统计
String
names
=
"污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水"
;
String
unit
=
"万吨,%,万千瓦时,吨,吨,吨标准煤,吨CO2当量,千瓦时/吨"
;
String
[]
nameList
=
names
.
split
(
","
);
String
[]
unitList
=
unit
.
split
(
","
);
ResultNumberVO
numberVO
=
null
;
for
(
String
name
:
nameList
){
for
(
int
i
=
0
;
i
<
nameList
.
length
;
i
++
){
numberVO
=
new
ResultNumberVO
();
numberVO
.
setName
(
name
);
numberVO
.
setName
(
nameList
[
i
]);
numberVO
.
setUnit
(
unitList
[
i
]
);
this
.
getHeadStatisticsList
().
add
(
numberVO
)
;
}
//消减量统计
names
=
"COD,NH3-N,TP,TN"
;
nameList
=
names
.
split
(
","
);
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/vo/largeScreen/ResultChartsVO.java
查看文件 @
6946f06
package
com
.
skua
.
modules
.
report
.
vo
.
largeScreen
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.modules.report.vo.JnhbReportData
;
import
com.skua.tool.util.DigitalUtils
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -32,10 +33,10 @@ public class ResultChartsVO {
public
void
setData
(
JnhbReportData
reportData
){
this
.
getXLine
().
add
(
reportData
.
getDepartName
()
)
;
this
.
getCodDataList
().
add
(
reportData
.
getCodxjl
()
)
;
this
.
getNh3DataList
().
add
(
reportData
.
getTnxjl
(
)
)
;
this
.
getTpDataList
().
add
(
reportData
.
getTpxjl
(
)
)
;
this
.
getTnDataList
().
add
(
reportData
.
getTnxjl
(
)
)
;
this
.
getCodDataList
().
add
(
ConvertUtils
.
getString
(
reportData
.
getCodxjl
(),
"0"
)
)
;
this
.
getNh3DataList
().
add
(
ConvertUtils
.
getString
(
reportData
.
getTnxjl
(),
"0"
)
)
;
this
.
getTpDataList
().
add
(
ConvertUtils
.
getString
(
reportData
.
getTpxjl
(),
"0"
)
)
;
this
.
getTnDataList
().
add
(
ConvertUtils
.
getString
(
reportData
.
getTnxjl
(),
"0"
)
)
;
}
public
void
setDataByZhnyxhl
(
JnhbReportData
reportData
){
this
.
getXLine
().
add
(
reportData
.
getDepartName
()
)
;
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/vo/largeScreen/ResultNumberVO.java
查看文件 @
6946f06
package
com
.
skua
.
modules
.
report
.
vo
.
largeScreen
;
import
com.skua.tool.util.DigitalUtils
;
import
com.skua.tool.util.JSUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -14,6 +15,8 @@ public class ResultNumberVO {
@ApiModelProperty
(
value
=
"名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"单位"
)
private
String
unit
;
@ApiModelProperty
(
value
=
"结果"
)
private
String
value
;
...
...
@@ -24,25 +27,71 @@ public class ResultNumberVO {
@ApiModelProperty
(
value
=
"环比(上月)"
)
private
String
valueHb
;
@ApiModelProperty
(
value
=
"同比(去年同期)排名"
)
private
String
valueTbRank
;
/*
@ApiModelProperty(value = "同比(去年同期)排名")
private String valueTbRank;
*/
@ApiModelProperty
(
value
=
"环比(上月)排名"
)
private
String
valueHbRank
;
private
Integer
rank
;
/* @ApiModelProperty(value = "环比(上月)排名")
private String valueHbRank;*/
@ApiModelProperty
(
value
=
"同比比例"
)
private
String
valueTbRatio
;
@ApiModelProperty
(
value
=
"同比比例箭头"
)
private
Boolean
valueTbArrow
;
@ApiModelProperty
(
value
=
"环比比例"
)
private
String
valueHbRatio
;
private
String
valueHbRatio
;
@ApiModelProperty
(
value
=
"环比比例箭头"
)
private
Boolean
valueHbArrow
;
public
String
getValueTbRatio
()
{
this
.
valueTbRatio
=
DigitalUtils
.
division
(
this
.
value
,
this
.
valueTb
)
;
String
expression
=
this
.
getValue
()
+
">"
+
this
.
getValueTb
();
Boolean
result
=
JSUtils
.
executeExpressionForBoolean
(
expression
);
if
(
result
!=
null
){
if
(
result
){
expression
=
""
+
this
.
getValue
()
+
"/"
+
this
.
getValueTb
()+
"* 100 - 100"
;
}
if
(
!
result
){
expression
=
" 100-"
+
this
.
getValue
()
+
"/"
+
this
.
getValueTb
()+
"* 100 "
;
}
}
this
.
valueTbRatio
=
JSUtils
.
executeExpression
(
expression
,
"0.0"
);
// DigitalUtils.division( this.value , this.valueTb) ;
return
valueTbRatio
;
}
public
String
getValueHbRatio
()
{
this
.
valueHbRatio
=
DigitalUtils
.
division
(
this
.
value
,
this
.
valueHb
)
;
//this.valueHbRatio = DigitalUtils.division( this.value , this.valueHb) ;
// String expression = "" +this.value +"/"+this.valueHb+"* 100 - 100";
String
expression
=
this
.
getValue
()
+
">"
+
this
.
getValueHb
();
Boolean
result
=
JSUtils
.
executeExpressionForBoolean
(
expression
);
if
(
result
!=
null
){
if
(
result
){
expression
=
""
+
this
.
getValue
()
+
"/"
+
this
.
getValueHb
()+
"* 100 - 100"
;
}
if
(
!
result
){
expression
=
" 100 -"
+
this
.
getValue
()
+
"/"
+
this
.
getValueHb
()+
"* 100 "
;
}
}
this
.
valueHbRatio
=
JSUtils
.
executeExpression
(
expression
,
"0.0"
);
// DigitalUtils.division( this.value , this.valueTb) ;
return
valueHbRatio
;
}
public
Boolean
getValueTbArrow
()
{
String
expression
=
this
.
getValue
()
+
">"
+
this
.
getValueHb
();
Boolean
result
=
JSUtils
.
executeExpressionForBoolean
(
expression
);
if
(
result
==
null
)
result
=
true
;
return
result
;
}
public
Boolean
getValueHbArrow
()
{
String
expression
=
this
.
getValue
()
+
">"
+
this
.
getValueHb
();
Boolean
result
=
JSUtils
.
executeExpressionForBoolean
(
expression
);
if
(
result
==
null
)
result
=
true
;
return
result
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论