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
dcfed3a0
Commit
dcfed3a0
authored
Oct 11, 2022
by
litengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务 9900
parent
ed504d97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
+76
-0
EquipmentSpecificIndexMapper.java
...join/equipmanage/mapper/EquipmentSpecificIndexMapper.java
+1
-0
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+75
-0
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+0
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificIndexMapper.java
View file @
dcfed3a0
...
@@ -110,4 +110,5 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
...
@@ -110,4 +110,5 @@ 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
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
dcfed3a0
...
@@ -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
;
...
@@ -1803,4 +1809,73 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1803,4 +1809,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
<
30
&&
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-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
dcfed3a0
This diff is collapsed.
Click to expand it.
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