1ca30618 康伟

kangwei : 联调:能环保态势大屏-后端

1 个父辈 691b55e8
...@@ -108,7 +108,9 @@ public class DigitalUtils { ...@@ -108,7 +108,9 @@ public class DigitalUtils {
108 */ 108 */
109 public static String division(String dividend , String divisor ){ 109 public static String division(String dividend , String divisor ){
110 String resultStr = null; 110 String resultStr = null;
111 try{ 111 String expression = dividend+ "/ "+ divisor;
112 resultStr = JSUtils.executeExpression(expression,"0.00");
113 /* try{
112 if( isNumber(dividend) && isNumber( divisor) && Double.parseDouble(divisor) != 0 ){ 114 if( isNumber(dividend) && isNumber( divisor) && Double.parseDouble(divisor) != 0 ){
113 BigDecimal dividend_BD = new BigDecimal(dividend); 115 BigDecimal dividend_BD = new BigDecimal(dividend);
114 BigDecimal divisor_BD = new BigDecimal(divisor); 116 BigDecimal divisor_BD = new BigDecimal(divisor);
...@@ -116,8 +118,9 @@ public class DigitalUtils { ...@@ -116,8 +118,9 @@ public class DigitalUtils {
116 resultStr = result.toString(); 118 resultStr = result.toString();
117 } 119 }
118 }catch(Exception e){ 120 }catch(Exception e){
121 System.out.println("dividend = "+ dividend +"; divisor = "+ divisor);
119 e.printStackTrace(); 122 e.printStackTrace();
120 } 123 }*/
121 124
122 //System.out.print("请输入被除数:");double dividend =scanner.nextDouble(); 125 //System.out.print("请输入被除数:");double dividend =scanner.nextDouble();
123 // System.out.print("请输入除数:");double divisor =scanner.nextDouble(); 126 // System.out.print("请输入除数:");double divisor =scanner.nextDouble();
......
1 package com.skua.tool.util;
2
3 import javax.script.ScriptEngine;
4 import javax.script.ScriptEngineManager;
5 import javax.script.ScriptException;
6 import java.math.BigDecimal;
7 import java.text.DecimalFormat;
8 import java.util.HashMap;
9 import java.util.Map;
10 import java.util.Scanner;
11 import java.util.Stack;
12 import java.util.regex.Matcher;
13 import java.util.regex.Pattern;
14
15
16 /**
17 * 加减乘除表达式求值算法
18 * @version 1.0
19 */
20 public class JSUtils {
21
22 // 表达式字符合法性校验正则模式,静态常量化可以降低每次使用都要编译地消耗
23 private static final Pattern EXPRESSION_PATTERN = Pattern.compile("[0-9\\.+-/*()= ]+");
24 // 运算符优先级map
25 private static final Map<String, Integer> OPT_PRIORITY_MAP = new HashMap<String, Integer>() {
26 private static final long serialVersionUID = 6968472606692771458L;
27 {
28 put("(", 0);
29 put("+", 2);
30 put("-", 2);
31 put("*", 3);
32 put("/", 3);
33 put(")", 7);
34 put("=", 20);
35 }
36 };
37
38
39 /**
40 * 输入加减乘除表达式字符串,返回计算结果
41 *
42 * @param expression 表达式字符串
43 * @return 返回计算结果
44 */
45 public static String executeExpression(String expression , String decimalFormat) {
46 String result = "0";
47 if(decimalFormat == null ) decimalFormat = "0.00";
48 try{
49 Double aDouble = executeExpression( expression );
50 DecimalFormat df = new DecimalFormat(decimalFormat);
51 result = df.format(aDouble);
52 }catch(Exception e ){
53 // e.printStackTrace();
54 }
55 return result;
56 }
57 public static double executeExpression(String expression) {
58 // 非空校验
59 if (null == expression || "".equals(expression.trim())) {
60 throw new IllegalArgumentException("表达式不能为空!");
61 }
62
63 // 表达式字符合法性校验
64 Matcher matcher = EXPRESSION_PATTERN.matcher(expression);
65 if (!matcher.matches()) {
66 throw new IllegalArgumentException("表达式含有非法字符!");
67 }
68
69 Stack<String> optStack = new Stack<>(); // 运算符栈
70 Stack<BigDecimal> numStack = new Stack<>(); // 数值栈,数值以BigDecimal存储计算,避免精度计算问题
71 StringBuilder curNumBuilder = new StringBuilder(16); // 当前正在读取中的数值字符追加器
72
73 // 逐个读取字符,并根据运算符判断参与何种计算
74 for (int i = 0; i < expression.length(); i++) {
75 char c = expression.charAt(i);
76 if (c != ' ') { // 空白字符直接丢弃掉
77 if ((c >= '0' && c <= '9') || c == '.') {
78 curNumBuilder.append(c); // 持续读取一个数值的各个字符
79 } else {
80 if (curNumBuilder.length() > 0) {
81 // 如果追加器有值,说明之前读取的字符是数值,而且此时已经完整读取完一个数值
82 numStack.push(new BigDecimal(curNumBuilder.toString()));
83 curNumBuilder.delete(0, curNumBuilder.length());
84 }
85
86 String curOpt = String.valueOf(c);
87 if (optStack.empty()) {
88 // 运算符栈栈顶为空则直接入栈
89 optStack.push(curOpt);
90 } else {
91 if (curOpt.equals("(")) {
92 // 当前运算符为左括号,直接入运算符栈
93 optStack.push(curOpt);
94 } else if (curOpt.equals(")")) {
95 // 当前运算符为右括号,触发括号内的字表达式进行计算
96 directCalc(optStack, numStack, true);
97 } else if (curOpt.equals("=")) {
98 // 当前运算符为等号,触发整个表达式剩余计算,并返回总的计算结果
99 directCalc(optStack, numStack, false);
100 return numStack.pop().doubleValue();
101 } else {
102 // 当前运算符为加减乘除之一,要与栈顶运算符比较,判断是否要进行一次二元计算
103 compareAndCalc(optStack, numStack, curOpt);
104 }
105 }
106 }
107 }
108 }
109
110 // 表达式不是以等号结尾的场景
111 if (curNumBuilder.length() > 0) {
112 // 如果追加器有值,说明之前读取的字符是数值,而且此时已经完整读取完一个数值
113 numStack.push(new BigDecimal(curNumBuilder.toString()));
114 }
115 directCalc(optStack, numStack, false);
116 return numStack.pop().doubleValue();
117 }
118
119 /**
120 * 拿当前运算符和栈顶运算符对比,如果栈顶运算符优先级高于或同级于当前运算符,
121 * 则执行一次二元运算(递归比较并计算),否则当前运算符入栈
122 *
123 * @param optStack 运算符栈
124 * @param numStack 数值栈
125 * @param curOpt 当前运算符
126 */
127 public static void compareAndCalc(Stack<String> optStack, Stack<BigDecimal> numStack,
128 String curOpt) {
129 // 比较当前运算符和栈顶运算符的优先级
130 String peekOpt = optStack.peek();
131 int priority = getPriority(peekOpt, curOpt);
132 if (priority == -1 || priority == 0) {
133 // 栈顶运算符优先级大或同级,触发一次二元运算
134 String opt = optStack.pop(); // 当前参与计算运算符
135 BigDecimal num2 = numStack.pop(); // 当前参与计算数值2
136 BigDecimal num1 = numStack.pop(); // 当前参与计算数值1
137 BigDecimal bigDecimal = floatingPointCalc(opt, num1, num2);
138
139 // 计算结果当做操作数入栈
140 numStack.push(bigDecimal);
141
142 // 运算完栈顶还有运算符,则还需要再次触发一次比较判断是否需要再次二元计算
143 if (optStack.empty()) {
144 optStack.push(curOpt);
145 } else {
146 compareAndCalc(optStack, numStack, curOpt);
147 }
148 } else {
149 // 当前运算符优先级高,则直接入栈
150 optStack.push(curOpt);
151 }
152 }
153
154 /**
155 * 遇到右括号和等号执行的连续计算操作(递归计算)
156 *
157 * @param optStack 运算符栈
158 * @param numStack 数值栈
159 * @param isBracket true表示为括号类型计算
160 */
161 public static void directCalc(Stack<String> optStack, Stack<BigDecimal> numStack,
162 boolean isBracket) {
163 String opt = optStack.pop(); // 当前参与计算运算符
164 BigDecimal num2 = numStack.pop(); // 当前参与计算数值2
165 BigDecimal num1 = numStack.pop(); // 当前参与计算数值1
166 BigDecimal bigDecimal = floatingPointCalc(opt, num1, num2);
167
168 // 计算结果当做操作数入栈
169 numStack.push(bigDecimal);
170
171 if (isBracket) {
172 if ("(".equals(optStack.peek())) {
173 // 括号类型则遇左括号停止计算,同时将左括号从栈中移除
174 optStack.pop();
175 } else {
176 directCalc(optStack, numStack, isBracket);
177 }
178 } else {
179 if (!optStack.empty()) {
180 // 等号类型只要栈中还有运算符就继续计算
181 directCalc(optStack, numStack, isBracket);
182 }
183 }
184 }
185
186 /**
187 * 不丢失精度的二元运算,支持高精度计算
188 *
189 * @param opt
190 * @return
191 */
192 public static BigDecimal floatingPointCalc(String opt, BigDecimal bigDecimal1,
193 BigDecimal bigDecimal2) {
194 BigDecimal resultBigDecimal = new BigDecimal(0);
195 switch (opt) {
196 case "+":
197 resultBigDecimal = bigDecimal1.add(bigDecimal2);
198 break;
199 case "-":
200 resultBigDecimal = bigDecimal1.subtract(bigDecimal2);
201 break;
202 case "*":
203 resultBigDecimal = bigDecimal1.multiply(bigDecimal2);
204 break;
205 case "/":
206 resultBigDecimal = bigDecimal1.divide(bigDecimal2, 10, BigDecimal.ROUND_HALF_DOWN); // 注意此处用法
207 break;
208 default:
209 break;
210 }
211 return resultBigDecimal;
212 }
213
214 /**
215 * priority = 0 表示两个运算符同级别
216 * priority = 1 第二个运算符级别高,负数则相反
217 *
218 * @param opt1
219 * @param opt2
220 * @return
221 */
222 public static int getPriority(String opt1, String opt2) {
223 int priority = OPT_PRIORITY_MAP.get(opt2) - OPT_PRIORITY_MAP.get(opt1);
224 return priority;
225 }
226
227 /**
228 * 浮点数相等比较函数
229 *
230 * @param value1
231 * @param value2
232 * @return
233 */
234 private static boolean isDoubleEquals(double value1, double value2) {
235 System.out.println("正确结果=" + value1 + ", 实际计算结果=" + value2);
236 return Math.abs(value1 - value2) <= 0.0001;
237 }
238
239 /* public static void main(String[] args) throws ScriptException {
240 Scanner in = new Scanner(System.in);
241 System.out.println("请输入一个算法表达式:");
242 String str = in.next();
243
244 // 表达式字符合法性校验
245 Matcher matcher = EXPRESSION_PATTERN.matcher(str);
246 if (!matcher.matches()) {
247 System.out.println("aaaaa");
248 return;
249 }
250
251 ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
252 Object eval = se.eval(str);
253 Double aDouble = Double.valueOf(eval.toString());
254 BigDecimal b = new BigDecimal(aDouble);
255 double doubleRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
256
257 str +="=";
258 double aa = executeExpression(str);
259 System.out.println("js算:"+doubleRate+"---算法:"+aa);
260 // // 几个测试数据
261 // System.out.println(isDoubleEquals(-39.5, executeExpression(" 2 + 3/2 * 3 - 4 *(2 + 5 -2*4/2+9) + 3 + (2*1)-3= ")));
262 // 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)=")));
263 // System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199 = ")));
264 // System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199 ")));
265 // System.out.println(isDoubleEquals(372.8, executeExpression(" 9.2 *(20-1)-1+199")));
266 // System.out.println(isDoubleEquals(-29, executeExpression(" 9 *(20-1)-(1+199) ")));
267 // System.out.println(isDoubleEquals(1.0E24, executeExpression("1000000000000*1000000000000 = ")));
268
269
270
271 }*/
272
273 public static Boolean executeExpressionForBoolean(String expression){
274 ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
275 Object eval = null;
276 Boolean result = null;
277 try {
278 eval = se.eval(expression);
279 result = Boolean.parseBoolean(eval.toString());
280 } catch (ScriptException e) {
281 //e.printStackTrace();
282 return null;
283 }
284 return result;
285 }
286
287 public static String executeExpressionForString(String expression){
288 ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
289 Object eval = null;
290 String result = null;
291 try {
292 eval = se.eval(expression);
293 result = eval.toString();
294 } catch (ScriptException e) {
295 //e.printStackTrace();
296 return null;
297 }
298 return result;
299 }
300
301 /* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
302 Object eval = null;
303 try {
304 eval = se.eval("1+2+(1*3)");
305 Double aDouble = Double.valueOf(eval.toString());
306 DecimalFormat df = new DecimalFormat("0.00");
307 String amountstr = df.format(aDouble);
308 //amount = new BigDecimal(amountstr);
309 System.out.println("amountstr = "+amountstr);
310 } catch (ScriptException e) {
311 e.printStackTrace();
312 }*/
313
314 }
...@@ -29,7 +29,6 @@ public class SkApplication { ...@@ -29,7 +29,6 @@ public class SkApplication {
29 "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" + 29 "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
30 "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" + 30 "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
31 "----------------------------------------------------------"); 31 "----------------------------------------------------------");
32
33 } 32 }
34 33
35 // @Configuration 34 // @Configuration
......
...@@ -59,8 +59,7 @@ public class EmergencyRiskEventController { ...@@ -59,8 +59,7 @@ public class EmergencyRiskEventController {
59 Result<List<Map<String,Object>>> result = new Result<>(); 59 Result<List<Map<String,Object>>> result = new Result<>();
60 QueryWrapper<EmergencyRiskEvent> queryWrapper = new QueryWrapper<EmergencyRiskEvent>();//QueryGenerator.initQueryWrapper(equipmentDefectManagement, req.getParameterMap()); 60 QueryWrapper<EmergencyRiskEvent> queryWrapper = new QueryWrapper<EmergencyRiskEvent>();//QueryGenerator.initQueryWrapper(equipmentDefectManagement, req.getParameterMap());
61 queryWrapper.select("count(id) count,handle_result handleResult"); 61 queryWrapper.select("count(id) count,handle_result handleResult");
62 queryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime()); 62
63 queryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
64 queryWrapper.groupBy("handle_result"); 63 queryWrapper.groupBy("handle_result");
65 List<Map<String,Object>> list = emergencyRiskEventService.listMaps(queryWrapper); 64 List<Map<String,Object>> list = emergencyRiskEventService.listMaps(queryWrapper);
66 result.setSuccess(true); 65 result.setSuccess(true);
...@@ -79,8 +78,7 @@ public class EmergencyRiskEventController { ...@@ -79,8 +78,7 @@ public class EmergencyRiskEventController {
79 emergencyRiskEventQueryWrapper.eq("handle_result","1"); 78 emergencyRiskEventQueryWrapper.eq("handle_result","1");
80 emergencyRiskEventQueryWrapper.ne("event_type",""); 79 emergencyRiskEventQueryWrapper.ne("event_type","");
81 emergencyRiskEventQueryWrapper.isNotNull("event_type"); 80 emergencyRiskEventQueryWrapper.isNotNull("event_type");
82 emergencyRiskEventQueryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime()); 81
83 emergencyRiskEventQueryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
84 emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type"); 82 emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type");
85 List<Map<String,Object>> list = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper); 83 List<Map<String,Object>> list = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper);
86 //已处理应急事件 84 //已处理应急事件
...@@ -89,8 +87,7 @@ public class EmergencyRiskEventController { ...@@ -89,8 +87,7 @@ public class EmergencyRiskEventController {
89 emergencyRiskEventQueryWrapper.eq("handle_result","3"); 87 emergencyRiskEventQueryWrapper.eq("handle_result","3");
90 emergencyRiskEventQueryWrapper.ne("event_type",""); 88 emergencyRiskEventQueryWrapper.ne("event_type","");
91 emergencyRiskEventQueryWrapper.isNotNull("event_type"); 89 emergencyRiskEventQueryWrapper.isNotNull("event_type");
92 emergencyRiskEventQueryWrapper.ge(StringUtils.isNotEmpty(equipmentDefectManagement.getStartTime()),"report_date",equipmentDefectManagement.getStartTime()); 90
93 emergencyRiskEventQueryWrapper.le(StringUtils.isNotEmpty(equipmentDefectManagement.getEndTime()),"report_date",equipmentDefectManagement.getEndTime());
94 emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type"); 91 emergencyRiskEventQueryWrapper.groupBy("handle_result","event_type");
95 List<Map<String,Object>> yclList = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper); 92 List<Map<String,Object>> yclList = emergencyRiskEventService.listMaps(emergencyRiskEventQueryWrapper);
96 //获取未处理、已处理中的应急事件类型 93 //获取未处理、已处理中的应急事件类型
...@@ -133,40 +130,40 @@ public class EmergencyRiskEventController { ...@@ -133,40 +130,40 @@ public class EmergencyRiskEventController {
133 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, 130 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
134 HttpServletRequest req) { 131 HttpServletRequest req) {
135 Result<IPage<EmergencyRiskEvent>> result = new Result<IPage<EmergencyRiskEvent>>(); 132 Result<IPage<EmergencyRiskEvent>> result = new Result<IPage<EmergencyRiskEvent>>();
133 //2023-10-05 00:00:00 2023-10-05 23:59:59
136 QueryWrapper<EmergencyRiskEvent> queryWrapper = QueryGenerator.initQueryWrapper(emergencyRiskEvent, req.getParameterMap()); 134 QueryWrapper<EmergencyRiskEvent> queryWrapper = QueryGenerator.initQueryWrapper(emergencyRiskEvent, req.getParameterMap());
137 Page<EmergencyRiskEvent> page = new Page<EmergencyRiskEvent>(pageNo, pageSize); 135 Page<EmergencyRiskEvent> page = new Page<EmergencyRiskEvent>(pageNo, pageSize);
138 136
139 if(StringUtils.isNotEmpty(emergencyRiskEvent.getStartTime())){ 137
140 queryWrapper.ge("report_date",emergencyRiskEvent.getStartTime());
141 }
142 if(StringUtils.isNotEmpty(emergencyRiskEvent.getEndTime())){
143 queryWrapper.le("report_date",emergencyRiskEvent.getEndTime());
144 }
145 IPage<EmergencyRiskEvent> pageList = emergencyRiskEventService.page(page, queryWrapper); 138 IPage<EmergencyRiskEvent> pageList = emergencyRiskEventService.page(page, queryWrapper);
146 139
147 //获取流程状态 140 //获取流程状态
148 List<EmergencyRiskEvent> records = pageList.getRecords(); 141 List<EmergencyRiskEvent> records = pageList.getRecords();
149 Set<String> processInstanceIdSet = records.stream().filter(data-> StringUtils.isNotBlank(data.getProcessInstanceId())) 142 if(records != null && !records.isEmpty()){
150 .map(EmergencyRiskEvent::getProcessInstanceId).collect(Collectors.toSet()); 143 Set<String> processInstanceIdSet = records.stream().filter(data-> StringUtils.isNotBlank(data.getProcessInstanceId()))
151 Map<String, Map<String, String>> processInstanceMap; 144 .map(EmergencyRiskEvent::getProcessInstanceId).collect(Collectors.toSet());
152 try { 145 Map<String, Map<String, String>> processInstanceMap;
153 processInstanceMap = flowBusinessService.getProcessState(processInstanceIdSet); 146 try {
154 } catch (Exception e) { 147 processInstanceMap = flowBusinessService.getProcessState(processInstanceIdSet);
155 e.printStackTrace(); 148 } catch (Exception e) {
156 processInstanceMap = new HashMap<>(); 149 e.printStackTrace();
157 } 150 processInstanceMap = new HashMap<>();
158 for (EmergencyRiskEvent record : records) { 151 }
159 record.getFlow().setProcessDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionKey")); 152 for (EmergencyRiskEvent record : records) {
160 record.getFlow().setTaskDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("taskDefinitionKey")); 153 record.getFlow().setProcessDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionKey"));
161 record.getFlow().setStatus(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("state")); 154 record.getFlow().setTaskDefinitionKey(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("taskDefinitionKey"));
162 record.getFlow().setTaskName(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionName")); 155 record.getFlow().setStatus(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("state"));
163 } 156 record.getFlow().setTaskName(processInstanceMap.getOrDefault(record.getProcessInstanceId(), new HashMap<>()).get("processDefinitionName"));
157 }
158 }
159
164 160
165 result.setSuccess(true); 161 result.setSuccess(true);
166 result.setResult(pageList); 162 result.setResult(pageList);
167 return result; 163 return result;
168 } 164 }
169 165
166
170 /** 167 /**
171 168
172 /** 169 /**
......
...@@ -143,10 +143,5 @@ public class EmergencyRiskEvent extends FlowEntity { ...@@ -143,10 +143,5 @@ public class EmergencyRiskEvent extends FlowEntity {
143 @Excel(name = "删除标识,0:正常,1:删除", width = 15) 143 @Excel(name = "删除标识,0:正常,1:删除", width = 15)
144 @ApiModelProperty(value = "删除标识,0:正常,1:删除") 144 @ApiModelProperty(value = "删除标识,0:正常,1:删除")
145 private Integer delFlag; 145 private Integer delFlag;
146 @TableField(exist = false) 146
147 @ApiModelProperty(value = "开始时间")
148 private String startTime;
149 @TableField(exist = false)
150 @ApiModelProperty(value = "结束时间")
151 private String endTime;
152 } 147 }
......
...@@ -2,6 +2,8 @@ package com.skua.modules.custom.service.impl; ...@@ -2,6 +2,8 @@ package com.skua.modules.custom.service.impl;
2 2
3 import com.skua.common.report.ReportViewUtil; 3 import com.skua.common.report.ReportViewUtil;
4 import com.skua.core.context.SpringContextUtils; 4 import com.skua.core.context.SpringContextUtils;
5 import com.skua.core.excel.demo.Student;
6 import com.skua.core.util.ConvertUtils;
5 import com.skua.modules.custom.entity.FCustomReportDataset; 7 import com.skua.modules.custom.entity.FCustomReportDataset;
6 import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; 8 import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
7 import com.skua.modules.custom.service.IFCustomReportDatasetService; 9 import com.skua.modules.custom.service.IFCustomReportDatasetService;
...@@ -279,18 +281,18 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -279,18 +281,18 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
279 JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); 281 JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO();
280 //当月数据 282 //当月数据
281 String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); 283 String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
282 String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); 284 String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
283 List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null); 285 List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null);
284 286
285 // 上月数据 同比 287 // 上月数据 同比
286 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); 288 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
287 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); 289 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
288 List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null); 290 List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null);
289 291
290 Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList); 292 Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList);
291 // 去年数据 环比 293 // 去年数据 环比
292 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); 294 dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
293 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); 295 dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
294 List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null); 296 List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null);
295 Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList); 297 Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList);
296 298
...@@ -316,6 +318,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -316,6 +318,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
316 powerConsumeVO = new PowerConsumeVO(reportData.getDepartId(),reportData.getDepartName(),reportData.getDh(), reportData.getGffdl(), reportData.getQy(), reportData.getZhnyxhl() , reportData.getEyhtpfl() , reportData.getDsdh() ); 318 powerConsumeVO = new PowerConsumeVO(reportData.getDepartId(),reportData.getDepartName(),reportData.getDh(), reportData.getGffdl(), reportData.getQy(), reportData.getZhnyxhl() , reportData.getEyhtpfl() , reportData.getDsdh() );
317 319
318 c02NumberVO = new ResultNumberVO(); 320 c02NumberVO = new ResultNumberVO();
321 c02NumberVO.setName( reportData.getDepartName() );
319 c02NumberVO.setValue( reportData.getCodxjl() ); 322 c02NumberVO.setValue( reportData.getCodxjl() );
320 cod_NumberVO = new ResultNumberVO();cod_NumberVO.setValue(reportData.getCodxjl()); 323 cod_NumberVO = new ResultNumberVO();cod_NumberVO.setValue(reportData.getCodxjl());
321 nh3n_NumberVO = new ResultNumberVO();nh3n_NumberVO.setValue(reportData.getTnxjl()); 324 nh3n_NumberVO = new ResultNumberVO();nh3n_NumberVO.setValue(reportData.getTnxjl());
...@@ -380,6 +383,35 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -380,6 +383,35 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
380 383
381 int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class); 384 int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class);
382 largeScreenVO.setEquipmentL2( count2 ); 385 largeScreenVO.setEquipmentL2( count2 );
386
387 // 各站点系统负荷率排名:负荷率排序、设置排名
388 if(largeScreenVO.getLoadRateVOList() != null && !largeScreenVO.getLoadRateVOList().isEmpty()){
389 // 根据分数排序
390 Collections.sort(largeScreenVO.getLoadRateVOList(), new Comparator<LoadRateVO>() {
391 public int compare(LoadRateVO s1, LoadRateVO s2) {
392 return Double.compare(ConvertUtils.getDouble(s1.getWsfhl(),0d), ConvertUtils.getDouble(s1.getWsfhl(),0d)); // 降序排序
393 }
394 });
395 /*int rank = 1; // 设置排名
396 for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
397 loadRateVORank.setRank( rank++);
398 }*/
399 }
400 //各站点能源消耗排名 吨水电耗
401 if(largeScreenVO.getPowerConsumeVOList() != null && !largeScreenVO.getPowerConsumeVOList().isEmpty()) {
402 // 根据分数排序
403 Collections.sort(largeScreenVO.getPowerConsumeVOList(), new Comparator<PowerConsumeVO>() {
404 public int compare(PowerConsumeVO s1, PowerConsumeVO s2) {
405 return Double.compare(ConvertUtils.getDouble(s1.getDh(), 0d), ConvertUtils.getDouble(s1.getDh(), 0d)); // 降序排序
406 }
407 });
408 /*int rank = 1; // 设置排名
409 for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
410 loadRateVORank.setRank( rank++);
411 }*/
412 }
413
414
383 return largeScreenVO; 415 return largeScreenVO;
384 } 416 }
385 /**转换为Map<部门编号,JnhbReportData> */ 417 /**转换为Map<部门编号,JnhbReportData> */
......
...@@ -50,38 +50,39 @@ public class JnhbLargeScreenVO { ...@@ -50,38 +50,39 @@ public class JnhbLargeScreenVO {
50 public void setHeadStatisticsValue(JnhbReportData reportData){ 50 public void setHeadStatisticsValue(JnhbReportData reportData){
51 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh 51 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
52 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 52 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
53 this.getHeadStatisticsList().get(0).setValue( reportData.getWssjcll() ); 53 this.getHeadStatisticsList().get(0).setValue( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValue() , reportData.getWssjcll()) );
54 this.getHeadStatisticsList().get(1).setValue( reportData.getWsfhl() ); 54 this.getHeadStatisticsList().get(1).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValue() , reportData.getWsfhl()) );
55 this.getHeadStatisticsList().get(2).setValue( reportData.getDh() ); 55 this.getHeadStatisticsList().get(2).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValue() , reportData.getDh() ));
56 this.getHeadStatisticsList().get(3).setValue( reportData.getQy() ); 56 this.getHeadStatisticsList().get(3).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValue() , reportData.getQy()) );
57 this.getHeadStatisticsList().get(4).setValue( reportData.getXssyl() ); 57 this.getHeadStatisticsList().get(4).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValue() , reportData.getXssyl()) );
58 this.getHeadStatisticsList().get(5).setValue( reportData.getZhnyxhl() ); 58 this.getHeadStatisticsList().get(5).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValue() , reportData.getZhnyxhl()) );
59 this.getHeadStatisticsList().get(6).setValue( reportData.getEyhtpfl() ); 59 this.getHeadStatisticsList().get(6).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValue() , reportData.getEyhtpfl() ));
60 this.getHeadStatisticsList().get(7).setValue( reportData.getDsdh() ); 60 this.getHeadStatisticsList().get(7).setValue(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValue() , reportData.getDsdh() ));
61 } 61 }
62 public void setHeadStatisticsValueTB(JnhbReportData reportData){ 62 public void setHeadStatisticsValueTB(JnhbReportData reportData){
63 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh 63 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
64 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 64 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
65 this.getHeadStatisticsList().get(0).setValueTb( reportData.getWssjcll() ); 65
66 this.getHeadStatisticsList().get(1).setValueTb( reportData.getWsfhl() ); 66 this.getHeadStatisticsList().get(0).setValueTb( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValueTb() , reportData.getWssjcll()) );
67 this.getHeadStatisticsList().get(2).setValueTb( reportData.getDh() ); 67 this.getHeadStatisticsList().get(1).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValueTb() , reportData.getWsfhl()) );
68 this.getHeadStatisticsList().get(3).setValueTb( reportData.getQy() ); 68 this.getHeadStatisticsList().get(2).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValueTb() , reportData.getDh() ));
69 this.getHeadStatisticsList().get(4).setValueTb( reportData.getXssyl() ); 69 this.getHeadStatisticsList().get(3).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValueTb() , reportData.getQy()) );
70 this.getHeadStatisticsList().get(5).setValueTb( reportData.getZhnyxhl() ); 70 this.getHeadStatisticsList().get(4).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValueTb() , reportData.getXssyl()) );
71 this.getHeadStatisticsList().get(6).setValueTb( reportData.getEyhtpfl() ); 71 this.getHeadStatisticsList().get(5).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValueTb() , reportData.getZhnyxhl()) );
72 this.getHeadStatisticsList().get(7).setValueTb( reportData.getDsdh() ); 72 this.getHeadStatisticsList().get(6).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValueTb() , reportData.getEyhtpfl() ));
73 this.getHeadStatisticsList().get(7).setValueTb(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValueTb() , reportData.getDsdh() ));
73 } 74 }
74 public void setHeadStatisticsValueHB(JnhbReportData reportData){ 75 public void setHeadStatisticsValueHB(JnhbReportData reportData){
75 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh 76 // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh
76 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 77 ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水
77 this.getHeadStatisticsList().get(0).setValueHb( reportData.getWssjcll() ); 78 this.getHeadStatisticsList().get(0).setValueHb( DigitalUtils.add( this.getHeadStatisticsList().get(0).getValueHb() , reportData.getWssjcll()) );
78 this.getHeadStatisticsList().get(1).setValueHb( reportData.getWsfhl() ); 79 this.getHeadStatisticsList().get(1).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(1).getValueHb() , reportData.getWsfhl()) );
79 this.getHeadStatisticsList().get(2).setValueHb( reportData.getDh() ); 80 this.getHeadStatisticsList().get(2).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(2).getValueHb() , reportData.getDh() ));
80 this.getHeadStatisticsList().get(3).setValueHb( reportData.getQy() ); 81 this.getHeadStatisticsList().get(3).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(3).getValueHb() , reportData.getQy()) );
81 this.getHeadStatisticsList().get(4).setValueHb( reportData.getXssyl() ); 82 this.getHeadStatisticsList().get(4).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(4).getValueHb() , reportData.getXssyl()) );
82 this.getHeadStatisticsList().get(5).setValueHb( reportData.getZhnyxhl() ); 83 this.getHeadStatisticsList().get(5).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(5).getValueHb() , reportData.getZhnyxhl()) );
83 this.getHeadStatisticsList().get(6).setValueHb( reportData.getEyhtpfl() ); 84 this.getHeadStatisticsList().get(6).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(6).getValueHb() , reportData.getEyhtpfl() ));
84 this.getHeadStatisticsList().get(7).setValueHb( reportData.getDsdh() ); 85 this.getHeadStatisticsList().get(7).setValueHb(DigitalUtils.add( this.getHeadStatisticsList().get(7).getValueHb() , reportData.getDsdh() ));
85 } 86 }
86 87
87 /*** 88 /***
...@@ -98,13 +99,17 @@ public class JnhbLargeScreenVO { ...@@ -98,13 +99,17 @@ public class JnhbLargeScreenVO {
98 public JnhbLargeScreenVO(){ 99 public JnhbLargeScreenVO(){
99 //头部数值统计 100 //头部数值统计
100 String names = "污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水"; 101 String names = "污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水";
102 String unit = "万吨,%,万千瓦时,吨,吨,吨标准煤,吨CO2当量,千瓦时/吨";
101 String[] nameList = names.split(","); 103 String[] nameList = names.split(",");
104 String[] unitList = unit.split(",");
102 ResultNumberVO numberVO = null; 105 ResultNumberVO numberVO = null;
103 for(String name : nameList){ 106 for(int i = 0 ; i< nameList.length ; i++){
104 numberVO = new ResultNumberVO(); 107 numberVO = new ResultNumberVO();
105 numberVO.setName( name); 108 numberVO.setName( nameList[i]);
109 numberVO.setUnit(unitList[i] );
106 this.getHeadStatisticsList().add(numberVO) ; 110 this.getHeadStatisticsList().add(numberVO) ;
107 } 111 }
112
108 //消减量统计 113 //消减量统计
109 names= "COD,NH3-N,TP,TN"; 114 names= "COD,NH3-N,TP,TN";
110 nameList = names.split(","); 115 nameList = names.split(",");
......
1 package com.skua.modules.report.vo.largeScreen; 1 package com.skua.modules.report.vo.largeScreen;
2 2
3 import com.skua.core.util.ConvertUtils;
3 import com.skua.modules.report.vo.JnhbReportData; 4 import com.skua.modules.report.vo.JnhbReportData;
4 import com.skua.tool.util.DigitalUtils; 5 import com.skua.tool.util.DigitalUtils;
5 import io.swagger.annotations.ApiModel; 6 import io.swagger.annotations.ApiModel;
...@@ -32,10 +33,10 @@ public class ResultChartsVO { ...@@ -32,10 +33,10 @@ public class ResultChartsVO {
32 33
33 public void setData(JnhbReportData reportData ){ 34 public void setData(JnhbReportData reportData ){
34 this.getXLine().add( reportData.getDepartName() ) ; 35 this.getXLine().add( reportData.getDepartName() ) ;
35 this.getCodDataList().add( reportData.getCodxjl() ) ; 36 this.getCodDataList().add(ConvertUtils.getString(reportData.getCodxjl(),"0") ) ;
36 this.getNh3DataList().add( reportData.getTnxjl() ) ; 37 this.getNh3DataList().add( ConvertUtils.getString(reportData.getTnxjl(),"0") ) ;
37 this.getTpDataList().add( reportData.getTpxjl() ) ; 38 this.getTpDataList().add( ConvertUtils.getString( reportData.getTpxjl(),"0") ) ;
38 this.getTnDataList().add( reportData.getTnxjl() ) ; 39 this.getTnDataList().add( ConvertUtils.getString(reportData.getTnxjl(),"0") ) ;
39 } 40 }
40 public void setDataByZhnyxhl(JnhbReportData reportData ){ 41 public void setDataByZhnyxhl(JnhbReportData reportData ){
41 this.getXLine().add( reportData.getDepartName() ) ; 42 this.getXLine().add( reportData.getDepartName() ) ;
......
1 package com.skua.modules.report.vo.largeScreen; 1 package com.skua.modules.report.vo.largeScreen;
2 2
3 import com.skua.tool.util.DigitalUtils; 3 import com.skua.tool.util.DigitalUtils;
4 import com.skua.tool.util.JSUtils;
4 import io.swagger.annotations.ApiModel; 5 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty; 6 import io.swagger.annotations.ApiModelProperty;
6 import lombok.Data; 7 import lombok.Data;
...@@ -14,6 +15,8 @@ public class ResultNumberVO { ...@@ -14,6 +15,8 @@ public class ResultNumberVO {
14 15
15 @ApiModelProperty(value = "名称") 16 @ApiModelProperty(value = "名称")
16 private String name; 17 private String name;
18 @ApiModelProperty(value = "单位")
19 private String unit;
17 20
18 @ApiModelProperty(value = "结果") 21 @ApiModelProperty(value = "结果")
19 private String value; 22 private String value;
...@@ -24,25 +27,71 @@ public class ResultNumberVO { ...@@ -24,25 +27,71 @@ public class ResultNumberVO {
24 @ApiModelProperty(value = "环比(上月)") 27 @ApiModelProperty(value = "环比(上月)")
25 private String valueHb; 28 private String valueHb;
26 29
27 @ApiModelProperty(value = "同比(去年同期)排名") 30 /* @ApiModelProperty(value = "同比(去年同期)排名")
28 private String valueTbRank; 31 private String valueTbRank;*/
29 32
30 @ApiModelProperty(value = "环比(上月)排名") 33 @ApiModelProperty(value = "环比(上月)排名")
31 private String valueHbRank; 34 private Integer rank;
35
36 /* @ApiModelProperty(value = "环比(上月)排名")
37 private String valueHbRank;*/
32 38
33 39
34 @ApiModelProperty(value = "同比比例") 40 @ApiModelProperty(value = "同比比例")
35 private String valueTbRatio; 41 private String valueTbRatio;
42 @ApiModelProperty(value = "同比比例箭头")
43 private Boolean valueTbArrow;
44
45
36 @ApiModelProperty(value = "环比比例") 46 @ApiModelProperty(value = "环比比例")
37 private String valueHbRatio; 47 private String valueHbRatio;
48 @ApiModelProperty(value = "环比比例箭头")
49 private Boolean valueHbArrow;
38 50
39 public String getValueTbRatio() { 51 public String getValueTbRatio() {
40 this.valueTbRatio = DigitalUtils.division( this.value , this.valueTb) ; 52 String expression = this.getValue() +">" + this.getValueTb();
53 Boolean result = JSUtils.executeExpressionForBoolean(expression);
54 if( result != null ){
55 if(result){
56 expression = "" +this.getValue() +"/"+this.getValueTb()+"* 100 - 100";
57 }
58 if( !result ){
59 expression = " 100-" +this.getValue() +"/"+this.getValueTb()+"* 100 ";
60 }
61 }
62 this.valueTbRatio = JSUtils.executeExpression(expression,"0.0");// DigitalUtils.division( this.value , this.valueTb) ;
41 return valueTbRatio; 63 return valueTbRatio;
42 } 64 }
43 65
44 public String getValueHbRatio() { 66 public String getValueHbRatio() {
45 this.valueHbRatio = DigitalUtils.division( this.value , this.valueHb) ; 67 //this.valueHbRatio = DigitalUtils.division( this.value , this.valueHb) ;
68 // String expression = "" +this.value +"/"+this.valueHb+"* 100 - 100";
69
70 String expression = this.getValue() +">" + this.getValueHb();
71 Boolean result = JSUtils.executeExpressionForBoolean(expression);
72 if( result != null ){
73 if(result){
74 expression = "" +this.getValue() +"/"+this.getValueHb()+"* 100 - 100";
75 }
76 if( !result ){
77 expression = " 100 -" +this.getValue() +"/"+this.getValueHb()+"* 100 ";
78 }
79 }
80 this.valueHbRatio = JSUtils.executeExpression(expression,"0.0");// DigitalUtils.division( this.value , this.valueTb) ;
46 return valueHbRatio; 81 return valueHbRatio;
47 } 82 }
83
84 public Boolean getValueTbArrow() {
85 String expression = this.getValue() +">" + this.getValueHb();
86 Boolean result = JSUtils.executeExpressionForBoolean(expression);
87 if(result == null ) result = true;
88 return result;
89 }
90
91 public Boolean getValueHbArrow() {
92 String expression = this.getValue() +">" + this.getValueHb();
93 Boolean result = JSUtils.executeExpressionForBoolean(expression);
94 if(result == null ) result = true;
95 return result;
96 }
48 } 97 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!