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
2bd57061
Commit
2bd57061
authored
Nov 22, 2021
by
chenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/moa/amos-boot-biz
into developer
parents
9bb1742a
b6685aaf
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
920 additions
and
699 deletions
+920
-699
RuleTypeEnum.java
.../com/yeejoin/amos/boot/biz/common/enums/RuleTypeEnum.java
+2
-2
IFirefightersService.java
.../boot/module/common/api/service/IFirefightersService.java
+0
-4
IUnitInfoChangeService.java
...ot/module/tzs/flc/api/service/IUnitInfoChangeService.java
+3
-0
IUnitInfoService.java
...mos/boot/module/tzs/flc/api/service/IUnitInfoService.java
+10
-0
FirefightersServiceImpl.java
...dule/common/biz/service/impl/FirefightersServiceImpl.java
+1
-2
FirefightersController.java
...oot/module/jcs/biz/controller/FirefightersController.java
+282
-295
UserController.java
...ejoin/amos/patrol/business/controller/UserController.java
+364
-371
MsgRo.java
...main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
+4
-1
RulePlanService.java
...in/amos/patrol/business/service/impl/RulePlanService.java
+2
-0
ElevatorServiceImpl.java
...boot/module/tzs/biz/service/impl/ElevatorServiceImpl.java
+3
-2
BeanDtoVoUtils.java
...eejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
+1
-0
UnitInfoController.java
...oot/module/tzs/flc/biz/controller/UnitInfoController.java
+47
-2
UnitInfoChangeServiceImpl.java
...e/tzs/flc/biz/service/impl/UnitInfoChangeServiceImpl.java
+28
-0
UnitInfoServiceImpl.java
.../module/tzs/flc/biz/service/impl/UnitInfoServiceImpl.java
+173
-20
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/enums/RuleTypeEnum.java
View file @
2bd57061
...
...
@@ -11,8 +11,8 @@ public enum RuleTypeEnum {
// 防火监督
计划提交
(
"计划提交"
,
"addPlan"
,
"auditPage"
,
RuleConstant
.
WEB
,
RuleConstant
.
TASK
),
计划审核
(
"计划审核"
,
"planAudit"
,
"auditPage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
TASK
),
计划审核完成
(
"计划审核完成"
,
"planAuditAll"
,
"formulatePage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
NOTIFY
),
计划审核
(
"计划审核"
,
"planAudit"
,
"auditPage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
NOTIFY
),
计划审核完成
(
"计划审核完成"
,
"planAuditAll"
,
"formulatePage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
TASK
),
计划生成
(
"计划生成"
,
"addPlanTask"
,
null
,
RuleConstant
.
APP
,
RuleConstant
.
TASK
),
计划完成
(
"计划完成"
,
"planCompleted"
,
null
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
NOTIFY
),
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IFirefightersService.java
View file @
2bd57061
...
...
@@ -29,10 +29,6 @@ public interface IFirefightersService {
void
saveFirefighters
(
FirefightersInfoDto
firefighters
);
Firefighters
selectByAmosOrgId
(
Long
id
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IUnitInfoChangeService.java
View file @
2bd57061
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
service
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
/**
* 企业信息变更表接口类
*
...
...
@@ -9,4 +11,5 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
public
interface
IUnitInfoChangeService
{
UnitInfoDto
findLastChangInfo
(
Long
sourceId
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IUnitInfoService.java
View file @
2bd57061
...
...
@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfoChange
;
/**
* 企业信息表接口类
...
...
@@ -21,5 +23,13 @@ public interface IUnitInfoService {
UnitInfoDto
getDtoById
(
Long
sequenceNbr
);
UnitInfoDto
getUnItDtoById
(
Long
sequenceNbr
);
UnitInfoDto
unitInfoToDto
(
UnitInfo
source
);
UnitInfoDto
unitChangeInfoToDto
(
UnitInfoChange
source
);
UnitInfoDto
getDtoByOrgId
(
Long
sequenceNbr
);
UnitInfoDto
changeUnInfo
(
UnitInfoDto
model
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/FirefightersServiceImpl.java
View file @
2bd57061
...
...
@@ -89,14 +89,13 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
@Override
public
Firefighters
selectByAmosOrgId
(
Long
id
)
{
QueryWrapper
<
Firefighters
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"amos_user_id"
,
id
);
Firefighters
firefighters
=
firefightersMapper
.
selectOne
(
queryWrapper
);
return
firefighters
;
}
/**
* 导出列表
*/
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/FirefightersController.java
View file @
2bd57061
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireTeam
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -35,6 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.Menu
;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
...
...
@@ -42,23 +16,29 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.Firefighters
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersEducation
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersThought
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContactsServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContractServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersEducationServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersPostServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersThoughtServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.entity.*
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.*
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.FirefightersJacketServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
/**
* 消防队员
...
...
@@ -71,270 +51,277 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping
(
value
=
"/firefighters"
)
public
class
FirefightersController
extends
BaseController
{
@Autowired
FirefightersServiceImpl
iFirefightersService
;
@Autowired
FirefightersPostServiceImpl
iFirefightersPostService
;
@Autowired
FirefightersContactsServiceImpl
ifirefightersContactsService
;
@Autowired
FirefightersEducationServiceImpl
ifirefightersEducationService
;
@Autowired
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
FirefightersJacketServiceImpl
iFirefightersJacketService
;
@Autowired
FireTeamServiceImpl
iFireTeamService
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
DataDictionaryServiceImpl
dataDictionaryService
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
/**
* 新增消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防队员"
,
notes
=
"新增消防队员"
)
@Transactional
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
if
(
firefighters
.
getFirefighters
().
getJobTitleCode
()
!=
null
&&
!
firefighters
.
getFirefighters
().
getJobTitleCode
().
equals
(
""
)){
DataDictionary
gwmc
=
dataDictionaryService
.
getByCode
(
firefighters
.
getFirefighters
().
getJobTitleCode
(),
"GWMC"
);
firefighters
.
getFirefighters
().
setJobTitle
(
gwmc
.
getName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao end 2021-10-19*/
iFirefightersService
.
saveFirefighters
(
firefighters
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@Transactional
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
//BUG 2761 判断人员删除时的逻辑 如果被选为队伍联系人则无法被删除 bykongfm
List
fireTeam
=
iFireTeamService
.
list
(
new
LambdaQueryWrapper
<
FireTeam
>().
eq
(
FireTeam:
:
getIsDelete
,
false
).
eq
(
FireTeam:
:
getContactUserId
,
id
));
if
(
fireTeam
.
size
()
>
0
)
{
return
ResponseHelper
.
buildResponse
(
"-1"
);
}
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
queryWrapper
.
eq
(
"is_delete"
,
0
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
&&
firefightersJacket
.
size
()
>
0
)
{
// BUG 2222 by litw start 2021年9月10日
return
ResponseHelper
.
buildResponse
(
"-2"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThought
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContract
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
// 删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
"0"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
}
/**
* 修改消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防队员"
,
notes
=
"修改消防队员"
)
@Transactional
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
// BUG2168 居住地户籍所在地为空判断 bykongfm
if
(
firefighter
.
getResidenceDetails
()
!=
null
)
{
FeignClientResult
<
RegionModel
>
region
=
Systemctl
.
regionClient
.
getRegion
(
Long
.
parseLong
(
firefighter
.
getResidenceDetails
()));
firefighter
.
setResidence
(
region
.
getResult
().
getRegionName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
if
(
firefighter
.
getJobTitleCode
()
!=
null
){
DataDictionary
gwmc
=
dataDictionaryService
.
getByCode
(
firefighter
.
getJobTitleCode
(),
"GWMC"
);
firefighter
.
setJobTitle
(
gwmc
.
getName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao end 2021-10-19*/
if
(
firefighter
.
getNativePlace
()
!=
null
)
{
FeignClientResult
<
RegionModel
>
nativePlace
=
Systemctl
.
regionClient
.
getRegion
(
Long
.
parseLong
(
firefighter
.
getNativePlace
()));
firefighter
.
setNativePlaceValue
(
nativePlace
.
getResult
().
getRegionName
());
}
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
// 删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
@Autowired
FirefightersServiceImpl
iFirefightersService
;
@Autowired
FirefightersPostServiceImpl
iFirefightersPostService
;
@Autowired
FirefightersContactsServiceImpl
ifirefightersContactsService
;
@Autowired
FirefightersEducationServiceImpl
ifirefightersEducationService
;
@Autowired
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
FirefightersJacketServiceImpl
iFirefightersJacketService
;
@Autowired
FireTeamServiceImpl
iFireTeamService
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
DataDictionaryServiceImpl
dataDictionaryService
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
throw
new
RuntimeException
(
"系统异常"
);
}
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
/**
* 新增消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防队员"
,
notes
=
"新增消防队员"
)
@Transactional
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
if
(
firefighters
.
getFirefighters
().
getJobTitleCode
()
!=
null
&&
!
firefighters
.
getFirefighters
().
getJobTitleCode
().
equals
(
""
))
{
DataDictionary
gwmc
=
dataDictionaryService
.
getByCode
(
firefighters
.
getFirefighters
().
getJobTitleCode
(),
"GWMC"
);
firefighters
.
getFirefighters
().
setJobTitle
(
gwmc
.
getName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao end 2021-10-19*/
iFirefightersService
.
saveFirefighters
(
firefighters
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersInfoDto
);
}
}
}
/**
* 列表详情展示
*/
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@Transactional
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
//BUG 2761 判断人员删除时的逻辑 如果被选为队伍联系人则无法被删除 bykongfm
List
fireTeam
=
iFireTeamService
.
list
(
new
LambdaQueryWrapper
<
FireTeam
>().
eq
(
FireTeam:
:
getIsDelete
,
false
).
eq
(
FireTeam:
:
getContactUserId
,
id
));
if
(
fireTeam
.
size
()
>
0
)
{
return
ResponseHelper
.
buildResponse
(
"-1"
);
}
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
queryWrapper
.
eq
(
"is_delete"
,
0
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
&&
firefightersJacket
.
size
()
>
0
)
{
// BUG 2222 by litw start 2021年9月10日
return
ResponseHelper
.
buildResponse
(
"-2"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThought
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContract
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
// 删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
"0"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表详情根据id查询"
,
notes
=
"列表详情根据id查询"
)
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
}
/**
* 修改消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防队员"
,
notes
=
"修改消防队员"
)
@Transactional
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
// BUG2168 居住地户籍所在地为空判断 bykongfm
if
(
firefighter
.
getResidenceDetails
()
!=
null
)
{
FeignClientResult
<
RegionModel
>
region
=
Systemctl
.
regionClient
.
getRegion
(
Long
.
parseLong
(
firefighter
.
getResidenceDetails
()));
firefighter
.
setResidence
(
region
.
getResult
().
getRegionName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
if
(
firefighter
.
getJobTitleCode
()
!=
null
)
{
DataDictionary
gwmc
=
dataDictionaryService
.
getByCode
(
firefighter
.
getJobTitleCode
(),
"GWMC"
);
firefighter
.
setJobTitle
(
gwmc
.
getName
());
}
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao end 2021-10-19*/
if
(
firefighter
.
getNativePlace
()
!=
null
)
{
FeignClientResult
<
RegionModel
>
nativePlace
=
Systemctl
.
regionClient
.
getRegion
(
Long
.
parseLong
(
firefighter
.
getNativePlace
()));
firefighter
.
setNativePlaceValue
(
nativePlace
.
getResult
().
getRegionName
());
}
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
// 删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
QueryWrapper
<
Firefighters
>
firefightersQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Firefighters
>
aClass
=
firefighters
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
firefighters
);
if
(
o
!=
null
)
{
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
Firefighters
>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersService
.
page
(
pageBean
,
firefightersQueryWrapper
);
return
page
;
}
throw
new
RuntimeException
(
"系统异常"
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighters"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新列表分页查询"
,
notes
=
"新表分页查询"
)
public
ResponseModel
<
Page
<
FirefightersZhDto
>>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
)
{
// 条件分页
if
(
null
==
pageNum
||
null
==
pageSize
)
{
pageNum
=
1
;
pageSize
=
Integer
.
MAX_VALUE
;
}
List
<
FirefightersZhDto
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Page
<
FirefightersZhDto
>
pageBean
=
new
Page
<>(
pageNum
,
pageSize
,
num
.
get
(
"num"
));
pageBean
.
setRecords
(
list
);
return
ResponseHelper
.
buildResponse
(
pageBean
);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersInfoDto
);
}
}
/**
* 岗位树,带统计
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
/**
* 根据amos ID查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighterByAmosUserId"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据AmosId查询"
,
notes
=
"根据AmosId查询"
)
public
ResponseModel
<
Object
>
selectByAmosId
()
{
Firefighters
firefighters
=
iFirefightersService
.
selectByAmosOrgId
(
Long
.
valueOf
(
getUserId
()));
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
/**
* 列表详情展示
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表详情根据id查询"
,
notes
=
"列表详情根据id查询"
)
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
QueryWrapper
<
Firefighters
>
firefightersQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Firefighters
>
aClass
=
firefighters
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
firefighters
);
if
(
o
!=
null
)
{
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
Firefighters
>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersService
.
page
(
pageBean
,
firefightersQueryWrapper
);
return
page
;
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighters"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新列表分页查询"
,
notes
=
"新表分页查询"
)
public
ResponseModel
<
Page
<
FirefightersZhDto
>>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
)
{
// 条件分页
if
(
null
==
pageNum
||
null
==
pageSize
)
{
pageNum
=
1
;
pageSize
=
Integer
.
MAX_VALUE
;
}
List
<
FirefightersZhDto
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Page
<
FirefightersZhDto
>
pageBean
=
new
Page
<>(
pageNum
,
pageSize
,
num
.
get
(
"num"
));
pageBean
.
setRecords
(
list
);
return
ResponseHelper
.
buildResponse
(
pageBean
);
}
/**
* 岗位树,带统计
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/UserController.java
View file @
2bd57061
...
...
@@ -11,6 +11,8 @@ import java.util.TreeSet;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.feign.PushFeignServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -51,7 +53,8 @@ import com.yeejoin.amos.patrol.business.util.DepartmentUserTreeAppVo;
import
com.yeejoin.amos.patrol.business.util.DepartmentUserTreeWebVo
;
import
com.yeejoin.amos.patrol.business.util.DesUtil
;
import
com.yeejoin.amos.patrol.business.util.StringUtil
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.jpush.AppMessagePushService
;
...
...
@@ -70,7 +73,7 @@ import io.swagger.annotations.ApiParam;
public
class
UserController
extends
AbstractBaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserController
.
class
);
@Autowired
private
IAppService
iAppService
;
@Autowired
...
...
@@ -102,55 +105,55 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryDeptUser"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryDeptUser
(
@RequestParam
(
value
=
"deptId"
,
required
=
false
)
String
deptId
)
{
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
deptId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
if
(
"-1"
.
equals
(
deptId
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
dep
=
reginParams
.
getCompany
().
getSequenceNbr
().
toString
();
//查询没有部门的人员信息
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
dep
);
List
children
=
(
List
)
companyModel
.
getChildren
();
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
if
(
"其他"
.
equals
((
map
.
get
(
"departmentName"
).
toString
())))
{
List
<
LinkedHashMap
<
String
,
Object
>>
user1
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
map
.
get
(
"userModelList"
);
for
(
int
j
=
0
;
j
<
user1
.
size
();
j
++)
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"key"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"value"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"name"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"mobile"
)))
{
user
.
put
(
"mobile"
,
user1
.
get
(
j
).
get
(
"mobile"
).
toString
());
}
else
{
user
.
put
(
"mobile"
,
""
);
}
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"landlinePhone"
)))
{
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
deptId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
if
(
"-1"
.
equals
(
deptId
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
dep
=
reginParams
.
getCompany
().
getSequenceNbr
().
toString
();
//查询没有部门的人员信息
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
dep
);
List
children
=
(
List
)
companyModel
.
getChildren
();
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
if
(
"其他"
.
equals
((
map
.
get
(
"departmentName"
).
toString
())))
{
List
<
LinkedHashMap
<
String
,
Object
>>
user1
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
map
.
get
(
"userModelList"
);
for
(
int
j
=
0
;
j
<
user1
.
size
();
j
++)
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"key"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"value"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"name"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"mobile"
)))
{
user
.
put
(
"mobile"
,
user1
.
get
(
j
).
get
(
"mobile"
).
toString
());
}
else
{
user
.
put
(
"mobile"
,
""
);
}
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"landlinePhone"
)))
{
user
.
put
(
"telephone"
,
user1
.
get
(
j
).
get
(
"landlinePhone"
).
toString
());
}
else
{
}
else
{
user
.
put
(
"telephone"
,
""
);
}
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
}
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
}
}
}
}
else
{
userList
=
paraseData
(
userModels
,
null
).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
return
CommonResponseUtil
.
success
(
userList
);
}
}
}
else
{
userList
=
paraseData
(
userModels
,
null
).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
return
CommonResponseUtil
.
success
(
userList
);
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData
(
List
<
AgencyUserModel
>
list
,
String
userNmae
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
...
...
@@ -169,7 +172,7 @@ public class UserController extends AbstractBaseController {
user
.
put
(
"mobile"
,
userModel
.
getMobile
());
user
.
put
(
"telephone"
,
userModel
.
getLandlinePhone
());
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
userList
.
add
(
user
);
}
}
...
...
@@ -185,7 +188,7 @@ public class UserController extends AbstractBaseController {
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
.
getCompany
().
getSequenceNbr
().
toString
());
List
children
=
(
List
)
companyModel
.
getChildren
();
List
<
DepartmentUserTreeWebVo
>
list
=
Lists
.
newArrayList
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
loginOrgCode
=
getOrgCode
(
reginParams
);
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
));
...
...
@@ -198,7 +201,7 @@ public class UserController extends AbstractBaseController {
deptTreeWeb
.
setTitle
(
map
.
get
(
"departmentName"
).
toString
());
deptTreeWeb
.
setValue
(
map
.
get
(
"sequenceNbr"
).
toString
());
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"userModelList"
)))
{
List
userModalList
=
(
List
)
((
List
)
map
.
get
(
"userModelList"
)).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
userModalList
=
(
List
)
((
List
)
map
.
get
(
"userModelList"
)).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
deptTreeWeb
.
setUserModelList
(
userModalList
);
}
...
...
@@ -206,9 +209,9 @@ public class UserController extends AbstractBaseController {
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
buildUserDeptTreeForWebBefore
(
list
,
childrens
);
}
list
=
buildUserDeptTreeForWeb
(
list
);
list
=
buildUserDeptTreeForWeb
(
list
);
}
}
return
CommonResponseUtil
.
success
(
list
);
}
...
...
@@ -220,34 +223,35 @@ public class UserController extends AbstractBaseController {
*/
private
List
<
DepartmentUserTreeWebVo
>
buildUserDeptTreeForWeb
(
List
<
DepartmentUserTreeWebVo
>
list
)
{
list
.
forEach
(
x
->
{
List
<
DepartmentUserTreeWebVo
>
users
=
Lists
.
newArrayList
();
if
(!
ObjectUtils
.
isEmpty
(
x
.
getUserModelList
()))
{
List
<
DepartmentUserTreeWebVo
>
collects
=
x
.
getUserModelList
().
stream
().
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
userModelList
=
(
List
)
collects
;
userModelList
.
forEach
(
userModel
->
{
DepartmentUserTreeWebVo
userTreeWeb
=
new
DepartmentUserTreeWebVo
();
userTreeWeb
.
setType
(
"user"
);
userTreeWeb
.
setKey
(
userModel
.
get
(
"userId"
).
toString
()+
"*"
+
x
.
getValue
()+
"*"
+
UUID
.
randomUUID
().
toString
());
userTreeWeb
.
setLabel
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setTitle
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setValue
(
userModel
.
get
(
"userId"
).
toString
()+
"*"
+
x
.
getValue
()+
"*"
+
UUID
.
randomUUID
().
toString
());
users
.
add
(
userTreeWeb
);
x
->
{
List
<
DepartmentUserTreeWebVo
>
users
=
Lists
.
newArrayList
();
if
(!
ObjectUtils
.
isEmpty
(
x
.
getUserModelList
()))
{
List
<
DepartmentUserTreeWebVo
>
collects
=
x
.
getUserModelList
().
stream
().
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
userModelList
=
(
List
)
collects
;
userModelList
.
forEach
(
userModel
->
{
DepartmentUserTreeWebVo
userTreeWeb
=
new
DepartmentUserTreeWebVo
();
userTreeWeb
.
setType
(
"user"
);
userTreeWeb
.
setKey
(
userModel
.
get
(
"userId"
).
toString
()
+
"*"
+
x
.
getValue
()
+
"*"
+
UUID
.
randomUUID
().
toString
());
userTreeWeb
.
setLabel
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setTitle
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setValue
(
userModel
.
get
(
"userId"
).
toString
()
+
"*"
+
x
.
getValue
()
+
"*"
+
UUID
.
randomUUID
().
toString
());
users
.
add
(
userTreeWeb
);
}
);
x
.
setChildren
(
users
);
collects
.
clear
();
x
.
setUserModelList
(
collects
);
}
);
x
.
setChildren
(
users
);
collects
.
clear
();
x
.
setUserModelList
(
collects
);
}
}
}
);
return
list
;
}
/**
* 部门数据预处理(获取所有子节点)
*
...
...
@@ -286,9 +290,6 @@ public class UserController extends AbstractBaseController {
}
/**
* 查询用户权限人员
*
...
...
@@ -317,11 +318,11 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryDeptUserTree"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryDeptUserTree
()
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
departmentId
=
getDepartmentId
(
reginParams
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
paraseData
(
userModels
,
null
);
return
CommonResponseUtil
.
success
(
userList
);
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
departmentId
=
getDepartmentId
(
reginParams
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
paraseData
(
userModels
,
null
);
return
CommonResponseUtil
.
success
(
userList
);
}
/**
...
...
@@ -335,123 +336,120 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryUserAddressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryUserAddressListTree
(
@ApiParam
(
value
=
"用户名"
,
required
=
false
)
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
DepartmentUserTreeAppVo
departmentUserTreeDto
=
new
DepartmentUserTreeAppVo
();
if
(
arr
!=
null
&&
arr
.
size
()
>
0
)
{
buildUserDeptTree
(
departmentUserTreeDto
,
arr
);
}
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
//数据重新封装
List
<
DepartmentUserTreeAppVo
>
list
=
departmentUserTreeDto
.
getChildren
();
LinkedHashMap
<
String
,
Object
>
otherDept1
=
new
LinkedHashMap
<>();
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
list
)
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
if
(
"其他"
.
equals
(
departmentUserTreeAppVo
.
getName
())){
otherDept1
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
"其他"
,
"-1"
,
userName
));
otherDept1
.
put
(
"id"
,
-
1
);
otherDept1
.
put
(
"key"
,
-
1
);
otherDept1
.
put
(
"value"
,
-
1
);
otherDept1
.
put
(
"state"
,
"open"
);
otherDept1
.
put
(
"type"
,
"department"
);
otherDept1
.
put
(
"label"
,
"其他"
);
otherDept1
.
put
(
"title"
,
"其他"
);
otherDept1
.
put
(
"name"
,
"其他"
);
otherDept1
.
put
(
"desc"
,
"其他"
);
otherDept1
.
put
(
"writeable"
,
0
);
otherDept1
.
put
(
"attributes"
,
""
);
}
else
{
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
userName
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
}
if
(
otherDept1
!=
null
){
content
.
add
(
otherDept1
);
}
return
CommonResponseUtil
.
success
(
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"通讯录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
DepartmentUserTreeAppVo
departmentUserTreeDto
=
new
DepartmentUserTreeAppVo
();
if
(
arr
!=
null
&&
arr
.
size
()
>
0
)
{
buildUserDeptTree
(
departmentUserTreeDto
,
arr
);
}
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
//数据重新封装
List
<
DepartmentUserTreeAppVo
>
list
=
departmentUserTreeDto
.
getChildren
();
LinkedHashMap
<
String
,
Object
>
otherDept1
=
new
LinkedHashMap
<>();
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
list
)
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
if
(
"其他"
.
equals
(
departmentUserTreeAppVo
.
getName
()))
{
otherDept1
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
"其他"
,
"-1"
,
userName
));
otherDept1
.
put
(
"id"
,
-
1
);
otherDept1
.
put
(
"key"
,
-
1
);
otherDept1
.
put
(
"value"
,
-
1
);
otherDept1
.
put
(
"state"
,
"open"
);
otherDept1
.
put
(
"type"
,
"department"
);
otherDept1
.
put
(
"label"
,
"其他"
);
otherDept1
.
put
(
"title"
,
"其他"
);
otherDept1
.
put
(
"name"
,
"其他"
);
otherDept1
.
put
(
"desc"
,
"其他"
);
otherDept1
.
put
(
"writeable"
,
0
);
otherDept1
.
put
(
"attributes"
,
""
);
}
else
{
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
userName
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
}
}
if
(
otherDept1
!=
null
)
{
content
.
add
(
otherDept1
);
}
return
CommonResponseUtil
.
success
(
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"通讯录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData1
(
String
toke
,
String
product
,
String
appKey
,
List
<
DepartmentUserTreeAppVo
>
map
,
String
name
,
String
depid
,
String
username
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
if
(
map
!=
null
&&
map
.
size
()>
0
)
{
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
map
)
{
if
(
"dept"
.
equals
(
departmentUserTreeAppVo
.
getType
()))
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
username
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
else
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"type"
,
"user"
);
user
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"depid"
,
depid
);
//获取电话邮箱
Map
<
String
,
String
>
userObj
=
departmentUserTreeAppVo
.
getObject
();
if
(
userObj
!=
null
&&
userObj
.
get
(
"telephone"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"telephone"
));
}
else
{
user
.
put
(
"mobile"
,
""
);
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"email"
)
!=
null
)
{
user
.
put
(
"email"
,
userObj
.
get
(
"email"
));
}
else
{
user
.
put
(
"email"
,
""
);
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"mobile"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"mobile"
));
}
else
{
user
.
put
(
"mobile"
,
""
);
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData1
(
String
toke
,
String
product
,
String
appKey
,
List
<
DepartmentUserTreeAppVo
>
map
,
String
name
,
String
depid
,
String
username
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
map
)
{
if
(
"dept"
.
equals
(
departmentUserTreeAppVo
.
getType
()))
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
username
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
else
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"type"
,
"user"
);
user
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"depid"
,
depid
);
//获取电话邮箱
Map
<
String
,
String
>
userObj
=
departmentUserTreeAppVo
.
getObject
();
if
(
userObj
!=
null
&&
userObj
.
get
(
"telephone"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"telephone"
));
}
else
{
user
.
put
(
"mobile"
,
""
);
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"email"
)
!=
null
)
{
user
.
put
(
"email"
,
userObj
.
get
(
"email"
));
}
else
{
user
.
put
(
"email"
,
""
);
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"mobile"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"mobile"
));
}
else
{
user
.
put
(
"mobile"
,
""
);
}
// AgencyUserModel userdate=remoteSecurityService.getUserById( toke, product, appKey, departmentUserTreeAppVo.getId());
// if(userdate!=null){
// user.put("telephone", userdate.getLandlinePhone());
...
...
@@ -460,19 +458,19 @@ public class UserController extends AbstractBaseController {
// }else{
// user.put("mobile", "");
// }
user
.
put
(
"departmentName"
,
name
);
if
(
username
!=
null
&&!
""
.
equals
(
username
))
{
if
(!
ObjectUtils
.
isEmpty
(
departmentUserTreeAppVo
.
getName
())
&&
departmentUserTreeAppVo
.
getName
().
indexOf
(
username
)
!=
-
1
)
{
content
.
add
(
user
);
}
}
else
{
content
.
add
(
user
);
}
}
}
return
content
;
}
return
null
;
user
.
put
(
"departmentName"
,
name
);
if
(
username
!=
null
&&
!
""
.
equals
(
username
))
{
if
(!
ObjectUtils
.
isEmpty
(
departmentUserTreeAppVo
.
getName
())
&&
departmentUserTreeAppVo
.
getName
().
indexOf
(
username
)
!=
-
1
)
{
content
.
add
(
user
);
}
}
else
{
content
.
add
(
user
);
}
}
}
return
content
;
}
return
null
;
}
...
...
@@ -494,19 +492,19 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"用户登录成功之后数据初始化(<font color='blue'>手机app</font>)"
,
notes
=
"用户登录成功之后数据初始化"
)
@RequestMapping
(
value
=
"/initData"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
initUserApp
()
{
try
{
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
getToken
(),
getProduct
(),
getAppKey
(),
appType
);
if
(!
secResponse
.
isSuccess
())
{
return
CommonResponseUtil
.
failure
(
"权限获取失败"
);
}
List
<
LinkedHashMap
<
String
,
Object
>>
response
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
resp
=
new
HashMap
<>();
resp
.
put
(
"permissionitems"
,
secResponse
.
getDataList
());
resp
.
put
(
"companys"
,
response
);
return
CommonResponseUtil
.
success
(
resp
);
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"数据初始化失败"
);
}
try
{
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
getToken
(),
getProduct
(),
getAppKey
(),
appType
);
if
(!
secResponse
.
isSuccess
())
{
return
CommonResponseUtil
.
failure
(
"权限获取失败"
);
}
List
<
LinkedHashMap
<
String
,
Object
>>
response
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
resp
=
new
HashMap
<>();
resp
.
put
(
"permissionitems"
,
secResponse
.
getDataList
());
resp
.
put
(
"companys"
,
response
);
return
CommonResponseUtil
.
success
(
resp
);
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"数据初始化失败"
);
}
}
/**
...
...
@@ -533,7 +531,7 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"通讯录"
,
notes
=
"通讯录"
)
@RequestMapping
(
value
=
"/mobile/addressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
addressList
()
{
try
{
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
...
...
@@ -551,14 +549,6 @@ public class UserController extends AbstractBaseController {
}
private
void
buildUserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
JSONObject
json
=
childs
.
getJSONObject
(
i
);
...
...
@@ -571,33 +561,33 @@ public class UserController extends AbstractBaseController {
buildUserDeptTree
(
treeDto
,
childrens
);
}
JSONArray
userModelList
=
json
.
getJSONArray
(
"userModelList"
);
if
(
userModelList
!=
null
&&
userModelList
.
size
()
>
0
)
{
if
(
userModelList
!=
null
&&
userModelList
.
size
()
>
0
)
{
List
<
HashMap
>
modelList
=
JSONObject
.
parseArray
(
userModelList
.
toJSONString
(),
HashMap
.
class
);
modelList
=
modelList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
userModelList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
modelList
));
UserDeptTree
(
treeDto
,
userModelList
);
modelList
=
modelList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
userModelList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
modelList
));
UserDeptTree
(
treeDto
,
userModelList
);
}
deptUser
.
getChildren
().
add
(
treeDto
);
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
//部门下用户
private
void
UserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
JSONObject
json
=
childs
.
getJSONObject
(
i
);
DepartmentUserTreeAppVo
treeDto
=
new
DepartmentUserTreeAppVo
();
treeDto
.
setName
(
json
.
getString
(
"realName"
));
treeDto
.
setId
(
json
.
getString
(
"userId"
));
//treeDto.setType(json.getString("level"));
treeDto
.
setType
(
"user"
);
// JSONObject object = json.getJSONObject("object");
Map
<
String
,
String
>
user
=
Maps
.
newHashMap
();
user
.
put
(
"mobile"
,
json
.
getString
(
"mobile"
));
user
.
put
(
"telephone"
,
json
.
getString
(
"landlinePhone"
));
user
.
put
(
"email"
,
json
.
getString
(
"email"
));
treeDto
.
setObject
(
user
);
// JSONObject object = json.getJSONObject("object");
Map
<
String
,
String
>
user
=
Maps
.
newHashMap
();
user
.
put
(
"mobile"
,
json
.
getString
(
"mobile"
));
user
.
put
(
"telephone"
,
json
.
getString
(
"landlinePhone"
));
user
.
put
(
"email"
,
json
.
getString
(
"email"
));
treeDto
.
setObject
(
user
);
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
...
...
@@ -609,42 +599,42 @@ public class UserController extends AbstractBaseController {
@PostMapping
(
value
=
"/mobile/login"
)
public
CommonResponse
mobileLogin
(
@ApiParam
(
value
=
"账号"
,
required
=
true
)
@RequestBody
AppLoginUserParam
param
)
{
try
{
JSONObject
jsonObject
=
null
;
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
param
.
getUserName
());
dPasswordAuthModel
.
setPassword
(
DesUtil
.
decode
(
param
.
getPassword
(),
"yeejoin"
));
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
productApp
);
HttpEntity
httpEntity
=
new
HttpEntity
<>(
dPasswordAuthModel
,
headers
);
FeignClientResult
feignClientResult
=
restTemplate
.
postForObject
(
"http://"
+
SecurityName
+
"/privilege/v1/auth/idpassword"
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getStatus
()
==
200
)
{
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"product"
,
productApp
);
String
jsonStr
=
JSON
.
toJSONString
(
map
);
jsonObject
=
JSONObject
.
parseObject
(
jsonStr
);
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getMessage
());
}
if
(
jsonObject
!=
null
)
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"token"
,
jsonObject
.
getString
(
"token"
));
result
.
put
(
"userId"
,
jsonObject
.
getString
(
"userId"
));
result
.
put
(
"appKey"
,
jsonObject
.
getString
(
"appKey"
));
result
.
put
(
"product"
,
jsonObject
.
getString
(
"product"
));
result
.
put
(
"jpushUserKey"
,
param
.
getUserName
());
JSONObject
jsonObject
=
null
;
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
param
.
getUserName
());
dPasswordAuthModel
.
setPassword
(
DesUtil
.
decode
(
param
.
getPassword
(),
"yeejoin"
));
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
productApp
);
HttpEntity
httpEntity
=
new
HttpEntity
<>(
dPasswordAuthModel
,
headers
);
FeignClientResult
feignClientResult
=
restTemplate
.
postForObject
(
"http://"
+
SecurityName
+
"/privilege/v1/auth/idpassword"
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getStatus
()
==
200
)
{
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"product"
,
productApp
);
String
jsonStr
=
JSON
.
toJSONString
(
map
);
jsonObject
=
JSONObject
.
parseObject
(
jsonStr
);
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getMessage
());
}
if
(
jsonObject
!=
null
)
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"token"
,
jsonObject
.
getString
(
"token"
));
result
.
put
(
"userId"
,
jsonObject
.
getString
(
"userId"
));
result
.
put
(
"appKey"
,
jsonObject
.
getString
(
"appKey"
));
result
.
put
(
"product"
,
jsonObject
.
getString
(
"product"
));
result
.
put
(
"jpushUserKey"
,
param
.
getUserName
());
// //删除别名关联设备
// CommonResponse commonResponse=PushFeign.PushDevice(appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return
CommonResponseUtil
.
success
(
result
);
}
return
CommonResponseUtil
.
failure
(
"登录失败"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"APP登录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
return
CommonResponseUtil
.
success
(
result
);
}
return
CommonResponseUtil
.
failure
(
"登录失败"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"APP登录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
/**
...
...
@@ -654,17 +644,17 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"APP登出"
,
notes
=
"APP登出"
)
@PostMapping
(
value
=
"/mobile/loginOut"
)
public
CommonResponse
mobileLoginOut
()
{
try
{
try
{
// if (remoteSecurityService.loginOutFromApp(getToken(), getProduct(), getAppKey())) {
// return CommonResponseUtil.success();
// } else {
// return CommonResponseUtil.failure("APP登出失败");
// }
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"APP登出异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"APP登出异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
/**
...
...
@@ -673,70 +663,72 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"获取公司选择信息"
,
notes
=
"获取公司选择信息"
)
@GetMapping
(
value
=
"/selectInfo"
)
public
CommonResponse
selectInfo
()
{
try
{
JSONObject
result
=
new
JSONObject
();
AgencyUserModel
user
=
getUserInfo
();
if
(
user
!=
null
)
{
List
<
CompanyModel
>
list
=
user
.
getCompanys
().
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CompanyModel:
:
getSequenceNbr
))),
ArrayList:
:
new
));
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapdate
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
List
<
Map
>
listCompanyModel
=
new
ArrayList
();
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
for
(
CompanyModel
article
:
list
)
{
Map
<
String
,
Object
>
map
=
objectToMap
(
article
);
map
.
put
(
"companySeq"
,
map
.
get
(
"companySeq"
)+
""
);
map
.
put
(
"parentId"
,
map
.
get
(
"parentId"
)+
""
);
listCompanyModel
.
add
(
map
);
long
key
=
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
());
List
<
DepartmentModel
>
listdep
=
mapDepartments
.
get
(
key
);
List
<
Map
<
String
,
Object
>>
dep
=
new
ArrayList
();
for
(
DepartmentModel
departmentModel
:
listdep
)
{
if
(
departmentModel
!=
null
)
{
Map
<
String
,
Object
>
mapo
=
objectToMap
(
departmentModel
);
mapo
.
put
(
"sequenceNbr"
,
mapo
.
get
(
"sequenceNbr"
).
toString
());
dep
.
add
(
mapo
);
}
}
mapdate
.
put
(
map
.
get
(
"sequenceNbr"
).
toString
(),
dep
);
}
}
result
.
put
(
"companys"
,
listCompanyModel
);
result
.
put
(
"orgRoles"
,
user
.
getOrgRoles
());
result
.
put
(
"companyDepartments"
,
mapdate
);
return
CommonResponseUtil
.
success
(
result
);
}
return
CommonResponseUtil
.
failure
(
"请重新登录"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取公司选择信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
try
{
JSONObject
result
=
new
JSONObject
();
AgencyUserModel
user
=
getUserInfo
();
if
(
user
!=
null
)
{
List
<
CompanyModel
>
list
=
user
.
getCompanys
().
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CompanyModel:
:
getSequenceNbr
))),
ArrayList:
:
new
));
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapdate
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
List
<
Map
>
listCompanyModel
=
new
ArrayList
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
CompanyModel
article
:
list
)
{
Map
<
String
,
Object
>
map
=
objectToMap
(
article
);
map
.
put
(
"companySeq"
,
map
.
get
(
"companySeq"
)
+
""
);
map
.
put
(
"parentId"
,
map
.
get
(
"parentId"
)
+
""
);
listCompanyModel
.
add
(
map
);
long
key
=
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
());
List
<
DepartmentModel
>
listdep
=
mapDepartments
.
get
(
key
);
List
<
Map
<
String
,
Object
>>
dep
=
new
ArrayList
();
for
(
DepartmentModel
departmentModel
:
listdep
)
{
if
(
departmentModel
!=
null
)
{
Map
<
String
,
Object
>
mapo
=
objectToMap
(
departmentModel
);
mapo
.
put
(
"sequenceNbr"
,
mapo
.
get
(
"sequenceNbr"
).
toString
());
dep
.
add
(
mapo
);
}
}
mapdate
.
put
(
map
.
get
(
"sequenceNbr"
).
toString
(),
dep
);
}
}
result
.
put
(
"companys"
,
listCompanyModel
);
result
.
put
(
"orgRoles"
,
user
.
getOrgRoles
());
result
.
put
(
"companyDepartments"
,
mapdate
);
return
CommonResponseUtil
.
success
(
result
);
}
return
CommonResponseUtil
.
failure
(
"请重新登录"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取公司选择信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
//对象转map
public
static
Map
<
String
,
Object
>
objectToMap
(
Object
obj
)
throws
IllegalAccessException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
obj
!=
null
)
{
Class
<?>
clazz
=
obj
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
Object
value
=
nvl
(
field
.
get
(
obj
));
map
.
put
(
fieldName
,
value
);
}
return
map
;
}
return
map
;
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
obj
!=
null
)
{
Class
<?>
clazz
=
obj
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
Object
value
=
nvl
(
field
.
get
(
obj
));
map
.
put
(
fieldName
,
value
);
}
return
map
;
}
return
map
;
}
public
static
Object
nvl
(
Object
param
)
{
return
param
!=
null
?
param
:
""
;
}
/**
* 保存登陆用户选择公司信息
*/
...
...
@@ -744,24 +736,24 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"保存登陆用户选择公司信息"
,
notes
=
"保存登陆用户选择公司信息"
)
@PostMapping
(
value
=
"/save/curCompany"
)
public
CommonResponse
saveCurCompany
(
@ApiParam
(
value
=
"当前登陆用户所选单位机构编号"
,
required
=
true
)
@RequestBody
ReginParams
reginParams
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
try
{
AgencyUserModel
user
=
getUserInfo
();
// saveSelectedOrgInfo(reginParams);
return
CommonResponseUtil
.
success
(
buildCurCompany
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
,
user
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存登陆用户选择公司信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
return
CommonResponseUtil
.
success
(
buildCurCompany
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
,
user
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存登陆用户选择公司信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
private
JSONObject
buildCurCompany
(
String
toke
,
String
product
,
String
appKey
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
private
JSONObject
buildCurCompany
(
String
toke
,
String
product
,
String
appKey
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"userId"
,
user
.
getUserId
());
result
.
put
(
"realName"
,
user
.
getRealName
());
result
.
put
(
"userMobile"
,
user
.
getMobile
());
result
.
put
(
"userName"
,
user
.
getUserName
());
result
.
put
(
"email"
,
user
.
getEmail
());
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
Long
.
valueOf
(
reginParams
.
getRole
().
getSequenceNbr
()),
toke
,
product
,
appKey
,
appType
);
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
Long
.
valueOf
(
reginParams
.
getRole
().
getSequenceNbr
()),
toke
,
product
,
appKey
,
appType
);
if
(
secResponse
.
isSuccess
()
&&
secResponse
.
getDataList
()
!=
null
)
{
JSONArray
arr
=
JSON
.
parseArray
(
JSONArray
.
toJSONString
(
secResponse
.
getDataList
()));
Map
<
String
,
JSONObject
>
map
=
Maps
.
newHashMap
();
...
...
@@ -813,36 +805,37 @@ public class UserController extends AbstractBaseController {
@GetMapping
(
value
=
"/editPassword"
)
public
CommonResponse
editPassword
(
@ApiParam
(
value
=
"旧密码"
,
required
=
true
)
@RequestParam
String
password
,
@ApiParam
(
value
=
"新密码"
,
required
=
true
)
@RequestParam
String
newPassword
)
{
AgencyUserModel
userModel
=
getUserInfo
();
boolean
flag
=
false
;
if
(
password
.
equals
(
newPassword
))
{
return
CommonResponseUtil
.
failure
(
"新密码不能跟旧密码相同!"
);
AgencyUserModel
userModel
=
getUserInfo
();
boolean
flag
=
false
;
if
(
password
.
equals
(
newPassword
))
{
return
CommonResponseUtil
.
failure
(
"新密码不能跟旧密码相同!"
);
}
try
{
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
agencyUserModel
.
setPassword
(
newPassword
);
agencyUserModel
.
setRePassword
(
newPassword
);
agencyUserModel
.
setOriginalPassword
(
password
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"appKey"
,
getAppKey
());
HttpEntity
httpEntity
=
new
HttpEntity
<>(
agencyUserModel
,
headers
);
ResponseEntity
<
FeignClientResult
>
feignClientResult
=
restTemplate
.
exchange
(
"http://"
+
SecurityName
+
"/privilege/v1/agencyuser/"
+
userModel
.
getUserId
()+
"/password"
,
HttpMethod
.
PUT
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getBody
().
getStatus
()
==
200
)
{
CommonResponse
dates
=
CommonResponseUtil
.
success
();
dates
.
setMessage
(
"修改成功!"
);
return
dates
;
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getBody
().
getMessage
());
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"修改密码异常"
,
e
);
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"appKey"
,
getAppKey
());
HttpEntity
httpEntity
=
new
HttpEntity
<>(
agencyUserModel
,
headers
);
ResponseEntity
<
FeignClientResult
>
feignClientResult
=
restTemplate
.
exchange
(
"http://"
+
SecurityName
+
"/privilege/v1/agencyuser/"
+
userModel
.
getUserId
()
+
"/password"
,
HttpMethod
.
PUT
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getBody
().
getStatus
()
==
200
)
{
CommonResponse
dates
=
CommonResponseUtil
.
success
();
dates
.
setMessage
(
"修改成功!"
);
return
dates
;
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getBody
().
getMessage
());
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"修改密码异常"
,
e
);
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
View file @
2bd57061
...
...
@@ -15,7 +15,7 @@ import java.util.Map;
@RuleFact
(
value
=
"消防巡查"
,
project
=
"消息规则"
)
public
class
MsgRo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4210693601552557441
L
;
private
static
final
long
serialVersionUID
=
-
2766051871044757100
L
;
@Label
(
"名称"
)
private
String
name
;
...
...
@@ -47,4 +47,7 @@ public class MsgRo implements Serializable {
@Label
(
value
=
"扩展参数"
)
private
Map
<
String
,
String
>
extras
;
@Label
(
value
=
"类别"
)
private
Integer
category
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/RulePlanService.java
View file @
2bd57061
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
...
...
@@ -38,6 +39,7 @@ public class RulePlanService {
msgRo
.
setExtras
(
pushMsgParam
.
getExtras
());
msgRo
.
setIsSendApp
(
true
);
msgRo
.
setIsSendWeb
(
true
);
msgRo
.
setCategory
(
RuleConstant
.
NOTIFY
);
//触发规则
try
{
ruleTrigger
.
publish
(
msgRo
,
packageId
,
new
String
[
0
]);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/ElevatorServiceImpl.java
View file @
2bd57061
...
...
@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.module.tzs.api.entity.ElevatorInsure
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.ElevatorInsureRelation
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.ElevatorMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorInsureRelationService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService
;
...
...
@@ -209,8 +210,8 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
temp
.
setType
(
"image"
);
temp
.
setUrl
(
filePath
);
qrCode
.
add
(
temp
);
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
new
HashMap
<>(
);
attachmentMap
.
put
(
"qrCode"
,
qrCode
);
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
elevatorId
);
attachmentMap
.
put
(
TzsCommonParam
.
QR_CODE
,
qrCode
);
sourceFileService
.
saveAttachments
(
elevatorId
,
attachmentMap
);
return
filePath
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
View file @
2bd57061
...
...
@@ -267,6 +267,7 @@ public class BeanDtoVoUtils {
}
target
.
setFullAddress
(
item
.
getProvince
()
+
item
.
getCity
()
+
item
.
getDistrict
()
+
item
.
getStree
()
+
item
.
getCommunity
()
+
item
.
getAddress
());
target
.
setAdminLoginPwd
(
null
);
return
target
;
}
catch
(
Exception
e
)
{
return
null
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/UnitInfoController.java
View file @
2bd57061
...
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoChangeServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
...
@@ -81,6 +82,9 @@ public class UnitInfoController extends BaseController {
@Autowired
OrgUsrServiceImpl
iOrgUsrService
;
@Autowired
UnitInfoChangeServiceImpl
unitInfoChangeServiceImpl
;
/**
* 获取组织机构树
*
...
...
@@ -256,7 +260,7 @@ public class UnitInfoController extends BaseController {
if
(
ValidationUtil
.
isEmpty
(
sequenceNbr
)
)
{
throw
new
BadRequest
(
"参数校验失败."
);
}
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getDtoById
(
sequenceNbr
));
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
get
UnIt
DtoById
(
sequenceNbr
));
}
...
...
@@ -395,7 +399,14 @@ public class UnitInfoController extends BaseController {
for
(
CompanyModel
c
:
companys
)
{
OrgUsr
temp
=
iOrgUsrService
.
getOne
(
new
LambdaQueryWrapper
<
OrgUsr
>().
eq
(
OrgUsr:
:
getIsDelete
,
false
).
eq
(
OrgUsr:
:
getAmosOrgId
,
c
.
getSequenceNbr
()));
if
(
temp
!=
null
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getDtoByOrgId
(
temp
.
getSequenceNbr
()));
// 企业信息查看判断是否变更 如果变更信息则返回变更中信息
result
=
unitInfoServiceImpl
.
getDtoByOrgId
(
temp
.
getSequenceNbr
());
if
(
result
.
getIsChange
()
&&
result
.
getUnitStatus
()
==
0
)
{
result
=
unitInfoChangeServiceImpl
.
findLastChangInfo
(
temp
.
getSequenceNbr
());
}
return
ResponseHelper
.
buildResponse
(
result
);
}
}
return
ResponseHelper
.
buildResponse
(
result
);
...
...
@@ -403,4 +414,38 @@ public class UnitInfoController extends BaseController {
/**
* 变更企业表
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/change"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"变更企业表"
,
notes
=
"变更企业表"
)
public
ResponseModel
<
UnitInfoDto
>
change
(
@RequestBody
UnitInfoDto
model
)
{
model
=
unitInfoServiceImpl
.
changeUnInfo
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 查询审批数据
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/approve/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询审批数据"
,
notes
=
"查询审批数据"
)
public
ResponseModel
<
UnitInfoDto
>
getApproveInfo
(
@PathVariable
Long
sequenceNbr
)
{
if
(
ValidationUtil
.
isEmpty
(
sequenceNbr
)
)
{
throw
new
BadRequest
(
"参数校验失败."
);
}
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getDtoById
(
sequenceNbr
));
}
}
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/UnitInfoChangeServiceImpl.java
View file @
2bd57061
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoChangeDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfoChange
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.UnitInfoChangeMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitInfoChangeService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.List
;
...
...
@@ -18,6 +23,10 @@ import java.util.List;
*/
@Service
public
class
UnitInfoChangeServiceImpl
extends
BaseService
<
UnitInfoChangeDto
,
UnitInfoChange
,
UnitInfoChangeMapper
>
implements
IUnitInfoChangeService
{
@Autowired
IUnitInfoService
iUnitInfoService
;
/**
* 分页查询
*/
...
...
@@ -31,4 +40,22 @@ public class UnitInfoChangeServiceImpl extends BaseService<UnitInfoChangeDto, Un
public
List
<
UnitInfoChangeDto
>
queryForFlcUnitInfoChangeList
()
{
return
this
.
queryForList
(
""
,
false
);
}
/**
* 根据源码id 返回最新的变更记录
* @param sourceId
* @return
*/
@Override
public
UnitInfoDto
findLastChangInfo
(
Long
sourceId
)
{
UnitInfoChange
result
;
List
<
UnitInfoChange
>
changInfoList
=
this
.
list
(
new
LambdaQueryWrapper
<
UnitInfoChange
>().
eq
(
UnitInfoChange:
:
getIsDelete
,
false
).
eq
(
UnitInfoChange:
:
getSourceId
,
sourceId
).
orderByDesc
(
UnitInfoChange:
:
getRecDate
));
if
(
changInfoList
!=
null
&&
changInfoList
.
size
()
>
0
)
{
result
=
changInfoList
.
get
(
0
);
}
else
{
throw
new
BadRequest
(
"未找到变更记录"
);
}
return
iUnitInfoService
.
unitChangeInfoToDto
(
result
);
}
}
\ No newline at end of file
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/UnitInfoServiceImpl.java
View file @
2bd57061
...
...
@@ -83,6 +83,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
SourceFileServiceImpl
sourceFileService
;
@Transactional
public
UnitInfoDto
saveUnitInfo
(
UnitInfoDto
model
)
{
tzsAuthServiceImpl
.
setRequestContext
();
...
...
@@ -150,19 +151,96 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
approveDto
.
setSourceId
(
sourceUnit
.
getSequenceNbr
());
if
(
0
==
approveStatus
)
{
// 审核通过生成二维码
Set
<
String
>
roleNameSet
=
new
HashSet
<>();
this
.
saveUnitInfoQrCode
(
sourceUnit
);
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
RoleModel
>
allRoleList
=
roleListResult
.
getResult
();
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
List
<
Long
>
roleIds
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
content
))
{
content
=
"通过"
;
}
sourceUnit
.
setUnitStatus
(
1
);
if
(
changeFlag
)
{
// 如果是变更单 需要把 变更数据覆盖到原单子 预留(确定字段)
changeUnit
.
setUnitStatus
(
1
);
// 变更单全覆盖原单
Long
sourceId
=
sourceUnit
.
getSequenceNbr
();
BeanUtils
.
copyProperties
(
changeUnit
,
sourceUnit
);
sourceUnit
.
setSequenceNbr
(
sourceId
);
unitInfoChangeServiceImpl
.
updateById
(
changeUnit
);
// 更新企业信息 org_user 信息 及管理员信息
}
else
{
// 如果是审批单 创建用户 创建组织机构 赋权等
// 根据unitTypeCode 获取应用和 角色
String
unitTypeCode
=
sourceUnit
.
getUnitTypeCode
();
String
[]
unitTypeCodes
=
unitTypeCode
.
split
(
","
);
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqsMap
=
new
HashMap
<>();
for
(
String
code
:
unitTypeCodes
)
{
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
code
));
String
appCode
=
unitType
.
getTypeDesc
();
String
[]
appCodes
=
appCode
.
split
(
","
);
for
(
String
tempCode
:
appCodes
)
{
appCodesSet
.
add
(
tempCode
);
}
roleNameSet
.
add
(
unitType
.
getName
());
}
allRoleList
.
stream
().
forEach
(
t
->
{
if
(
roleNameSet
.
contains
(
t
.
getRoleName
()))
{
userRoleList
.
add
(
t
);
}
});
userRoleList
.
stream
().
forEach
(
r
->
{
roleIds
.
add
(
r
.
getSequenceNbr
());
});
// orguser
OrgUsr
org
=
iOrgUsrService
.
getById
(
sourceUnit
.
getOrgUserId
());
org
.
setBizOrgName
(
sourceUnit
.
getOrgName
());
iOrgUsrService
.
updateById
(
org
);
// company
CompanyModel
companyInfo
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
parseLong
(
org
.
getAmosOrgId
())).
getResult
();
companyInfo
.
setCompanyName
(
sourceUnit
.
getOrgName
());
companyInfo
.
setAddress
(
sourceUnit
.
getProvince
()
+
sourceUnit
.
getCity
()
+
sourceUnit
.
getDistrict
()
+
sourceUnit
.
getStree
()
+
sourceUnit
.
getCommunity
()
+
sourceUnit
.
getAddress
());
Privilege
.
companyClient
.
update
(
companyInfo
,
Long
.
parseLong
(
org
.
getAmosOrgId
()));
// 人员信息
AgencyUserModel
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserName
(
sourceUnit
.
getAdminLoginName
()).
getResult
();
roleSeqsMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
List
<
String
>
appCodes
=
new
ArrayList
<>(
appCodesSet
);
agencyUserModel
.
setAppCodes
(
appCodes
);
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
orgRoles
.
put
(
companyInfo
.
getSequenceNbr
(),
userRoleList
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqsMap
);
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
agencyUserModel
.
getUserId
());
// 更新附件
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
changeUnit
.
getSequenceNbr
());
// 获取附件
if
(
attachmentMap
!=
null
)
{
Map
<
String
,
List
<
AttachmentDto
>>
resultPicMap
=
new
HashMap
<>();
if
(
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
)
!=
null
)
{
resultPicMap
.
put
(
TzsCommonParam
.
LICENCE_PIC
,
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
));
}
if
(
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
)
!=
null
)
{
resultPicMap
.
put
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
,
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
));
}
ISourceFileService
.
saveAttachments
(
sourceUnit
.
getSequenceNbr
(),
resultPicMap
);
}
}
else
{
// 如果是审批单 创建用户 创建组织机构 赋权等
sourceUnit
.
setApprovedTime
(
new
Date
());
// 创建用户 创建组织机构 平台组织机构及 org_user表中 赋权
String
adminUserName
=
sourceUnit
.
getAdminName
();
...
...
@@ -195,7 +273,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
// 根据unitTypeCode 获取应用和 角色
String
unitTypeCode
=
sourceUnit
.
getUnitTypeCode
();
String
[]
unitTypeCodes
=
unitTypeCode
.
split
(
","
);
Set
<
String
>
roleNameSet
=
new
HashSet
<>();
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqsMap
=
new
HashMap
<>();
...
...
@@ -208,23 +286,20 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
roleNameSet
.
add
(
unitType
.
getName
());
}
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
// 全部角色筛选
// 获取角色
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
RoleModel
>
allRoleList
=
roleListResult
.
getResult
();
allRoleList
.
stream
().
forEach
(
t
->
{
if
(
roleNameSet
.
contains
(
t
.
getRoleName
()))
{
userRoleList
.
add
(
t
);
}
});
List
<
Long
>
roleIds
=
new
ArrayList
<>();
userRoleList
.
stream
().
forEach
(
r
->
{
roleIds
.
add
(
r
.
getSequenceNbr
());
});
roleSeqsMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
roleSeqsMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
List
<
String
>
appCodes
=
new
ArrayList
<>(
appCodesSet
);
agencyUserModel
.
setAppCodes
(
appCodes
);
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
...
...
@@ -253,16 +328,25 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
sourceUnit
.
setOrgUserId
(
org
.
getSequenceNbr
());
}
// 审核通过生成二维码
this
.
saveUnitInfoQrCode
(
sourceUnit
);
}
else
if
(
1
==
approveStatus
)
{
if
(
StringUtils
.
isEmpty
(
content
))
{
content
=
"驳回"
;
}
if
(
changeFlag
)
{
// 如果是变更单 需要把 变更数据覆盖到原单子 预留(确定字段)
changeUnit
.
setUnitStatus
(
2
);
// 变更单全覆盖原单
unitInfoChangeServiceImpl
.
updateById
(
changeUnit
);
}
sourceUnit
.
setUnitStatus
(
2
);
}
approveDto
.
setContent
(
content
);
iUnitInfoApproveServiceImpl
.
createWithModel
(
approveDto
);
if
(
this
.
updateById
(
sourceUnit
))
{
if
(
changeFlag
&&
1
==
approveStatus
)
{
// 变更不通过返回变更表数据 其他情况返回原数据
result
=
unitChangeInfoToDto
(
changeUnit
);
...
...
@@ -281,17 +365,22 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
UnitInfoDto
result
=
null
;
// 如果是变更单 同时为 审批中,默认展示变更表中最新数据
if
(
unitInfo
.
getIsChange
()
&&
unitInfo
.
getUnitStatus
()
==
0
)
{
List
<
UnitInfoChange
>
changeList
=
unitInfoChangeServiceImpl
.
list
(
new
LambdaQueryWrapper
<
UnitInfoChange
>().
eq
(
UnitInfoChange:
:
getIsDelete
,
false
).
eq
(
UnitInfoChange:
:
getSourceId
,
sequenceNbr
).
orderByDesc
(
UnitInfoChange:
:
getRecDate
));
UnitInfoChange
temp
=
changeList
.
get
(
0
);
result
=
unitChangeInfoToDto
(
temp
);
result
=
unitInfoChangeServiceImpl
.
findLastChangInfo
(
sequenceNbr
);
}
else
{
result
=
unitInfoToDto
(
unitInfo
);
}
return
result
;
}
@Override
public
UnitInfoDto
getUnItDtoById
(
Long
sequenceNbr
)
{
UnitInfo
unitInfo
=
this
.
getById
(
sequenceNbr
);
return
unitInfoToDto
(
unitInfo
);
}
private
UnitInfoDto
unitInfoToDto
(
UnitInfo
source
)
{
@Override
public
UnitInfoDto
unitInfoToDto
(
UnitInfo
source
)
{
UnitInfoDto
target
=
new
UnitInfoDto
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
...
...
@@ -322,10 +411,12 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
target
.
setFullAddress
(
source
.
getProvince
()
+
source
.
getCity
()
+
source
.
getDistrict
()
+
source
.
getStree
()
+
source
.
getCommunity
()
+
source
.
getAddress
());
target
.
setAdminLoginPwd
(
null
);
return
target
;
}
private
UnitInfoDto
unitChangeInfoToDto
(
UnitInfoChange
source
)
{
@Override
public
UnitInfoDto
unitChangeInfoToDto
(
UnitInfoChange
source
)
{
UnitInfoDto
target
=
new
UnitInfoDto
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
...
...
@@ -336,7 +427,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
else
if
(
2
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"已驳回"
);
}
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
source
.
getS
ourceId
());
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
source
.
getS
equenceNbr
());
// 获取附件信息
if
(
attachmentMap
!=
null
)
{
if
(
attachmentMap
.
get
(
TzsCommonParam
.
QR_CODE
)
!=
null
)
{
...
...
@@ -351,6 +442,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
target
.
setFullAddress
(
source
.
getProvince
()
+
source
.
getCity
()
+
source
.
getDistrict
()
+
source
.
getStree
()
+
source
.
getCommunity
()
+
source
.
getAddress
());
UnitInfo
info
=
this
.
getById
(
source
.
getSourceId
());
target
.
setAdminName
(
info
.
getAdminName
());
target
.
setAdminLoginName
(
info
.
getAdminLoginName
());
return
target
;
}
...
...
@@ -379,7 +474,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
temp
.
setType
(
"image"
);
temp
.
setUrl
(
filePath
);
qrCode
.
add
(
temp
);
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
new
HashMap
<>();
// 查询之前的附件
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
sourceUnit
.
getSequenceNbr
());
attachmentMap
.
put
(
TzsCommonParam
.
QR_CODE
,
qrCode
);
sourceFileService
.
saveAttachments
(
sourceUnit
.
getSequenceNbr
(),
attachmentMap
);
return
filePath
;
...
...
@@ -394,4 +490,60 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
return
unitInfoToDto
(
unitInfo
);
}
@Transactional
@Override
public
UnitInfoDto
changeUnInfo
(
UnitInfoDto
model
)
{
// 变更之前判断是否可以变更
UnitInfo
sourceInfo
=
this
.
getById
(
model
.
getSequenceNbr
());
if
(
sourceInfo
==
null
)
{
throw
new
BadRequest
(
"未找到原单"
);
}
if
(
sourceInfo
.
getUnitStatus
()
!=
1
)
{
throw
new
BadRequest
(
"该企业状态无法变更"
);
}
// 原表单变为 变更审核状态
sourceInfo
.
setIsChange
(
true
);
// 新增状态不是变更状态
sourceInfo
.
setUnitStatus
(
0
);
// 设置为待审核状态
this
.
updateById
(
sourceInfo
);
UnitInfoChange
targetInfo
=
new
UnitInfoChange
();
BeanUtils
.
copyProperties
(
model
,
targetInfo
);
targetInfo
.
setSequenceNbr
(
null
);
targetInfo
.
setSourceId
(
model
.
getSequenceNbr
());
targetInfo
.
setRecDate
(
new
Date
());
// 社会信用代码和管辖单位不可变
targetInfo
.
setOrganizationCode
(
sourceInfo
.
getOrganizationCode
());
targetInfo
.
setManagementUnit
(
sourceInfo
.
getManagementUnit
());
targetInfo
.
setManagementUnitId
(
sourceInfo
.
getManagementUnitId
());
targetInfo
.
setUnitStatus
(
0
);
targetInfo
.
setSubmitTime
(
sourceInfo
.
getSubmitTime
());
// targetInfo.setApprovedTime(sourceInfo.getApprovedTime());
// 处理单位类型
String
unitTypeCode
=
model
.
getUnitTypeCode
();
String
[]
unitTypeCodes
=
unitTypeCode
.
split
(
","
);
String
unitType
=
""
;
for
(
String
t
:
unitTypeCodes
)
{
LambdaQueryWrapper
<
DataDictionary
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
DataDictionary:
:
getType
,
TzsCommonParam
.
UNIT_TYPE
).
eq
(
DataDictionary:
:
getCode
,
t
);
DataDictionary
temp
=
iDataDictionaryService
.
getOne
(
queryWrapper
);
unitType
+=
","
+
temp
.
getName
();
}
if
(
unitType
.
length
()
>
0
)
{
unitType
=
unitType
.
substring
(
1
);
targetInfo
.
setUnitType
(
unitType
);
}
if
(
unitInfoChangeServiceImpl
.
save
(
targetInfo
))
{
// 处理图片信息
Map
<
String
,
List
<
AttachmentDto
>>
resultPicMap
=
new
HashMap
<>();
resultPicMap
.
put
(
TzsCommonParam
.
LICENCE_PIC
,
model
.
getLicencePic
());
resultPicMap
.
put
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
,
model
.
getAdminLicensePic
());
ISourceFileService
.
saveAttachments
(
targetInfo
.
getSequenceNbr
(),
resultPicMap
);
}
return
unitChangeInfoToDto
(
targetInfo
);
}
}
\ No newline at end of file
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