Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
f0396d33
Commit
f0396d33
authored
Dec 03, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
035c4ada
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
MallCustomerDao.java
...in/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
+10
-0
CompanyAuthServiceImpl.java
...z/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
+17
-4
No files found.
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
View file @
f0396d33
...
...
@@ -2,6 +2,8 @@ package com.jz.dm.mall.moduls.mapper;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.entity.MallCustomer
;
import
org.apache.ibatis.annotations.ResultType
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.Map
;
...
...
@@ -27,4 +29,12 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
*/
MallCustomer
selectByPhone
(
String
username
);
/**
* 根据ID查询用户信息
* @param customerId
* @return
*/
@Select
(
"select * from t_mall_customer where customer_id =#{customerId}"
)
@ResultType
(
MallCustomer
.
class
)
MallCustomer
findById
(
Long
customerId
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/CompanyAuthServiceImpl.java
View file @
f0396d33
...
...
@@ -5,6 +5,7 @@ import com.jz.common.entity.Department;
import
com.jz.common.entity.FinanceCustomerAssets
;
import
com.jz.common.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.UserContextUtil
;
import
com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq
;
import
com.jz.dm.mall.moduls.mapper.DepartmentDao
;
import
com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao
;
...
...
@@ -52,6 +53,18 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Result
addCompanyData
(
CompanyAddReq
req
)
{
//TODO 获取当前用户ID判断当前用户是否已经关联企业
Long
customerId
=
(
Long
)
UserContextUtil
.
pop
(
"customer_id"
);
if
(
null
==
customerId
){
return
Result
.
error
(
"获取用户信息失败"
);
}
MallCustomer
mallCustomer
=
mallCustomerDao
.
findById
(
customerId
);
if
(
null
==
mallCustomer
){
return
Result
.
error
(
"用户信息不存在"
);
}
if
(
null
!=
mallCustomer
.
getDepartmentId
()){
return
Result
.
error
(
"用户已关联企业,请勿重复操作"
);
}
req
.
setCustomerId
(
mallCustomer
.
getCustomerId
());
if
(
StringUtils
.
isNotBlank
(
req
.
getDepartmentName
())
&&
StringUtils
.
isNotBlank
(
req
.
getUnifiedCreditCode
()))
{
//企业名称 && 营业执照
Department
department
=
departmentDao
.
selectDepartmentData
(
req
);
...
...
@@ -85,7 +98,7 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
Department
departmentInset
=
new
Department
();
departmentInset
.
setAuditStatus
(
"01"
);
//待审核
departmentInset
.
setCreTime
(
new
Date
());
departmentInset
.
setCrePerson
(
""
);
departmentInset
.
setCrePerson
(
req
.
getLoginName
()
);
BeanUtils
.
copyProperties
(
req
,
departmentInset
);
if
(
departmentDao
.
insert
(
departmentInset
)
!=
1
){
throw
new
RuntimeException
(
"保存企业信息失败"
);
...
...
@@ -94,16 +107,16 @@ public class CompanyAuthServiceImpl implements CompanyAuthService {
FinanceCustomerAssets
finance
=
new
FinanceCustomerAssets
();
finance
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
//企业ID
finance
.
setCreTime
(
new
Date
());
finance
.
setCrePerson
(
""
);
finance
.
setCrePerson
(
req
.
getLoginName
()
);
if
(
financeCustomerAssetsDao
.
insert
(
finance
)
!=
1
){
throw
new
RuntimeException
(
"初始化用户资产失败"
);
}
//更新用户企业信息
MallCustomer
mallCustomer
=
new
MallCustomer
();
mallCustomer
.
setCustomerId
(
0L
);
//用户ID
mallCustomer
.
setCustomerId
(
req
.
getCustomerId
()
);
//用户ID
mallCustomer
.
setDepartmentId
(
departmentInset
.
getDepartmentId
());
mallCustomer
.
setUptTime
(
new
Date
());
mallCustomer
.
setUptPerson
(
""
);
mallCustomer
.
setUptPerson
(
req
.
getLoginName
()
);
if
(
mallCustomerDao
.
updateById
(
mallCustomer
)
!=
1
){
throw
new
RuntimeException
(
"更新用户企业信息失败"
);
}
...
...
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