Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
2526e61c
由
张雷
编写于
2024-11-01 23:40:43 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
报警短信修改、安环底图问题修改
1 个父辈
913db01c
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
227 行增加
和
23 行删除
sk-base-common/src/main/java/com/skua/common/constant/CacheConstant.java
sk-base-common/src/main/java/com/skua/modules/common/vo/AliAlarm.java
sk-base-common/src/main/java/com/skua/modules/common/vo/AliCode.java
sk-base-common/src/main/java/com/skua/tool/util/AliSmsUtil.java
sk-module-alarm/src/main/java/com/skua/modules/quartz/RealTimeAlarmJob.java
sk-module-biz/src/main/java/com/skua/modules/emergency/service/impl/EmergencyRiskEventServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/ScreenDataController.java
sk-module-biz/src/main/resources/application-dev.yml
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentSparepartController.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/EquipmentSparepartDTO.java
sk-base-common/src/main/java/com/skua/common/constant/CacheConstant.java
查看文件 @
2526e61
...
...
@@ -35,4 +35,30 @@ public interface CacheConstant {
*/
public
static
final
String
DEPART_IDMODEL_CACHE
=
"departCache_idmodel"
;
/**
* 阈值报警模版
*/
public
static
final
String
SMS_TEMPLATE_LIMIT
=
"SMS_474515061"
;
/**
* 设备报警模版
*/
public
static
final
String
SMS_TEMPLATE_EQUIP
=
"SMS_474510018"
;
/**
* 修改密码验证码
*/
public
static
final
String
SMS_TEMPLATE_UPDATE
=
"SMS_71850022"
;
/**
* 用户注册验证码
*/
public
static
final
String
SMS_TEMPLATE_REGISTER
=
"SMS_71850024"
;
/**
* 登录确认验证码
*/
public
static
final
String
SMS_TEMPLATE_LOGIN
=
"SMS_71850026"
;
}
...
...
sk-base-common/src/main/java/com/skua/modules/common/vo/AliAlarm.java
0 → 100644
查看文件 @
2526e61
package
com
.
skua
.
modules
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
AliAlarm
{
@ApiModelProperty
(
value
=
"时间"
)
private
String
time
;
@ApiModelProperty
(
value
=
"机构名称:水厂名称"
)
private
String
factory
;
@ApiModelProperty
(
value
=
"指标名称"
)
private
String
alarmParamName
;
@ApiModelProperty
(
value
=
"指标单位"
)
private
String
alarmParamUnit
;
@ApiModelProperty
(
value
=
"超标值"
)
private
String
alarmParamValue
;
@ApiModelProperty
(
value
=
"指标限值"
)
private
String
limitValue
;
@ApiModelProperty
(
value
=
"超标原因:大于上限,小于下限"
)
private
String
alarmParamReason
;
@ApiModelProperty
(
value
=
"接收手机号,多个手机号逗号隔开"
)
private
String
phone
;
}
sk-base-common/src/main/java/com/skua/modules/common/vo/AliCode.java
0 → 100644
查看文件 @
2526e61
package
com
.
skua
.
modules
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
AliCode
{
@ApiModelProperty
(
value
=
"验证码"
)
private
String
code
;
@ApiModelProperty
(
value
=
"项目名称"
)
private
String
product
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phone
;
@ApiModelProperty
(
value
=
"短信类型 修改密码:update,注册:register,登录:login"
)
private
String
type
;
}
sk-base-common/src/main/java/com/skua/tool/util/AliSmsUtil.java
查看文件 @
2526e61
package
com
.
skua
.
tool
.
util
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.skua.common.constant.CacheConstant
;
import
com.skua.core.exception.JeecgBootException
;
import
com.skua.modules.common.vo.AliAlarm
;
import
com.skua.modules.common.vo.AliCode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.http.RequestEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
...
...
@@ -63,18 +67,78 @@ public class AliSmsUtil {
/**
* 发送阈值报警短信
*/
public
static
void
sendLimitAlarmMsg
()
{
HashMap
<
String
,
Object
>
message
=
new
HashMap
<>();
message
.
put
(
"time"
,
"2024-10-12"
);
message
.
put
(
"factory"
,
"天长市污水处理厂"
);
message
.
put
(
"alarmParamName"
,
"进水COD"
);
message
.
put
(
"actualAvgValue"
,
"130"
+
"mg/L"
);
message
.
put
(
"limit"
,
"105"
+
"mg/L"
);
message
.
put
(
"alarmParamUnit"
,
"大于上限"
);
AliSmsUtil
.
sendMsg
(
"18519526218"
,
"SMS_474510018"
,
message
);
public
static
void
sendLimitAlarmMsg
(
AliAlarm
aliAlarm
)
{
if
(
StringUtils
.
isNotEmpty
(
aliAlarm
.
getPhone
())){
HashMap
<
String
,
Object
>
message
=
new
HashMap
<>();
message
.
put
(
"time"
,
aliAlarm
.
getTime
());
message
.
put
(
"factory"
,
aliAlarm
.
getFactory
());
message
.
put
(
"alarmParamName"
,
aliAlarm
.
getAlarmParamName
());
message
.
put
(
"actualAvgValue"
,
aliAlarm
.
getAlarmParamValue
()
+
aliAlarm
.
getAlarmParamUnit
());
message
.
put
(
"limit"
,
aliAlarm
.
getLimitValue
()
+
aliAlarm
.
getAlarmParamUnit
());
message
.
put
(
"alarmParamUnit"
,
aliAlarm
.
getAlarmParamReason
());
AliSmsUtil
.
sendMsg
(
aliAlarm
.
getPhone
(),
CacheConstant
.
SMS_TEMPLATE_LIMIT
,
message
);
}
else
{
log
.
info
(
"=======>>>>>>>>>>【阈值报警】接收人手机号未设定!"
);
}
}
/**
* 发送设备报警短信
*/
public
static
void
sendEquipAlarmMsg
(
AliAlarm
aliAlarm
)
{
if
(
StringUtils
.
isNotEmpty
(
aliAlarm
.
getPhone
())){
HashMap
<
String
,
Object
>
message
=
new
HashMap
<>();
message
.
put
(
"time"
,
aliAlarm
.
getTime
());
message
.
put
(
"factory"
,
aliAlarm
.
getFactory
());
message
.
put
(
"alarmParamName"
,
aliAlarm
.
getAlarmParamName
());
message
.
put
(
"actualAvgValue"
,
aliAlarm
.
getAlarmParamValue
()
+
aliAlarm
.
getAlarmParamUnit
());
message
.
put
(
"limit"
,
aliAlarm
.
getLimitValue
()
+
aliAlarm
.
getAlarmParamUnit
());
message
.
put
(
"alarmParamUnit"
,
aliAlarm
.
getAlarmParamReason
());
AliSmsUtil
.
sendMsg
(
aliAlarm
.
getPhone
(),
CacheConstant
.
SMS_TEMPLATE_EQUIP
,
message
);
}
else
{
log
.
info
(
"=======>>>>>>>>>>【设备报警】接收人手机号未设定!"
);
}
}
/**
* 发送验证码短信
*/
public
static
void
sendCodeMsg
(
AliCode
aliCode
)
{
if
(
StringUtils
.
isNotEmpty
(
aliCode
.
getPhone
())){
HashMap
<
String
,
Object
>
message
=
new
HashMap
<>();
message
.
put
(
"code"
,
aliCode
.
getCode
());
message
.
put
(
"product"
,
aliCode
.
getProduct
());
if
(
"update"
.
equals
(
aliCode
.
getType
())){
AliSmsUtil
.
sendMsg
(
aliCode
.
getPhone
(),
CacheConstant
.
SMS_TEMPLATE_UPDATE
,
message
);
}
else
if
(
"login"
.
equals
(
aliCode
.
getType
())){
AliSmsUtil
.
sendMsg
(
aliCode
.
getPhone
(),
CacheConstant
.
SMS_TEMPLATE_LOGIN
,
message
);
}
else
if
(
"register"
.
equals
(
aliCode
.
getType
())){
AliSmsUtil
.
sendMsg
(
aliCode
.
getPhone
(),
CacheConstant
.
SMS_TEMPLATE_REGISTER
,
message
);
}
else
{
log
.
info
(
"=======>>>>>>>>>>短信验证码缺少对应模版"
);
}
}
else
{
log
.
info
(
"=======>>>>>>>>>>【验证码】接收人手机号未设定!"
);
}
}
public
static
void
main
(
String
[]
args
)
{
sendLimitAlarmMsg
();
// AliAlarm aliAlarm = new AliAlarm();
// aliAlarm.setPhone("18519526218");
// aliAlarm.setTime("2024-11-01 11:25:29");
// aliAlarm.setFactory("天长市污水处理厂");
// aliAlarm.setAlarmParamName("进水COD");
// aliAlarm.setAlarmParamValue("130");
// aliAlarm.setAlarmParamUnit("mg/L");
// aliAlarm.setLimitValue("100");
// aliAlarm.setAlarmParamReason("大于上限");
// sendLimitAlarmMsg(aliAlarm);
AliCode
aliCode
=
new
AliCode
();
aliCode
.
setPhone
(
"18519526218"
);
aliCode
.
setCode
(
"889955"
);
aliCode
.
setProduct
(
"数字化企业大脑"
);
aliCode
.
setType
(
"login"
);
sendCodeMsg
(
aliCode
);
}
}
...
...
sk-module-alarm/src/main/java/com/skua/modules/quartz/RealTimeAlarmJob.java
查看文件 @
2526e61
...
...
@@ -14,6 +14,8 @@ import java.util.Set;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
com.skua.modules.common.vo.AliAlarm
;
import
com.skua.tool.util.AliSmsUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.flowable.engine.ProcessEngine
;
import
org.flowable.engine.ProcessEngines
;
...
...
@@ -126,7 +128,6 @@ public class RealTimeAlarmJob implements Job {
if
(
equipAlarmRuleAndAlarmRuleLevelVOList
!=
null
&&
equipAlarmRuleAndAlarmRuleLevelVOList
.
size
()>
0
)
{
allAlarmRuleAndAlarmRuleLevelVOList
.
addAll
(
equipAlarmRuleAndAlarmRuleLevelVOList
);
}
//查询pg数据超标警报
Map
<
String
,
Object
>
excessAlarmPgList
=
checkPgExcessAlarm
(
allAlarmRuleAndAlarmRuleLevelVOList
);
sendMessage
(
excessAlarmPgList
);
...
...
@@ -398,11 +399,16 @@ public class RealTimeAlarmJob implements Job {
String
alarmRuleLevelName
=
alarmRuleLevelConfig
.
getAlarmRuleLevelName
();
String
alarmRuleLevelConfigId
=
alarmRuleLevelConfig
.
getId
();
String
content
=
""
;
AliAlarm
aliAlarm
=
new
AliAlarm
();
//报警实体
String
departName
=
departNameTemplete
.
replace
(
"${departName}"
,
alarmRuleAndAlarmRuleLevelVO
.
getDepartName
());
aliAlarm
.
setFactory
(
alarmRuleAndAlarmRuleLevelVO
.
getDepartName
());
String
unit
=
""
;
if
(
alarmRuleAndAlarmRuleLevelVO
.
getAlarmParamUnit
()
!=
null
)
{
unit
=
alarmRuleAndAlarmRuleLevelVO
.
getAlarmParamUnit
();
}
aliAlarm
.
setAlarmParamName
(
alarmParamName
);
aliAlarm
.
setAlarmParamValue
(
alarmValue
.
doubleValue
()+
""
);
aliAlarm
.
setAlarmParamUnit
(
unit
);
if
(
alarmValue
>
maxValue
)
{
//最大值超标
content
=
contentTemplete
.
replace
(
"${alarmParamName}"
,
alarmParamName
)
...
...
@@ -410,6 +416,8 @@ public class RealTimeAlarmJob implements Job {
.
replace
(
"${limit}"
,
">"
+
maxValue
)
.
replace
(
"${alarmParamUnit}"
,
unit
);
content
=
content
+
"大于上限"
;
aliAlarm
.
setLimitValue
(
maxValue
.
toString
());
aliAlarm
.
setAlarmParamReason
(
"大于上限"
);
}
else
{
//最小值超标
content
=
contentTemplete
.
replace
(
"${alarmParamName}"
,
alarmParamName
)
...
...
@@ -417,6 +425,8 @@ public class RealTimeAlarmJob implements Job {
.
replace
(
"${limit}"
,
"<"
+
minValue
)
.
replace
(
"${alarmParamUnit}"
,
unit
);
content
=
content
+
"小于下限"
;
aliAlarm
.
setLimitValue
(
minValue
.
toString
());
aliAlarm
.
setAlarmParamReason
(
"小于下限"
);
}
//查询短信上一条报警是否处理,未处理就不新增报警记录
//TODO 先从数据库中获取,后期优化放redis中
...
...
@@ -568,8 +578,11 @@ public class RealTimeAlarmJob implements Job {
String
phone1
=
sysUserList
.
get
(
i
).
getPhone
();
if
(
StringUtils
.
isNotBlank
(
phone1
))
{
phoneStringBuilder
.
append
(
phone1
);
aliAlarm
.
setTime
(
date
);
aliAlarm
.
setPhone
(
phone1
);
//发送短信
HttpSenderMsg
.
sendMsg
(
prefix
+
date
+
"时"
+
departName
+
"采集数据"
+
content
+
suffix
,
phone1
);
AliSmsUtil
.
sendLimitAlarmMsg
(
aliAlarm
);
//新版短息发送工具
log
.
info
(
"短信发送成功手机号:"
+
phone1
+
",内容:"
+
content
);
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/emergency/service/impl/EmergencyRiskEventServiceImpl.java
查看文件 @
2526e61
...
...
@@ -23,6 +23,12 @@ import com.skua.modules.flow.custombiz.handle.IFlowCustomHandle;
import
com.skua.modules.flow.custombiz.vo.FlowProcessFormFieldInfoVO
;
import
com.skua.modules.flow.support.Kv
;
import
com.skua.modules.flow.utils.Func
;
import
com.skua.modules.safe.entity.DangerInspectionRecord
;
import
com.skua.modules.safe.entity.DangerLevelManage
;
import
com.skua.modules.safe.entity.DangerLevelManageShare
;
import
com.skua.modules.safe.mapper.DangerInspectionRecordMapper
;
import
com.skua.modules.safe.mapper.DangerLevelManageMapper
;
import
com.skua.modules.safe.mapper.DangerLevelManageShareMapper
;
import
com.skua.tool.util.UniqIdUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -47,6 +53,12 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
private
FlowBusinessService
flowBusinessService
;
@Autowired
private
EmergencyRiskEventMapper
emergencyRiskEventMapper
;
@Autowired
private
DangerLevelManageMapper
dangerLevelManageMapper
;
@Autowired
private
DangerLevelManageShareMapper
dangerLevelManageShareMapper
;
@Autowired
private
DangerInspectionRecordMapper
dangerInspectionRecordMapper
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -100,33 +112,66 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
@Override
public
Map
<
String
,
Object
>
getCount
(
String
year
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
int
aqyhTotal
=
0
;
//隐患排查总数
int
aqyhYes
=
0
;
//隐患排查处理数
int
aqyhNo
=
0
;
//隐患排查未完成数
int
fxTotal
=
0
;
//风险库总数
int
fxShare
=
0
;
//风险库共享总数
Map
<
String
,
Object
>
aqyhMap
=
new
HashMap
<>();
aqyhMap
.
put
(
"total"
,
"9"
);
aqyhMap
.
put
(
"yes"
,
"5"
);
aqyhMap
.
put
(
"no"
,
"4"
);
List
<
DangerInspectionRecord
>
inspectionList
=
dangerInspectionRecordMapper
.
selectList
(
new
QueryWrapper
<>());
if
(
inspectionList
.
size
()
>
0
){
aqyhTotal
=
inspectionList
.
size
();
for
(
DangerInspectionRecord
dangerInspectionRecord
:
inspectionList
)
{
if
(
"2"
.
equals
(
dangerInspectionRecord
.
getStatus
())){
aqyhYes
++;
}
else
{
aqyhNo
++;
}
}
}
aqyhMap
.
put
(
"total"
,
aqyhTotal
);
aqyhMap
.
put
(
"yes"
,
aqyhYes
);
aqyhMap
.
put
(
"no"
,
aqyhNo
);
map
.
put
(
"aqyh"
,
aqyhMap
);
Map
<
String
,
Object
>
fxkMap
=
new
HashMap
<>();
fxkMap
.
put
(
"total"
,
"9"
);
fxkMap
.
put
(
"share"
,
"5"
);
map
.
put
(
"fxk"
,
fxkMap
);
map
.
put
(
"yhpcyj"
,
"6"
);
List
<
DangerLevelManage
>
dangerList
=
dangerLevelManageMapper
.
selectList
(
new
QueryWrapper
<>());
List
<
DangerLevelManageShare
>
dangerShareList
=
dangerLevelManageShareMapper
.
selectList
(
new
QueryWrapper
<>());
if
(
dangerList
.
size
()
>
0
){
fxTotal
=
dangerList
.
size
();
}
if
(
dangerList
.
size
()
>
0
){
fxShare
=
dangerShareList
.
size
();
}
fxkMap
.
put
(
"total"
,
fxTotal
+
fxShare
);
fxkMap
.
put
(
"share"
,
fxShare
);
map
.
put
(
"fxk"
,
fxkMap
);
map
.
put
(
"yhpcyj"
,
aqyhTotal
);
return
map
;
}
@Override
public
List
<
RiskDatabaseResult
>
getRiskList
(
String
year
)
{
if
(
year
==
null
){
year
=
String
.
valueOf
(
DateUtils
.
getYear
());
}
List
<
RiskDatabaseResult
>
list
=
emergencyRiskEventMapper
.
getRiskList
(
year
);
return
list
;
}
@Override
public
List
<
DangerDatabaseResult
>
getDangerList
(
String
year
)
{
if
(
year
==
null
){
year
=
String
.
valueOf
(
DateUtils
.
getYear
());
}
List
<
DangerDatabaseResult
>
list
=
emergencyRiskEventMapper
.
getDangerList
(
year
);
return
list
;
}
@Override
public
List
<
MapDatabaseResult
>
getMapData
(
String
year
)
{
if
(
year
==
null
){
year
=
String
.
valueOf
(
DateUtils
.
getYear
());
}
List
<
MapDatabaseResult
>
list
=
emergencyRiskEventMapper
.
getMapData
(
year
);
return
list
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/ScreenDataController.java
查看文件 @
2526e61
...
...
@@ -654,15 +654,12 @@ public class ScreenDataController {
public
Result
<
List
<
SysFactoryInfoVO
>>
getFactoryListByWrapper
(
SysFactoryInfoVO
sysFactoryInfoVO
)
{
Result
<
List
<
SysFactoryInfoVO
>>
result
=
new
Result
<>();
QueryWrapper
<
SysFactoryInfoVO
>
queryWrapper
=
new
QueryWrapper
<>();
String
departType
=
sysFactoryInfoVO
.
getDepartType
();
if
(
ConvertUtils
.
isNotEmpty
(
departType
))
{
queryWrapper
.
in
(
"d.depart_type"
,
departType
.
split
(
","
));
}
String
dataDepartId
=
sysFactoryInfoVO
.
getDepartId
();
if
(
ConvertUtils
.
isNotEmpty
(
dataDepartId
))
{
queryWrapper
.
in
(
"d.id"
,
dataDepartId
.
split
(
","
));
if
(
ConvertUtils
.
isNotEmpty
(
sysFactoryInfoVO
.
getDepartId
()))
{
queryWrapper
.
in
(
"d.id"
,
sysFactoryInfoVO
.
getDepartId
().
split
(
","
));
}
else
{
queryWrapper
.
in
(
"d.id"
,
BaseContextHandler
.
getDeparts
().
split
(
","
));
}
...
...
sk-module-biz/src/main/resources/application-dev.yml
查看文件 @
2526e61
...
...
@@ -90,6 +90,7 @@ spring:
datasource
:
master
:
url
:
jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800
# url: jdbc:mysql://113.249.91.27:3306/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800
username
:
root
password
:
jkauto@123
driver-class-name
:
com.mysql.jdbc.Driver
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentSparepartController.java
查看文件 @
2526e61
...
...
@@ -249,6 +249,7 @@ public class EquipmentSparepartController {
.
innerJoin
(
EquipmentSparepartSupplies
.
class
,
EquipmentSparepartSupplies
.
class
.
getDeclaredField
(
"id"
),
EquipmentSparepart
.
class
.
getDeclaredField
(
"suppliesId"
))
.
where
()
.
ge
(
equipmentSparepartDTO
.
getNum
()>
0
,
"equipment_sparepart.storage_num"
,
equipmentSparepartDTO
.
getNum
())
.
eq
(
StringUtils
.
isNotEmpty
(
equipmentSparepartDTO
.
getDepartId
()),
"equipment_sparepart_supplies.depart_id"
,
equipmentSparepartDTO
.
getDepartId
())
.
like
(
StringUtils
.
isNotEmpty
(
equipmentSparepartDTO
.
getSparepartCode
()),
"equipment_sparepart_supplies.sparepart_code"
,
equipmentSparepartDTO
.
getSparepartCode
())
.
like
(
StringUtils
.
isNotEmpty
(
equipmentSparepartDTO
.
getSpecification
()),
"equipment_sparepart_supplies.specification"
,
equipmentSparepartDTO
.
getSpecification
())
.
like
(
StringUtils
.
isNotEmpty
(
equipmentSparepartDTO
.
getSparepartName
()),
"equipment_sparepart_supplies.sparepart_name"
,
equipmentSparepartDTO
.
getSparepartName
())
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/EquipmentSparepartDTO.java
查看文件 @
2526e61
...
...
@@ -25,6 +25,7 @@ public class EquipmentSparepartDTO extends EquipmentSparepart {
private
String
startTime
;
private
String
endTime
;
private
String
warehouseName
;
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论