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
85349789
Commit
85349789
authored
Aug 09, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码同步
parent
f8cf0346
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
32 deletions
+96
-32
TzsAppController.java
...amos/boot/module/app/biz/controller/TzsAppController.java
+96
-32
No files found.
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/java/com/yeejoin/amos/boot/module/app/biz/controller/TzsAppController.java
View file @
85349789
...
...
@@ -3,10 +3,15 @@ package com.yeejoin.amos.boot.module.app.biz.controller;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
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.utils.Menu
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
import
com.yeejoin.amos.boot.module.app.api.common.MobileLoginParam
;
import
com.yeejoin.amos.boot.module.app.api.dto.EquipExportDto
;
import
com.yeejoin.amos.boot.module.app.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.app.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.app.api.entity.PageParam
;
import
com.yeejoin.amos.boot.module.app.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.app.api.mapper.ViewJgClaimMapper
;
...
...
@@ -16,6 +21,7 @@ import com.yeejoin.amos.boot.module.app.biz.service.impl.TzsAppService;
import
com.yeejoin.amos.boot.module.app.flc.api.entity.RegUnitInfo
;
import
com.yeejoin.amos.boot.module.app.flc.api.mapper.RegUnitInfoMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.PermissionModel
;
...
...
@@ -23,6 +29,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -31,6 +38,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -54,10 +62,18 @@ public class TzsAppController {
private
EquipmentCategoryServiceImpl
equipmentCategoryService
;
private
static
final
String
LEVEL
=
"company"
;
private
static
final
String
COMPANYPATH
=
"/company"
;
private
static
final
String
JIANGUAN
=
"/"
;
private
static
final
String
JIANGUAN
=
"/"
;
@Autowired
AmosRequestContext
amosRequestContext
;
@Autowired
EquipmentCategoryServiceImpl
equipmentCategoryServiceImpl
;
/**
* 小程序获取设备详情
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -69,6 +85,7 @@ public class TzsAppController {
/**
* 小程序获取设备详情-微信扫一扫
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -81,6 +98,7 @@ public class TzsAppController {
/**
* 根据监管码查询设备详情
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -92,50 +110,51 @@ public class TzsAppController {
/**
* 登录
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/mobile/login"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"小程序登录"
,
notes
=
"小程序登录"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
login
(
@RequestBody
MobileLoginParam
param
)
{
return
ResponseHelper
.
buildResponse
(
appService
.
login
(
param
));
}
/**
* 小程序企业详情
*
*/
/**
* 小程序企业详情
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/details"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"小程序企业详情"
,
notes
=
"小程序企业详情"
)
public
ResponseModel
<
IPage
<
TzBaseEnterpriseInfoDto
>>
pageInfo
(
String
unitCode
)
{
public
ResponseModel
<
IPage
<
TzBaseEnterpriseInfoDto
>>
pageInfo
(
String
unitCode
)
{
PageParam
pageParam
=
new
PageParam
();
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>
objectLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
objectLambdaQueryWrapper
.
eq
(!
ValidationUtil
.
isEmpty
(
unitCode
),
TzBaseEnterpriseInfo:
:
getUseCode
,
unitCode
);
objectLambdaQueryWrapper
.
eq
(!
ValidationUtil
.
isEmpty
(
unitCode
),
TzBaseEnterpriseInfo:
:
getUseCode
,
unitCode
);
TzBaseEnterpriseInfo
neInfo
=
iTzBaseEnterpriseInfoService
.
getOne
(
objectLambdaQueryWrapper
,
true
);
return
ResponseHelper
.
buildResponse
(
iTzBaseEnterpriseInfoService
.
page
(
pageParam
,
neInfo
.
getUseUnit
()));
}
/**
* 小程序菜单权限
*
*
/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/permission/tree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"小程序菜单权限"
,
notes
=
"小程序菜单权限"
)
public
FeignClientResult
<
Collection
<
PermissionModel
>>
tree
(
HttpServletRequest
http
,
@RequestParam
(
value
=
"most"
,
required
=
false
)
String
most
)
{
FeignClientResult
<
Collection
<
PermissionModel
>>
app
=
new
FeignClientResult
<
Collection
<
PermissionModel
>>();
public
FeignClientResult
<
Collection
<
PermissionModel
>>
tree
(
HttpServletRequest
http
,
@RequestParam
(
value
=
"most"
,
required
=
false
)
String
most
)
{
FeignClientResult
<
Collection
<
PermissionModel
>>
app
=
new
FeignClientResult
<
Collection
<
PermissionModel
>>();
if
(
ValidationUtil
.
isEmpty
(
most
))
{
//根据当前登录人的公司是企业还是监管来过滤
List
<
JSONObject
>
objectList
=
equipmentCategoryService
.
getCompanyType
();
List
<
JSONObject
>
total
=
objectList
.
stream
().
filter
(
item
->
!
LEVEL
.
equals
(
item
.
getString
(
"level"
))).
collect
(
Collectors
.
toList
());
if
(
total
.
size
()==
0
)
{
//企业
app
=
Privilege
.
permissionClient
.
queryPermissionTree
(
"APP"
,
null
,
null
,
COMPANYPATH
,
null
);
}
else
{
//监管
app
=
Privilege
.
permissionClient
.
queryPermissionTree
(
"APP"
,
null
,
null
,
JIANGUAN
,
null
);
}
}
else
{
//更多应用
if
(
total
.
size
()
==
0
)
{
//企业
app
=
Privilege
.
permissionClient
.
queryPermissionTree
(
"APP"
,
null
,
null
,
COMPANYPATH
,
null
);
}
else
{
//监管
app
=
Privilege
.
permissionClient
.
queryPermissionTree
(
"APP"
,
null
,
null
,
JIANGUAN
,
null
);
}
}
else
{
//更多应用
app
=
Privilege
.
permissionClient
.
queryPermissionTree
(
"APP"
,
null
,
null
,
most
,
null
);
}
...
...
@@ -147,14 +166,14 @@ public class TzsAppController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{userId}/password"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改密码"
,
notes
=
"修改密码"
)
public
ResponseModel
<
Boolean
>
updatePassword
(
@PathVariable
(
"userId"
)
String
userId
,
@RequestBody
AgencyUserModel
AgencyUserModel
)
{
Boolean
result
=
false
;
if
(
ValidationUtil
.
isEmpty
(
userId
)
||
public
ResponseModel
<
Boolean
>
updatePassword
(
@PathVariable
(
"userId"
)
String
userId
,
@RequestBody
AgencyUserModel
AgencyUserModel
)
{
Boolean
result
=
false
;
if
(
ValidationUtil
.
isEmpty
(
userId
)
||
ValidationUtil
.
isEmpty
(
AgencyUserModel
.
getOriginalPassword
())
||
ValidationUtil
.
isEmpty
(
AgencyUserModel
.
getRePassword
())
||
ValidationUtil
.
isEmpty
(
AgencyUserModel
.
getPassword
())
)
{
ValidationUtil
.
isEmpty
(
AgencyUserModel
.
getPassword
()))
{
log
.
error
(
"用户信息不能为空"
);
return
ResponseHelper
.
buildResponse
(
result
);
return
ResponseHelper
.
buildResponse
(
result
);
}
if
(!
AgencyUserModel
.
getRePassword
().
equals
(
AgencyUserModel
.
getPassword
()))
{
log
.
error
(
"两次密码不一致"
);
...
...
@@ -163,18 +182,18 @@ public class TzsAppController {
//平台修改
AgencyUserModel
.
setUserId
(
userId
);
FeignClientResult
<
AgencyUserModel
>
agencyUserModelFeignClientResult
=
Privilege
.
agencyUserClient
.
modifyPassword
(
userId
,
AgencyUserModel
);
if
(
agencyUserModelFeignClientResult
.
getStatus
()
!=
200
)
{
if
(
agencyUserModelFeignClientResult
.
getStatus
()
!=
200
)
{
log
.
error
(
"Privilege远程调用失败"
);
return
ResponseHelper
.
buildResponse
(
result
);
}
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelFeignClientResult
.
getResult
())
||
ValidationUtil
.
isEmpty
(
agencyUserModelFeignClientResult
.
getResult
().
getUserId
()))
{
if
(
ValidationUtil
.
isEmpty
(
agencyUserModelFeignClientResult
.
getResult
())
||
ValidationUtil
.
isEmpty
(
agencyUserModelFeignClientResult
.
getResult
().
getUserId
()))
{
log
.
error
(
"平台修改失败"
);
return
ResponseHelper
.
buildResponse
(
result
);
}
//走业务修改
LambdaQueryWrapper
<
RegUnitInfo
>
objectLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
objectLambdaQueryWrapper
.
eq
(
RegUnitInfo:
:
getAdminUserId
,
agencyUserModelFeignClientResult
.
getResult
().
getUserId
());
objectLambdaQueryWrapper
.
eq
(
RegUnitInfo:
:
getAdminUserId
,
agencyUserModelFeignClientResult
.
getResult
().
getUserId
());
RegUnitInfo
regUnitInfo
=
new
RegUnitInfo
();
regUnitInfo
.
setAdminLoginPwd
(
AgencyUserModel
.
getRePassword
());
int
update
=
regUnitInfoMapper
.
update
(
regUnitInfo
,
objectLambdaQueryWrapper
);
...
...
@@ -182,7 +201,7 @@ public class TzsAppController {
log
.
error
(
"业务更新失败"
);
return
ResponseHelper
.
buildResponse
(
result
);
}
result
=
true
;
result
=
true
;
return
ResponseHelper
.
buildResponse
(
result
);
}
...
...
@@ -198,10 +217,10 @@ public class TzsAppController {
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/wxUserLogin"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信授权登陆"
,
notes
=
"微信授权登陆"
)
public
ResponseModel
<
JSONObject
>
wxUserLogin
(
@RequestBody
JSONObject
wx
)
{
public
ResponseModel
<
JSONObject
>
wxUserLogin
(
@RequestBody
JSONObject
wx
)
{
return
ResponseHelper
.
buildResponse
(
appService
.
wxUserLogin
(
wx
));
}
...
...
@@ -217,8 +236,11 @@ public class TzsAppController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备列表"
,
notes
=
"设备列表"
)
@GetMapping
(
value
=
"/getTable"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getTable
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
appService
.
getTable
(
map
));
public
ResponseModel
<
Page
<
JSONObject
>>
getTable
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
JSONObject
jsonObject
=
new
JSONObject
(
map
);
return
ResponseHelper
.
buildResponse
(
equipmentCategoryServiceImpl
.
queryByKeys
(
jsonObject
));
//return ResponseHelper.buildResponse(appService.getTable(map));
}
//行政区划树
...
...
@@ -231,4 +253,46 @@ public class TzsAppController {
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"获取机器人登录token"
,
notes
=
"获取机器人登录token"
)
@GetMapping
(
value
=
"/acquireToken"
)
synchronized
public
String
getRobotLoginToken
()
{
return
amosRequestContext
.
getToken
();
}
/**
* 树
*
* @return
* @throws Exception
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备分类列表全部数据查询"
,
notes
=
"装备分类列表全部数据查询"
)
@GetMapping
(
value
=
"/tree"
)
public
ResponseModel
<
Object
>
tree
(
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
code
)
throws
Exception
{
if
(
ObjectUtils
.
isEmpty
(
code
))
{
return
ResponseHelper
.
buildResponse
(
new
ArrayList
<>());
}
EquipmentCategory
root
=
equipmentCategoryServiceImpl
.
getOne
(
new
LambdaQueryWrapper
<
EquipmentCategory
>().
eq
(
EquipmentCategory:
:
getCode
,
code
));
QueryWrapper
<
EquipmentCategory
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
likeRight
(
"code"
,
code
.
replaceAll
(
"0+$"
,
""
));
Collection
<
EquipmentCategory
>
list
=
equipmentCategoryServiceImpl
.
list
(
queryWrapper
);
Menu
menu
=
new
Menu
(
root
.
getId
(),
root
.
getName
(),
0L
,
0
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
root
.
getId
(),
list
,
EquipmentCategory
.
class
.
getName
(),
"getId"
,
0
,
"getName"
,
"getParentId"
,
null
,
"getCode"
);
menu
.
setChildren
(
menus
);
List
<
Menu
>
tree
=
new
ArrayList
<>();
tree
.
add
(
menu
);
return
ResponseHelper
.
buildResponse
(
tree
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/page"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"企业列表"
,
notes
=
"企业列表"
)
public
ResponseModel
<
IPage
<
TzBaseEnterpriseInfoDto
>>
page
(
PageParam
pageParam
,
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
)
{
return
ResponseHelper
.
buildResponse
(
iTzBaseEnterpriseInfoService
.
page
(
pageParam
,
tzBaseEnterpriseInfoDto
));
}
}
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