Merge remote-tracking branch 'origin/master' into master
正在显示
14 个修改的文件
包含
199 行增加
和
80 行删除
... | @@ -72,9 +72,9 @@ public class ReportViewUtil { | ... | @@ -72,9 +72,9 @@ public class ReportViewUtil { |
72 | if(!StringUtils.isEmpty(itemIds)) { | 72 | if(!StringUtils.isEmpty(itemIds)) { |
73 | itemIds = itemIds.substring(1); | 73 | itemIds = itemIds.substring(1); |
74 | } | 74 | } |
75 | sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); | 75 | sb.append(" `a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); |
76 | 76 | ||
77 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 "); | 77 | sb.append(" SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv v WHERE 1=1 "); |
78 | if(StringUtils.isNotEmpty(departIds)){ | 78 | if(StringUtils.isNotEmpty(departIds)){ |
79 | sb.append(" and depart_id in ("+inSqlPart+") "); | 79 | sb.append(" and depart_id in ("+inSqlPart+") "); |
80 | } | 80 | } |
... | @@ -141,16 +141,16 @@ public class ReportViewUtil { | ... | @@ -141,16 +141,16 @@ public class ReportViewUtil { |
141 | itemIds = itemIds.substring(1); | 141 | itemIds = itemIds.substring(1); |
142 | } | 142 | } |
143 | sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); | 143 | sb.append("`a`.`depart_id` AS `depart_id`,`a`.`data_id` AS `id`,`a`.`data_time` AS `time` from (( "); |
144 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); | 144 | sb.append(" SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); |
145 | if(StringUtils.isNotEmpty(departIds)){ | 145 | if(StringUtils.isNotEmpty(departIds)){ |
146 | sb.append("and depart_id in ("+inSqlPart+")"); | 146 | sb.append(" and depart_id in ("+inSqlPart+")"); |
147 | } | 147 | } |
148 | if(!StringUtils.isEmpty(dataTime)) { | 148 | if(!StringUtils.isEmpty(dataTime)) { |
149 | sb.append("and data_time like'"+dataTime+"%'"); | 149 | sb.append("and data_time like'"+dataTime+"%'"); |
150 | } | 150 | } |
151 | sb.append("and reit_id in ("+itemIds+")"); | 151 | sb.append(" and reit_id in ("+itemIds+")"); |
152 | 152 | ||
153 | sb.append(") `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)"); | 153 | sb.append(" ) `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)"); |
154 | 154 | ||
155 | return sb.toString(); | 155 | return sb.toString(); |
156 | } | 156 | } |
... | @@ -204,17 +204,17 @@ public class ReportViewUtil { | ... | @@ -204,17 +204,17 @@ public class ReportViewUtil { |
204 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); | 204 | sb.append("SELECT data_id,reit_id,item_value,data_time,depart_id FROM f_report_itemv WHERE 1=1 "); |
205 | 205 | ||
206 | if(!StringUtils.isEmpty(departIds)) { | 206 | if(!StringUtils.isEmpty(departIds)) { |
207 | sb.append(" and depart_id in ("+inSqlPart+")"); | 207 | sb.append(" and depart_id in ("+inSqlPart+") "); |
208 | } | 208 | } |
209 | if(!StringUtils.isEmpty(startTime)) { | 209 | if(!StringUtils.isEmpty(startTime)) { |
210 | sb.append("and data_time >='"+startTime+"'"); | 210 | sb.append(" and data_time >='"+startTime+"' "); |
211 | } | 211 | } |
212 | if(!StringUtils.isEmpty(endTime)) { | 212 | if(!StringUtils.isEmpty(endTime)) { |
213 | sb.append("and data_time <='"+endTime+"'"); | 213 | sb.append(" and data_time <='"+endTime+"' "); |
214 | } | 214 | } |
215 | sb.append("and reit_id in ("+itemIds+")"); | 215 | sb.append(" and reit_id in ("+itemIds+") "); |
216 | 216 | ||
217 | sb.append(") `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`depart_id`)"); | 217 | sb.append(") `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`depart_id`) "); |
218 | 218 | ||
219 | return sb.toString(); | 219 | return sb.toString(); |
220 | } | 220 | } | ... | ... |
... | @@ -64,15 +64,16 @@ public class DateVO { | ... | @@ -64,15 +64,16 @@ public class DateVO { |
64 | this.nowYear = Integer.parseInt(DateUtils.dateformat(currentDate,"yyyy")); | 64 | this.nowYear = Integer.parseInt(DateUtils.dateformat(currentDate,"yyyy")); |
65 | //同比时间 | 65 | //同比时间 |
66 | this.lastYear = nowYear -1 ;//去年 | 66 | this.lastYear = nowYear -1 ;//去年 |
67 | this.lastYearMonth = DateUtils.getHbMonth(currentDate); | 67 | this.lastYearMonth = DateUtils.getTbMonth(this.nowMonth); |
68 | System.out.println(" lastYearMonth "+lastYearMonth); | 68 | //System.out.println(" lastYearMonth "+lastYearMonth); |
69 | this.lastYearMonthStartTime = lastYearMonth+"-01"; | 69 | this.lastYearMonthStartTime = lastYearMonth+"-01"; |
70 | this.lastYearMonthStartTime = lastYearMonth+"-31"; | 70 | this.lastYearMonthEndTime = lastYearMonth+"-31"; |
71 | this.lastYearStartDate = this.lastYear+"-01-01"; | 71 | this.lastYearStartDate = this.lastYear+"-01-01"; |
72 | this.lastYearEndDate = this.lastYear+"-12-31"; | 72 | this.lastYearEndDate = this.lastYear+"-12-31"; |
73 | 73 | ||
74 | //环比时间 | 74 | //环比时间 |
75 | this.lastMonth = DateUtils.getHbMonth(currentDate);// | 75 | this.lastMonth = DateUtils.getHbMonth(this.nowMonth);// |
76 | System.out.println(" lastMonth "+lastMonth); | ||
76 | this.lastMonthStartTime = lastMonth+"-01"; | 77 | this.lastMonthStartTime = lastMonth+"-01"; |
77 | this.lastMonthEndTime = lastMonth+"-31"; | 78 | this.lastMonthEndTime = lastMonth+"-31"; |
78 | 79 | ... | ... |
... | @@ -51,6 +51,7 @@ public class DigitalUtils { | ... | @@ -51,6 +51,7 @@ public class DigitalUtils { |
51 | if(StringUtils.isNotEmpty(val2)){ | 51 | if(StringUtils.isNotEmpty(val2)){ |
52 | BigDecimal num2 = new BigDecimal(val2); | 52 | BigDecimal num2 = new BigDecimal(val2); |
53 | result = result.add( num2 ); | 53 | result = result.add( num2 ); |
54 | result = result.multiply( num2).setScale(2, BigDecimal.ROUND_HALF_UP); | ||
54 | } | 55 | } |
55 | return result.toString(); | 56 | return result.toString(); |
56 | } | 57 | } | ... | ... |
... | @@ -19,23 +19,51 @@ import java.util.regex.Pattern; | ... | @@ -19,23 +19,51 @@ import java.util.regex.Pattern; |
19 | */ | 19 | */ |
20 | public class JSUtils { | 20 | public class JSUtils { |
21 | 21 | ||
22 | // 表达式字符合法性校验正则模式,静态常量化可以降低每次使用都要编译地消耗 | 22 | public static String add(Object obj1 , Object obj2){ |
23 | private static final Pattern EXPRESSION_PATTERN = Pattern.compile("[0-9\\.+-/*()= ]+"); | 23 | String expression = obj1+ "+" + obj2; |
24 | // 运算符优先级map | 24 | return executeExpression(expression,"0.00"); |
25 | private static final Map<String, Integer> OPT_PRIORITY_MAP = new HashMap<String, Integer>() { | 25 | } |
26 | private static final long serialVersionUID = 6968472606692771458L; | 26 | public static String subtract(Object obj1 , Object obj2){ |
27 | { | 27 | String expression = obj1+ "-" + obj2; |
28 | put("(", 0); | 28 | return executeExpression(expression,"0.00"); |
29 | put("+", 2); | 29 | } |
30 | put("-", 2); | 30 | public static String multiply(Object obj1 , Object obj2){ |
31 | put("*", 3); | 31 | String expression = obj1+ "*" + obj2; |
32 | put("/", 3); | 32 | return executeExpression(expression,"0.00"); |
33 | put(")", 7); | 33 | } |
34 | put("=", 20); | 34 | public static String divide(Object obj1 , Object obj2){ |
35 | String expression = obj1+ "/" + obj2; | ||
36 | return executeExpression(expression,"0.00"); | ||
35 | } | 37 | } |
36 | }; | ||
37 | 38 | ||
39 | /*** | ||
40 | * 格式化结果,保留两位小数 | ||
41 | * @param obj1 | ||
42 | * @return | ||
43 | */ | ||
44 | public static String format(Object obj1 ){ | ||
45 | return format(obj1,null); | ||
46 | } | ||
38 | 47 | ||
48 | /*** | ||
49 | * 格式化结果,指定格式,默认保留两位小数 | ||
50 | * @param obj1 | ||
51 | * @param decimalFormat | ||
52 | * @return | ||
53 | */ | ||
54 | public static String format(Object obj1 , String decimalFormat){ | ||
55 | String result = null; | ||
56 | try{ | ||
57 | if(obj1 != null ){ | ||
58 | if(decimalFormat == null ) decimalFormat = "0.00"; | ||
59 | DecimalFormat df = new DecimalFormat(decimalFormat); | ||
60 | result = df.format(Double.parseDouble(obj1.toString())); | ||
61 | } | ||
62 | }catch(Exception e){ | ||
63 | e.printStackTrace(); | ||
64 | } | ||
65 | return result; | ||
66 | } | ||
39 | /** | 67 | /** |
40 | * 输入加减乘除表达式字符串,返回计算结果 | 68 | * 输入加减乘除表达式字符串,返回计算结果 |
41 | * | 69 | * |
... | @@ -54,6 +82,25 @@ public class JSUtils { | ... | @@ -54,6 +82,25 @@ public class JSUtils { |
54 | } | 82 | } |
55 | return result; | 83 | return result; |
56 | } | 84 | } |
85 | |||
86 | // 表达式字符合法性校验正则模式,静态常量化可以降低每次使用都要编译地消耗 | ||
87 | private static final Pattern EXPRESSION_PATTERN = Pattern.compile("[0-9\\.+-/*()= ]+"); | ||
88 | // 运算符优先级map | ||
89 | private static final Map<String, Integer> OPT_PRIORITY_MAP = new HashMap<String, Integer>() { | ||
90 | private static final long serialVersionUID = 6968472606692771458L; | ||
91 | { | ||
92 | put("(", 0); | ||
93 | put("+", 2); | ||
94 | put("-", 2); | ||
95 | put("*", 3); | ||
96 | put("/", 3); | ||
97 | put(")", 7); | ||
98 | put("=", 20); | ||
99 | } | ||
100 | }; | ||
101 | |||
102 | |||
103 | |||
57 | public static double executeExpression(String expression) { | 104 | public static double executeExpression(String expression) { |
58 | // 非空校验 | 105 | // 非空校验 |
59 | if (null == expression || "".equals(expression.trim())) { | 106 | if (null == expression || "".equals(expression.trim())) { | ... | ... |
此文件的差异被折叠,
点击展开。
sk-module-biz/src/main/java/com/skua/modules/algorithm/service/impl/ReportItemvService.java
0 → 100644
1 | package com.skua.modules.algorithm.service.impl; | ||
2 | |||
3 | import com.skua.common.report.ReportViewUtil; | ||
4 | import com.skua.core.context.SpringContextUtils; | ||
5 | import org.springframework.jdbc.core.JdbcTemplate; | ||
6 | import org.springframework.stereotype.Service; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @auther kangwei | ||
11 | * @create 2024-11-01-10:09 | ||
12 | */ | ||
13 | @Service("reportItemvService") | ||
14 | public class ReportItemvService { | ||
15 | |||
16 | |||
17 | String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H | ||
18 | String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表 | ||
19 | String view4411 = "4411ed3d78634bcdcd700f6e33724025";//生产运营周报 | ||
20 | |||
21 | private JdbcTemplate getJdbcTemplate(){ | ||
22 | //主库数据源 | ||
23 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
24 | return masterDB; | ||
25 | } | ||
26 | |||
27 | public String getSumCSL(String departId ,String startTime ,String endTime){ | ||
28 | String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, startTime,endTime); | ||
29 | String sql = "select sum(aaa.CSL) from " + dataViewName2119+ "aaa"; | ||
30 | String csl = getJdbcTemplate().queryForObject(sql,String.class); | ||
31 | return csl; | ||
32 | } | ||
33 | /* public List<Map<String,Object>> getDeptCSL(String departId , String startTime , String endTime){ | ||
34 | |||
35 | }*/ | ||
36 | |||
37 | public String getSumDLHJ(String departId ,String startTime ,String endTime){ | ||
38 | String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,"DLHJ", departId, startTime,endTime); | ||
39 | String sql = "select sum(aaa.DLHJ) from " + dataViewName3a24+ "aaa"; | ||
40 | String dlhj = getJdbcTemplate().queryForObject(sql,String.class); | ||
41 | return dlhj; | ||
42 | } | ||
43 | /* public List<Map<String,Object>> getDeptDLHJ(String departId , String startTime , String endTime){ | ||
44 | |||
45 | }*/ | ||
46 | } |
... | @@ -23,13 +23,12 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -23,13 +23,12 @@ import javax.servlet.http.HttpServletRequest; |
23 | * @create 2024-10-14-16:46 | 23 | * @create 2024-10-14-16:46 |
24 | */ | 24 | */ |
25 | @Slf4j | 25 | @Slf4j |
26 | @Api(tags="在线考试-试卷") | 26 | @Api(tags="测试报表") |
27 | @RestController("testReportController") | 27 | @RestController("testReportController") |
28 | @RequestMapping("/web/edu/paper") | ||
29 | public class TestReportSqlController { | 28 | public class TestReportSqlController { |
30 | 29 | ||
31 | @AutoLog(value = "在线考试--构造填报报表视图") | 30 | @AutoLog(value = "测试报表") |
32 | @ApiOperation(value="在线考试-构造填报报表视图", notes="在线考试-构造填报报表视图") | 31 | @ApiOperation(value="测试报表", notes="测试报表") |
33 | @GetMapping(value = "/testReportSql") | 32 | @GetMapping(value = "/testReportSql") |
34 | public Result<String> testReportSql( | 33 | public Result<String> testReportSql( |
35 | @RequestParam(name="reportId") String reportId, | 34 | @RequestParam(name="reportId") String reportId, | ... | ... |
1 | package com.skua.modules.quartz.util; | 1 | package com.skua.modules.quartz.util; |
2 | 2 | ||
3 | import com.skua.core.util.ConvertUtils; | ||
3 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
4 | 5 | ||
5 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
... | @@ -16,6 +17,22 @@ import java.util.regex.Pattern; | ... | @@ -16,6 +17,22 @@ import java.util.regex.Pattern; |
16 | public class BaseUtil { | 17 | public class BaseUtil { |
17 | 18 | ||
18 | 19 | ||
20 | private static DecimalFormat df = new DecimalFormat("#.00"); | ||
21 | |||
22 | /** | ||
23 | * 格式化 | ||
24 | * @param obj | ||
25 | * @param defval | ||
26 | * @return | ||
27 | */ | ||
28 | public static String getValue(Object obj ,Double defval ){ | ||
29 | Double d = ConvertUtils.getDouble(obj,defval); | ||
30 | if(d.doubleValue() != 0 ){ | ||
31 | return df.format( d ); | ||
32 | } | ||
33 | return d.toString(); | ||
34 | } | ||
35 | |||
19 | /*** | 36 | /*** |
20 | * 计算时间的前几个月的月份 | 37 | * 计算时间的前几个月的月份 |
21 | * @param month | 38 | * @param month | ... | ... |
... | @@ -67,7 +67,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ... | @@ -67,7 +67,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
67 | dataList = masterDB.queryForList(dataViewName2119); | 67 | dataList = masterDB.queryForList(dataViewName2119); |
68 | for(Map<String, Object> dataMap : dataList) { | 68 | for(Map<String, Object> dataMap : dataList) { |
69 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | 69 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); |
70 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_lastDay(dataMap.get("CSL").toString() ) ; | 70 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_lastDay( BaseUtil.getValue( dataMap.get("CSL"),0d) ) ; |
71 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | 71 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); |
72 | } | 72 | } |
73 | //本月处理水量(m³) | 73 | //本月处理水量(m³) |
... | @@ -75,7 +75,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ... | @@ -75,7 +75,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
75 | dataList = masterDB.queryForList(dataViewName2119); | 75 | dataList = masterDB.queryForList(dataViewName2119); |
76 | for(Map<String, Object> dataMap : dataList) { | 76 | for(Map<String, Object> dataMap : dataList) { |
77 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | 77 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); |
78 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_month(dataMap.get("CSL").toString() ) ; | 78 | if(factoryInfoVO != null ) factoryInfoVO.setCsl_month( BaseUtil.getValue( dataMap.get("CSL"),0d) ) ; |
79 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | 79 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); |
80 | } | 80 | } |
81 | //本年处理水量(万m³) | 81 | //本年处理水量(万m³) |
... | @@ -84,13 +84,11 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ... | @@ -84,13 +84,11 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
84 | for(Map<String, Object> dataMap : dataList) { | 84 | for(Map<String, Object> dataMap : dataList) { |
85 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); | 85 | factoryInfoVO = factoryInfoMap.get(dataMap.get("depart_id").toString()); |
86 | if(factoryInfoVO != null ){ | 86 | if(factoryInfoVO != null ){ |
87 | factoryInfoVO.setCsl_year(dataMap.get("CSL").toString() ) ; | 87 | factoryInfoVO.setCsl_year( BaseUtil.getValue( ConvertUtils.getDouble(dataMap.get("CSL"),0d) / 10000,0d) ) ; |
88 | factoryInfoVO.setCsl_avg_day(DigitalUtils.division( dataMap.get("CSL").toString() ,differenceTime+"" ) ); | 88 | factoryInfoVO.setCsl_avg_day( BaseUtil.getValue( ConvertUtils.getDouble(dataMap.get("CSL"),0d) / differenceTime,0d) ); |
89 | } | 89 | } |
90 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); | 90 | // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); |
91 | } | 91 | } |
92 | |||
93 | |||
94 | factoryInfoVOList = new ArrayList(factoryInfoMap.values()); | 92 | factoryInfoVOList = new ArrayList(factoryInfoMap.values()); |
95 | 93 | ||
96 | // 添加:中冶数据 | 94 | // 添加:中冶数据 |
... | @@ -239,9 +237,12 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ... | @@ -239,9 +237,12 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
239 | StringBuffer sql = new StringBuffer("select round(aaa.CSL,2) 'csl',round(( aaa.JSCOD - aaa.CSCOD ),2) 'codxjl', round(( aaa.JSAD -aaa.CSAD ),2) 'adxjl' from "); | 237 | StringBuffer sql = new StringBuffer("select round(aaa.CSL,2) 'csl',round(( aaa.JSCOD - aaa.CSCOD ),2) 'codxjl', round(( aaa.JSAD -aaa.CSAD ),2) 'adxjl' from "); |
240 | sql.append(" "+dataViewName2119 +" aaa "); | 238 | sql.append(" "+dataViewName2119 +" aaa "); |
241 | System.out.println(sql.toString()); | 239 | System.out.println(sql.toString()); |
242 | waterQualityVO = getJdbcTemplate().queryForObject(sql.toString(),new BeanPropertyRowMapper<WaterQualityVO>(WaterQualityVO.class)); | 240 | List<WaterQualityVO> waterQualityVOList = getJdbcTemplate().query(sql.toString(),new BeanPropertyRowMapper<WaterQualityVO>(WaterQualityVO.class)); |
243 | 241 | if(waterQualityVOList != null && !waterQualityVOList.isEmpty()){ | |
244 | 242 | waterQualityVO = waterQualityVOList.get(0); | |
243 | }else{ | ||
244 | waterQualityVO = new WaterQualityVO(); | ||
245 | } | ||
245 | // if(waterQualityVO == null )waterQualityVO = new WaterQualityVO(); | 246 | // if(waterQualityVO == null )waterQualityVO = new WaterQualityVO(); |
246 | //负荷率 CSL/设计规模 () | 247 | //负荷率 CSL/设计规模 () |
247 | String factoryProScaleSql = "select round( ("+waterQualityVO.getCsl() +"/(pro_scale * 100) ),2) fhl from sys_factory_info where depart_id = '"+departId+"'"; | 248 | String factoryProScaleSql = "select round( ("+waterQualityVO.getCsl() +"/(pro_scale * 100) ),2) fhl from sys_factory_info where depart_id = '"+departId+"'"; |
... | @@ -257,10 +258,15 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ... | @@ -257,10 +258,15 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { |
257 | sql2.append( " "+dataViewName3a24+" aaa "); | 258 | sql2.append( " "+dataViewName3a24+" aaa "); |
258 | 259 | ||
259 | System.out.println("sql2 = "+sql2.toString()); | 260 | System.out.println("sql2 = "+sql2.toString()); |
260 | WaterQualityVO waterQualityVOTemp = getJdbcTemplate().queryForObject( sql2.toString(), new BeanPropertyRowMapper<WaterQualityVO>(WaterQualityVO.class)); | 261 | waterQualityVOList = getJdbcTemplate().query( sql2.toString(), new BeanPropertyRowMapper<WaterQualityVO>(WaterQualityVO.class)); |
262 | if(waterQualityVOList != null && !waterQualityVOList.isEmpty() ){ | ||
263 | WaterQualityVO waterQualityVOTemp = waterQualityVOList.get(0); | ||
261 | waterQualityVO.setTnl(waterQualityVOTemp.getTnl() ); | 264 | waterQualityVO.setTnl(waterQualityVOTemp.getTnl() ); |
262 | waterQualityVO.setDsdh(waterQualityVOTemp.getDsdh()); | 265 | waterQualityVO.setDsdh(waterQualityVOTemp.getDsdh()); |
263 | waterQualityVO.setDsyh(waterQualityVOTemp.getDsyh()); | 266 | waterQualityVO.setDsyh(waterQualityVOTemp.getDsyh()); |
267 | } | ||
268 | |||
269 | |||
264 | 270 | ||
265 | return waterQualityVO; | 271 | return waterQualityVO; |
266 | } | 272 | } | ... | ... |
... | @@ -100,7 +100,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -100,7 +100,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
100 | " v6.dhgyqntqyy, " + | 100 | " v6.dhgyqntqyy, " + |
101 | " round(v4.yjhl/sum(v1.CSL),2) as yyh, " + | 101 | " round(v4.yjhl/sum(v1.CSL),2) as yyh, " + |
102 | " v6.yyf," + | 102 | " v6.yyf," + |
103 | " round(ifnull(v5.yjhl/tb.clsl_tb,0),2) qntqyh, " + | 103 | " round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " + |
104 | " round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " + | 104 | " round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " + |
105 | " v6.yhgyqntqyy, " + | 105 | " v6.yhgyqntqyy, " + |
106 | " rtc.target_power as bndhmb, " + | 106 | " rtc.target_power as bndhmb, " + |
... | @@ -128,9 +128,9 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -128,9 +128,9 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
128 | " ) v4 on v4.month_tb = right(left(v1.time,7),2) " + | 128 | " ) v4 on v4.month_tb = right(left(v1.time,7),2) " + |
129 | " left join ( " + | 129 | " left join ( " + |
130 | " select right(left(time,7),2) month_tb, " + | 130 | " select right(left(time,7),2) month_tb, " + |
131 | " SUM(DLHJ) dlhj,(SUM( PAMRJ ) + SUM( SCLPAMZ ) + SUM( SCLPAMF ) + SUM( NACLO ) + SUM( PACGT ) + SUM( PACYT ) + SUM( PFS ) + SUM( FHTY ) + " + | 131 | " SUM(DLHJ) dlhj,(SUM( IFNULL(PAMRJ,0) ) + SUM( IFNULL(SCLPAMZ,0) ) + SUM( IFNULL(SCLPAMF,0) ) + SUM( IFNULL(NACLO,0) ) + SUM( IFNULL(PACGT,0) ) + SUM( IFNULL(PACYT,0) ) + SUM( IFNULL(PFS,0) ) + SUM( IFNULL(FHTY,0) ) + " + |
132 | " SUM( RYXNJ ) + SUM( YWL ) + SUM( GXCLJ ) + SUM( CH3COONA ) + SUM( HXT ) + SUM( FECL3 ) + SUM( SH ) + SUM( CH3COOH ) + SUM( FESO4G ) + " + | 132 | " SUM( IFNULL(RYXNJ,0) ) + SUM( IFNULL(YWL,0) ) + SUM( IFNULL(GXCLJ,0) ) + SUM( IFNULL(CH3COONA,0) ) + SUM( IFNULL(HXT,0) ) + SUM( IFNULL(FECL3,0) ) + SUM( IFNULL(SH,0) ) + SUM( IFNULL(CH3COOH,0) ) + SUM( IFNULL(FESO4G,0) ) + " + |
133 | " SUM( FESO4Y ) + SUM( H2O2 )) yjhl " + | 133 | " SUM( IFNULL(FESO4Y,0) ) + SUM( IFNULL(H2O2,0) )) yjhl " + |
134 | " from "+dataViewName3a24tb+" v3 " + | 134 | " from "+dataViewName3a24tb+" v3 " + |
135 | " where v3.depart_id = '"+departId+"' and v3.time like CONCAT('"+tbYear+"','%') GROUP BY left(time,7) " + | 135 | " where v3.depart_id = '"+departId+"' and v3.time like CONCAT('"+tbYear+"','%') GROUP BY left(time,7) " + |
136 | " ) v5 on v5.month_tb = right(left(v1.time,7),2) " + | 136 | " ) v5 on v5.month_tb = right(left(v1.time,7),2) " + | ... | ... |
... | @@ -33,7 +33,7 @@ public class OperationReportServiceImpl implements IOperationReportService { | ... | @@ -33,7 +33,7 @@ public class OperationReportServiceImpl implements IOperationReportService { |
33 | 33 | ||
34 | String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H | 34 | String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H |
35 | String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表 | 35 | String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表 |
36 | String view4411 = "4411ed3d78634bcdcd700f6e33724025"; | 36 | String view4411 = "4411ed3d78634bcdcd700f6e33724025";//生产运营周报 |
37 | 37 | ||
38 | private JdbcTemplate getJdbcTemplate(){ | 38 | private JdbcTemplate getJdbcTemplate(){ |
39 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | 39 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ... | ... |
... | @@ -34,4 +34,10 @@ public class FRportlCommandCenterVO implements Serializable { | ... | @@ -34,4 +34,10 @@ public class FRportlCommandCenterVO implements Serializable { |
34 | this.valueTb = valueTb; | 34 | this.valueTb = valueTb; |
35 | this.valueHb = valueHb; | 35 | this.valueHb = valueHb; |
36 | } | 36 | } |
37 | public FRportlCommandCenterVO(String title ,String value, String valueTb, String valueHb) { | ||
38 | this.title = title; | ||
39 | this.value = value; | ||
40 | this.valueTb = valueTb; | ||
41 | this.valueHb = valueHb; | ||
42 | } | ||
37 | } | 43 | } | ... | ... |
1 | package com.skua.modules.report.vo; | 1 | package com.skua.modules.report.vo; |
2 | 2 | ||
3 | import com.skua.tool.util.DateUtils; | ||
3 | import io.swagger.annotations.ApiModel; | 4 | import io.swagger.annotations.ApiModel; |
4 | import io.swagger.annotations.ApiModelProperty; | 5 | import io.swagger.annotations.ApiModelProperty; |
5 | import lombok.Data; | 6 | import lombok.Data; |
6 | 7 | ||
8 | import java.text.SimpleDateFormat; | ||
7 | import java.time.LocalDate; | 9 | import java.time.LocalDate; |
8 | import java.time.format.DateTimeFormatter; | 10 | import java.time.format.DateTimeFormatter; |
9 | import java.time.temporal.ChronoUnit; | 11 | import java.time.temporal.ChronoUnit; |
12 | import java.util.Calendar; | ||
13 | |||
10 | /** | 14 | /** |
11 | * 季度时间 | 15 | * 季度时间 |
12 | * @auther kangwei | 16 | * @auther kangwei |
... | @@ -24,7 +28,7 @@ public class SeasonTimeVO { | ... | @@ -24,7 +28,7 @@ public class SeasonTimeVO { |
24 | @ApiModelProperty(value = "季度结束时间") | 28 | @ApiModelProperty(value = "季度结束时间") |
25 | private String endTime; | 29 | private String endTime; |
26 | @ApiModelProperty(value = "季度天数") | 30 | @ApiModelProperty(value = "季度天数") |
27 | private String disparityDay; | 31 | private Long disparityDay; |
28 | 32 | ||
29 | public SeasonTimeVO(){ | 33 | public SeasonTimeVO(){ |
30 | 34 | ||
... | @@ -38,37 +42,32 @@ public class SeasonTimeVO { | ... | @@ -38,37 +42,32 @@ public class SeasonTimeVO { |
38 | public void getTimeBySeason(int year,int season){ | 42 | public void getTimeBySeason(int year,int season){ |
39 | int startMonth = 0; | 43 | int startMonth = 0; |
40 | int endMonth = 0; | 44 | int endMonth = 0; |
45 | int startDay = 1; | ||
46 | int endDay = 31; | ||
41 | switch (season) { | 47 | switch (season) { |
42 | case 1: | 48 | case 1: startMonth = 1;endMonth = 3; endDay=31; break; |
43 | startMonth = 1; | 49 | case 2: startMonth = 4;endMonth = 6; endDay=30; break; |
44 | endMonth = 3; | 50 | case 3:startMonth = 7;endMonth = 9;endDay=30; break; |
45 | break; | 51 | case 4: startMonth = 10; endMonth = 12; endDay=31; break; |
46 | case 2: | 52 | default:System.out.println("季度输入无效,请输入1-4之间的数字。");return ; |
47 | startMonth = 4; | ||
48 | endMonth = 6; | ||
49 | break; | ||
50 | case 3: | ||
51 | startMonth = 7; | ||
52 | endMonth = 9; | ||
53 | break; | ||
54 | case 4: | ||
55 | startMonth = 10; | ||
56 | endMonth = 12; | ||
57 | break; | ||
58 | default: | ||
59 | System.out.println("季度输入无效,请输入1-4之间的数字。"); | ||
60 | } | 53 | } |
54 | Calendar startDate = Calendar.getInstance(); | ||
55 | /* startDate.set(Calendar.YEAR,year); | ||
56 | startDate.set(Calendar.MONTH, startMonth-1); | ||
57 | startDate.set(Calendar.DATE, startDay);*/ | ||
58 | startDate.set(year,startMonth-1,startDay); | ||
61 | 59 | ||
62 | LocalDate startDate = LocalDate.of(year, startMonth, 1); | 60 | Calendar endDate = Calendar.getInstance(); |
63 | LocalDate endDate = LocalDate.of(year, endMonth, startDate.lengthOfMonth()); | 61 | /* endDate.set(Calendar.YEAR,year); |
64 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | 62 | endDate.set(Calendar.MONTH, endMonth-1); |
63 | endDate.set(Calendar.DATE, endDay);*/ | ||
64 | endDate.set(year,endMonth-1,endDay); | ||
65 | 65 | ||
66 | this.startTime = startDate.format(formatter);; | 66 | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
67 | this.endTime = endDate.format(formatter); ; | 67 | this.startTime = formatter.format(startDate.getTime()); |
68 | long daysBetween = daysBetween(startDate, endDate); | 68 | this.endTime = formatter.format(endDate.getTime()); |
69 | this.disparityDay = daysBetween+""; | 69 | //long daysBetween = daysBetween(this.startTime, this.endTime ); |
70 | } | 70 | this.disparityDay = DateUtils.differenceDay( this.startTime, this.endTime ); |
71 | public static long daysBetween(LocalDate startDate, LocalDate endDate) { | ||
72 | return ChronoUnit.DAYS.between(startDate, endDate); | ||
73 | } | 71 | } |
72 | |||
74 | } | 73 | } | ... | ... |
... | @@ -34,11 +34,8 @@ import java.util.List; | ... | @@ -34,11 +34,8 @@ import java.util.List; |
34 | @EnableSwagger2 | 34 | @EnableSwagger2 |
35 | @EnableSwaggerBootstrapUI | 35 | @EnableSwaggerBootstrapUI |
36 | public class Swagger2Config implements WebMvcConfigurer { | 36 | public class Swagger2Config implements WebMvcConfigurer { |
37 | |||
38 | /** | 37 | /** |
39 | * | ||
40 | * 显示swagger-ui.html文档展示页,还必须注入swagger资源: | 38 | * 显示swagger-ui.html文档展示页,还必须注入swagger资源: |
41 | * | ||
42 | * @param registry | 39 | * @param registry |
43 | */ | 40 | */ |
44 | @Override | 41 | @Override | ... | ... |
-
请 注册 或 登录 后发表评论