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
3cb60f6b
Commit
3cb60f6b
authored
Sep 02, 2022
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人员打卡添加mqtt消息,同步打卡数据
parent
e2833682
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
SignServiceImpl.java
...mos/boot/module/jcs/biz/service/impl/SignServiceImpl.java
+40
-1
application.properties
...boot-system-jcs/src/main/resources/application.properties
+3
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/SignServiceImpl.java
View file @
3cb60f6b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto
;
...
@@ -7,14 +9,21 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.Sign;
...
@@ -7,14 +9,21 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.Sign;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.service.ISignService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.ISignService
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.SignDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.SignDto
;
import
com.yeejoin.amos.component.rule.config.RuleConfig
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.text.NumberFormat
;
import
java.text.NumberFormat
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -25,6 +34,13 @@ import java.util.List;
...
@@ -25,6 +34,13 @@ import java.util.List;
*/
*/
@Service
@Service
public
class
SignServiceImpl
extends
BaseService
<
SignDto
,
Sign
,
SignMapper
>
implements
ISignService
{
public
class
SignServiceImpl
extends
BaseService
<
SignDto
,
Sign
,
SignMapper
>
implements
ISignService
{
@Autowired
private
EmqKeeper
emqKeeper
;
@Value
(
"${mqtt.topic.person.sign}"
)
private
String
personSign
;
/**
/**
* 分页查询
* 分页查询
*/
*/
...
@@ -102,6 +118,28 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
...
@@ -102,6 +118,28 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
int
num
=
this
.
baseMapper
.
queryPersonNum
(
dot
.
getBizOrgCode
());
int
num
=
this
.
baseMapper
.
queryPersonNum
(
dot
.
getBizOrgCode
());
Bean
.
copyExistPropertis
(
dot
,
sign
);
Bean
.
copyExistPropertis
(
dot
,
sign
);
sign
.
setPersonOfDay
(
String
.
valueOf
(
num
));
sign
.
setPersonOfDay
(
String
.
valueOf
(
num
));
return
this
.
save
(
sign
);
boolean
save
=
this
.
save
(
sign
);
// 发送mqtt 消息 同步人员打卡数据
if
(
save
){
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bizOrgName"
,
ObjectUtils
.
isEmpty
(
sign
.
getBizOrgName
())?
""
:
sign
.
getBizOrgName
());
map
.
put
(
"bizOrgCode"
,
ObjectUtils
.
isEmpty
(
sign
.
getBizOrgCode
())?
""
:
sign
.
getBizOrgCode
());
map
.
put
(
"orgCode"
,
ObjectUtils
.
isEmpty
(
sign
.
getOrgCode
())?
""
:
sign
.
getOrgCode
());
map
.
put
(
"signUserName"
,
ObjectUtils
.
isEmpty
(
sign
.
getName
())?
""
:
sign
.
getName
());
map
.
put
(
"jobTitle"
,
ObjectUtils
.
isEmpty
(
sign
.
getJobTitle
())?
""
:
sign
.
getJobTitle
());
map
.
put
(
"userId"
,
ObjectUtils
.
isEmpty
(
sign
.
getSignUserId
())?
""
:
sign
.
getSignUserId
());
map
.
put
(
"signDate"
,
ObjectUtils
.
isEmpty
(
sign
.
getSignTime
())?
""
:
sign
.
getSignTime
());
map
.
put
(
"recUserId"
,
ObjectUtils
.
isEmpty
(
sign
.
getRecUserId
())?
""
:
sign
.
getRecUserId
());
map
.
put
(
"recUserName"
,
ObjectUtils
.
isEmpty
(
sign
.
getRecUserName
())?
""
:
sign
.
getRecUserName
());
map
.
put
(
"sequenceNbr"
,
ObjectUtils
.
isEmpty
(
sign
.
getRecUserName
())?
""
:
sign
.
getSequenceNbr
());
String
json
=
JSONObject
.
toJSONString
(
map
,
SerializerFeature
.
PrettyFormat
,
SerializerFeature
.
WriteMapNullValue
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
personSign
,
json
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
return
save
;
}
}
}
}
\ No newline at end of file
amos-boot-system-jcs/src/main/resources/application.properties
View file @
3cb60f6b
...
@@ -78,6 +78,9 @@ mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
...
@@ -78,6 +78,9 @@ mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
#航空报警器警情通知
#航空报警器警情通知
mqtt.topic.command.alert.noticeAviation
=
aviationAlarm
mqtt.topic.command.alert.noticeAviation
=
aviationAlarm
#人员打卡同步数据
mqtt.topic.person.sign
=
sign/data/syn
security.systemctl.name
=
AMOS-API-SYSTEMCTL
security.systemctl.name
=
AMOS-API-SYSTEMCTL
jcs.company.topic.add
=
jcs/company/topic/add
jcs.company.topic.add
=
jcs/company/topic/add
...
...
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