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
8c5c01e1
Commit
8c5c01e1
authored
Mar 21, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营后台--
创建企业登录账号
parent
f98534e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
3 deletions
+192
-3
src/main/java/cn/timer/api/controller/qyzx/QyzxController.java
+192
-3
No files found.
src/main/java/cn/timer/api/controller/qyzx/QyzxController.java
View file @
8c5c01e1
package
cn
.
timer
.
api
.
controller
.
qyzx
;
package
cn
.
timer
.
api
.
controller
.
qyzx
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.timer.api.bean.jxgl.JxglBasicSetting
;
import
cn.timer.api.bean.kqmk.*
;
import
cn.timer.api.bean.qyxx.CmsContent
;
import
cn.timer.api.bean.xcgl.XcglAssoBszqsz
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.enuminterface.YgEnumInterface
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.controller.jxgl.service.JxglService
;
import
cn.timer.api.controller.qyzx.service.RegisterHelper
;
import
cn.timer.api.controller.spmk.service.SpmkServiceImpl
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper
;
import
cn.timer.api.dto.qyzx.*
;
import
cn.timer.api.dto.qyzx.*
;
import
cn.timer.api.utils.Md5
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
@@ -87,6 +105,26 @@ public class QyzxController {
...
@@ -87,6 +105,26 @@ public class QyzxController {
@Autowired
@Autowired
private
QyzxInvoiceUsualMapper
qyzxInvoiceUsualMapper
;
private
QyzxInvoiceUsualMapper
qyzxInvoiceUsualMapper
;
@Value
(
"${config-8timer.register-company-max-num}"
)
public
Integer
max
;
@Value
(
"${config-8timer.qyxx.title}"
)
private
String
title
;
@Value
(
"${config-8timer.qyxx.author}"
)
private
String
author
;
@Value
(
"${config-8timer.qyxx.cover}"
)
private
String
cover
;
@Value
(
"${config-8timer.qyxx.summary}"
)
private
String
summary
;
@Value
(
"${config-8timer.environmental-science}"
)
public
String
environmental_science
;
@Autowired
SpmkServiceImpl
SpmkService
;
@Autowired
private
KqglAssoLeaveRulesMapper
kqglassoleaverulesmapper
;
@Autowired
JxglService
jxglService
;
/**
/**
* 获取企业信息
* 获取企业信息
*
*
...
@@ -632,12 +670,153 @@ public class QyzxController {
...
@@ -632,12 +670,153 @@ public class QyzxController {
@ApiOperation
(
value
=
"运营后台---添加/修改企业信息"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"运营后台---添加/修改企业信息"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@Log
(
title
=
"运营后台---添加/修改-企业信息"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"运营后台---添加/修改-企业信息"
,
businessType
=
BusinessType
.
UPDATE
)
public
Result
<
QyzxEntInfoM
>
aeCompamy
(
@RequestBody
QyzxEntInfoM
qyzxEntInfoM
)
{
public
Result
<
QyzxEntInfoM
>
aeCompamy
(
@RequestBody
QyzxEntInfoM
qyzxEntInfoM
)
{
QyzxEntInfoM
q
=
new
LambdaQueryChainWrapper
<
QyzxEntInfoM
>(
qyzxEntInfoMMapper
)
QyzxEntInfoM
q
=
new
LambdaQueryChainWrapper
<
QyzxEntInfoM
>(
qyzxEntInfoMMapper
)
.
eq
(
QyzxEntInfoM:
:
getId
,
qyzxEntInfoM
.
getId
()).
one
();
.
eq
(
QyzxEntInfoM:
:
getId
,
qyzxEntInfoM
.
getId
()).
one
();
if
(
q
!=
null
){
boolean
b1
;
qyzxEntInfoM
.
setRegisterTime
(
q
.
getRegisterTime
());
if
(
q
==
null
)
{
try
{
qyzxEntInfoM
.
setRegisterTime
(
new
Date
());
QyzxEmpLogin
login
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
qyzxEntInfoM
.
getPhone
()),
QyzxEmpLogin:
:
getPhone
,
qyzxEntInfoM
.
getPhone
()).
one
();
if
(
login
!=
null
)
{
Integer
count
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
login
.
getId
())
.
eq
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_ADMIN
.
getType
()).
count
();
//将密码改为注册企业输入的密码 2021//11/11 wgd
login
.
setPw
(
Md5
.
md5
(
"123456"
));
if
(
count
>
max
)
{
return
ResultUtil
.
error
(
"已注册过企业"
);
}
}
b1
=
qyzxEntInfoM
.
insert
();
Integer
qyId
=
qyzxEntInfoM
.
getId
();
if
(
login
==
null
)
{
// 员工信息
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
phone
(
qyzxEntInfoM
.
getPhone
()).
pw
(
Md5
.
md5
(
"123456"
))
.
sts
(
CommonEnum
.
U_STS_ON
.
getType
()).
orgId
(
qyId
).
regTime
(
DateUtil
.
date
()).
build
();
boolean
b2
=
qyzxEmpLogin
.
insert
();
if
(!
b2
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败2"
);
}
login
=
qyzxEmpLogin
;
}
else
{
login
.
setOrgId
(
qyId
);
login
.
updateById
();
}
// 员工信息
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyId
).
empNum
(
login
.
getId
()).
rzTime
(
new
Date
()).
name
(
qyzxEntInfoM
.
getLinkMan
())
.
phone
(
qyzxEntInfoM
.
getPhone
()).
jobType
(
YgEnumInterface
.
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
();
boolean
b3
=
qyzxEmpEntAsso
.
insert
();
if
(!
b3
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败4"
);
}
SpmkService
.
createCustomApproval
(
qyzxEntInfoM
.
getId
());
//企业注册添加10条短信
RegisterHelper
.
companyRegister
(
qyId
,
login
.
getId
());
// *****************************考勤假期初始化
// 获取模板数据
// List<KqglAssoLeaveRules> ruless = new LambdaQueryChainWrapper<KqglAssoLeaveRules>(kqglassoleaverulesmapper)
// .eq(KqglAssoLeaveRules::getOrgCode, 0).list();
List
<
KqglAssoLeaveRulesT
>
ruless
=
KqglAssoLeaveRulesT
.
builder
().
build
().
selectAll
();
// 查询当前公司是否已初始化
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
(
KqglAssoLeaveRulesT
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
)
{
kqglassoleaverulesmapper
.
insertleaverulesList
(
rullist
);
}
Logoutput
(
"操作成功!"
);
}
else
{
Logoutput
(
"重复初始化数据!"
);
}
//建立初始化的加班规则
KqglAssoOvertimeRulesM
jbgzdef
=
KqglAssoOvertimeRulesM
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoOvertimeRulesM
>().
lambda
().
eq
(
KqglAssoOvertimeRulesM:
:
getOvertimeruledefault
,
1
));
KqglAssoOvertimeRules
Rules
=
KqglAssoOvertimeRules
.
builder
().
build
();
Rules
.
setOrgCode
(
qyzxEntInfoM
.
getId
());
BeanUtil
.
copyProperties
(
jbgzdef
,
Rules
,
"orgCode"
);
Rules
.
insert
();
//假期规则初始化
String
current_time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
List
<
KqglAssoLeaveRules
>
rul
=
KqglAssoLeaveRules
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
().
eq
(
KqglAssoLeaveRules:
:
getOrgCode
,
qyId
));
for
(
KqglAssoLeaveRules
r
:
rul
)
{
if
(
r
.
getLeaveBalance
()
==
0
)
{
KqglAssoLeaveEmployeeBalance
.
builder
().
leaveRulesId
(
r
.
getId
()).
userid
(
login
.
getId
()).
balanceDays
(-
1
).
modifyUserid
(
login
.
getId
()).
modifyTimer
(
current_time
).
orgCode
(
qyId
).
build
().
insert
();
}
else
{
KqglAssoLeaveEmployeeBalance
.
builder
().
leaveRulesId
(
r
.
getId
()).
userid
(
login
.
getId
()).
balanceDays
(
0.0
).
modifyUserid
(
login
.
getId
()).
modifyTimer
(
current_time
).
orgCode
(
qyId
).
build
().
insert
();
}
}
//加班基础设置
KqglAssoOvertimeBasics
.
builder
().
minimumUnit
(
3
).
modifyUserid
(
999
).
modifyTime
(
new
Date
().
getTime
()).
orgCode
(
qyzxEntInfoM
.
getId
()).
build
().
insert
();
//报税周期设置
XcglAssoBszqsz
.
builder
().
taxReturnCycle
(
2
).
qyid
(
qyzxEntInfoM
.
getId
()).
build
().
insert
();
// 绩效设置初始化
JxglBasicSetting
bS
=
jxglService
.
selectAT
(
qyId
);
if
(
bS
==
null
)
{
boolean
res
=
jxglService
.
initJxglBasicSetting
(
qyId
);
if
(!
res
)
{
throw
new
CustomException
(
"绩效设置异常"
);
}
}
/********** 默认企业讯息添加 ***********/
CmsContent
cmsContent
=
CmsContent
.
builder
().
build
();
cmsContent
.
setTitle
(
title
);
cmsContent
.
setPublisherName
(
author
);
cmsContent
.
setAuthor
(
author
);
cmsContent
.
setModularid
(
1
);
cmsContent
.
setFmtpath
(
cover
);
cmsContent
.
setSummary
(
summary
);
cmsContent
.
setStatus
(
1
);
cmsContent
.
setOrganizationId
(
qyId
);
cmsContent
.
setReleasestate
(
0
);
cmsContent
.
setAddeddate
(
new
Date
().
getTime
());
cmsContent
.
setReleasetime
(
String
.
valueOf
(
new
Date
().
getTime
()));
cmsContent
.
insert
();
/********** 默认企业讯息添加 ***********/
return
ResultUtil
.
success
(
"注册企业成功"
);
}
catch
(
Exception
e
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
e
.
printStackTrace
();
return
ResultUtil
.
error
(
"注册异常"
);
}
}
}
qyzxEntInfoM
.
insertOrUpdate
();
b1
=
qyzxEntInfoM
.
updateById
();
if
(!
b1
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败1"
);
}
return
ResultUtil
.
data
(
qyzxEntInfoM
,
"添加/修改企业"
);
return
ResultUtil
.
data
(
qyzxEntInfoM
,
"添加/修改企业"
);
}
}
@GetMapping
(
value
=
"/getCompanySelect"
)
@GetMapping
(
value
=
"/getCompanySelect"
)
...
@@ -645,5 +824,15 @@ public class QyzxController {
...
@@ -645,5 +824,15 @@ public class QyzxController {
public
Result
<
Object
>
getCompanySelect
()
{
public
Result
<
Object
>
getCompanySelect
()
{
return
ResultUtil
.
data
(
qyzxEntInfoMMapper
.
getCompanyList
(),
"获取成功"
);
return
ResultUtil
.
data
(
qyzxEntInfoMMapper
.
getCompanyList
(),
"获取成功"
);
}
}
public
void
Logoutput
(
String
science
)
{
if
(!(
"pro"
).
equals
(
environmental_science
))
{
System
.
out
.
println
(
science
);
}
else
{
System
.
out
.
println
(
""
);
}
}
}
}
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