Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
ccf64fff
Commit
ccf64fff
authored
Jun 19, 2020
by
lal
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200 into lal
parents
01984b5b
8cb7adc9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
41 deletions
+186
-41
src/main/java/cn/timer/api/bean/qyzx/QyzxEmpEntAsso.java
+5
-1
src/main/java/cn/timer/api/controller/LoginController.java
+32
-40
src/main/java/cn/timer/api/controller/qyzx/Auth.java
+149
-0
No files found.
src/main/java/cn/timer/api/bean/qyzx/QyzxEmpEntAsso.java
View file @
ccf64fff
...
...
@@ -27,12 +27,15 @@ public class QyzxEmpEntAsso extends Model<QyzxEmpEntAsso> {
@ApiModelProperty
(
value
=
"组织机构代码 组织机构代码"
,
example
=
"101"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"用户类型
1 超管理员 2子管理 3
普通员工"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"用户类型
0 超管理员 1子管理 2
普通员工"
,
example
=
"101"
)
private
Integer
userType
;
@ApiModelProperty
(
value
=
"用户状态"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"最大数量"
,
example
=
"10"
)
private
Integer
maxNum
;
@ApiModelProperty
(
value
=
"为0的id"
,
example
=
"0"
)
private
Integer
id
;
}
\ No newline at end of file
src/main/java/cn/timer/api/controller/LoginController.java
View file @
ccf64fff
...
...
@@ -37,7 +37,6 @@ import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import
cn.timer.api.bean.qyzx.QyzxEmpLogin
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.bean.qyzx.QyzxSms
;
import
cn.timer.api.bean.qyzx.auth.QyzxAuthAccount
;
import
cn.timer.api.bean.qyzx.businessService.QyzxRemainingQuantity
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.bean.zzgl.ZzglAuth
;
...
...
@@ -459,7 +458,7 @@ public class LoginController {
@Autowired
SpmkServiceImpl
SpmkService
;
@Autowired
private
KqglAssoLeaveRulesMapper
kqglassoleaverulesmapper
;
...
...
@@ -513,8 +512,7 @@ public class LoginController {
System
.
err
.
println
(
"kanxia"
);
// 员工信息
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
phone
(
phone
).
pw
(
Md5
.
md5
(
pw
))
.
sts
(
CommonEnum
.
U_STS_ON
.
getType
()).
orgId
(
qyId
).
regTime
(
DateUtil
.
date
())
.
build
();
.
sts
(
CommonEnum
.
U_STS_ON
.
getType
()).
orgId
(
qyId
).
regTime
(
DateUtil
.
date
()).
build
();
boolean
b2
=
qyzxEmpLogin
.
insert
();
if
(!
b2
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
...
...
@@ -523,18 +521,17 @@ public class LoginController {
login
=
qyzxEmpLogin
;
}
// 1-是主账号管理员
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyId
).
empNum
(
login
.
getId
()).
rzTime
(
new
Date
())
.
isManager
(
1
).
name
(
username
).
phone
(
phone
)
.
jobType
(
YgJobType
.
QUANZHI
.
getType
()).
jobStatus
(
YgEnumInterface
.
jobStatus
.
ZHENSHI
.
getType
()).
build
()
.
insert
();
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyId
).
empNum
(
login
.
getId
()).
rzTime
(
new
Date
()).
isManager
(
1
)
.
name
(
username
).
phone
(
phone
).
jobType
(
YgJobType
.
QUANZHI
.
getType
())
.
jobStatus
(
YgEnumInterface
.
jobStatus
.
ZHENSHI
.
getType
()).
build
().
insert
();
if
(!
b4
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败3"
);
}
// 员工企业关联表
// 员工企业关联表
// 主账号权限
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
empNum
(
login
.
getId
()).
orgCode
(
qyzxEntInfoM
.
getId
())
.
status
(
1
).
userType
(
SysRoleType
.
U_TYPE_ADMIN
.
getType
()).
build
();
.
maxNum
(
10
).
status
(
1
).
userType
(
SysRoleType
.
U_TYPE_ADMIN
.
getType
()).
build
();
boolean
b3
=
qyzxEmpEntAsso
.
insert
();
if
(!
b3
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
...
...
@@ -543,34 +540,30 @@ public class LoginController {
SpmkService
.
createCustomApproval
(
qyzxEntInfoM
.
getId
());
QyzxAuthAccount
.
builder
().
createdTime
(
new
Date
()).
maxChildAccount
(
maxChildAccount
).
name
(
username
)
.
accountPhone
(
phone
).
empNum
(
login
.
getId
()).
orgCode
(
qyzxEntInfoM
.
getId
()).
build
().
insert
();
// TODO
// 主账号权限表
//*****************************考勤假期初始化
//获取模板数据
List
<
KqglAssoLeaveRules
>
ruless
=
new
LambdaQueryChainWrapper
<
KqglAssoLeaveRules
>(
kqglassoleaverulesmapper
).
eq
(
KqglAssoLeaveRules:
:
getOrgCode
,
0
).
list
();
//查询当前公司是否已初始化
KqglAssoLeaveRules
rule
=
kqglassoleaverulesmapper
.
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
().
eq
(
KqglAssoLeaveRules:
:
getOrgCode
,
qyzxEntInfoM
.
getId
())
.
eq
(
KqglAssoLeaveRules:
:
getLeaveType
,
1
).
last
(
"LIMIT 1"
));
if
(
rule
==
null
)
{
// *****************************考勤假期初始化
// 获取模板数据
List
<
KqglAssoLeaveRules
>
ruless
=
new
LambdaQueryChainWrapper
<
KqglAssoLeaveRules
>(
kqglassoleaverulesmapper
)
.
eq
(
KqglAssoLeaveRules:
:
getOrgCode
,
0
).
list
();
// 查询当前公司是否已初始化
KqglAssoLeaveRules
rule
=
kqglassoleaverulesmapper
.
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
()
.
eq
(
KqglAssoLeaveRules:
:
getOrgCode
,
qyzxEntInfoM
.
getId
()).
eq
(
KqglAssoLeaveRules:
:
getLeaveType
,
1
)
.
last
(
"LIMIT 1"
));
if
(
rule
==
null
)
{
List
<
KqglAssoLeaveRules
>
rullist
=
new
ArrayList
<
KqglAssoLeaveRules
>();
for
(
KqglAssoLeaveRules
rul
:
ruless
){
KqglAssoLeaveRules
vice
=
KqglAssoLeaveRules
.
builder
().
name
(
rul
.
getName
()).
company
(
rul
.
getCompany
()).
leaveType
(
rul
.
getLeaveType
())
.
apply
(
rul
.
getApply
()).
createTime
(
new
Date
().
getTime
()).
createUserid
(
999
).
orgCode
(
qyzxEntInfoM
.
getId
())
.
isOpen
(
rul
.
getIsOpen
()).
leaveBalance
(
rul
.
getLeaveBalance
()).
rulesType
(
rul
.
getRulesType
()).
build
();
for
(
KqglAssoLeaveRules
rul
:
ruless
)
{
KqglAssoLeaveRules
vice
=
KqglAssoLeaveRules
.
builder
().
name
(
rul
.
getName
()).
company
(
rul
.
getCompany
())
.
leaveType
(
rul
.
getLeaveType
()).
apply
(
rul
.
getApply
()).
createTime
(
new
Date
().
getTime
())
.
createUserid
(
999
).
orgCode
(
qyzxEntInfoM
.
getId
()).
isOpen
(
rul
.
getIsOpen
())
.
leaveBalance
(
rul
.
getLeaveBalance
()).
rulesType
(
rul
.
getRulesType
()).
build
();
rullist
.
add
(
vice
);
}
if
(
rullist
.
size
()
>
0
)
{
if
(
rullist
.
size
()
>
0
)
{
kqglassoleaverulesmapper
.
insertleaverulesList
(
rullist
);
}
System
.
out
.
println
(
"操作成功!"
);
}
else
{
}
else
{
System
.
out
.
println
(
"重复初始化数据!"
);
}
return
ResultUtil
.
success
(
"注册企业成功"
);
}
catch
(
Exception
e
)
{
...
...
@@ -619,15 +612,14 @@ public class LoginController {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
Integer
isLeader
=
zzglBmgwMMapper
.
selectCount
(
new
QueryWrapper
<
ZzglBmgwM
>().
lambda
()
.
eq
(
ZzglBmgwM:
:
getLeader
,
qyzxEmpLogin1
.
getId
())
.
eq
(
ZzglBmgwM:
:
getOrgCode
,
qyzxEmpLogin1
.
getOrgId
()))
>
0
?
0
:
1
;
Integer
isLeader
=
zzglBmgwMMapper
.
selectCount
(
new
QueryWrapper
<
ZzglBmgwM
>().
lambda
().
eq
(
ZzglBmgwM:
:
getLeader
,
qyzxEmpLogin1
.
getId
())
.
eq
(
ZzglBmgwM:
:
getOrgCode
,
qyzxEmpLogin1
.
getOrgId
()))
>
0
?
0
:
1
;
QyzxEmpEntAsso
eEA
=
qyzxEmpEntAssoMapper
.
selectOne
(
new
QueryWrapper
<
QyzxEmpEntAsso
>().
lambda
()
.
select
(
QyzxEmpEntAsso:
:
getUserType
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
qyzxEmpLogin1
.
getId
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
qyzxEmpLogin1
.
getOrgId
()));
.
select
(
QyzxEmpEntAsso:
:
getUserType
).
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
qyzxEmpLogin1
.
getId
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
qyzxEmpLogin1
.
getOrgId
()));
qyzxEmpLogin1
.
setIsLeader
(
isLeader
);
qyzxEmpLogin1
.
setUserType
(
eEA
!=
null
?
eEA
.
getUserType
()
:
null
);
...
...
@@ -703,8 +695,8 @@ public class LoginController {
String
phone
=
entRegisterDto
.
getPhone
();
String
pw
=
entRegisterDto
.
getPw
();
if
(
phone
==
null
||
""
.
equals
(
phone
)
)
{
if
(
phone
==
null
||
""
.
equals
(
phone
))
{
return
ResultUtil
.
error
(
"手机号不能为空!"
);
}
...
...
src/main/java/cn/timer/api/controller/qyzx/Auth.java
0 → 100644
View file @
ccf64fff
/**
* <p>Title: QyzxAuthController.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月19日
* @version 1.0
*/
package
cn
.
timer
.
api
.
controller
.
qyzx
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections4.map.HashedMap
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.timer.api.aspect.lang.annotation.Log
;
import
cn.timer.api.aspect.lang.enums.BusinessType
;
import
cn.timer.api.bean.qyzx.QyzxEmpEntAsso
;
import
cn.timer.api.bean.qyzx.auth.QyzxAuthAccount
;
import
cn.timer.api.bean.qyzx.auth.QyzxAuthChild
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enums.SysRoleType
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* <p>
* Title: Auth.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年5月19日
* @version 1.0
*/
@Transactional
@RestController
@Api
(
tags
=
"4.5企业中心(账号权限(新))"
)
@RequestMapping
(
value
=
"/Auth"
,
produces
=
{
"application/json"
})
public
class
Auth
{
private
QyzxEmpEntAsso
selectMain
(
Integer
orgCode
,
Integer
empNum
)
{
return
QyzxEmpEntAsso
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
empNum
)
.
eq
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_ADMIN
.
getType
()));
}
@Transactional
@PostMapping
(
value
=
"/addChildAccount"
)
@ApiOperation
(
value
=
"新增子账号"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@Log
(
title
=
"新增-子账号"
,
businessType
=
BusinessType
.
INSERT
)
public
Result
<
QyzxAuthChild
>
addChildAccount
(
@CurrentUser
UserBean
userBean
,
@RequestParam
Integer
childEmpNum
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
Integer
empNum
=
userBean
.
getEmpNum
();
QyzxEmpEntAsso
qyzxEmpEntAsso
=
selectMain
(
orgCode
,
empNum
);
System
.
err
.
println
(
qyzxEmpEntAsso
);
if
(
qyzxEmpEntAsso
!=
null
)
{
if
(
QyzxEmpEntAsso
.
builder
().
build
()
.
selectCount
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
>=
qyzxEmpEntAsso
.
getMaxNum
())
return
ResultUtil
.
error
(
"子账号数量超过上限"
);
if
(
QyzxEmpEntAsso
.
builder
().
empNum
(
childEmpNum
).
orgCode
(
orgCode
)
.
userType
(
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()).
build
().
insert
())
return
ResultUtil
.
success
(
"添加成功"
);
}
return
ResultUtil
.
error
(
"暂无添加权限"
);
}
@Transactional
@DeleteMapping
(
value
=
"/delChildAccount/{childEmpNum}"
)
@ApiOperation
(
value
=
"删除子账号"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@Log
(
title
=
"删除-子账号"
,
businessType
=
BusinessType
.
DELETE
)
public
Result
<
String
>
delChildAccount
(
@CurrentUser
UserBean
userBean
,
@PathVariable
Integer
childEmpNum
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
Integer
empNum
=
userBean
.
getEmpNum
();
if
(
selectMain
(
orgCode
,
empNum
)
!=
null
)
{
if
(
QyzxEmpEntAsso
.
builder
().
build
()
.
delete
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
childEmpNum
)
.
eq
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
())))
return
ResultUtil
.
success
(
"删除成功"
);
}
return
ResultUtil
.
error
(
"暂无删除权限"
);
}
// @PostMapping(value = "/modifyMaxChild")
// @ApiOperation(value = "修改子账号最大数量", httpMethod = "POST", notes = "接口发布说明")
// @Log(title = "修改-子账号最大数量", businessType = BusinessType.UPDATE)
// public Result<QyzxAuthChild> modifyMaxChild(@CurrentUser UserBean userBean, @RequestParam Integer maxNum) {
// Integer orgCode = userBean.getOrgCode();
// Integer empNum = userBean.getEmpNum();
// QyzxEmpEntAsso qyzxEmpEntAsso = selectMain(orgCode, empNum);
// if (qyzxEmpEntAsso != null && qyzxEmpEntAsso.getUserType() == 99) { // 99-后台管理员
// if (QyzxEmpEntAsso.builder().maxNum(maxNum).build().update(
// new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())))
// return ResultUtil.success("修改成功");
// return ResultUtil.error("修改失败");
// }
// return ResultUtil.error("暂无修改权限");
// }
@GetMapping
(
value
=
"/getAll"
)
@ApiOperation
(
value
=
"获取全部账号信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
YgglMainEmp
>>
getAll
(
@CurrentUser
UserBean
userBean
)
{
List
<
Integer
>
roles
=
new
ArrayList
<
Integer
>();
roles
.
add
(
SysRoleType
.
U_TYPE_ADMIN
.
getType
());
roles
.
add
(
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
());
List
<
QyzxEmpEntAsso
>
list
=
QyzxEmpEntAsso
.
builder
().
build
().
selectList
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
roles
).
select
(
QyzxEmpEntAsso:
:
getEmpNum
));
List
<
YgglMainEmp
>
ygs
=
new
ArrayList
<
YgglMainEmp
>();
List
<
Integer
>
empNums
=
list
.
stream
().
map
(
QyzxEmpEntAsso:
:
getEmpNum
).
collect
(
Collectors
.
toList
());
for
(
Integer
empNum
:
empNums
)
{
YgglMainEmp
yg
=
YgglMainEmp
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
YgglMainEmp
>().
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
YgglMainEmp:
:
getEmpNum
,
empNum
)
.
select
(
YgglMainEmp:
:
getName
,
YgglMainEmp:
:
getPhone
,
YgglMainEmp:
:
getEmpNum
));
if
(
yg
!=
null
)
ygs
.
add
(
yg
);
}
return
ResultUtil
.
data
(
ygs
,
"查询成功"
);
}
}
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