Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_platformV2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_platformV2
Commits
2c21ca29
Commit
2c21ca29
authored
Jul 28, 2023
by
shenweidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新了根据单警柜查询警员接口
parent
51bb7926
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
165 行增加
和
25 行删除
+165
-25
jyzb-biz.iml
jyzb-biz/jyzb-biz.iml
+1
-0
CabinetController.java
jyzb-biz/src/main/java/com/junmp/jyzb/controller/CabinetController.java
+6
-1
CabinetMapper.java
jyzb-biz/src/main/java/com/junmp/jyzb/mapper/CabinetMapper.java
+5
-0
CabinetService.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/CabinetService.java
+7
-0
CabinetServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetServiceImpl.java
+24
-0
PolicemanServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
+83
-20
HttpStatus.java
jyzb-biz/src/main/java/com/junmp/jyzb/utils/HttpStatus.java
+0
-1
CabinetMapper.xml
jyzb-biz/src/main/resources/mapper/CabinetMapper.xml
+29
-2
PolicemanMapper.xml
jyzb-biz/src/main/resources/mapper/PolicemanMapper.xml
+2
-0
jyzb-boot.iml
jyzb-boot/jyzb-boot.iml
+1
-0
application.yml
jyzb-boot/src/main/resources/application.yml
+1
-1
pom.properties
jyzb-mq/jyzb-mq-consumer/target/maven-archiver/pom.properties
+3
-0
pom.properties
jyzb-mq/jyzb-mq-producer/target/maven-archiver/pom.properties
+3
-0
没有找到文件。
jyzb-biz/jyzb-biz.iml
View file @
2c21ca29
...
...
@@ -20,6 +20,7 @@
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"module"
module-name=
"jyzb-api"
/>
<orderEntry
type=
"library"
name=
"Maven: io.swagger:swagger-annotations:1.5.22"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: cn.hutool:hutool-all:5.6.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.projectlombok:lombok:1.18.20"
level=
"project"
/>
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/controller/CabinetController.java
View file @
2c21ca29
...
...
@@ -80,7 +80,12 @@ public class CabinetController {
return
returnMsg
;
}
@PostMapping
(
"/GetCabinetByOrgId"
)
@ApiOperation
(
"根据组织机构获取单警柜及箱号信息"
)
public
ResponseResult
getCabinetByOrgId
(
@RequestBody
Map
<
String
,
Object
>
msg
){
ResponseResult
returnMsg
=
cabinetService
.
getCabinetByOrgId
(
msg
);
return
returnMsg
;
}
@PostMapping
(
"/AddCabinetInfo"
)
@ApiOperation
(
"添加单警柜"
)
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/mapper/CabinetMapper.java
View file @
2c21ca29
...
...
@@ -43,4 +43,8 @@ public interface CabinetMapper extends BaseMapper<Cabinet> {
void
setCabinetOutSumInventory
(
@Param
(
"updateId"
)
String
id
);
void
setCabinetPriceInventory
(
@Param
(
"updateId"
)
String
id
);
List
<
Map
<
String
,
Object
>>
getCabinetByOrgId
(
String
orgId
);
String
getOrgByCabinet
(
String
cabinetId
);
}
\ No newline at end of file
jyzb-biz/src/main/java/com/junmp/jyzb/service/CabinetService.java
View file @
2c21ca29
...
...
@@ -73,4 +73,11 @@ public interface CabinetService extends IService<Cabinet> {
* @return
*/
boolean
boxBindPolice
(
CabinetBoxReq
req
,
String
policeId
);
/**
* 根据组织机构获取单警柜及箱号信息
* @param msg
* @return
*/
ResponseResult
getCabinetByOrgId
(
Map
<
String
,
Object
>
msg
);
}
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetServiceImpl.java
View file @
2c21ca29
...
...
@@ -635,6 +635,30 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return
policemanService
.
save
(
one2
);
}
@Override
public
ResponseResult
getCabinetByOrgId
(
Map
<
String
,
Object
>
msg
)
{
try
{
checkNotBlank
(
msg
.
get
(
"orgId"
),
"orgId不能为空"
);
}
catch
(
IllegalArgumentException
e
)
{
return
new
ResponseResult
(
HttpStatus
.
ERROR
,
ReturnMsg
.
ERROR
,
e
.
getMessage
());
}
// 根据组织机构获取该组织机构下所有单警柜
List
<
Map
<
String
,
Object
>>
allCabinet
=
new
ArrayList
<>();
allCabinet
=
cabinetMapper
.
getCabinetByOrgId
(
msg
.
get
(
"orgId"
).
toString
());
// 遍历allCabinet
for
(
Map
<
String
,
Object
>
oneCabinet:
allCabinet
){
String
cabinetId
=
oneCabinet
.
get
(
"id"
).
toString
();
// 根据单警柜id获取箱号信息
List
<
Map
<
String
,
Object
>>
allBox
=
new
ArrayList
<>();
allBox
=
cabinetBoxMapper
.
getBoxMsg
(
cabinetId
);
oneCabinet
.
put
(
"allBoxMsg"
,
allBox
);
}
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
allCabinet
);
}
//查询的各种条件信息
//单警柜主柜查询条件
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
View file @
2c21ca29
...
...
@@ -17,6 +17,7 @@ import com.junmp.jyzb.service.PubOrgService;
import
com.junmp.jyzb.utils.*
;
import
com.junmp.v2.common.exception.base.ServiceException
;
import
com.junmp.v2.common.util.BeanPlusUtil
;
import
com.sun.jna.platform.win32.ObjBase
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
...
...
@@ -657,36 +658,40 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
@Override
public
ResponseResult
getPoliceData
(
Map
<
String
,
Object
>
cabinetId
)
{
public
ResponseResult
getPoliceData
(
Map
<
String
,
Object
>
msg
)
{
try
{
checkNotBlank
(
cabinetId
.
get
(
"cabinetId"
),
"cabinetId不能为空"
);
checkNotBlank
(
msg
.
get
(
"cabinetId"
),
"cabinetId不能为空"
);
checkNotBlank
(
msg
.
get
(
"type"
),
"type不能为空"
);
}
catch
(
IllegalArgumentException
e
)
{
return
new
ResponseResult
(
HttpStatus
.
ERROR
,
ReturnMsg
.
ERROR
,
e
.
getMessage
());
}
//如果没有找到该单警柜,返回对应信息
String
cabinetMsg
=
cabinetId
.
get
(
"cabinetId"
).
toString
();
String
cabinetMsg
=
msg
.
get
(
"cabinetId"
).
toString
();
Map
<
String
,
Object
>
oneCabinet
=
cabinetMapper
.
getOneCabinet
(
cabinetMsg
);
if
(
oneCabinet
.
isEmpty
()){
return
new
ResponseResult
(
HttpStatus
.
ERROR
,
ReturnMsg
.
NO_DATA
,
ReturnData
.
NO_DATA
);
}
// 构建 Redis 缓存键
String
redisKey
=
"getPoliceData"
+
cabinetId
.
get
(
"cabinetId"
).
toString
();
// 从 Redis 中获取数据
Map
<
String
,
Object
>
cachedData
=
redisUtils
.
findCachedData
(
redisKey
);
if
(
cachedData
!=
null
)
{
//将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allPoliceman.add(one);
// }
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
cachedData
);
}
String
type
=
msg
.
get
(
"type"
).
toString
();
//存放返回的数据
Map
<
String
,
Object
>
allMsg
=
new
HashMap
<>();
allMsg
.
put
(
"cabinetName"
,
oneCabinet
.
get
(
"name"
));
if
(
type
.
equals
(
"all"
)){
//根据单警柜id获取组织机构id
String
orgId
=
cabinetMapper
.
getOrgByCabinet
(
msg
.
get
(
"cabinetId"
).
toString
());
//根据组织机构id,查询所有的警员
List
<
Map
<
String
,
Object
>>
allPolicemanByOrg
=
policemanMapper
.
getAllPolicemanByOrg
(
orgId
);
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
allPolicemanByOrg
);
}
else
if
(
type
.
equals
(
"single"
)){
allMsg
.
put
(
"id"
,
oneCabinet
.
get
(
"id"
));
allMsg
.
put
(
"cabinetNum"
,
oneCabinet
.
get
(
"cabinetNum"
));
allMsg
.
put
(
"name"
,
oneCabinet
.
get
(
"name"
));
allMsg
.
put
(
"orgId"
,
oneCabinet
.
get
(
"orgId"
));
allMsg
.
put
(
"orgName"
,
oneCabinet
.
get
(
"orgName"
));
allMsg
.
put
(
"location"
,
oneCabinet
.
get
(
"location"
));
List
<
Map
<
String
,
Object
>>
allBoxMsg
=
cabinetBoxMapper
.
getBoxMsg
(
cabinetMsg
);
List
<
Map
<
String
,
Object
>>
policeMsg
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
boxMsg:
allBoxMsg
){
...
...
@@ -700,10 +705,68 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
}
allMsg
.
put
(
"policeList"
,
policeMsg
);
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
allMsg
);
}
else
if
(
type
.
equals
(
"allBind"
)){
//构建存放返回信息的List
List
<
Map
<
String
,
Object
>>
returnMsg
=
new
ArrayList
<>();
//根据单警柜id获取组织机构id
String
orgId
=
cabinetMapper
.
getOrgByCabinet
(
msg
.
get
(
"cabinetId"
).
toString
());
//根据组织机构id获取下面的所有单警柜
List
<
Map
<
String
,
Object
>>
allCabinet
=
cabinetMapper
.
getCabinetByOrgId
(
orgId
);
//根据单警柜的List,查询所有绑定的警员信息
for
(
Map
<
String
,
Object
>
one:
allCabinet
){
//构建cabinet的map
Map
<
String
,
Object
>
cabinetMap
=
new
HashMap
<>();
cabinetMap
.
put
(
"id"
,
one
.
get
(
"id"
));
cabinetMap
.
put
(
"cabinetNum"
,
one
.
get
(
"cabinetNum"
));
cabinetMap
.
put
(
"name"
,
one
.
get
(
"name"
));
cabinetMap
.
put
(
"orgId"
,
one
.
get
(
"orgId"
));
cabinetMap
.
put
(
"orgName"
,
one
.
get
(
"orgName"
));
cabinetMap
.
put
(
"location"
,
one
.
get
(
"location"
));
List
<
Map
<
String
,
Object
>>
allBoxMsg
=
cabinetBoxMapper
.
getBoxMsg
(
one
.
get
(
"id"
).
toString
());
List
<
Map
<
String
,
Object
>>
policeMsg
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
boxMsg:
allBoxMsg
){
String
cabinetBoxId
=
boxMsg
.
get
(
"cabinetBoxId"
).
toString
();
List
<
String
>
allPoliceIdByBoxId
=
policemanMapper
.
getAllPoliceIdByBoxId
(
cabinetBoxId
);
for
(
String
policeId:
allPoliceIdByBoxId
){
Map
<
String
,
Object
>
onePolice
=
policemanMapper
.
getOnePolice
(
policeId
);
List
<
Map
<
String
,
Object
>>
fingerprints
=
policeFingerMapper
.
getFingersByUserId
(
policeId
);
onePolice
.
put
(
"fingerMsg"
,
fingerprints
);
policeMsg
.
add
(
onePolice
);
}
}
cabinetMap
.
put
(
"policeList"
,
policeMsg
);
//将cabinetMap放入list
returnMsg
.
add
(
cabinetMap
);
}
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
returnMsg
);
}
else
{
return
new
ResponseResult
(
HttpStatus
.
ERROR
,
ReturnMsg
.
ERROR
,
"传入的type有误"
);
}
// // 构建 Redis 缓存键
// String redisKey = "getPoliceData" + cabinetId.get("cabinetId").toString();
// // 从 Redis 中获取数据
// Map<String, Object> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData != null) {
// //将Long类型的数据转化为Date
//// for (Map<String,Object> one:cachedData){
//// Long dataMsg = (Long) one.get("updateTime");
//// one.put("updateTime", redisUtils.getDate(dataMsg));
//// allPoliceman.add(one);
//// }
// return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cachedData);
// }
//将查询结果存入 Redis 中
redisUtils
.
set
(
redisKey
,
allMsg
);
return
new
ResponseResult
(
HttpStatus
.
SUCCESS
,
ReturnMsg
.
PASS
,
allMsg
);
//redisUtils.set(redisKey, allMsg);
}
/**
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/utils/HttpStatus.java
View file @
2c21ca29
package
com
.
junmp
.
jyzb
.
utils
;
import
org.omg.CORBA.NO_PERMISSION
;
/**
* 返回状态码
...
...
jyzb-biz/src/main/resources/mapper/CabinetMapper.xml
View file @
2c21ca29
...
...
@@ -64,7 +64,7 @@
where p.id =#{id}
</update>
<select
id=
"getAllCabinet"
>
<select
id=
"getAllCabinet"
resultType=
"com.junmp.jyzb.entity.Cabinet"
>
select
c.id,
c.cabinet_num as cabinetNum,
...
...
@@ -115,7 +115,7 @@
select cabinet_num from base_cabinet where id =#{id}
</select>
<select
id=
"getAllCabinetByOrgList"
parameterType=
"java.util.List"
resultType=
"
java.util.Map
"
>
<select
id=
"getAllCabinetByOrgList"
parameterType=
"java.util.List"
resultType=
"
com.junmp.jyzb.entity.Cabinet
"
>
select
c.id,
c.cabinet_num as cabinetNum,
...
...
@@ -210,4 +210,30 @@ SET price_total = (
where c.id = #{updateId}
</if>
</update>
<select
id=
"getOrgByCabinet"
resultType=
"String"
>
select
o.org_id
from base_cabinet c
join pub_org o on c.org_id_int =o.org_id
where c.id = #{cabinetId}
</select>
<select
id=
"getCabinetByOrgId"
resultType=
"map"
>
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int = #{orgId}
</select>
</mapper>
\ No newline at end of file
jyzb-biz/src/main/resources/mapper/PolicemanMapper.xml
View file @
2c21ca29
...
...
@@ -39,6 +39,7 @@
p.sex,
p.phone,
p.photo,
COALESCE(p.cabinet_box_id,null) as cabinetBoxId,
p.police_code AS policeCode,
c.id AS cabinetId,
c.name AS cabinetName,
...
...
@@ -177,6 +178,7 @@
p.org_id_int AS orgId,
o.org_name AS orgName,
p.name AS name,
COALESCE(p.cabinet_box_id,null) as cabinetBoxId,
p.sex,
p.phone,
p.photo,
...
...
jyzb-boot/jyzb-boot.iml
View file @
2c21ca29
...
...
@@ -31,6 +31,7 @@
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"module"
module-name=
"jyzb-api"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: p6spy:p6spy:3.9.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: mysql:mysql-connector-java:8.0.21"
level=
"project"
/>
...
...
jyzb-boot/src/main/resources/application.yml
View file @
2c21ca29
...
...
@@ -4,7 +4,7 @@
server
:
tomcat
:
uri-encoding
:
UTF-8
#tomcat编码
port
:
1003
1
#tomcat端口
port
:
1003
0
#tomcat端口
spring
:
main
:
#bea同名类进行注册时,准许覆盖注册
...
...
jyzb-mq/jyzb-mq-consumer/target/maven-archiver/pom.properties
0 → 100644
View file @
2c21ca29
artifactId
=
jyzb-mq-consumer
groupId
=
com.junmp.jyzb
version
=
1.0.0
jyzb-mq/jyzb-mq-producer/target/maven-archiver/pom.properties
0 → 100644
View file @
2c21ca29
artifactId
=
jyzb-mq-producer
groupId
=
com.junmp.jyzb
version
=
1.0.0
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论