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
1d593802
Commit
1d593802
authored
Aug 29, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.96333 提交接口人员信息调用平台查询人员实现
parent
7ad3f568
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
41 deletions
+141
-41
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+2
-0
IAlertCalledService.java
...boot/module/elevator/api/service/IAlertCalledService.java
+6
-0
RedissonManager.java
...amos/boot/module/elevator/biz/config/RedissonManager.java
+61
-0
AlertCalledController.java
...module/elevator/biz/controller/AlertCalledController.java
+18
-40
AlertCalledServiceImpl.java
...ule/elevator/biz/service/impl/AlertCalledServiceImpl.java
+54
-1
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
1d593802
...
...
@@ -103,6 +103,8 @@ public class ControllerAop {
urls
.
add
(
"^/tcm/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"
);
urls
.
add
(
"/tcm/reg-unit-info/save"
);
urls
.
add
(
"/ymt/equipment-category/getFormRecordById"
);
urls
.
add
(
"/elevator/alert-called/getWorkOderNumber"
);
urls
.
add
(
"/elevator/alert-called/save"
);
// 获取请求路径
for
(
String
uri
:
urls
)
{
Pattern
p
=
Pattern
.
compile
(
uri
);
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/service/IAlertCalledService.java
View file @
1d593802
...
...
@@ -93,4 +93,10 @@ public interface IAlertCalledService {
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
Integer
current
,
Integer
pageNum
,
String
equipmentCode
);
Integer
getEquipmentHistoryCount
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
String
equipmentCode
);
/**
* 生成工单号
* @return
*/
String
nextId
();
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/config/RedissonManager.java
0 → 100644
View file @
1d593802
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
biz
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.Redisson
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.config.Config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Slf4j
public
class
RedissonManager
{
/**
* 集群环境使用-节点信息
*/
@Value
(
"${spring.redis.cluster.nodes:default}"
)
private
String
clusterNodes
;
/**
* 公共-密码
*/
@Value
(
"${spring.redis.password}"
)
private
String
password
;
/**
* 单机环境使用
*/
@Value
(
"${spring.redis.host:default}"
)
private
String
host
;
/**
* 单机环境使用
*/
@Value
(
"${spring.redis.port:default}"
)
private
String
port
;
@Bean
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"cluster"
)
public
RedissonClient
redissonClient
()
{
Config
config
=
new
Config
();
config
.
useClusterServers
()
.
addNodeAddress
(
clusterNodes
.
split
(
","
))
.
setPassword
(
password
);
return
Redisson
.
create
(
config
);
}
@Bean
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"singleton"
,
matchIfMissing
=
true
)
public
RedissonClient
redissonSingletonClient
()
{
// 单机打包使用
Config
config
=
new
Config
();
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
);
return
Redisson
.
create
(
config
);
}
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/controller/AlertCalledController.java
View file @
1d593802
...
...
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.SystemClock
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
...
...
@@ -18,11 +17,11 @@ import com.yeejoin.amos.boot.module.elevator.biz.service.impl.*;
import
com.yeejoin.amos.boot.module.elevator.api.dto.*
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.*
;
import
com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IMaintenanceUnitService
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IUseUnitService
;
import
com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.AlertBeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -41,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -50,7 +50,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.util.*
;
/**
...
...
@@ -123,23 +122,23 @@ public class AlertCalledController extends BaseController {
if
(
ValidationUtil
.
isEmpty
(
alertCalledObjsDto
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
//切换数据源
//
LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
//
queryWrapper.eq(Elevator::getRescueCode,alertCalledObjsDto.getAlertCalledDto().getDeviceId());
//切换数据源
//
LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
//
queryWrapper.eq(Elevator::getRescueCode,alertCalledObjsDto.getAlertCalledDto().getDeviceId());
Elevator
elevator
=
new
Elevator
();
elevator
.
setRescueCode
(
Integer
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getDeviceId
()));
Map
<
String
,
Object
>
map
=
iElevatorService
.
selectElevatorList
(
elevator
);
if
(
ObjectUtils
.
isEmpty
(
map
))
{
throw
new
BadRequest
(
"未找到相关电梯."
);
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
alertCalledObjsDto
=
iAlertCalledService
.
createAlertCalled
(
alertCalledObjsDto
,
reginParams
.
getUserModel
());
List
<
AgencyUserModel
>
userModels
=
FeignUtil
.
remoteCall
(()->
Privilege
.
agencyUserClient
.
queryByIds
(
RequestContext
.
getExeUserId
(),
false
));
//由于查询的当前登录的用户信息 所以一定有 未作冗余判空
AgencyUserModel
userModel
=
userModels
.
get
(
0
);
alertCalledObjsDto
=
iAlertCalledService
.
createAlertCalled
(
alertCalledObjsDto
,
userModel
);
// 坐席接警后,辅屏由常态化切换为处置态
AgencyUserModel
user
=
getUserInfo
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"userId"
,
user
.
getUserId
());
jsonObject
.
put
(
"userId"
,
user
Model
.
getUserId
());
jsonObject
.
put
(
"alertId"
,
String
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getSequenceNbr
()));
JSONObject
jsonObject1
=
new
JSONObject
();
...
...
@@ -294,40 +293,19 @@ public class AlertCalledController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getWorkOderNumber"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成工单编号报警人及报警时间"
,
notes
=
"生成工单编号报警人及报警时间"
)
public
ResponseModel
<
AlertCallInfoDto
>
selectOne
()
throws
ParseException
{
String
workOrderNumber
=
nextId
();
public
ResponseModel
<
AlertCallInfoDto
>
selectOne
()
{
List
<
AgencyUserModel
>
userModels
=
FeignUtil
.
remoteCall
(()->
Privilege
.
agencyUserClient
.
queryByIds
(
RequestContext
.
getExeUserId
(),
false
));
//由于查询的当前登录的用户信息 所以一定有 未作冗余判空
AgencyUserModel
userModel
=
userModels
.
get
(
0
);
String
workOrderNumber
=
iAlertCalledService
.
nextId
();
AlertCallInfoDto
alertCallInfoDto
=
new
AlertCallInfoDto
();
alertCallInfoDto
.
setCallTime
(
DateUtils
.
stampToDate
(
System
.
currentTimeMillis
(),
"yyyy-MM-dd HH:mm:ss "
));
alertCallInfoDto
.
setWorkOrderNumber
(
workOrderNumber
);
alertCallInfoDto
.
setRecUserId
(
getUserInfo
()
.
getUserId
());
alertCallInfoDto
.
setRecUserName
(
getUserInfo
()
.
getRealName
());
alertCallInfoDto
.
setRecUserId
(
userModel
.
getUserId
());
alertCallInfoDto
.
setRecUserName
(
userModel
.
getRealName
());
return
ResponseHelper
.
buildResponse
(
alertCallInfoDto
);
}
/**
* 获取下一个 工单编号
*
* @return 下一个 工单编号
*/
public
synchronized
String
nextId
()
throws
ParseException
{
String
number
=
DateUtils
.
stampToDate
(
SystemClock
.
now
(),
"yyyy-MM-dd HH:mm:ss SSS"
);
String
newNumber
=
number
.
replace
(
"-"
,
""
).
replace
(
" "
,
""
).
replace
(
":"
,
""
);
ReginParams
reginParams
=
getSelectedOrgInfo
();
AgencyUserModel
user
=
reginParams
.
getUserModel
();
String
orgCode
=
ValidationUtil
.
isEmpty
(
user
.
getCompanys
())
?
null
:
user
.
getCompanys
().
get
(
0
).
getOrgCode
();
Map
<
String
,
Object
>
map
=
iAlertCalledService
.
getAlertInfoList
(
DateUtils
.
stampToDate
(
System
.
currentTimeMillis
(),
DateUtils
.
DATE_TIME_PATTERN
),
DateUtils
.
stampToDate
(
System
.
currentTimeMillis
(),
DateUtils
.
DATE_TIME_PATTERN
),
orgCode
,
user
.
getUserId
());
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
newNumber
);
String
workOrderNumber
=
stringBuilder
.
append
(
map
.
get
(
"calledCount"
)
==
null
?
"1"
:
String
.
valueOf
(
Integer
.
parseInt
(
map
.
get
(
"calledCount"
).
toString
())
+
1
)).
toString
();
return
workOrderNumber
;
}
/**
* 警情统计
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/AlertCalledServiceImpl.java
View file @
1d593802
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.SystemClock
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -46,17 +47,24 @@ import org.apache.commons.lang.text.StrBuilder;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RAtomicLong
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -131,6 +139,17 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Value
(
"${duty.seats.role.ids}"
)
private
String
dutySeatsRoleIds
;
private
RedissonClient
redissonClient
;
private
RAtomicLong
rAtomicLong
;
public
AlertCalledServiceImpl
(
RedissonClient
client
){
this
.
redissonClient
=
client
;
rAtomicLong
=
redissonClient
.
getAtomicLong
(
"AUTO_INCR_LONG"
);
}
private
final
Logger
logger
=
LogManager
.
getLogger
(
AlertCalledServiceImpl
.
class
);
...
...
@@ -816,7 +835,41 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
public
Integer
getEquipmentHistoryCount
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
String
equipmentCode
)
{
return
baseMapper
.
getEquipmentHistoryCount
(
useRegionCode
,
equipmentClassCode
,
equipmentCode
);
}
// 今日值班人员接警数量统计
@Override
public
String
nextId
()
{
RLock
lock
=
redissonClient
.
getLock
(
"WORK_ORDER_NUMBER_LOCK_KEY"
);
String
workOrderNumber
=
""
;
try
{
lock
.
lock
();
long
remainTimeToLive
=
rAtomicLong
.
remainTimeToLive
();
// 判断是否过期,设置过期时间,序列开始重置为0
if
(
remainTimeToLive
<=
0
)
{
resetCounterAndExpire
();
}
long
seq
=
rAtomicLong
.
incrementAndGet
();
String
number
=
DateUtils
.
stampToDate
(
SystemClock
.
now
(),
"yyyyMMddHHmmss"
);
workOrderNumber
=
number
+
seq
;
}
finally
{
lock
.
unlock
();
}
return
workOrderNumber
;
}
private
void
resetCounterAndExpire
()
{
// 第二天凌晨序列重置 新开始
rAtomicLong
.
set
(
0
);
rAtomicLong
.
expireAt
(
calculateExpirationTime
());
}
private
long
calculateExpirationTime
()
{
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
nextDay
=
now
.
plus
(
1
,
ChronoUnit
.
DAYS
).
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
return
nextDay
.
toInstant
(
ZoneOffset
.
of
(
"+0"
)).
toEpochMilli
();
}
// 今日值班人员接警数量统计
public
Integer
countNum
(
String
userName
){
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
format
=
simpleDateFormat
.
format
(
new
Date
());
...
...
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