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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
82 deletions
+154
-82
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
+78
-82
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
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.*;
import
java.util.stream.Collectors
;
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.vo.*
;
import
com.yeejoin.equipmanage.mapper.*
;
...
...
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -162,6 +165,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value
(
"${equipment.type}"
)
String
equipmentCategoryLeftTypeCode
;
@Value
(
"${equipment.scrap.day}"
)
String
equipmentScrapDay
;
@Autowired
private
ISyncDataService
syncDataService
;
...
...
@@ -1803,4 +1809,73 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
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
...
...
@@ -34,8 +34,7 @@
</update>
<select
id=
"getEquipmentSpeIndexBySpeIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wesi.id AS id,
SELECT wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
...
...
@@ -66,18 +65,19 @@
sd.warehouse_structure_id AS buildId
FROM
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
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_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
wes.iot_code = #{iotCode} and wei.is_iot = true
wes.iot_code = #{iotCode}
and wei.is_iot = true
</select>
<select
id=
"getEquipmentSpeIndexByIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wesi.id AS id,
SELECT wesi.id AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
...
...
@@ -91,15 +91,16 @@
wesi.update_date AS updateDate
FROM
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
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
</select>
<select
id=
"getEquipmentSpeIndexByIotCodeAndTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wei.id
AS id,
<select
id=
"getEquipmentSpeIndexByIotCodeAndTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT wei.id
AS id,
wei.name_key AS nameKey,
wesi.value AS value,
wesi.equipment_specific_id AS equipmentSpecificId,
...
...
@@ -113,7 +114,8 @@
wesi.update_date AS updateDate
FROM
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
ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
...
...
@@ -123,8 +125,7 @@
<select
id=
"getEquipmentSpeIndexDataByIotCode"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wesi.id AS id,
SELECT wesi.id AS id,
wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value',
wesi.equipment_specific_id AS equipmentSpecificId,
...
...
@@ -136,59 +137,48 @@
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.value_enum AS valueEnum
FROM
wl_equipment_specific_index AS wesi
FROM wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
WHERE wes.iot_code = #{iotCode}
</select>
<select
id=
"getEquipmentSpeIndexByEquipmentSecificId"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wesi.id,
SELECT wesi.id,
wesi.equipment_specific_id,
wesi.VALUE,
wesi.create_date,
wesi.equipment_index_id,
wli.`name` nameKey
FROM
wl_equipment_specific_index wesi
FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
where wesi.equipment_specific_id=
#{id}
where wesi.equipment_specific_id =
#{id}
</select>
<select
id=
"getVideoByEquipmentSecificId"
resultType=
"com.yeejoin.equipmanage.common.entity.Video"
>
SELECT
ip,
SELECT ip,
`port`,
url,
`name`,
token,
`code`,
preset_position
FROM
wl_video wlv
FROM wl_video wlv
LEFT JOIN wl_video_equipment_specific wlves ON wlv.id = wlves.video_id
WHERE
wlves.equipment_specific_id = #{id}
WHERE wlves.equipment_specific_id = #{id}
</select>
<select
id=
"getEquipmentDetailBySecificId"
resultMap=
"EquipmentDetail"
>
SELECT
wled.NAME equipment_name,
SELECT wled.NAME equipment_name,
wle.id equip_id,
wled.id equip_detail_id,
wles.qr_code,
wles.
CODE,
wles.
CODE,
(
select
GROUP_CONCAT(fs.name)
from
f_fire_fighting_system fs
where
FIND_IN_SET(fs.id,wles.system_id)
select GROUP_CONCAT(fs.name)
from f_fire_fighting_system fs
where FIND_IN_SET(fs.id, wles.system_id)
) as System_name,
wlec. NAME
category_name,
wlec.NAME
category_name,
wlws.full_name warehouse_name,
wled.standard,
sd.`name` country,
...
...
@@ -203,37 +193,31 @@
wlmi.address,
wlmi.img,
wleias.`value` STATUS
FROM
wl_equipment_specific wles
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN (
SELECT
wlei.equipment_id,
FROM wl_equipment_specific wles
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_system_dic sd ON sd.id = wled.country
LEFT JOIN wl_equipment wle ON wled.equipment_id = wle.id
LEFT JOIN wl_equipment_category wlec ON wle.category_id = wlec.id
LEFT JOIN wl_stock_detail wlsd ON wlsd.qr_code = wles.qr_code
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN (
SELECT wlei.equipment_id,
wlesi.`value`
FROM
wl_equipment_index wlei
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}
WHERE wlei.name_key = 'runState'
) wleias ON wle.id = wleias.equipment_id
WHERE wles.id = #{id}
</select>
<select
id=
"selectEquProperty"
resultType=
"java.util.HashMap"
>
SELECT
wlei. NAME,
SELECT wlei.NAME,
wlesi.`value`
FROM
wl_equipment_specific_index wlesi
FROM wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_specific wleqs ON wleqs.id = wlesi.equipment_specific_id
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
where wleqs.id
=
#{id}
where wleqs.id
=
#{id}
</select>
<select
id=
"selectEquList"
resultType=
"java.util.HashMap"
>
SELECT
...
...
@@ -317,21 +301,18 @@ WHERE wles.id=#{id}
</select>
<select
id=
"getEquipmentSpeIndexList"
resultType=
"hashmap"
>
SELECT
wles.equipment_specific_id AS speId,
SELECT wles.equipment_specific_id AS speId,
wles.`value` AS speIndexValue,
wlei.type_name AS typeName,
wlei.type_code AS typeCode,
wlei.name_key AS nameKey,
wlei.`name` as indexName
FROM
wl_equipment_specific_index wles
FROM wl_equipment_specific_index wles
JOIN wl_equipment_index wlei ON wlei.id = wles.equipment_index_id
WHERE
wlei.is_iot = 1
WHERE wlei.is_iot = 1
AND (
wlei.type_code IN (
'BREAKDOWN', 'SHIELD'
))
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1
)
wlei.type_code IN (
'BREAKDOWN', 'SHIELD'
))
AND (wles.`value` IS NOT NULL AND LENGTH(TRIM(wles.`value`)) > 1
)
</select>
<select
id=
"getEquipSpecificIndexList"
resultType=
"com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO"
>
SELECT
...
...
@@ -390,7 +371,8 @@ WHERE wles.id=#{id}
SELECT
si.id,
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.update_date
FROM
...
...
@@ -434,12 +416,11 @@ WHERE wles.id=#{id}
</where>
</select>
<select
id=
"getEquipSpecificIndexByUpdateDateDesc"
resultType=
"java.util.HashMap"
>
SELECT
esi.id,
SELECT esi.id,
es.`name` AS equipmentSpecificName,
esi.equipment_index_name AS equipmentSpecificIndexName,
IF
(
IF
(
esi.value_label = ''
OR esi.value_label IS NULL,
esi.`value`,
...
...
@@ -447,17 +428,14 @@ WHERE wles.id=#{id}
) AS valueLabel,
es.position AS location,
esi.update_date AS createDate
FROM
`wl_equipment_specific_index` esi
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
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
id=
"getEquipmentSpeIndexByIotCodeTrend"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"
>
SELECT
wei.id AS id,
wei.name_key AS nameKey,
...
...
@@ -487,4 +465,21 @@ WHERE wles.id=#{id}
AND wei.name_key = #{fieldKey}
</if>
</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>
</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