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
52869a15
Commit
52869a15
authored
Dec 07, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备添加 查询添加设备所属单位字段 监管端人员新增相关接口
parent
6d514abb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
3 deletions
+152
-3
EquipmentDto.java
...eejoin/amos/boot/module/tzs/flc/api/dto/EquipmentDto.java
+6
-0
Equipment.java
...eejoin/amos/boot/module/tzs/flc/api/entity/Equipment.java
+13
-0
IEquipmentService.java
...os/boot/module/tzs/flc/api/service/IEquipmentService.java
+2
-0
WechatController.java
...amos/boot/module/tzs/biz/controller/WechatController.java
+4
-2
EquipmentController.java
...ot/module/tzs/flc/biz/controller/EquipmentController.java
+35
-0
UnitPersonController.java
...t/module/tzs/flc/biz/controller/UnitPersonController.java
+41
-0
EquipmentServiceImpl.java
...module/tzs/flc/biz/service/impl/EquipmentServiceImpl.java
+38
-0
tzs-1.0.0.0.xml
...ystem-tzs/src/main/resources/db/changelog/tzs-1.0.0.0.xml
+13
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/EquipmentDto.java
View file @
52869a15
...
...
@@ -95,4 +95,10 @@ public class EquipmentDto extends BaseDto {
@ApiModelProperty
(
value
=
"设备参数"
)
private
List
<
EquipmentIndexDto
>
equipmentIndex
;
@ApiModelProperty
(
value
=
"设备所属单位id"
)
private
Long
equipUnitId
;
@ApiModelProperty
(
value
=
"设备所属单位"
)
private
String
equipUnit
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/Equipment.java
View file @
52869a15
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -142,4 +143,16 @@ public class Equipment extends BaseEntity {
@TableField
(
"status"
)
private
String
status
;
/**
* 设备所属单位id
*/
@TableField
(
"equip_unit_id"
)
private
Long
equipUnitId
;
/**
* 设备所属单位
*/
@TableField
(
"equip_unit"
)
private
String
equipUnit
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IEquipmentService.java
View file @
52869a15
...
...
@@ -36,4 +36,6 @@ public interface IEquipmentService {
List
<
Object
>
getEquipmentClass
(
String
typeCode
);
EquipmentDto
getEquipmentById
(
Long
sequenceNbr
);
Boolean
batchDelete
(
List
<
Long
>
sequenceNbrList
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/WechatController.java
View file @
52869a15
...
...
@@ -121,6 +121,8 @@ public class WechatController extends BaseController {
@Autowired
ISourceFileService
sourceFileService
;
private
Long
TOKEN_TIME
=
1209600
l
;
/**
* 获取微信回调信息返回验证是否通过
...
...
@@ -331,7 +333,7 @@ public class WechatController extends BaseController {
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
dto
.
setToken
(
resultMap
.
get
(
"token"
).
toString
());
redisUtils
.
set
(
model
.
getPhone
()
+
"_token"
,
resultMap
.
get
(
"token"
).
toString
(),
25920000
l
);
redisUtils
.
set
(
model
.
getPhone
()
+
"_token"
,
resultMap
.
get
(
"token"
).
toString
(),
TOKEN_TIME
);
}
return
ResponseHelper
.
buildResponse
(
dto
);
...
...
@@ -349,7 +351,7 @@ public class WechatController extends BaseController {
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
token
=
resultMap
.
get
(
"token"
).
toString
();
redisUtils
.
set
(
tel
+
"_token"
,
resultMap
.
get
(
"token"
).
toString
(),
25920000
l
);
redisUtils
.
set
(
tel
+
"_token"
,
resultMap
.
get
(
"token"
).
toString
(),
TOKEN_TIME
);
}
return
token
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EquipmentController.java
View file @
52869a15
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -49,6 +55,10 @@ public class EquipmentController extends BaseController {
@Autowired
EquipmentServiceImpl
equipmentServiceImpl
;
@Autowired
OrgUsrServiceImpl
iOrgUsrService
;
/**
* 新增装备信息表
*
...
...
@@ -108,6 +118,18 @@ public class EquipmentController extends BaseController {
return
ResponseHelper
.
buildResponse
(
equipmentServiceImpl
.
deleteById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr删除
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/delete_batch"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"批量删除装备信息"
,
notes
=
"批量删除装备信息"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@RequestParam
(
value
=
"sequenceNbrList"
)
List
<
Long
>
sequenceNbrList
){
return
ResponseHelper
.
buildResponse
(
equipmentServiceImpl
.
batchDelete
(
sequenceNbrList
));
}
/**
* 列表分页查询
...
...
@@ -139,6 +161,19 @@ public class EquipmentController extends BaseController {
private
QueryWrapper
<
Equipment
>
setQueryWrapper
(
QueryWrapper
<
Equipment
>
queryWrapper
,
EquipmentDto
equipmentDto
,
String
sort
)
{
queryWrapper
.
eq
(
"is_delete"
,
false
);
// 获取用户所在单位 保存设备所属单位
OrgUsr
myUnit
=
null
;
AgencyUserModel
user
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
List
<
CompanyModel
>
companys
=
user
.
getCompanys
();
for
(
CompanyModel
c
:
companys
)
{
myUnit
=
iOrgUsrService
.
getOne
(
new
LambdaQueryWrapper
<
OrgUsr
>().
eq
(
OrgUsr:
:
getIsDelete
,
false
).
eq
(
OrgUsr:
:
getAmosOrgId
,
c
.
getSequenceNbr
()));
}
if
(
myUnit
==
null
)
{
throw
new
BadRequest
(
"该用户非企业人员无法查询企业设备"
);
}
queryWrapper
.
eq
(
"equip_unit_id"
,
myUnit
.
getSequenceNbr
());
if
(
sort
!=
null
)
{
// 排序失效
String
[]
date
=
sort
.
split
(
","
);
if
(
date
[
1
].
equals
(
"ascend"
))
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/UnitPersonController.java
View file @
52869a15
...
...
@@ -386,4 +386,45 @@ public class UnitPersonController extends BaseController {
/**
* 监管端-根据当前登录人获取企业列表
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/companyTreeSup"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管端-根据当前登录人获取企业列表"
,
notes
=
"监管端-根据当前登录人获取企业列表"
)
public
ResponseModel
<
List
<
CompanyModel
>>
getUserUnitSup
()
throws
Exception
{
AgencyUserModel
user
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
List
<
CompanyModel
>
companys
=
user
.
getCompanys
();
return
ResponseHelper
.
buildResponse
(
companys
);
}
/**
* 监管端-角色信息
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/listMyUnitRolesSup"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管端-获取本单位拥有的角色信息"
,
notes
=
"监管端-获取本单位拥有的角色信息"
)
public
ResponseModel
<
List
<
RoleModel
>>
listMyUnitRolesSup
()
{
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
RoleModel
>
allRoleList
=
roleListResult
.
getResult
();
return
ResponseHelper
.
buildResponse
(
allRoleList
);
}
/**
* 监管端-应用信息
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/listMyUnitAppSup"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管端-获取本单位拥有的应用信息"
,
notes
=
"监管端-获取本单位拥有的应用信息"
)
public
ResponseModel
<
List
<
ApplicationModel
>>
listMyUnitAppSup
()
{
List
<
ApplicationModel
>
allApp
=
Privilege
.
applicationClient
.
queryAgencyApplications
().
getResult
();
return
ResponseHelper
.
buildResponse
(
allApp
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/EquipmentServiceImpl.java
View file @
52869a15
...
...
@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto
;
...
...
@@ -12,12 +14,17 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import
com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
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.util.ArrayList
;
import
java.util.List
;
...
...
@@ -42,6 +49,9 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Autowired
EquipmentIndexServiceImpl
equipmentIndexServiceImpl
;
@Autowired
OrgUsrServiceImpl
iOrgUsrService
;
/**
* 分页查询
...
...
@@ -60,9 +70,23 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Override
public
EquipmentDto
createEquipment
(
EquipmentDto
model
)
{
model
.
setStatus
(
EquipmentStatusEnum
.
未安装
.
getCode
());
// 0 未安装 1 已安装
// 获取用户所在单位 保存设备所属单位
OrgUsr
myUnit
=
null
;
AgencyUserModel
user
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
List
<
CompanyModel
>
companys
=
user
.
getCompanys
();
for
(
CompanyModel
c
:
companys
)
{
myUnit
=
iOrgUsrService
.
getOne
(
new
LambdaQueryWrapper
<
OrgUsr
>().
eq
(
OrgUsr:
:
getIsDelete
,
false
).
eq
(
OrgUsr:
:
getAmosOrgId
,
c
.
getSequenceNbr
()));
}
if
(
myUnit
==
null
)
{
throw
new
BadRequest
(
"该用户非企业人员无法添加设备"
);
}
model
.
setEquipUnitId
(
myUnit
.
getSequenceNbr
());
model
.
setEquipUnit
(
myUnit
.
getBizOrgName
());
model
=
this
.
createWithModel
(
model
);
// 保存设备参数信息
List
<
EquipmentIndexDto
>
equipmentIndex
=
model
.
getEquipmentIndex
();
if
(
equipmentIndex
!=
null
&&
equipmentIndex
.
size
()>
0
)
{
for
(
EquipmentIndexDto
t
:
equipmentIndex
)
{
t
.
setEquipmentId
(
model
.
getSequenceNbr
());
...
...
@@ -137,6 +161,20 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return
result
;
}
@Transactional
@Override
public
Boolean
batchDelete
(
List
<
Long
>
sequenceNbrList
)
{
for
(
Long
sequenceNbr
:
sequenceNbrList
)
{
EquipmentDto
equipmentDto
=
this
.
queryBySeq
(
sequenceNbr
);
// 未安装设备可删除
if
(!
ValidationUtil
.
isEmpty
(
equipmentDto
)
&&
EquipmentStatusEnum
.
未安装
.
getCode
().
equals
(
equipmentDto
.
getStatus
()))
{
equipmentDto
.
setIsDelete
(
true
);
this
.
updateWithModel
(
equipmentDto
);
}
}
return
true
;
}
// 保存附件信息
public
void
saveSourceFile
(
EquipmentDto
model
)
{
if
(
model
.
getAttachments
()
!=
null
)
{
...
...
amos-boot-system-tzs/src/main/resources/db/changelog/tzs-1.0.0.0.xml
View file @
52869a15
...
...
@@ -467,6 +467,18 @@
</sql>
</changeSet>
<changeSet
author=
"kongfm"
id=
"2021-12-07-01"
>
<preConditions
onFail=
"MARK_RAN"
>
<tableExists
tableName=
"tcb_equipment"
/>
</preConditions>
<comment>
modify table tcb_equipment add equip_unit, equip_unit_id columns
</comment>
<sql>
ALTER TABLE `tcb_equipment` add equip_unit_id bigint(32) COMMENT '设备所属单位id';
ALTER TABLE `tcb_equipment` add equip_unit varchar(104) COMMENT '设备所属单位';
</sql>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
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