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
d28bc056
Commit
d28bc056
authored
Aug 18, 2021
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.删除无用接口
parent
12f4880f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
6 additions
and
1659 deletions
+6
-1659
AppVersion.java
...a/com/yeejoin/amos/maintenance/dao/entity/AppVersion.java
+0
-124
Config.java
.../java/com/yeejoin/amos/maintenance/dao/entity/Config.java
+0
-59
CommonController.java
...mos/maintenance/business/controller/CommonController.java
+0
-68
ConfigController.java
...mos/maintenance/business/controller/ConfigController.java
+0
-56
MsgController.java
...n/amos/maintenance/business/controller/MsgController.java
+0
-429
UserController.java
.../amos/maintenance/business/controller/UserController.java
+6
-795
AppVersionDao.java
...os/maintenance/business/dao/repository/AppVersionDao.java
+0
-12
IConfigDao.java
.../amos/maintenance/business/dao/repository/IConfigDao.java
+0
-12
AppServiceImpl.java
...mos/maintenance/business/service/impl/AppServiceImpl.java
+0
-85
IAppService.java
.../amos/maintenance/business/service/intfc/IAppService.java
+0
-19
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/dao/entity/AppVersion.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
dao
.
entity
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.Table
;
import
org.hibernate.annotations.Where
;
@Entity
@Table
(
name
=
"p_app_version"
)
@NamedQuery
(
name
=
"AppVersion.findAll"
,
query
=
"SELECT c FROM AppVersion c"
)
@Where
(
clause
=
"is_latest_version=1"
)
//表示未删除的数据
public
class
AppVersion
extends
BasicEntity
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
3207180951171522450L
;
/**
* app版本
*/
@Column
(
name
=
"version"
)
private
String
version
;
/**
* 版本说明
*/
@Column
(
name
=
"remark"
)
private
String
remark
;
/**
* app发布人id
*/
@Column
(
name
=
"publisher"
)
private
int
publisher
;
/**
* app发布人名称
*/
@Column
(
name
=
"publisher_name"
)
private
String
publisherName
;
/**
* 是否需要强制更新
*/
@Column
(
name
=
"update_type"
)
private
int
updateType
;
/**
* 是否为最新版本
*/
@Column
(
name
=
"is_latest_version"
)
private
Boolean
isLatestVersion
;
/**
* app保存路径
*/
@Column
(
name
=
"url"
)
private
String
url
;
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
int
getPublisher
()
{
return
publisher
;
}
public
void
setPublisher
(
int
publisher
)
{
this
.
publisher
=
publisher
;
}
public
String
getPublisherName
()
{
return
publisherName
;
}
public
void
setPublisherName
(
String
publisherName
)
{
this
.
publisherName
=
publisherName
;
}
public
int
getUpdateType
()
{
return
updateType
;
}
public
void
setUpdateType
(
int
updateType
)
{
this
.
updateType
=
updateType
;
}
public
Boolean
getIsLatestVersion
()
{
return
isLatestVersion
;
}
public
void
setIsLatestVersion
(
Boolean
isLatestVersion
)
{
this
.
isLatestVersion
=
isLatestVersion
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
static
long
getSerialversionuid
()
{
return
serialVersionUID
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/dao/entity/Config.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
dao
.
entity
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.Table
;
@Entity
@Table
(
name
=
"p_config"
)
@NamedQuery
(
name
=
"Config.findAll"
,
query
=
"SELECT c FROM Config c"
)
public
class
Config
extends
BasicEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 描述
*/
@Column
(
name
=
"des"
)
private
String
des
;
/**
* 名称
*/
@Column
(
name
=
"name"
)
private
String
name
;
/**
* 属性
*/
@Column
(
name
=
"attribute"
)
private
String
attribute
;
public
String
getDes
()
{
return
des
;
}
public
void
setDes
(
String
des
)
{
this
.
des
=
des
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getAttribute
()
{
return
attribute
;
}
public
void
setAttribute
(
String
attribute
)
{
this
.
attribute
=
attribute
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/CommonController.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
com.yeejoin.amos.maintenance.business.service.intfc.IAppService
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponse
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.maintenance.common.enums.CheckStatisticsTypeEnum
;
import
com.yeejoin.amos.maintenance.common.enums.PlanTaskExecution
;
import
com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum
;
import
com.yeejoin.amos.maintenance.common.enums.TaskStatisticsTypeEnum
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@RestController
@RequestMapping
(
value
=
"/api/common"
)
@Api
(
tags
=
"公共接口api"
)
public
class
CommonController
extends
AbstractBaseController
{
/*@Autowired
IUserService userService;*/
@Autowired
private
IAppService
iAppService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"任务统计口径类型"
,
notes
=
"任务统计口径类型"
)
@RequestMapping
(
value
=
"/taskgetStatisticsType"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
getTaskStatisticsType
()
{
return
CommonResponseUtil
.
success
(
TaskStatisticsTypeEnum
.
getEnumList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"巡检统计口径类型"
,
notes
=
"巡检统计口径类型"
)
@RequestMapping
(
value
=
"/checkStatisticsType"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
getCheckStatisticsType
()
{
return
CommonResponseUtil
.
success
(
CheckStatisticsTypeEnum
.
getEnumList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"计划任务完成种类"
,
notes
=
"计划任务完成种类"
)
@RequestMapping
(
value
=
"/planTaskFinishStatus"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
getPlanTaskFinishStatus
()
{
return
CommonResponseUtil
.
success
(
PlanTaskFinishStatusEnum
.
getEnumList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"计划任务执行情况种类"
,
notes
=
"计划任务执行情况种类"
)
@RequestMapping
(
value
=
"/planTaskExecution"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
getPlanTaskExecution
()
{
return
CommonResponseUtil
.
success
(
PlanTaskExecution
.
getEnumList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取app最新版本信息"
,
notes
=
"获取app最新版本信息"
)
@RequestMapping
(
value
=
"/queryAppVersion"
,
method
=
RequestMethod
.
GET
)
//@Authorization(ingore=true)
public
CommonResponse
getAppLastVersion
()
{
return
CommonResponseUtil
.
success
(
iAppService
.
queryAppLastVersion
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/ConfigController.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
controller
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
com.yeejoin.amos.maintenance.business.dao.repository.IConfigDao
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponse
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.maintenance.dao.entity.Config
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 获取主题信息
*
* @author
*
*/
@RestController
@RequestMapping
(
value
=
"/api/config"
)
@Api
(
tags
=
"配置接口api"
)
public
class
ConfigController
extends
AbstractBaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
ConfigController
.
class
);
@Autowired
private
IConfigDao
configDao
;
/**
* <pre>
* 获取配置接口信息
* </pre>
*
*
* @return
*/
//@Authorization(ingore = true)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取配置接口信息"
,
notes
=
" 获取配置接口信息"
)
@RequestMapping
(
value
=
"/getConfigsInfo"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
getConfigsInfo
()
{
List
<
Config
>
configs
=
configDao
.
findAll
();
return
CommonResponseUtil
.
success
(
configs
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/MsgController.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
controller
;
import
java.beans.BeanInfo
;
import
java.beans.Introspector
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.maintenance.business.constants.XJConstant
;
import
com.yeejoin.amos.maintenance.business.dao.repository.IMsgSubscribeDao
;
import
com.yeejoin.amos.maintenance.business.param.MsgInfoPageParam
;
import
com.yeejoin.amos.maintenance.business.param.NoticePublishParam
;
import
com.yeejoin.amos.maintenance.business.param.UserMsgInitParam
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IAppService
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IMessageService
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IMsgSubscribeService
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IRouteService
;
import
com.yeejoin.amos.maintenance.business.util.ClazzFieldUtil
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponse
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.maintenance.business.util.DaoCriteria
;
import
com.yeejoin.amos.maintenance.business.util.MsgParamUtils
;
import
com.yeejoin.amos.maintenance.business.vo.MsgVo
;
import
com.yeejoin.amos.maintenance.common.enums.CheckEmailEnum
;
import
com.yeejoin.amos.maintenance.common.enums.CheckTypeEnum
;
import
com.yeejoin.amos.maintenance.common.enums.MsgTypeEnum
;
import
com.yeejoin.amos.maintenance.core.common.request.CommonPageable
;
import
com.yeejoin.amos.maintenance.core.common.request.CommonRequest
;
import
com.yeejoin.amos.maintenance.dao.entity.Msg
;
import
com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe
;
import
com.yeejoin.amos.maintenance.quartz.IJobService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
/**
* 消息订阅接口 --- 手机
* @author gaodongdong
*
*/
@RestController
@RequestMapping
(
"/api/msgSubscribe"
)
@Api
(
value
=
"手机--消息订阅"
,
tags
=
"消息模块api"
)
public
class
MsgController
extends
AbstractBaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
MsgController
.
class
);
@Autowired
private
IRouteService
routeService
;
@Autowired
private
IMsgSubscribeService
msgSubscribeService
;
@Autowired
private
IMessageService
iMsgService
;
@Autowired
private
IJobService
jobService
;
@Autowired
private
IAppService
iAppService
;
@Autowired
private
IMsgSubscribeDao
msgSubscribeDao
;
/*@Autowired
private IUserService iUserService;
*/
/**
* 获取用户当前所选择公司的消息订阅信息
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取用户当前所选择公司的消息订阅信息"
,
notes
=
"获取用户当前所选择公司的消息订阅信息"
)
@GetMapping
(
value
=
"/querySubscribe"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
queryMsgSetting
()
{
try
{
AgencyUserModel
userModel
=
getUserInfo
();
String
userId
=
userModel
.
getUserId
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
deptId
=
null
;
if
(
reginParams
.
getDepartment
()!=
null
){
deptId
=
reginParams
.
getDepartment
().
getDepartmentDesc
();
}
/*if(XJConstant.ROLE_NAME_SUPERADMIN.equals(roleTypeName) || XJConstant.ROLE_NAME_ADMIN.equals(roleTypeName)){
orgCode = param.getUserOrgCode();
}else if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)){
deptId = param.getDepartmentId();
userId = param.getUserId();
}else if(XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)){
userId = param.getUserId();
}*/
List
<
HashMap
<
String
,
Object
>>
routeList
=
routeService
.
queryRouteListByOrgCode
(
loginOrgCode
,
userId
,
deptId
);
List
<
Map
<
String
,
Object
>>
checkType
=
CheckTypeEnum
.
getEnumList
();
List
<
Map
<
String
,
Object
>>
emailType
=
CheckEmailEnum
.
getEnumList
();
UserMsgInitParam
userInitParam
=
new
UserMsgInitParam
();
userInitParam
.
setOrgCode
(
loginOrgCode
);
userInitParam
.
setUserId
(
userModel
.
getUserId
());
List
<
MsgSubscribe
>
msgSubs
=
iAppService
.
saveUserMsgInit
(
userInitParam
);
// 获取搜友消息推送类型
if
(
ObjectUtils
.
isEmpty
(
msgSubs
)){
}
emailType
=
setupSelectItem
(
emailType
,
msgSubs
);
//标记已经选择的邮件消息推送类型
checkType
=
setupSelectItem
(
checkType
,
msgSubs
);
// 标记已经选择的检查类型消息
/**
* 获取所有已经选择的路线id数组
*/
String
sRoutes
=
""
;
for
(
MsgSubscribe
msg
:
msgSubs
)
{
if
(
"route"
.
equals
(
msg
.
getMsgType
()))
{
sRoutes
=
msg
.
getAttribute1
();
}
}
List
<
Map
<
String
,
Object
>>
respRoute
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
sRoutes
))
{
String
[]
aRoutes
=
sRoutes
.
split
(
","
);
for
(
HashMap
<
String
,
Object
>
route
:
routeList
)
{
for
(
String
s
:
aRoutes
)
{
if
(!
ObjectUtils
.
isEmpty
(
s
)
&&
s
.
equals
(
route
.
get
(
"id"
)))
{
route
.
put
(
"selected"
,
true
);
respRoute
.
add
(
route
);
break
;
}
else
{
respRoute
.
add
(
route
);
}
}
}
//将已经选择的路线标记位已选择
}
Map
<
String
,
Object
>
response
=
new
HashMap
<>();
response
.
put
(
"route"
,
respRoute
);
response
.
put
(
"email"
,
emailType
);
response
.
put
(
"check"
,
checkType
);
List
<
Map
<
String
,
Object
>>
listf
=
new
ArrayList
<>();
if
(
msgSubs
!=
null
&&
msgSubs
.
size
()>
0
){
for
(
MsgSubscribe
msg
:
msgSubs
)
{
listf
.
add
(
objectToMap1
(
msg
));
}
}
response
.
put
(
"checkPlan"
,
listf
);
return
CommonResponseUtil
.
success
(
response
);
}
catch
(
IllegalAccessException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
();
}
}
/**
* 保存用户消息订阅信息
* @param subscribe
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"保存用户消息订阅信息"
,
notes
=
"保存用户消息订阅信息"
)
@PostMapping
(
value
=
"/saveSubscribe"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
saveSubscribe
(
@ApiParam
(
value
=
"消息订阅信息"
,
required
=
false
)
@RequestBody
(
required
=
true
)
List
<
MsgSubscribe
>
subscribe
)
{
try
{
AgencyUserModel
userModel
=
getUserInfo
();
String
userId
=
userModel
.
getUserId
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
orgCode
=
getOrgCode
(
reginParams
);
for
(
MsgSubscribe
s:
subscribe
)
{
s
.
setOrgCode
(
orgCode
);
s
.
setUserId
(
userModel
.
getUserId
());
}
//查询当前用户是否已保存
List
<
MsgSubscribe
>
lits
=
msgSubscribeService
.
queryMsgSubscribes
(
userId
);
// if(lits!=null&&lits.size()>0){
// //删除
// List<Long> userIds=new ArrayList<>();
// userIds.add(Long.valueOf(userId));
// msgSubscribeDao.delMsgSubscribeByUserId(userIds);
// }
//
msgSubscribeService
.
saveSubscribe
(
subscribe
);
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
return
CommonResponseUtil
.
success
();
}
private
List
<
Map
<
String
,
Object
>>
setupSelectItem
(
List
<
Map
<
String
,
Object
>>
type
,
List
<
MsgSubscribe
>
msgSubs
)
{
for
(
Map
map
:
type
)
{
for
(
MsgSubscribe
msg
:
msgSubs
)
{
if
(!
msg
.
getMsgType
().
equals
(
map
.
get
(
"ower"
)))
continue
;
if
(
map
.
get
(
"code"
).
equals
(
msg
.
getAttribute1
()))
{
map
.
put
(
"selected"
,
true
);
break
;
}
}
}
return
type
;
}
private
Map
<
String
,
Object
>
objectToMap
(
Object
obj
)
throws
Exception
{
if
(
obj
==
null
)
return
null
;
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
BeanInfo
beanInfo
=
Introspector
.
getBeanInfo
(
obj
.
getClass
());
PropertyDescriptor
[]
propertyDescriptors
=
beanInfo
.
getPropertyDescriptors
();
for
(
PropertyDescriptor
property
:
propertyDescriptors
)
{
String
key
=
property
.
getName
();
if
(
key
.
compareToIgnoreCase
(
"class"
)
==
0
)
{
continue
;
}
Method
getter
=
property
.
getReadMethod
();
Object
value
=
getter
!=
null
?
getter
.
invoke
(
obj
)
:
null
;
map
.
put
(
key
,
value
);
}
return
map
;
}
/**
* 根据登陆用户APP获取未读消息个数
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"APP根据登陆用户获取未读消息个数"
,
notes
=
"APP根据登陆用户获取未读消息个数"
)
@GetMapping
(
value
=
"/unreadCount"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
getUnreadCount
()
{
try
{
AgencyUserModel
user
=
getUserInfo
();
int
count
=
msgSubscribeService
.
getUnreadCount
(
user
);
return
CommonResponseUtil
.
success
(
count
);
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
/**
* 获取消息类型
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"APP获取消息类型"
,
notes
=
"APP获取消息类型"
)
@GetMapping
(
value
=
"/MsgType"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
getMsgType
()
{
try
{
return
CommonResponseUtil
.
success
(
MsgTypeEnum
.
getEnumList
());
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"获取消息类型失败"
);
}
}
/**
* 根据条件获取消息列表
* @param queryRequests
* @param commonPageable
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"APP 根据条件获取消息列表"
,
notes
=
"APP 根据条件获取消息列表"
)
@PostMapping
(
value
=
"/msgList"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
queryMsgList
(
@ApiParam
(
value
=
"查询条件"
,
required
=
false
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
,
defaultValue
=
"pageNumber=0&pageSize=10"
)
CommonPageable
commonPageable
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
roleTypeName
=
getRoleTypeName
(
reginParams
);
CommonRequest
request
=
new
CommonRequest
();
CommonRequest
request1
=
new
CommonRequest
();
request
.
setName
(
"userId"
);
request
.
setValue
(
user
.
getUserId
());
request1
.
setName
(
"status"
);
request1
.
setValue
(
XJConstant
.
IS_SENT
);
queryRequests
.
add
(
request1
);
queryRequests
.
add
(
request
);
List
<
Map
<
String
,
Object
>>
listf
=
new
ArrayList
<>();
List
<
DaoCriteria
>
criterias
=
buildDaoCriterias
(
queryRequests
,
false
,
loginOrgCode
,
roleTypeName
);
Page
<
Msg
>
msgList
=
msgSubscribeService
.
queryMsgList
(
criterias
,
commonPageable
);
List
<
Msg
>
li
=
msgList
.
getContent
();
if
(
li
!=
null
&&
li
.
size
()>
0
){
for
(
Msg
msg
:
li
)
{
listf
.
add
(
objectToMap1
(
msg
));
}
}
Page
<
Map
<
String
,
Object
>>
pd
=
new
PageImpl
<>(
listf
,
msgList
.
getPageable
(),
msgList
.
getTotalElements
());
return
CommonResponseUtil
.
success
(
pd
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"件获取消息列表失败"
);
}
}
public
static
Map
<
String
,
Object
>
objectToMap1
(
Object
obj
)
throws
IllegalAccessException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
obj
!=
null
){
for
(
Field
field
:
ClazzFieldUtil
.
getAllFields
(
obj
))
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
Object
value
=
nvl
(
field
.
get
(
obj
));
if
(
"userId"
.
equals
(
fieldName
)){
map
.
put
(
fieldName
,
Long
.
valueOf
(
value
.
toString
()));
}
else
{
map
.
put
(
fieldName
,
value
);
}
}
return
map
;
}
return
map
;
}
public
static
Object
nvl
(
Object
param
)
{
return
param
!=
null
?
param
:
null
;
}
/**
* 根据条件查询消息列表
* @param queryRequests
* @param commonPageable
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"根据条件获取消息列表"
,
notes
=
"APP 根据条件获取消息列表"
)
@PostMapping
(
value
=
"/list"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
querylist
(
@ApiParam
(
value
=
"查询条件"
,
required
=
false
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
,
defaultValue
=
"pageNumber=0&pageSize=10"
)
CommonPageable
commonPageable
)
{
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
roleTypeName
=
getRoleTypeName
(
reginParams
);
HashMap
<
String
,
Object
>
paramMap
=
buildMybatisCriterias
(
loginOrgCode
,
roleTypeName
);
if
(
XJConstant
.
ROLE_NAME_DEPTADMIN
.
equals
(
roleTypeName
)||
XJConstant
.
ROLE_NAME_PERSON
.
equals
(
roleTypeName
))
paramMap
.
put
(
"userId"
,
getUserId
());
MsgInfoPageParam
param
=
MsgParamUtils
.
fillMsgInfoParam
(
queryRequests
,
commonPageable
,
paramMap
);
Page
<
MsgVo
>
dataList
=
iMsgService
.
queryMsgInfoList
(
param
);
return
CommonResponseUtil
.
success
(
dataList
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"件获取消息列表失败"
);
}
}
/**
* 修改消失为已读
* @param msgId
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"修改消失为已读"
,
notes
=
"修改消失为已读"
)
@PostMapping
(
value
=
"/isRead"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
isRead
(
@ApiParam
(
value
=
"消息id"
,
required
=
true
)
@RequestBody
Long
msgId
)
{
try
{
Msg
msg
=
msgSubscribeService
.
isRead
(
msgId
);
return
CommonResponseUtil
.
success
(
msg
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"修改消失为已读失败"
);
}
}
/**
* 通知发布
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"通知发布"
,
notes
=
"通知发布"
)
@PostMapping
(
value
=
"/noticePublish"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
noticePublish
(
@ApiParam
(
value
=
"通知信息"
,
required
=
true
)
@RequestBody
NoticePublishParam
msg
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
msg
.
setCreateBy
(
user
.
getUserId
());
ReginParams
reginParams
=
getSelectedOrgInfo
();
msg
.
setUserName
(
user
.
getRealName
());
String
loginOrgCode
=
getOrgCode
(
reginParams
);
msg
.
setOrgCode
(
loginOrgCode
);
List
<
Msg
>
msgList
=
iMsgService
.
publishNotice
(
getToken
(),
getProduct
(),
getAppKey
(),
msg
);
msgList
.
forEach
(
m
->{
jobService
.
msgAddJob
(
m
);
});
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"通知发布失败!"
);
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/UserController.java
View file @
d28bc056
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.maintenance.business.param.AppLoginUserParam
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IAppService
;
import
com.yeejoin.amos.maintenance.business.util.*
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponse
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.maintenance.core.framework.PersonIdentify
;
import
com.yeejoin.amos.maintenance.feign.RemoteSecurityService
;
import
com.yeejoin.amos.maintenance.jpush.AppMessagePushService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.env.Environment
;
import
org.springframework.http.*
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 获取用户信息
*
...
...
@@ -48,773 +24,8 @@ import java.util.stream.Collectors;
public
class
UserController
extends
AbstractBaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserController
.
class
);
@Autowired
private
IAppService
iAppService
;
@Autowired
private
Environment
env
;
private
static
final
String
appType
=
"APP"
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
AppMessagePushService
appMessagePushService
;
@Value
(
"${Security.fegin.name}"
)
private
String
SecurityName
;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
@Autowired
private
RestTemplate
restTemplate
;
/**
* 根据部门id查询用户信息
*
* @param deptId
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"部门人员查询"
,
notes
=
"部门人员查询"
)
@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"
)))
{
user
.
put
(
"telephone"
,
user1
.
get
(
j
).
get
(
"landlinePhone"
).
toString
());
}
else
{
user
.
put
(
"telephone"
,
""
);
}
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
}
}
}
}
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
<>();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
for
(
AgencyUserModel
userModel
:
list
)
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
userModel
.
getUserId
().
toString
());
user
.
put
(
"key"
,
userModel
.
getUserId
().
toString
());
user
.
put
(
"value"
,
userModel
.
getUserId
().
toString
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"name"
,
userModel
.
getRealName
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
userModel
.
getUserId
().
toString
());
user
.
put
(
"mobile"
,
userModel
.
getMobile
());
user
.
put
(
"telephone"
,
userModel
.
getLandlinePhone
());
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
}
}
return
userList
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"部门人员树查询"
,
notes
=
"部门人员树查询"
)
@RequestMapping
(
value
=
"/queryDeptUserTree1"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryDeptUserTree1
()
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
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
);
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
));
DepartmentUserTreeWebVo
deptTreeWeb
=
new
DepartmentUserTreeWebVo
();
JSONArray
childrens
=
json
.
getJSONArray
(
"children"
);
deptTreeWeb
.
setType
(
"department"
);
deptTreeWeb
.
setKey
(
map
.
get
(
"sequenceNbr"
).
toString
());
deptTreeWeb
.
setLabel
(
map
.
get
(
"sequenceNbr"
).
toString
());
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
());
deptTreeWeb
.
setUserModelList
(
userModalList
);
}
list
.
add
(
deptTreeWeb
);
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
buildUserDeptTreeForWebBefore
(
list
,
childrens
);
}
list
=
buildUserDeptTreeForWeb
(
list
);
}
return
CommonResponseUtil
.
success
(
list
);
}
/**
* 重构数据,用户存放在部门的children
*
* @param list
* @return
*/
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
.
setChildren
(
users
);
collects
.
clear
();
x
.
setUserModelList
(
collects
);
}
}
);
return
list
;
}
/**
* 部门数据预处理(获取所有子节点)
*
* @param list
* @param children
*/
private
void
buildUserDeptTreeForWebBefore
(
List
<
DepartmentUserTreeWebVo
>
list
,
JSONArray
children
)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
JSONObject
json
=
children
.
getJSONObject
(
i
);
DepartmentUserTreeWebVo
deptTreeWeb
=
new
DepartmentUserTreeWebVo
();
Map
deptMap
=
JSONObject
.
parseObject
(
json
.
toJSONString
(),
Map
.
class
);
deptTreeWeb
.
setType
(
"department"
);
deptTreeWeb
.
setKey
(
deptMap
.
get
(
"sequenceNbr"
).
toString
());
deptTreeWeb
.
setLabel
(
deptMap
.
get
(
"sequenceNbr"
).
toString
());
deptTreeWeb
.
setTitle
(
deptMap
.
get
(
"departmentName"
).
toString
());
deptTreeWeb
.
setValue
(
deptMap
.
get
(
"sequenceNbr"
).
toString
());
if
(!
ObjectUtils
.
isEmpty
(
deptMap
.
get
(
"userModelList"
)))
{
deptTreeWeb
.
setUserModelList
((
List
)
deptMap
.
get
(
"userModelList"
));
}
if
(
json
!=
null
&&
json
.
size
()
>
0
)
{
list
.
add
(
deptTreeWeb
);
}
else
{
JSONArray
childrens
=
json
.
getJSONArray
(
"children"
);
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
buildUserDeptTreeForWebBefore
(
deptTreeWeb
.
getChildren
(),
childrens
);
}
if
(
"0"
.
equals
(
deptMap
.
get
(
"parentId"
)))
{
list
.
add
(
deptTreeWeb
);
}
}
}
}
/**
* 查询用户权限人员
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"人员查询"
,
notes
=
"人员查询"
)
@RequestMapping
(
value
=
"/queryAuthUsers"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
// @Authorization(ingore = true)
public
CommonResponse
queryAllUser
()
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByOrgCode
(
getToken
(),
getProduct
(),
getAppKey
(),
loginOrgCode
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
paraseData
(
userModels
,
null
);
return
CommonResponseUtil
.
success
(
userList
);
}
/**
* 查询用户部门人员树
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"部门人员树查询"
,
notes
=
"部门人员树查询"
)
@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
);
}
/**
* 查询用户部门人员树
*
* @return
* @RequestParam userName 用户名
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"通讯录(<font color='blue'>手机app</font>)"
,
notes
=
"通讯录(<font color='blue'>手机app</font>)"
)
@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
(
"系统繁忙,请稍后再试"
);
}
}
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());
// user.put("mobile", userdate.getMobile());
// user.put("email", userdate.getEmail());
// }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
;
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
filterUser
(
List
<
LinkedHashMap
<
String
,
Object
>>
tempChildren
,
String
userNmae
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<
LinkedHashMap
<
String
,
Object
>>();
if
(
ObjectUtils
.
isEmpty
(
tempChildren
))
{
return
userList
;
}
userList
.
forEach
((
item
)
->
{
if
(!
ObjectUtils
.
isEmpty
(
userNmae
)
&&
item
.
get
(
"label"
).
toString
().
indexOf
(
userNmae
)
!=
-
1
)
{
userList
.
add
(
item
);
}
});
return
userList
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@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
(
"数据初始化失败"
);
}
}
/**
* 递归调用获取list中的末端节点
*
* @param src
* @return
*/
private
List
<
LinkedHashMap
<
String
,
Object
>>
getLeaves
(
List
<
LinkedHashMap
<
String
,
Object
>>
src
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
dest
=
new
ArrayList
<>();
for
(
LinkedHashMap
<
String
,
Object
>
leaves
:
src
)
{
if
(
ObjectUtils
.
isEmpty
(
leaves
.
get
(
"children"
)))
{
dest
.
add
(
leaves
);
}
else
{
List
<
LinkedHashMap
<
String
,
Object
>>
list
=
getLeaves
((
List
<
LinkedHashMap
<
String
,
Object
>>)
leaves
.
get
(
"children"
));
dest
.
addAll
(
list
);
}
}
return
dest
;
}
///////////////////////////////2019-11-18安全服务升级///////////////////////////////
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"通讯录"
,
notes
=
"通讯录"
)
@RequestMapping
(
value
=
"/mobile/addressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
addressList
()
{
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
);
}
return
CommonResponseUtil
.
success
(
departmentUserTreeDto
.
getChildren
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"通讯录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
private
void
buildUserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
JSONObject
json
=
childs
.
getJSONObject
(
i
);
DepartmentUserTreeAppVo
treeDto
=
new
DepartmentUserTreeAppVo
();
treeDto
.
setName
(
json
.
getString
(
"departmentName"
));
treeDto
.
setId
(
json
.
getString
(
"sequenceNbr"
));
treeDto
.
setType
(
json
.
getString
(
"level"
));
JSONArray
childrens
=
json
.
getJSONArray
(
"children"
);
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
buildUserDeptTree
(
treeDto
,
childrens
);
}
JSONArray
userModelList
=
json
.
getJSONArray
(
"userModelList"
);
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
);
}
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
//部门下用户
private
void
UserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
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
);
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
/**
* APP登录
*/
@ApiOperation
(
value
=
"APP登录"
,
notes
=
"APP登录"
)
@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
());
// //删除别名关联设备
// 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
(
"系统繁忙,请稍后再试"
);
}
}
/**
* APP登出
*/
@ApiOperation
(
value
=
"APP登出"
,
notes
=
"APP登出"
)
@PostMapping
(
value
=
"/mobile/loginOut"
)
public
CommonResponse
mobileLoginOut
()
{
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
(
"系统繁忙,请稍后再试"
);
}
}
/**
* 获取公司选择信息
*/
@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
(
"系统繁忙,请稍后再试"
);
}
}
//对象转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
;
}
public
static
Object
nvl
(
Object
param
)
{
return
param
!=
null
?
param
:
""
;
}
/**
* 保存登陆用户选择公司信息
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"保存登陆用户选择公司信息"
,
notes
=
"保存登陆用户选择公司信息"
)
@PostMapping
(
value
=
"/save/curCompany"
)
public
CommonResponse
saveCurCompany
(
@ApiParam
(
value
=
"当前登陆用户所选单位机构编号"
,
required
=
true
)
@RequestBody
ReginParams
reginParams
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
// saveSelectedOrgInfo(reginParams);
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
)
{
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
);
if
(
secResponse
.
isSuccess
()
&&
secResponse
.
getDataList
()
!=
null
)
{
JSONArray
arr
=
JSON
.
parseArray
(
JSONArray
.
toJSONString
(
secResponse
.
getDataList
()));
Map
<
String
,
JSONObject
>
map
=
Maps
.
newHashMap
();
if
(
arr
!=
null
&&
arr
.
size
()
>
0
)
{
JSONObject
obj
=
arr
.
getJSONObject
(
0
);
if
(
obj
!=
null
)
{
JSONArray
childrens
=
obj
.
getJSONArray
(
"children"
);
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
childrens
.
size
();
i
++)
{
JSONObject
child
=
childrens
.
getJSONObject
(
i
);
map
.
put
(
child
.
getString
(
"path"
),
child
);
}
}
}
List
<
String
>
userHaveToDo
=
iAppService
.
getHaveToDoList
(
user
.
getUserId
());
result
.
put
(
"userHaveToDo"
,
userHaveToDo
);
result
.
put
(
"userPower"
,
map
.
get
(
"appPower"
));
result
.
put
(
"userShow"
,
map
.
get
(
"appMenu"
));
}
}
result
.
put
(
"companyModel"
,
reginParams
.
getCompany
());
result
.
put
(
"departmentModel"
,
reginParams
.
getDepartment
());
result
.
put
(
"roleModel"
,
reginParams
.
getRole
());
return
result
;
}
/**
* 装备登录返回巡检统计信息
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"装备登录返回巡检统计信息"
,
notes
=
"装备登录返回巡检统计信息"
)
@GetMapping
(
value
=
"/patrolCount"
)
public
CommonResponse
getPatrolCount
()
{
try
{
AgencyUserModel
user
=
getUserInfo
();
List
<
String
>
userHaveToDo
=
iAppService
.
getHaveToDoList
(
user
.
getUserId
());
return
CommonResponseUtil
.
success
(
userHaveToDo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存登陆用户选择公司信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
/**
* 修改密码
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
" 修改密码"
,
notes
=
" 修改密码"
)
@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
(
"新密码不能跟旧密码相同!"
);
}
try
{
//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
());
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PersonIdentify
(
isNeedIdentity
=
true
)
@PersonIdentify
@ApiOperation
(
value
=
"获取人员身份信息"
,
notes
=
" 获取人员身份信息"
)
@GetMapping
(
value
=
"/identify"
)
public
CommonResponse
personIdentity
()
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/dao/repository/AppVersionDao.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
dao
.
repository
;
import
org.springframework.data.jpa.repository.Query
;
import
com.yeejoin.amos.maintenance.dao.entity.AppVersion
;
public
interface
AppVersionDao
extends
BaseDao
<
AppVersion
,
Long
>{
@Query
(
value
=
"SELECT * FROM p_app_version v ORDER BY v.id DESC LIMIT 0,1"
,
nativeQuery
=
true
)
AppVersion
findLastVersion
();
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/dao/repository/IConfigDao.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
dao
.
repository
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.yeejoin.amos.maintenance.dao.entity.Config
;
@Repository
(
"configDao"
)
public
interface
IConfigDao
extends
BaseDao
<
Config
,
Long
>{
List
<
Config
>
findAll
();
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/AppServiceImpl.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
service
.
impl
;
import
com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.maintenance.business.dao.repository.AppVersionDao
;
import
com.yeejoin.amos.maintenance.business.dao.repository.IMsgSubscribeDao
;
import
com.yeejoin.amos.maintenance.business.param.UserMsgInitParam
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IAppService
;
import
com.yeejoin.amos.maintenance.business.service.intfc.IMsgSubscribeService
;
import
com.yeejoin.amos.maintenance.common.enums.MsgSubscribeTypeEnum
;
import
com.yeejoin.amos.maintenance.dao.entity.AppVersion
;
import
com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe
;
import
org.assertj.core.util.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"iAppService"
)
public
class
AppServiceImpl
implements
IAppService
{
@Autowired
private
IMsgSubscribeDao
msgSubscribeDao
;
@Autowired
private
AppVersionDao
appVersionDao
;
@Autowired
private
IMsgSubscribeService
msgSubscribeService
;
@Autowired
private
PlanTaskMapper
planTaskMapper
;
@Override
public
AppVersion
queryAppLastVersion
()
{
// TODO Auto-generated method stub
return
appVersionDao
.
findLastVersion
();
}
/**
* 新增用户时初始化消息订阅(p_msg_subscribe)表
*
* @param userDTO
*/
@Override
public
List
<
MsgSubscribe
>
saveUserMsgInit
(
UserMsgInitParam
userInitParam
)
{
Long
count
=
msgSubscribeDao
.
countByUserId
(
userInitParam
.
getUserId
());
if
(
count
>
0
)
{
// 已存在用户订阅,直接返回
return
msgSubscribeService
.
queryMsgSubscribes
(
userInitParam
.
getUserId
());
}
List
<
MsgSubscribe
>
msgConfigs
=
new
ArrayList
<
MsgSubscribe
>();
for
(
MsgSubscribeTypeEnum
type
:
MsgSubscribeTypeEnum
.
values
())
{
MsgSubscribe
msgSub
=
new
MsgSubscribe
();
msgSub
.
setOrgCode
(
userInitParam
.
getOrgCode
());
msgSub
.
setUserId
(
userInitParam
.
getUserId
());
if
(
type
.
equals
(
MsgSubscribeTypeEnum
.
PLANBEGIN
)
||
type
.
equals
(
MsgSubscribeTypeEnum
.
PLANWARN
)
||
type
.
equals
(
MsgSubscribeTypeEnum
.
PLANEND
))
{
msgSub
.
setAttribute1
(
"False"
);
msgSub
.
setAttribute2
(
10
+
""
);
}
else
if
(
type
.
equals
(
MsgSubscribeTypeEnum
.
CHECKTYPE
)
||
type
.
equals
(
MsgSubscribeTypeEnum
.
CHECKEMAIL
))
{
msgSub
.
setAttribute1
(
"error"
);
}
msgSub
.
setMsgType
(
type
.
getName
());
msgSubscribeDao
.
saveAndFlush
(
msgSub
);
msgConfigs
.
add
(
msgSub
);
}
return
msgConfigs
;
}
@Override
public
List
<
String
>
getHaveToDoList
(
String
userId
)
{
int
taskCount
=
planTaskMapper
.
getCurrentPlanTaskCount
(
userId
);
List
<
String
>
havetoDoList
=
Lists
.
newArrayList
();
if
(
taskCount
>
0
)
{
havetoDoList
.
add
(
"planPatrol"
);
}
return
havetoDoList
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/intfc/IAppService.java
deleted
100644 → 0
View file @
12f4880f
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
service
.
intfc
;
import
java.util.List
;
import
com.yeejoin.amos.maintenance.business.param.UserMsgInitParam
;
import
com.yeejoin.amos.maintenance.dao.entity.AppVersion
;
import
com.yeejoin.amos.maintenance.dao.entity.MsgSubscribe
;
public
interface
IAppService
{
AppVersion
queryAppLastVersion
();
List
<
MsgSubscribe
>
saveUserMsgInit
(
UserMsgInitParam
userInitParam
);
List
<
String
>
getHaveToDoList
(
String
userId
);
}
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