Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
a3c628d8
由
康伟
编写于
2024-10-31 19:51:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei :格式化输出
1 个父辈
79358c7d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
45 行增加
和
33 行删除
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
sk-module-datafill/src/main/java/com/skua/modules/report/vo/SeasonTimeVO.java
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
查看文件 @
a3c628d
package
com
.
skua
.
modules
.
quartz
.
util
;
import
com.skua.core.util.ConvertUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
...
...
@@ -16,6 +17,18 @@ import java.util.regex.Pattern;
public
class
BaseUtil
{
private
static
DecimalFormat
df
=
new
DecimalFormat
(
"#.00"
);
/**
* 格式化
* @param obj
* @param defval
* @return
*/
public
static
String
getValue
(
Object
obj
,
Double
defval
){
return
df
.
format
(
ConvertUtils
.
getDouble
(
obj
,
defval
)
);
}
/***
* 计算时间的前几个月的月份
* @param month
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
查看文件 @
a3c628d
...
...
@@ -67,7 +67,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
dataList
=
masterDB
.
queryForList
(
dataViewName2119
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_lastDay
(
dataMap
.
get
(
"CSL"
).
toString
(
)
)
;
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_lastDay
(
BaseUtil
.
getValue
(
dataMap
.
get
(
"CSL"
),
0
d
)
)
;
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
//本月处理水量(m³)
...
...
@@ -75,7 +75,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
dataList
=
masterDB
.
queryForList
(
dataViewName2119
);
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_month
(
dataMap
.
get
(
"CSL"
).
toString
()
)
;
if
(
factoryInfoVO
!=
null
)
factoryInfoVO
.
setCsl_month
(
BaseUtil
.
getValue
(
dataMap
.
get
(
"CSL"
),
0
d
)
)
;
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
//本年处理水量(万m³)
...
...
@@ -84,8 +84,8 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
factoryInfoVO
=
factoryInfoMap
.
get
(
dataMap
.
get
(
"depart_id"
).
toString
());
if
(
factoryInfoVO
!=
null
){
factoryInfoVO
.
setCsl_year
(
dataMap
.
get
(
"CSL"
).
toString
()
)
;
factoryInfoVO
.
setCsl_avg_day
(
DigitalUtils
.
division
(
dataMap
.
get
(
"CSL"
).
toString
()
,
differenceTime
+
""
)
);
factoryInfoVO
.
setCsl_year
(
BaseUtil
.
getValue
(
ConvertUtils
.
getDouble
(
dataMap
.
get
(
"CSL"
),
0
d
)
/
10000
,
0
d
)
)
;
factoryInfoVO
.
setCsl_avg_day
(
BaseUtil
.
getValue
(
ConvertUtils
.
getDouble
(
dataMap
.
get
(
"CSL"
),
0
d
)
/
differenceTime
,
0
d
)
);
}
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/vo/SeasonTimeVO.java
查看文件 @
a3c628d
package
com
.
skua
.
modules
.
report
.
vo
;
import
com.skua.tool.util.DateUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.Calendar
;
/**
* 季度时间
* @auther kangwei
...
...
@@ -24,7 +28,7 @@ public class SeasonTimeVO {
@ApiModelProperty
(
value
=
"季度结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
value
=
"季度天数"
)
private
Stri
ng
disparityDay
;
private
Lo
ng
disparityDay
;
public
SeasonTimeVO
(){
...
...
@@ -38,37 +42,32 @@ public class SeasonTimeVO {
public
void
getTimeBySeason
(
int
year
,
int
season
){
int
startMonth
=
0
;
int
endMonth
=
0
;
int
startDay
=
1
;
int
endDay
=
31
;
switch
(
season
)
{
case
1
:
startMonth
=
1
;
endMonth
=
3
;
break
;
case
2
:
startMonth
=
4
;
endMonth
=
6
;
break
;
case
3
:
startMonth
=
7
;
endMonth
=
9
;
break
;
case
4
:
startMonth
=
10
;
endMonth
=
12
;
break
;
default
:
System
.
out
.
println
(
"季度输入无效,请输入1-4之间的数字。"
);
case
1
:
startMonth
=
1
;
endMonth
=
3
;
endDay
=
31
;
break
;
case
2
:
startMonth
=
4
;
endMonth
=
6
;
endDay
=
30
;
break
;
case
3
:
startMonth
=
7
;
endMonth
=
9
;
endDay
=
30
;
break
;
case
4
:
startMonth
=
10
;
endMonth
=
12
;
endDay
=
31
;
break
;
default
:
System
.
out
.
println
(
"季度输入无效,请输入1-4之间的数字。"
);
return
;
}
Calendar
startDate
=
Calendar
.
getInstance
();
/* startDate.set(Calendar.YEAR,year);
startDate.set(Calendar.MONTH, startMonth-1);
startDate.set(Calendar.DATE, startDay);*/
startDate
.
set
(
year
,
startMonth
-
1
,
startDay
);
LocalDate
startDate
=
LocalDate
.
of
(
year
,
startMonth
,
1
);
LocalDate
endDate
=
LocalDate
.
of
(
year
,
endMonth
,
startDate
.
lengthOfMonth
());
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
Calendar
endDate
=
Calendar
.
getInstance
();
/* endDate.set(Calendar.YEAR,year);
endDate.set(Calendar.MONTH, endMonth-1);
endDate.set(Calendar.DATE, endDay);*/
endDate
.
set
(
year
,
endMonth
-
1
,
endDay
);
this
.
startTime
=
startDate
.
format
(
formatter
);;
this
.
endTime
=
endDate
.
format
(
formatter
);
;
long
daysBetween
=
daysBetween
(
startDate
,
endDate
);
this
.
disparityDay
=
daysBetween
+
""
;
}
public
static
long
daysBetween
(
LocalDate
startDate
,
LocalDate
endDate
)
{
return
ChronoUnit
.
DAYS
.
between
(
startDate
,
endDate
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
this
.
startTime
=
formatter
.
format
(
startDate
.
getTime
());
this
.
endTime
=
formatter
.
format
(
endDate
.
getTime
());
//long daysBetween = daysBetween(this.startTime, this.endTime );
this
.
disparityDay
=
DateUtils
.
differenceDay
(
this
.
startTime
,
this
.
endTime
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论