9687d2f5 dengxuelong

Merge remote-tracking branch 'origin/master'

2 个父辈 59431130 62269c2c
...@@ -86,7 +86,7 @@ public final class ChineseInital { ...@@ -86,7 +86,7 @@ public final class ChineseInital {
86 } 86 }
87 87
88 public static void main(String[] args) { 88 public static void main(String[] args) {
89 System.out.println("获取拼音首字母:"+getAllFirstLetter("1大中国南昌中大china")); 89 System.out.println("获取拼音首字母:"+getAllFirstLetter("1-1#进水提升泵"));
90 } 90 }
91 91
92 } 92 }
......
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
......
...@@ -28,6 +28,8 @@ public class JTDisplayScreenController { ...@@ -28,6 +28,8 @@ public class JTDisplayScreenController {
28 public Result<List<SysFactoryInfoVO>> factoryList() { 28 public Result<List<SysFactoryInfoVO>> factoryList() {
29 Result<List<SysFactoryInfoVO>> result = new Result<>(); 29 Result<List<SysFactoryInfoVO>> result = new Result<>();
30 List<SysFactoryInfoVO> list = displayScreenService.getFactoryList(); 30 List<SysFactoryInfoVO> list = displayScreenService.getFactoryList();
31
32
31 result.setResult(list); 33 result.setResult(list);
32 return result; 34 return result;
33 } 35 }
......
...@@ -55,7 +55,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { ...@@ -55,7 +55,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
55 List<Map<String, Object>> dataList = masterDB.queryForList(factorySql); 55 List<Map<String, Object>> dataList = masterDB.queryForList(factorySql);
56 for(Map<String, Object> dataMap : dataList) { 56 for(Map<String, Object> dataMap : dataList) {
57 // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title"))); 57 // resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
58 factoryInfoVO = new SysFactoryInfoVO(dataMap.get("id")+"",dataMap.get("depart_id").toString(),dataMap.get("depart_name").toString(),dataMap.get("pro_longitude").toString(),dataMap.get("pro_latitude").toString()); 58 factoryInfoVO = new SysFactoryInfoVO(dataMap.get("id")+"",dataMap.get("depart_id").toString(),dataMap.get("depart_name").toString(),dataMap.get("pro_longitude").toString(),dataMap.get("pro_latitude").toString(),1);
59 factoryInfoMap.put(factoryInfoVO.getDepartId(),factoryInfoVO); 59 factoryInfoMap.put(factoryInfoVO.getDepartId(),factoryInfoVO);
60 } 60 }
61 //查询部门集合 61 //查询部门集合
...@@ -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,14 +84,24 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { ...@@ -84,14 +84,24 @@ 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
92 factoryInfoVOList = new ArrayList(factoryInfoMap.values()); 94 factoryInfoVOList = new ArrayList(factoryInfoMap.values());
95
96 // 添加:中冶数据
97 factorySql = "select fi.id,fi.depart_id,d.depart_name, fi.pro_longitude,fi.pro_latitude ,d.depart_type from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =-1";
98 List<SysFactoryInfoVO> factroyList = masterDB.query(factorySql, new BeanPropertyRowMapper<SysFactoryInfoVO>(SysFactoryInfoVO.class));
99 if(factroyList != null ){
100 factoryInfoVOList.addAll(factroyList);
101 }
93 return factoryInfoVOList; 102 return factoryInfoVOList;
94 } 103 }
104
95 /** 105 /**
96 * 项目运营情况 106 * 项目运营情况
97 * @param departId 107 * @param departId
......
...@@ -17,6 +17,9 @@ public class SysFactoryInfoVO { ...@@ -17,6 +17,9 @@ public class SysFactoryInfoVO {
17 @ApiModelProperty(value = "水厂名称") 17 @ApiModelProperty(value = "水厂名称")
18 private String departId; 18 private String departId;
19 19
20 @ApiModelProperty(value = "厂站类型")
21 private Integer departType = 1;
22
20 @ApiModelProperty(value = "水厂名称") 23 @ApiModelProperty(value = "水厂名称")
21 private String departName; 24 private String departName;
22 25
...@@ -42,11 +45,12 @@ public class SysFactoryInfoVO { ...@@ -42,11 +45,12 @@ public class SysFactoryInfoVO {
42 public SysFactoryInfoVO() { 45 public SysFactoryInfoVO() {
43 } 46 }
44 47
45 public SysFactoryInfoVO(String id, String departId, String departName, String proLongitude, String proLatitude) { 48 public SysFactoryInfoVO(String id, String departId, String departName, String proLongitude, String proLatitude,Integer departType) {
46 this.id = id; 49 this.id = id;
47 this.departId = departId; 50 this.departId = departId;
48 this.departName = departName; 51 this.departName = departName;
49 this.proLongitude = proLongitude; 52 this.proLongitude = proLongitude;
50 this.proLatitude = proLatitude; 53 this.proLatitude = proLatitude;
54 this.departType = departType;
51 } 55 }
52 } 56 }
......
...@@ -11,16 +11,6 @@ import java.util.List; ...@@ -11,16 +11,6 @@ import java.util.List;
11 */ 11 */
12 public interface OperationReportMapper { 12 public interface OperationReportMapper {
13 /*** 13 /***
14 * 查询月度生产数据报表
15 * @param startTime
16 * @param endTime
17 * @param lastStartTime
18 * @param lastEndTime
19 * @return
20 */
21 List<FReportMonthDataVO> queryReportMonthData(@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("lastStartTime")String lastStartTime,@Param("lastEndTime") String lastEndTime) ;
22
23 /***
24 * 查询隐含排查部门名称 14 * 查询隐含排查部门名称
25 * @return 15 * @return
26 */ 16 */
......
...@@ -2,60 +2,6 @@ ...@@ -2,60 +2,6 @@
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.skua.modules.report.mapper.OperationReportMapper"> 3 <mapper namespace="com.skua.modules.report.mapper.OperationReportMapper">
4 4
5 <!-- -->
6 <select id="queryReportMonthData" resultType="com.skua.modules.report.vo.FReportMonthDataVO">
7 SELECT
8 a.depart_id,tc.target_water,tc. target_power,tc.target_drug,
9 (select t.depart_name from sys_depart t where t.id = a.depart_id ) 'depart_name',
10 (
11 select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
12 where fi.report_id = '2119ecbf53a1d2d0708258ff67cfd9e1' and item_code= 'CSL' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2024%'
13 ) 'ysjsl',
14 (
15 select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
16 where fi.report_id = '2119ecbf53a1d2d0708258ff67cfd9e1' and item_code= 'CSL' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2023%'
17 ) 'tqysjsl',
18 (select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
19 where fi.report_id = '3a243d5715b9e1a3753c180872ca0df9' and item_code= 'DLHJ' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2024%' ) 'ydh',
20 sum( IF ( ( `d`.`item_code` = 'yslwcbl' ), `a`.`item_value`, NULL ) ) AS `yslwcbl`, -- 月水量完成比例
21 sum( IF ( ( `d`.`item_code` = 'ysjsldyqntqyy' ), `a`.`item_value`, NULL ) ) AS `ysjsldyqntqyy`, -- 月实际水量低于去年同期原因
22 sum( IF ( ( `d`.`item_code` = 'qntqsfsl' ), `a`.`item_value`, NULL ) ) AS `qntqsfsl`, -- 去年同期收费水量
23 sum( IF ( ( `d`.`item_code` = 'ysfsl' ), `a`.`item_value`, NULL ) ) AS `ysfsl`, -- 月收费水量
24 sum( IF ( ( `d`.`item_code` = 'bnsjdh' ), `a`.`item_value`, NULL ) ) AS `bnsjdh`,-- 本年实际电耗
25 sum( IF ( ( `d`.`item_code` = 'sldyyqyy' ), `a`.`item_value`, NULL ) ) AS `sldyyqyy`,-- 收费水量对比变化率
26 sum( IF ( ( `d`.`item_code` = 'dhgyqntqyy' ), `a`.`item_value`, NULL ) ) AS `dhgyqntqyy`, -- 电耗高于去年同期原因
27 sum( IF ( ( `d`.`item_code` = 'yyf' ), `a`.`item_value`, NULL ) ) AS `yyf`, -- 月药费
28 sum( IF ( ( `d`.`item_code` = 'yhgyqntqyy' ), `a`.`item_value`, NULL ) ) AS `yhgyqntqyy`, -- 药耗高于去年同期原因
29 sum( IF ( ( `d`.`item_code` = 'dhcmbzyy' ), `a`.`item_value`, NULL ) ) AS `dhcmbzyy`, -- 电耗超目标值原因
30 sum( IF ( ( `d`.`item_code` = 'yhcyqyy' ), `a`.`item_value`, NULL ) ) AS `yhcyqyy` -- 药耗超预期原因
31 FROM
32 ( (SELECT reit_id,item_value,depart_id
33 FROM f_report_itemv
34 WHERE
35 data_time LIKE '2024%'
36 AND reit_id IN (
37 '1818936216687595521',
38 '1818936217375461377',
39 '1818936218109464577',
40 '1818936218910576642',
41 '1818936219120291842',
42 '1818936219854295042',
43 '1818936220017872897',
44 '1818936220353417218',
45 '1818936220571521025',
46 '1818936220739293185',
47 '1818936220890288130' )
48 ) `a`
49 LEFT JOIN `f_report_item` `d` ON ( ( `a`.`reit_id` = `d`.`id` ) )
50 LEFT JOIN `report_target_config` tc ON ( ( `tc`.`depart_id` = `a`.`depart_id` ) )
51 )
52 WHERE
53 1 = 1
54 GROUP BY
55 `a`.`depart_id`
56 </select>
57
58
59 <select id="queryDepatNameList" resultType="java.lang.String"> 5 <select id="queryDepatNameList" resultType="java.lang.String">
60 select d.depart_name from ajh_rectification_info t 6 select d.depart_name from ajh_rectification_info t
61 left join sys_depart d on t.depart_id = d.id 7 left join sys_depart d on t.depart_id = d.id
......
...@@ -8,12 +8,6 @@ import com.skua.modules.report.vo.ProductDataVO; ...@@ -8,12 +8,6 @@ import com.skua.modules.report.vo.ProductDataVO;
8 */ 8 */
9 public interface IOperationReportService { 9 public interface IOperationReportService {
10 10
11 /***
12 * 执行查询sql语句返回一个结果
13 * @param sql
14 * @return
15 */
16 String queryForString(String sql );
17 11
18 /*** 12 /***
19 * 处理月季度数据 13 * 处理月季度数据
......
...@@ -22,6 +22,10 @@ public class FReportPowerMonthDataVO { ...@@ -22,6 +22,10 @@ public class FReportPowerMonthDataVO {
22 @ApiModelProperty(value = "原因分析") 22 @ApiModelProperty(value = "原因分析")
23 private String causeAnalysis; 23 private String causeAnalysis;
24 24
25 public FReportPowerMonthDataVO(){
26
27 }
28
25 public FReportPowerMonthDataVO(String deptartName, String targetConsume, String realConsume , String causeAnalysis) { 29 public FReportPowerMonthDataVO(String deptartName, String targetConsume, String realConsume , String causeAnalysis) {
26 this.deptartName = deptartName; 30 this.deptartName = deptartName;
27 this.targetConsume = targetConsume; 31 this.targetConsume = targetConsume;
......
...@@ -19,6 +19,10 @@ public class FReportWaterMonthDataVO { ...@@ -19,6 +19,10 @@ public class FReportWaterMonthDataVO {
19 @ApiModelProperty(value = "原因分析") 19 @ApiModelProperty(value = "原因分析")
20 private String causeAnalysis; 20 private String causeAnalysis;
21 21
22 public FReportWaterMonthDataVO(){
23
24 }
25
22 public FReportWaterMonthDataVO(String deptartName, String ratio, String causeAnalysis) { 26 public FReportWaterMonthDataVO(String deptartName, String ratio, String causeAnalysis) {
23 this.deptartName = deptartName; 27 this.deptartName = deptartName;
24 this.ratio = ratio; 28 this.ratio = ratio;
......
1 package com.skua.modules.report.vo; 1 package com.skua.modules.report.vo;
2 2
3 import com.skua.core.util.ConvertUtils;
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;
...@@ -18,19 +19,22 @@ public class ProductDataVO { ...@@ -18,19 +19,22 @@ public class ProductDataVO {
18 19
19 @ApiModelProperty(value = "季度开始时间") 20 @ApiModelProperty(value = "季度开始时间")
20 private String startTime; 21 private String startTime;
21
22 @ApiModelProperty(value = "季度结束时间") 22 @ApiModelProperty(value = "季度结束时间")
23 private String endTime; 23 private String endTime;
24 @ApiModelProperty(value = "水务厂站数量") 24 @ApiModelProperty(value = "水务厂站数量")
25 private String deptartCount; 25 private String deptartCount;
26
27 @ApiModelProperty(value = "相差天数")
28 private Long dayNum;
29
26 @ApiModelProperty(value = "收费水量") 30 @ApiModelProperty(value = "收费水量")
27 private String chargeWaterVolume;//收费水量9854.012552万吨 31 private String chargeWaterVolume;//收费水量9854.012552万吨
28 @ApiModelProperty(value = "收费水量-日均值") 32 @ApiModelProperty(value = "收费水量-日均值")
29 private String avgDayWaterVolume;//平均108.29万吨/天 33 private Double avgDayWaterVolume;//平均108.29万吨/天
30 @ApiModelProperty(value = "收费水量-同比增长") 34 @ApiModelProperty(value = "收费水量-同比增长")
31 private String chargeWaterRatio; 35 private Double chargeWaterRatio;
32 @ApiModelProperty(value = "收费水量-完成率") 36 @ApiModelProperty(value = "收费水量-完成率")
33 private String completeRatio; 37 private Double completeRatio;
34 @ApiModelProperty(value = "序时进度") 38 @ApiModelProperty(value = "序时进度")
35 private String sequentialProgress; 39 private String sequentialProgress;
36 40
...@@ -39,17 +43,17 @@ public class ProductDataVO { ...@@ -39,17 +43,17 @@ public class ProductDataVO {
39 @ApiModelProperty(value = "实际处理水量") 43 @ApiModelProperty(value = "实际处理水量")
40 private String ysjslWaterVolume; 44 private String ysjslWaterVolume;
41 @ApiModelProperty(value = "实际处理水量-日均值") 45 @ApiModelProperty(value = "实际处理水量-日均值")
42 private String avgYsjslWaterVolume;//平均99.76万吨/天 46 private Double avgYsjslWaterVolume;//平均99.76万吨/天
43 @ApiModelProperty(value = "实际处理水量--同比增长") 47 @ApiModelProperty(value = "实际处理水量--同比增长")
44 private String ysjslWaterRatio; 48 private Double ysjslWaterRatio;
45 49
46 50
47 @ApiModelProperty(value = "药量目标") 51 @ApiModelProperty(value = "药量目标")
48 private String targetDrug; 52 private Double targetDrug;
49 53
50 54
51 @ApiModelProperty(value = "药剂实际费用") 55 @ApiModelProperty(value = "药剂实际费用")
52 private String drugCost;//实际发生为0.219元/吨水 56 private Double drugCost;//实际发生为0.219元/吨水
53 57
54 58
55 @ApiModelProperty(value = "实际水量同比下降--水务公司列表") 59 @ApiModelProperty(value = "实际水量同比下降--水务公司列表")
...@@ -76,6 +80,16 @@ public class ProductDataVO { ...@@ -76,6 +80,16 @@ public class ProductDataVO {
76 @ApiModelProperty(value = "隐患部门名称") 80 @ApiModelProperty(value = "隐患部门名称")
77 private String dangerDeptNames; 81 private String dangerDeptNames;
78 82
83 //收费水量-日均值
84 public Double getAvgDayWaterVolume() {
85 avgDayWaterVolume = ConvertUtils.getDouble(chargeWaterVolume,0) / dayNum ;
86 return avgDayWaterVolume;
87 }
88 //实际处理水量-日均值
89 public Double getAvgYsjslWaterVolume() {
90 avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
91 return avgYsjslWaterVolume;
92 }
79 93
80 public String getWaterDeptartName() { 94 public String getWaterDeptartName() {
81 return getDeptName(waterDeptartList); 95 return getDeptName(waterDeptartList);
...@@ -110,3 +124,4 @@ public class ProductDataVO { ...@@ -110,3 +124,4 @@ public class ProductDataVO {
110 return deptName; 124 return deptName;
111 } 125 }
112 } 126 }
127
......
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
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!