Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
e59bc0ce
Commit
e59bc0ce
authored
Oct 11, 2022
by
KeYong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6
parents
04c779e4
7c16e08c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
688 additions
and
212 deletions
+688
-212
PressurePumpCheckEnum.java
...ejoin/equipmanage/common/enums/PressurePumpCheckEnum.java
+33
-0
PressurePumpEnum.java
...om/yeejoin/equipmanage/common/enums/PressurePumpEnum.java
+68
-0
PressurePumpMessageEnum.java
...oin/equipmanage/common/enums/PressurePumpMessageEnum.java
+43
-0
PressurePumpValueEnum.java
...ejoin/equipmanage/common/enums/PressurePumpValueEnum.java
+34
-0
EquipmentSpecificIndexMapper.java
...join/equipmanage/mapper/EquipmentSpecificIndexMapper.java
+3
-0
IEquipmentSpecificIndexService.java
...n/equipmanage/service/IEquipmentSpecificIndexService.java
+7
-0
EquipmentSpecificIndexServiceImpl.java
...anage/service/impl/EquipmentSpecificIndexServiceImpl.java
+6
-0
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+75
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+179
-0
application-dev.properties
...ystem-equip/src/main/resources/application-dev.properties
+9
-0
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+231
-212
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/PressurePumpCheckEnum.java
0 → 100644
View file @
e59bc0ce
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
public
enum
PressurePumpCheckEnum
{
LE
(
"le"
,
"小于等于"
),
GE
(
"ge"
,
"大于等于"
),
BE
(
"be"
,
"在两者之间"
);
private
String
code
;
private
String
describe
;
private
PressurePumpCheckEnum
(
String
code
,
String
describe
)
{
this
.
code
=
code
;
this
.
describe
=
describe
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getDescribe
()
{
return
describe
;
}
public
static
PressurePumpCheckEnum
getByCode
(
String
code
)
{
for
(
PressurePumpCheckEnum
l
:
PressurePumpCheckEnum
.
values
())
{
if
(
code
.
equals
(
l
.
getCode
()))
{
return
l
;
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/PressurePumpEnum.java
0 → 100644
View file @
e59bc0ce
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
enum
PressurePumpEnum
{
// ALONE_START_YXSC("FHS_PressurePump_Start_ALONE_START_YXSC", "ge", "5", "", "aaa", "bbb", "last"),
ALONE_START_QT
(
"FHS_PressurePump_Start_ALONE_START_QT"
,
PressurePumpCheckEnum
.
LE
.
getCode
(),
""
,
"5"
,
PressurePumpValueEnum
.
LAST_STOP
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_QT_WJ
.
getCode
()),
ALONE_STOP_QT
(
"FHS_PressurePump_Stop_ALONE_STOP_QT"
,
PressurePumpCheckEnum
.
GE
.
getCode
(),
"5"
,
""
,
PressurePumpValueEnum
.
LAST_START
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_QT_WJ_YXSC
.
getCode
()),
ALL_START_QT_WJ
(
"FHS_PressurePump_Start_ALL_START_QT_WJ"
,
PressurePumpCheckEnum
.
LE
.
getCode
(),
""
,
"30"
,
PressurePumpValueEnum
.
LATELY_STOP
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_QT_WJ
.
getCode
()),
ALL_START_QT_YZ
(
"FHS_PressurePump_Start_ALL_START_QT_YZ"
,
PressurePumpCheckEnum
.
BE
.
getCode
(),
"30"
,
"60"
,
PressurePumpValueEnum
.
LATELY_STOP
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_YZ
.
getCode
()),
ALL_START_QT_YB
(
"FHS_PressurePump_Start_ALL_START_QT_YB"
,
PressurePumpCheckEnum
.
BE
.
getCode
(),
"60"
,
"240"
,
PressurePumpValueEnum
.
LATELY_STOP
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_YB
.
getCode
()),
ALL_STOP_QT_WJ
(
"FHS_PressurePump_Stop_ALL_STOP_QT_WJ"
,
PressurePumpCheckEnum
.
LE
.
getCode
(),
""
,
"30"
,
PressurePumpValueEnum
.
LATELY_START
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_QT_WJ
.
getCode
()),
ALL_STOP_QT_YZ
(
"FHS_PressurePump_Stop_ALL_STOP_QT_YZ"
,
PressurePumpCheckEnum
.
BE
.
getCode
(),
"30"
,
"60"
,
PressurePumpValueEnum
.
LATELY_START
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_YZ
.
getCode
()),
ALL_STOP_QT_YB
(
"FHS_PressurePump_Stop_ALL_STOP_QT_YB"
,
PressurePumpCheckEnum
.
BE
.
getCode
(),
"60"
,
"240"
,
PressurePumpValueEnum
.
LATELY_START
.
getCode
(),
PressurePumpMessageEnum
.
MESSAGE_LEVEL_YB
.
getCode
());
private
String
code
;
private
String
operator
;
private
String
leftValue
;
private
String
rightValue
;
private
String
compareValue
;
private
String
level
;
private
PressurePumpEnum
(
String
code
,
String
operator
,
String
leftValue
,
String
rightValue
,
String
compareValue
,
String
level
)
{
this
.
code
=
code
;
this
.
operator
=
operator
;
this
.
leftValue
=
leftValue
;
this
.
rightValue
=
rightValue
;
this
.
compareValue
=
compareValue
;
this
.
level
=
level
;
}
public
static
List
<
PressurePumpEnum
>
getEnumListByCode
(
String
code
)
{
List
<
PressurePumpEnum
>
list
=
new
ArrayList
<>();
for
(
PressurePumpEnum
e
:
PressurePumpEnum
.
values
())
{
if
(
e
.
getCode
().
startsWith
(
code
))
{
list
.
add
(
e
);
}
}
return
list
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getOperator
()
{
return
operator
;
}
public
String
getLeftValue
()
{
return
leftValue
;
}
public
String
getRightValue
()
{
return
rightValue
;
}
public
String
getCompareValue
()
{
return
compareValue
;
}
public
String
getLevel
()
{
return
level
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/PressurePumpMessageEnum.java
0 → 100644
View file @
e59bc0ce
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
public
enum
PressurePumpMessageEnum
{
MESSAGE_LEVEL_YB
(
"YB"
,
"【%s】分钟内,启停间隔较小"
,
""
,
"名称:稳压泵启停异常提醒;时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,请及时查看处理"
),
MESSAGE_LEVEL_YZ
(
"YZ"
,
"【%s】分钟内,启停间隔较小"
,
""
,
"名称:稳压泵启停异常提醒;时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,请及时查看处理"
),
MESSAGE_LEVEL_QT_WJ
(
"QT_WJ"
,
"【%s】分钟内,设备启停频繁"
,
""
,
"名称:漏水提醒; 时间:%s;内容:【%s】- 【%s】 - 【%s】分钟内,设备启停频繁,可能存在漏水,请及时查看处理"
),
MESSAGE_LEVEL_QT_WJ_YXSC
(
"WJ_YXSC"
,
"运行时长超过【%s】分钟,存在漏水可能"
,
""
,
"名称:漏水提醒; 时间:%s;内容:【%s】- 【%s】 - 运行时长超过【%s】分钟,存在漏水可能,请及时查看处理"
);
private
String
code
;
private
String
allMessage
;
private
String
marqueeMessage
;
private
String
recordMessage
;
private
PressurePumpMessageEnum
(
String
code
,
String
allMessage
,
String
marqueeMessage
,
String
recordMessage
)
{
this
.
code
=
code
;
this
.
allMessage
=
allMessage
;
this
.
marqueeMessage
=
marqueeMessage
;
this
.
recordMessage
=
recordMessage
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getAllMessage
()
{
return
allMessage
;
}
public
String
getMarqueeMessage
()
{
return
marqueeMessage
;
}
public
String
getRecordMessage
()
{
return
recordMessage
;
}
public
static
PressurePumpMessageEnum
getByCode
(
String
code
)
{
for
(
PressurePumpMessageEnum
l
:
PressurePumpMessageEnum
.
values
())
{
if
(
code
.
equals
(
l
.
getCode
()))
{
return
l
;
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/PressurePumpValueEnum.java
0 → 100644
View file @
e59bc0ce
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
public
enum
PressurePumpValueEnum
{
LAST_STOP
(
"lastStop"
,
"上次停泵时间"
),
LAST_START
(
"lastStart"
,
"上次启泵时间"
),
LATELY_STOP
(
"latelyStop"
,
"所有泵最近一次停泵时间"
),
LATELY_START
(
"latelyStart"
,
"所有泵最近一次启泵时间"
);
private
String
code
;
private
String
describe
;
private
PressurePumpValueEnum
(
String
code
,
String
describe
)
{
this
.
code
=
code
;
this
.
describe
=
describe
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getDescribe
()
{
return
describe
;
}
public
static
PressurePumpValueEnum
getByCode
(
String
code
)
{
for
(
PressurePumpValueEnum
l
:
PressurePumpValueEnum
.
values
())
{
if
(
code
.
equals
(
l
.
getCode
()))
{
return
l
;
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificIndexMapper.java
View file @
e59bc0ce
...
@@ -110,4 +110,7 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
...
@@ -110,4 +110,7 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexByIotCodeTrend
(
String
iotCode
,
Integer
isTrend
,
String
fieldKey
);
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexByIotCodeTrend
(
String
iotCode
,
Integer
isTrend
,
String
fieldKey
);
List
<
Map
<
String
,
Object
>>
getEquipSpecificScrap
();
List
<
EquipmentSpecificIndex
>
getEquipIndexInIndex
(
@Param
(
"list"
)
List
<
String
>
listIndex
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEquipmentSpecificIndexService.java
View file @
e59bc0ce
...
@@ -27,4 +27,11 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif
...
@@ -27,4 +27,11 @@ public interface IEquipmentSpecificIndexService extends IService<EquipmentSpecif
* @Date 2020/11/3 17:58
* @Date 2020/11/3 17:58
*/
*/
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexBySpeIotCode
(
String
iotCode
);
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexBySpeIotCode
(
String
iotCode
);
/**
* 根据指标key查询列表
* @param listIndex keys
* @return 列表
*/
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexByIndex
(
List
<
String
>
listIndex
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificIndexServiceImpl.java
View file @
e59bc0ce
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificIndexMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificIndexMapper
;
...
@@ -23,4 +24,9 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec
...
@@ -23,4 +24,9 @@ public class EquipmentSpecificIndexServiceImpl extends ServiceImpl<EquipmentSpec
public
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexBySpeIotCode
(
String
iotCode
)
{
public
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexBySpeIotCode
(
String
iotCode
)
{
return
this
.
baseMapper
.
getEquipmentSpeIndexBySpeIotCode
(
iotCode
);
return
this
.
baseMapper
.
getEquipmentSpeIndexBySpeIotCode
(
iotCode
);
}
}
@Override
public
List
<
EquipmentSpecificIndex
>
getEquipmentSpeIndexByIndex
(
List
<
String
>
listIndex
)
{
return
this
.
baseMapper
.
getEquipIndexInIndex
(
listIndex
);
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
e59bc0ce
...
@@ -6,6 +6,8 @@ import java.util.*;
...
@@ -6,6 +6,8 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.mapper.*
;
...
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -162,6 +165,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -162,6 +165,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value
(
"${equipment.type}"
)
@Value
(
"${equipment.type}"
)
String
equipmentCategoryLeftTypeCode
;
String
equipmentCategoryLeftTypeCode
;
@Value
(
"${equipment.scrap.day}"
)
String
equipmentScrapDay
;
@Autowired
@Autowired
private
ISyncDataService
syncDataService
;
private
ISyncDataService
syncDataService
;
...
@@ -1805,4 +1811,73 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1805,4 +1811,73 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return
infoVoList
;
return
infoVoList
;
}
}
/**
* 在设备报废前30日 每日9点执行 系统推送提醒。设备报废后停止消息推送提醒。。
*
* @throws Exception
*/
@Scheduled
(
cron
=
"${equipment.scrap.cron}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
equipmentScrap
()
throws
Exception
{
List
<
Map
<
String
,
Object
>>
equipSpecificScrap
=
equipmentSpecificIndexMapper
.
getEquipSpecificScrap
();
equipSpecificScrap
.
forEach
(
e
->{
try
{
int
year
=
e
.
get
(
"weExpiry"
)
!=
null
?
Integer
.
parseInt
(
e
.
get
(
"weExpiry"
).
toString
())
:
Integer
.
parseInt
(
e
.
get
(
"wesExpiry"
).
toString
());
Date
productDate
=
DateUtils
.
dateParse
(
e
.
get
(
"product"
).
toString
(),
DateUtils
.
DATE_TIME_PATTERN
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
productDate
);
calendar
.
add
(
Calendar
.
YEAR
,
year
);
Date
now
=
new
Date
();
String
scrapTime
=
new
SimpleDateFormat
(
DateUtils
.
DATE_TIME_PATTERN
).
format
(
calendar
.
getTime
());
int
i
=
0
;
while
(
now
.
after
(
calendar
.
getTime
()))
{
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
1
);
i
++;
}
if
(
i
<
Integer
.
parseInt
(
equipmentScrapDay
)
&&
i
>
-
1
)
{
syncSystemctlMsg
(
e
,
scrapTime
,
i
);
}
}
catch
(
ParseException
parseException
)
{
parseException
.
printStackTrace
();
}
});
}
void
syncSystemctlMsg
(
Map
<
String
,
Object
>
map
,
String
scrapTime
,
int
i
)
{
try
{
MessageModel
model
=
new
MessageModel
();
model
.
setTitle
(
"报废到期提醒"
);
String
equipName
=
map
.
get
(
"name"
).
toString
();
String
location
=
map
.
get
(
"sName"
).
toString
()
+
map
.
get
(
"position"
).
toString
()
;
String
body
=
String
.
format
(
"%s-%s于%s报废,请提前更换处理"
,
equipName
,
location
,
scrapTime
);
String
join
=
String
.
format
(
"设备还剩%s天报废,请提前更换"
,
i
);
model
.
setBody
(
body
);
model
.
setMsgType
(
"scrapWarning"
);
model
.
setSendTime
(
new
Date
());
model
.
setIsSendApp
(
false
);
model
.
setTerminal
(
"WEB"
);
model
.
setIsSendWeb
(
true
);
model
.
setRelationId
(
map
.
get
(
"id"
).
toString
());
model
.
setCategory
(
1
);
List
<
String
>
receive
=
new
ArrayList
<>();
receive
.
add
(
"system"
);
Map
<
String
,
String
>
ext
=
new
HashMap
<>();
ext
.
put
(
"content"
,
join
);
ext
.
put
(
"type"
,
"报废到期"
);
ext
.
put
(
"name"
,
map
.
get
(
"name"
).
toString
());
ext
.
put
(
"time"
,
new
SimpleDateFormat
(
DateUtils
.
DATE_TIME_PATTERN
).
format
(
new
Date
()));
model
.
setExtras
(
ext
);
model
.
setRecivers
(
receive
);
Systemctl
.
messageClient
.
create
(
model
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
e59bc0ce
...
@@ -27,6 +27,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -27,6 +27,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronization
;
...
@@ -35,8 +36,11 @@ import org.springframework.util.CollectionUtils;
...
@@ -35,8 +36,11 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.lang.reflect.Array
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -179,6 +183,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -179,6 +183,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
MqttReceiveServiceImpl
.
jcsSwitch
=
jcsSwitch
;
MqttReceiveServiceImpl
.
jcsSwitch
=
jcsSwitch
;
}
}
@Value
(
"${equipment.pressurepump.start}"
)
private
String
pressurePumpStart
;
@Value
(
"${equipment.pressurepump.stop}"
)
private
String
pressurePumpStop
;
private
static
Boolean
bool
=
Boolean
.
FALSE
;
private
static
Boolean
bool
=
Boolean
.
FALSE
;
@Override
@Override
...
@@ -281,6 +292,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -281,6 +292,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 存储温度数据至内存中(火眼)
// 存储温度数据至内存中(火眼)
iotDataListToCacheMap
(
iotDatalist
);
iotDataListToCacheMap
(
iotDatalist
);
iotDatalist
.
forEach
(
iotDataVO
->
{
iotDatalist
.
forEach
(
iotDataVO
->
{
String
indexKey
=
iotDataVO
.
getKey
();
// 稳压泵启停信号处理
if
(
indexKey
.
equals
(
pressurePumpStart
)
||
indexKey
.
equals
(
pressurePumpStop
))
{
pressurePump
(
indexKey
,
iotDatalist
,
topicEntity
);
}
for
(
EquipmentSpecificIndex
equipmentSpecificIndex
:
indexList
)
{
for
(
EquipmentSpecificIndex
equipmentSpecificIndex
:
indexList
)
{
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
.
getNameKey
())
if
(!
ObjectUtils
.
isEmpty
(
equipmentSpecificIndex
.
getNameKey
())
&&
equipmentSpecificIndex
.
getNameKey
().
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
()))
{
&&
equipmentSpecificIndex
.
getNameKey
().
toLowerCase
().
equals
(
iotDataVO
.
getKey
().
toLowerCase
()))
{
...
@@ -1143,4 +1159,167 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
...
@@ -1143,4 +1159,167 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
}
}
private
void
pressurePump
(
String
indexKey
,
List
<
IotDataVO
>
iotDatalist
,
TopicEntityVo
topicEntity
)
{
List
<
String
>
listIndex
=
new
ArrayList
<>();
listIndex
.
add
(
pressurePumpStart
);
listIndex
.
add
(
pressurePumpStop
);
// 获取全部启停泵信号
List
<
EquipmentSpecificIndex
>
equipmentSpeIndexList
=
equipmentSpecificIndexService
.
getEquipmentSpeIndexByIndex
(
listIndex
);
List
<
PressurePumpEnum
>
enumListByCode
=
PressurePumpEnum
.
getEnumListByCode
(
indexKey
);
if
(!
CollectionUtils
.
isEmpty
(
enumListByCode
))
{
enumListByCode
.
forEach
(
pressurePumpEnum
->
{
// 1. 获取需要校验的值
PressurePumpValueEnum
valueEnum
=
PressurePumpValueEnum
.
getByCode
(
pressurePumpEnum
.
getCompareValue
());
assert
valueEnum
!=
null
;
EquipmentSpecificIndex
data
=
getPressurePumpDateByType
(
valueEnum
,
topicEntity
,
equipmentSpeIndexList
);
Date
newDate
=
new
Date
();
// 2. 校验
if
(!
ObjectUtils
.
isEmpty
(
data
))
{
checkValueByDate
(
data
,
newDate
,
pressurePumpEnum
);
}
});
}
}
private
EquipmentSpecificIndex
getPressurePumpDateByType
(
PressurePumpValueEnum
valueEnum
,
TopicEntityVo
topicEntity
,
List
<
EquipmentSpecificIndex
>
equipmentSpeIndexList
)
{
String
iotCode
=
topicEntity
.
getIotCode
();
EquipmentSpecificIndex
equipmentSpecificIndex
=
null
;
switch
(
valueEnum
)
{
case
LAST_STOP:
List
<
EquipmentSpecificIndex
>
lastStop
=
equipmentSpeIndexList
.
stream
().
filter
(
e
->
StringUtil
.
isNotEmpty
(
e
.
getValue
())
&&
e
.
getIotCode
().
equals
(
iotCode
)
&&
pressurePumpStop
.
equals
(
e
.
getEquipmentIndexKey
())).
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
lastStop
))
{
equipmentSpecificIndex
=
lastStop
.
get
(
0
);
}
break
;
case
LAST_START:
List
<
EquipmentSpecificIndex
>
lastStart
=
equipmentSpeIndexList
.
stream
().
filter
(
e
->
StringUtil
.
isNotEmpty
(
e
.
getValue
())
&&
e
.
getIotCode
().
equals
(
iotCode
)
&&
pressurePumpStart
.
equals
(
e
.
getEquipmentIndexKey
())).
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
lastStart
))
{
equipmentSpecificIndex
=
lastStart
.
get
(
0
);
}
break
;
case
LATELY_STOP:
List
<
EquipmentSpecificIndex
>
latelyStop
=
equipmentSpeIndexList
.
stream
().
filter
(
e
->
StringUtil
.
isNotEmpty
(
e
.
getValue
())
&&
pressurePumpStop
.
equals
(
e
.
getEquipmentIndexKey
())).
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
latelyStop
))
{
equipmentSpecificIndex
=
latelyStop
.
get
(
0
);
}
break
;
case
LATELY_START:
List
<
EquipmentSpecificIndex
>
latelyStart
=
equipmentSpeIndexList
.
stream
().
filter
(
e
->
StringUtil
.
isNotEmpty
(
e
.
getValue
())
&&
pressurePumpStart
.
equals
(
e
.
getEquipmentIndexKey
())).
sorted
(
Comparator
.
comparing
(
EquipmentSpecificIndex:
:
getUpdateDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
latelyStart
))
{
equipmentSpecificIndex
=
latelyStart
.
get
(
0
);
}
break
;
default
:
break
;
}
return
equipmentSpecificIndex
;
}
private
void
checkValueByDate
(
EquipmentSpecificIndex
data
,
Date
newDate
,
PressurePumpEnum
pressurePumpEnum
)
{
String
operator
=
pressurePumpEnum
.
getOperator
();
PressurePumpCheckEnum
pumpCheckEnum
=
PressurePumpCheckEnum
.
getByCode
(
operator
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
long
diff
=
0
;
try
{
long
d1
=
df
.
parse
(
df
.
format
(
data
.
getUpdateDate
())).
getTime
();
long
d2
=
df
.
parse
(
df
.
format
(
newDate
)).
getTime
();
diff
=
(
d2
-
d1
)/
1000
/
60
;
}
catch
(
Exception
e
)
{
log
.
error
(
"时间转换失败"
+
e
.
getMessage
());
return
;
}
assert
pumpCheckEnum
!=
null
;
String
leftValue
=
pressurePumpEnum
.
getLeftValue
();
String
rightValue
=
pressurePumpEnum
.
getRightValue
();
switch
(
pumpCheckEnum
)
{
case
LE:
if
(
StringUtil
.
isNotEmpty
(
rightValue
))
{
long
value
=
Long
.
parseLong
(
rightValue
);
if
(
diff
<=
value
)
{
sendMessagePressure
(
pressurePumpEnum
,
data
);
}
}
break
;
case
GE:
if
(
StringUtil
.
isNotEmpty
(
leftValue
))
{
long
value
=
Long
.
parseLong
(
leftValue
);
if
(
diff
>=
value
)
{
sendMessagePressure
(
pressurePumpEnum
,
data
);
}
}
break
;
case
BE:
if
(
StringUtil
.
isNotEmpty
(
leftValue
)
&&
StringUtil
.
isNotEmpty
(
rightValue
))
{
long
lvalue
=
Long
.
parseLong
(
leftValue
);
long
rvalue
=
Long
.
parseLong
(
rightValue
);
if
(
diff
>=
lvalue
&&
diff
<=
rvalue
)
{
sendMessagePressure
(
pressurePumpEnum
,
data
);
}
}
break
;
default
:
break
;
}
}
private
void
sendMessagePressure
(
PressurePumpEnum
pressurePumpEnum
,
EquipmentSpecificIndex
data
)
{
String
level
=
pressurePumpEnum
.
getLevel
();
PressurePumpMessageEnum
pumpMessageEnum
=
PressurePumpMessageEnum
.
getByCode
(
level
);
assert
pumpMessageEnum
!=
null
;
String
time
=
new
SimpleDateFormat
(
DateUtils
.
DATE_TIME_PATTERN
).
format
(
new
Date
());
MessageModel
model
=
new
MessageModel
();
String
allMessage
=
pumpMessageEnum
.
getAllMessage
();
String
body
=
""
;
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
if
(
StringUtil
.
isNotEmpty
(
allMessage
))
{
String
value
=
StringUtil
.
isNotEmpty
(
pressurePumpEnum
.
getLeftValue
())
?
pressurePumpEnum
.
getLeftValue
()
:
pressurePumpEnum
.
getRightValue
();
String
content
=
String
.
format
(
allMessage
,
value
);
map
.
put
(
"content"
,
content
);
map
.
put
(
"name"
,
data
.
getEquipmentSpecificName
());
map
.
put
(
"time"
,
time
);
}
String
recordMessage
=
pumpMessageEnum
.
getRecordMessage
();
if
(
StringUtil
.
isNotEmpty
(
recordMessage
))
{
String
value
=
StringUtil
.
isNotEmpty
(
pressurePumpEnum
.
getLeftValue
())
?
pressurePumpEnum
.
getLeftValue
()
:
pressurePumpEnum
.
getRightValue
();
body
=
String
.
format
(
recordMessage
,
time
,
data
.
getEquipmentSpecificName
(),
data
.
getLocation
(),
value
);
}
String
marqueeMessage
=
pumpMessageEnum
.
getMarqueeMessage
();
if
(
StringUtil
.
isNotEmpty
(
marqueeMessage
))
{
// body = String.format(marqueeMessage);
}
switch
(
pumpMessageEnum
)
{
case
MESSAGE_LEVEL_YB:
case
MESSAGE_LEVEL_YZ:
map
.
put
(
"type"
,
"稳压泵启停异常提醒"
);
break
;
case
MESSAGE_LEVEL_QT_WJ:
case
MESSAGE_LEVEL_QT_WJ_YXSC:
map
.
put
(
"type"
,
"漏水提醒"
);
break
;
default
:
break
;
}
model
.
setBody
(
body
);
model
.
setExtras
(
map
);
model
.
setMsgType
(
"pressurePump"
);
model
.
setSendTime
(
new
Date
());
model
.
setIsSendApp
(
false
);
model
.
setTerminal
(
"WEB"
);
model
.
setIsSendWeb
(
true
);
model
.
setCategory
(
1
);
Token
token
=
remoteSecurityService
.
getServerToken
();
systemctlFeign
.
create
(
token
.
getAppKey
(),
token
.
getProduct
(),
token
.
getToke
(),
model
);
}
}
}
amos-boot-system-equip/src/main/resources/application-dev.properties
View file @
e59bc0ce
...
@@ -101,3 +101,12 @@ iot.code.prefix.have.used=
...
@@ -101,3 +101,12 @@ iot.code.prefix.have.used=
#是否向iot推送消息
#是否向iot推送消息
isSendIot
=
false
isSendIot
=
false
#报废前30日 发起提醒
equipment.scrap.day
=
30
#提醒时间
equipment.scrap.cron
=
0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start
=
FHS_PressurePump_Start
# 稳压泵停止信号
equipment.pressurepump.stop
=
FHS_PressurePump_Stop
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
e59bc0ce
...
@@ -25,19 +25,18 @@
...
@@ -25,19 +25,18 @@
<result
property=
"equipDetailId"
column=
"equip_detail_id"
></result>
<result
property=
"equipDetailId"
column=
"equip_detail_id"
></result>
</resultMap>
</resultMap>
<update
id=
"updateIndexValueBatch"
>
<update
id=
"updateIndexValueBatch"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
";"
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
";"
>
update wl_equipment_specific_index set
update wl_equipment_specific_index set
value = #{item.value}
value = #{item.value}
where equipment_specific_id = #{item.equipmentSpecificId}
where equipment_specific_id = #{item.equipmentSpecificId}
and equipment_index_id = #{item.equipmentIndexId}
and equipment_index_id = #{item.equipmentIndexId}
</foreach>
</foreach>
</update>
</update>
<select
id=
"getEquipmentSpeIndexBySpeIotCode"
<select
id=
"getEquipmentSpeIndexBySpeIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
SELECT wesi.id AS id,
wesi.id AS id,
wei.name_key AS nameKey,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_name AS equipmentIndexName,
wesi.equipment_index_name AS equipmentIndexName,
...
@@ -65,21 +64,22 @@
...
@@ -65,21 +64,22 @@
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
sd.warehouse_structure_id AS buildId
sd.warehouse_structure_id AS buildId
FROM
FROM
wl_equipment_specific_index AS wesi
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_specific AS wes
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wes.id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wes.id
WHERE
WHERE
wes.iot_code = #{iotCode} and wei.is_iot = true
wes.iot_code = #{iotCode}
and wei.is_iot = true
</select>
</select>
<select
id=
"getEquipmentSpeIndexByIotCode"
<select
id=
"getEquipmentSpeIndexByIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
SELECT wesi.id AS id,
wesi.id AS id,
wei.name_key AS nameKey,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.org_code AS code,
...
@@ -90,18 +90,19 @@
...
@@ -90,18 +90,19 @@
wei.unit AS indexUnitName,
wei.unit AS indexUnitName,
wesi.update_date AS updateDate
wesi.update_date AS updateDate
FROM
FROM
wl_equipment_specific_index AS wesi
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_specific AS wes
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
WHERE
wes.iot_code = #{iotCode}
wes.iot_code = #{iotCode}
</select>
</select>
<select
id=
"getEquipmentSpeIndexByIotCodeAndTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
<select
id=
"getEquipmentSpeIndexByIotCodeAndTrend"
SELECT
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
wei.id
AS id,
SELECT wei.id
AS id,
wei.name_key AS nameKey,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.org_code AS code,
...
@@ -112,159 +113,142 @@
...
@@ -112,159 +113,142 @@
wei.unit AS indexUnitName,
wei.unit AS indexUnitName,
wesi.update_date AS updateDate
wesi.update_date AS updateDate
FROM
FROM
wl_equipment_specific_index AS wesi
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_specific AS wes
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
WHERE
wes.iot_code = #{iotCode}
wes.iot_code = #{iotCode}
AND
AND
wei.is_trend = 1
wei.is_trend = 1
</select>
</select>
<select
id=
"getEquipmentSpeIndexDataByIotCode"
<select
id=
"getEquipmentSpeIndexDataByIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
SELECT wesi.id AS id,
wesi.id AS id,
wei.name_key AS nameKey,
wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value',
IFNULL(si.value_label, si.`value`) AS 'value',
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.org_code AS code,
wes.iot_code AS iotCode,
wes.iot_code AS iotCode,
wes.org_code AS orgCode,
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.unit AS indexUnitName,
wei.value_enum AS valueEnum
wei.value_enum AS valueEnum
FROM wl_equipment_specific_index AS wesi
FROM
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
WHERE wes.iot_code = #{iotCode}
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
</select>
</select>
<select
id=
"getEquipmentSpeIndexByEquipmentSecificId"
<select
id=
"getEquipmentSpeIndexByEquipmentSecificId"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
SELECT wesi.id,
wesi.id,
wesi.equipment_specific_id,
wesi.equipment_specific_id,
wesi.VALUE,
wesi.VALUE,
wesi.create_date,
wesi.create_date,
wesi.equipment_index_id,
wesi.equipment_index_id,
wli.`name` nameKey
wli.`name` nameKey
FROM wl_equipment_specific_index wesi
FROM
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
wl_equipment_specific_index wesi
where wesi.equipment_specific_id = #{id}
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
where wesi.equipment_specific_id=#{id}
</select>
</select>
<select
id=
"getVideoByEquipmentSecificId"
resultType=
"com.yeejoin.equipmanage.common.entity.Video"
>
<select
id=
"getVideoByEquipmentSecificId"
resultType=
"com.yeejoin.equipmanage.common.entity.Video"
>
SELECT
SELECT ip,
ip,
`port`,
`port`,
url,
url,
`name`,
`name`,
token,
token,
`code`,
`code`,
preset_position
preset_position
FROM wl_video wlv
FROM
LEFT JOIN wl_video_equipment_specific wlves ON wlv.id = wlves.video_id
wl_video wlv
WHERE wlves.equipment_specific_id = #{id}
LEFT JOIN wl_video_equipment_specific wlves ON wlv.id = wlves.video_id
WHERE
wlves.equipment_specific_id = #{id}
</select>
</select>
<select
id=
"getEquipmentDetailBySecificId"
resultMap=
"EquipmentDetail"
>
<select
id=
"getEquipmentDetailBySecificId"
resultMap=
"EquipmentDetail"
>
SELECT
SELECT wled.NAME equipment_name,
wled.NAME equipment_name,
wle.id equip_id,
wle.id equip_id,
wled.id equip_detail_id,
wled.id equip_detail_id,
wles.qr_code,
wles.qr_code,
wles.CODE,
wles. CODE,
(
(
select GROUP_CONCAT(fs.name)
select
from f_fire_fighting_system fs
GROUP_CONCAT(fs.name)
where FIND_IN_SET(fs.id, wles.system_id)
from
) as System_name,
f_fire_fighting_system fs
wlec.NAME category_name,
where
wlws.full_name warehouse_name,
FIND_IN_SET(fs.id,wles.system_id)
wled.standard,
) as System_name,
sd.`name` country,
wlec. NAME category_name,
wled.remark,
wlws.full_name warehouse_name,
wled.maintenance_cycle,
wled.standard,
wled.is_import,
sd.`name` country,
wled.brand,
wled.remark,
wlun.`name` unit_name,
wled.maintenance_cycle,
wlmi.`name` manufacturer_name,
wled.is_import,
wlmi.service_tel,
wled.brand,
wlmi.sales_tel,
wlun.`name` unit_name,
wlmi.address,
wlmi.`name` manufacturer_name,
wlmi.img,
wlmi.service_tel,
wleias.`value` STATUS
wlmi.sales_tel,
FROM wl_equipment_specific wles
wlmi.address,
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
wlmi.img,
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
wleias.`value` STATUS
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
FROM
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
wl_equipment_specific wles
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
LEFT JOIN (
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
SELECT wlei.equipment_id,
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
wlesi.`value`
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
FROM wl_equipment_index wlei
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id
LEFT JOIN (
WHERE wlei.name_key = 'runState'
SELECT
) wleias ON wle.id = wleias.equipment_id
wlei.equipment_id,
WHERE wles.id = #{id}
wlesi.`value`
FROM
wl_equipment_index wlei
LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id
WHERE
wlei.name_key = 'runState'
) wleias ON wle.id = wleias.equipment_id
WHERE wles.id=#{id}
</select>
</select>
<select
id=
"selectEquProperty"
resultType=
"java.util.HashMap"
>
<select
id=
"selectEquProperty"
resultType=
"java.util.HashMap"
>
SELECT
SELECT wlei.NAME,
wlei. NAME,
wlesi.`value`
wlesi.`value`
FROM wl_equipment_specific_index wlesi
FROM
LEFT JOIN wl_equipment_specific wleqs ON wleqs.id = wlesi.equipment_specific_id
wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wleqs ON wleqs.id = wlesi.equipment_specific_id
where wleqs.id = #{id}
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
where wleqs.id=#{id}
</select>
</select>
<select
id=
"selectEquList"
resultType=
"java.util.HashMap"
>
<select
id=
"selectEquList"
resultType=
"java.util.HashMap"
>
SELECT
SELECT
de.id,
de.id,
de.name,
de.name,
a.image,
a.image,
de.standard,
de.standard,
(case wsd.`status`
(case wsd.`status`
when '1' then '在位'
when '1' then '在位'
when '2' then '执勤'
when '2' then '执勤'
when '3' then '维修'
when '3' then '维修'
when '6' then '退役'
when '6' then '退役'
when '7' then '报废'
when '7' then '报废'
when '10' then '车载'
when '10' then '车载'
when '11' then '损耗'
when '11' then '损耗'
else '未入库' END) statusName,
else '未入库' END) statusName,
(case LEFT(ca.`code`,1)
(case LEFT(ca.`code`,1)
when '4' then '04#'
when '4' then '04#'
else '01#' END) typen,
else '01#' END) typen,
IFNULL(wsd.amount,0)amount,
IFNULL(wsd.amount,0)amount,
info.name manufacturerName,
info.name manufacturerName,
dic.name country,
dic.name country,
wesp.qr_code qrcode
wesp.qr_code qrcode
FROM
FROM
wl_equipment_specific wesp
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN (SELECT object_id,
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
...
@@ -272,29 +256,29 @@ WHERE wles.id=#{id}
...
@@ -272,29 +256,29 @@ WHERE wles.id=#{id}
FROM wl_upload_file
FROM wl_upload_file
GROUP BY object_id) a on a.object_id=de.id
GROUP BY object_id) a on a.object_id=de.id
LEFT JOIN wl_stock_detail wsd ON wsd.qr_code = wesp.qr_code
LEFT JOIN wl_stock_detail wsd ON wsd.qr_code = wesp.qr_code
<if
test=
"name!= null and name!=''"
>
<if
test=
"name!= null and name!=''"
>
AND
de.name like CONCAT('%',#{name},'%')
AND de.name like CONCAT('%',#{name},'%')
</if>
</if>
<if
test=
"standard!= null and standard!='' "
>
<if
test=
"standard!= null and standard!='' "
>
AND de.standard like CONCAT('%',#{standard},'%')
AND de.standard like CONCAT('%',#{standard},'%')
</if>
</if>
<if
test=
"manufacturerName != null and manufacturerName!='' "
>
<if
test=
"manufacturerName != null and manufacturerName!='' "
>
AND info.name like CONCAT('%',#{manufacturerName},'%')
AND info.name like CONCAT('%',#{manufacturerName},'%')
</if>
</if>
LIMIT #{pageNum},#{pageSize}
LIMIT #{pageNum},#{pageSize}
</select>
</select>
<select
id=
"selectEquListcount"
resultType=
"java.util.HashMap"
>
<select
id=
"selectEquListcount"
resultType=
"java.util.HashMap"
>
SELECT
SELECT
de.name
de.name
FROM
FROM
wl_equipment_specific wesp
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_equipment_detail de on wesp.equipment_detail_id=de.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_manufacturer_info info on de.manufacturer_id=info.id
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_system_dic dic on dic.id=de.country
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN wl_equipment ca on ca.id=de.equipment_id
LEFT JOIN (SELECT object_id,
LEFT JOIN (SELECT object_id,
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'image' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'image',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'video' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'video',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'instruction' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'instruction',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
(CASE `file_type` WHEN 'certificate' THEN GROUP_CONCAT(url SEPARATOR ',') ELSE '' END) as 'certificate',
...
@@ -306,32 +290,29 @@ WHERE wles.id=#{id}
...
@@ -306,32 +290,29 @@ WHERE wles.id=#{id}
LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id
LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id
LEFT JOIN wl_warehouse_structure wws1 ON wws.parent_id = wws1.id
LEFT JOIN wl_warehouse_structure wws1 ON wws.parent_id = wws1.id
<if
test=
"name!= null and name!='' "
>
<if
test=
"name!= null and name!='' "
>
AND
de.name like CONCAT('%',#{name},'%')
AND de.name like CONCAT('%',#{name},'%')
</if>
</if>
<if
test=
"standard!= null and standard!='' "
>
<if
test=
"standard!= null and standard!='' "
>
AND de.standard like CONCAT('%',#{standard},'%')
AND de.standard like CONCAT('%',#{standard},'%')
</if>
</if>
<if
test=
"manufacturerName != null and manufacturerName!='' "
>
<if
test=
"manufacturerName != null and manufacturerName!='' "
>
AND info.name like CONCAT('%',#{manufacturerName},'%')
AND info.name like CONCAT('%',#{manufacturerName},'%')
</if>
</if>
</select>
</select>
<select
id=
"getEquipmentSpeIndexList"
resultType=
"hashmap"
>
<select
id=
"getEquipmentSpeIndexList"
resultType=
"hashmap"
>
SELECT
SELECT wles.equipment_specific_id AS speId,
wles.equipment_specific_id AS speId,
wles.`value` AS speIndexValue,
wles.`value` AS speIndexValue,
wlei.type_name AS typeName,
wlei.type_name AS typeName,
wlei.type_code AS typeCode,
wlei.type_code AS typeCode,
wlei.name_key AS nameKey,
wlei.name_key AS nameKey,
wlei.`name` as indexName
wlei.`name` as indexName
FROM wl_equipment_specific_index wles
FROM
JOIN wl_equipment_index wlei ON wlei.id = wles.equipment_index_id
wl_equipment_specific_index wles
WHERE wlei.is_iot = 1
JOIN wl_equipment_index wlei ON wlei.id = wles.equipment_index_id
AND (
WHERE
wlei.type_code IN ('BREAKDOWN', 'SHIELD'))
wlei.is_iot = 1
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1)
AND (
wlei.type_code IN ( 'BREAKDOWN', 'SHIELD' ))
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1 )
</select>
</select>
<select
id=
"getEquipSpecificIndexList"
resultType=
"com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO"
>
<select
id=
"getEquipSpecificIndexList"
resultType=
"com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO"
>
SELECT
SELECT
...
@@ -379,7 +360,7 @@ WHERE wles.id=#{id}
...
@@ -379,7 +360,7 @@ WHERE wles.id=#{id}
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<where>
<if
test=
"list != null and list.size > 0 and type = 'id'"
>
<if
test=
"list != null and list.size > 0 and type = 'id'"
>
si.equipment_specific_id
IN
si.equipment_specific_id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
#{item}
</foreach>
</foreach>
...
@@ -390,17 +371,18 @@ WHERE wles.id=#{id}
...
@@ -390,17 +371,18 @@ WHERE wles.id=#{id}
SELECT
SELECT
si.id,
si.id,
si.equipment_specific_id AS equipmentId,
si.equipment_specific_id AS equipmentId,
(case when si.value_label is null or trim(si.value_label) ='' then si.`value` else si.value_label end )AS 'value',
(case when si.value_label is null or trim(si.value_label) ='' then si.`value` else si.value_label end )AS
'value',
si.create_date,
si.create_date,
si.update_date
si.update_date
FROM
FROM
wl_equipment_specific_index si
wl_equipment_specific_index si
<where>
<where>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
si.equipment_index_id = #{id}
si.equipment_index_id = #{id}
</if>
</if>
<if
test=
"equipmentSpecificId!= null"
>
<if
test=
"equipmentSpecificId!= null"
>
AND
si.equipment_specific_id = #{equipmentSpecificId}
AND si.equipment_specific_id = #{equipmentSpecificId}
</if>
</if>
</where>
</where>
</select>
</select>
...
@@ -426,38 +408,34 @@ WHERE wles.id=#{id}
...
@@ -426,38 +408,34 @@ WHERE wles.id=#{id}
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<where>
<if
test=
"list != null and list.size > 0 and type = 'id'"
>
<if
test=
"list != null and list.size > 0 and type = 'id'"
>
si.id
IN
si.id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
#{item}
</foreach>
</foreach>
</if>
</if>
</where>
</where>
</select>
</select>
<select
id=
"getEquipSpecificIndexByUpdateDateDesc"
resultType=
"java.util.HashMap"
>
<select
id=
"getEquipSpecificIndexByUpdateDateDesc"
resultType=
"java.util.HashMap"
>
SELECT
SELECT esi.id,
esi.id,
es.`name` AS equipmentSpecificName,
es.`name` AS equipmentSpecificName,
esi.equipment_index_name AS equipmentSpecificIndexName,
esi.equipment_index_name AS equipmentSpecificIndexName,
IF (
esi.value_label = ''
OR esi.value_label IS NULL,
esi.`value`,
esi.value_label
) AS valueLabel,
es.position AS location,
esi.update_date AS createDate
FROM
`wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON es.id = esi.equipment_specific_id
WHERE
esi.`value` IS NOT NULL
ORDER BY
esi.update_date DESC
LIMIT 50
</select>
<select
id=
"getEquipmentSpeIndexByIotCodeTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
IF(
esi.value_label = ''
OR esi.value_label IS NULL,
esi.`value`,
esi.value_label
) AS valueLabel,
es.position AS location,
esi.update_date AS createDate
FROM `wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON es.id = esi.equipment_specific_id
WHERE esi.`value` IS NOT NULL
ORDER BY esi.update_date DESC LIMIT 50
</select>
<select
id=
"getEquipmentSpeIndexByIotCodeTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
SELECT
wei.id AS id,
wei.id AS id,
wei.name_key AS nameKey,
wei.name_key AS nameKey,
...
@@ -487,4 +465,44 @@ WHERE wles.id=#{id}
...
@@ -487,4 +465,44 @@ WHERE wles.id=#{id}
AND wei.name_key = #{fieldKey}
AND wei.name_key = #{fieldKey}
</if>
</if>
</select>
</select>
<select
id=
"getEquipSpecificScrap"
resultType=
"java.util.Map"
>
select wes.id,
str.name as sname,
wlsd.status,
wes.position,
wes.name,
we.expiry_date as weExpiry,
wed.expiry_date as wesExpiry,
wed.production_date as product
from wl_equipment_specific wes
left join wl_equipment_detail wed on wes.equipment_detail_id = wed.id
left join wl_equipment we on wed.equipment_id = we.id
left join wl_warehouse_structure str on str.id = wes.warehouse_structure_id
left join wl_stock_detail wlsd on wes.id = wlsd.equipment_specific_id
where wed.production_date is not null
and wlsd.status != 7
</select>
<select
id=
"getEquipIndexInIndex"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
si.equipment_specific_id AS equipmentId,
si.id,
si.`value`,
si.create_date,
si.update_date,
si.equipment_index_key,
si.equipment_specific_name,
es.position location,
es.`iot_code` AS iotCode
FROM
wl_equipment_specific_index si
LEFT JOIN wl_equipment_specific es ON si.equipment_specific_id = es.id
<where>
<if
test=
"list != null and list.size > 0 and type = 'id'"
>
si.equipment_index_key IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment