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
557ba91c
Commit
557ba91c
authored
Dec 11, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户添加接口
parent
b6f48fa5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
462 additions
and
5 deletions
+462
-5
DepartmentController.java
...nage/moduls/controller/customer/DepartmentController.java
+20
-2
CustomerDto.java
...nage/moduls/controller/customer/bean/dto/CustomerDto.java
+100
-0
SaveCustomerRequest.java
...controller/customer/bean/request/SaveCustomerRequest.java
+163
-0
Department.java
...src/main/java/com/jz/manage/moduls/entity/Department.java
+11
-0
MallCustomer.java
...c/main/java/com/jz/manage/moduls/entity/MallCustomer.java
+11
-0
MallCustomerDao.java
...ain/java/com/jz/manage/moduls/mapper/MallCustomerDao.java
+6
-1
DepartmentService.java
.../java/com/jz/manage/moduls/service/DepartmentService.java
+7
-0
DepartmentServiceImpl.java
.../jz/manage/moduls/service/impl/DepartmentServiceImpl.java
+123
-0
DepartmentDao.xml
...nage/src/main/resources/mapper/customer/DepartmentDao.xml
+2
-2
MallCustomerDao.xml
...ge/src/main/resources/mapper/customer/MallCustomerDao.xml
+19
-0
No files found.
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/customer/DepartmentController.java
View file @
557ba91c
...
...
@@ -8,10 +8,12 @@ import com.jz.manage.moduls.controller.BaseController;
import
com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto
;
import
com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest
;
import
com.jz.manage.moduls.service.DepartmentService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -70,13 +72,29 @@ public class DepartmentController extends BaseController {
return
new
Result
<
CompanyDetailsDto
>(
false
,
"查询企业详情失败!"
,
StatusCode
.
ERROR
);
}
@PostMapping
(
value
=
"audit/{id}"
)
/**
* 企业审核接口
* @param id
* @return
*/
@PostMapping
(
value
=
"/audit/{id}"
)
@ApiModelProperty
(
value
=
"企业审核"
)
public
Result
audit
(
@PathVariable
(
value
=
"id"
)
Long
id
)
{
if
(
id
!=
null
)
{
departmentService
.
audit
(
id
);
return
new
Result
<
CompanyDetailsDto
>(
true
,
"企业审核成功!"
,
StatusCode
.
ERROR
);
return
new
Result
<
CompanyDetailsDto
>(
true
,
"企业审核成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<
CompanyDetailsDto
>(
false
,
"企业审核失败!"
,
StatusCode
.
ERROR
);
}
@PostMapping
(
value
=
"/add"
)
@ApiModelProperty
(
value
=
"添加用户"
)
public
Result
add
(
@RequestBody
SaveCustomerRequest
saveCustomerRequest
,
HttpServletRequest
req
)
throws
Exception
{
if
(
saveCustomerRequest
!=
null
)
{
departmentService
.
add
(
saveCustomerRequest
);
return
new
Result
<
CompanyDetailsDto
>(
true
,
"添加用户成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<
CompanyDetailsDto
>(
false
,
"添加用户失败!"
,
StatusCode
.
ERROR
);
}
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/customer/bean/dto/CustomerDto.java
0 → 100644
View file @
557ba91c
package
com
.
jz
.
manage
.
moduls
.
controller
.
customer
.
bean
.
dto
;
import
io.swagger.annotations.ApiModel
;
/**
* @ClassName: CustomerDto
* @Description: 商城用户返回对象参数
* @Author Bellamy
* @Date 2020/12/9
* @Version 1.0
*/
@ApiModel
(
value
=
"商城用户--返回参数对象"
,
description
=
"返回参数对象"
)
public
class
CustomerDto
{
/**
* 用户id
*/
private
Long
customerId
;
/**
* 企业id
*/
private
Long
departmentId
;
/**
* 密码
*/
private
String
password
;
/**
* 账户
*/
private
String
customerAccount
;
/**
* 用户真实姓名
*/
private
String
customerName
;
/**
* 联系电话
*/
private
String
customerPhone
;
/**
* 资产账户id
*/
private
String
assetsId
;
public
Long
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
Long
customerId
)
{
this
.
customerId
=
customerId
;
}
public
Long
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
Long
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getCustomerAccount
()
{
return
customerAccount
;
}
public
void
setCustomerAccount
(
String
customerAccount
)
{
this
.
customerAccount
=
customerAccount
;
}
public
String
getCustomerName
()
{
return
customerName
;
}
public
void
setCustomerName
(
String
customerName
)
{
this
.
customerName
=
customerName
;
}
public
String
getCustomerPhone
()
{
return
customerPhone
;
}
public
void
setCustomerPhone
(
String
customerPhone
)
{
this
.
customerPhone
=
customerPhone
;
}
public
String
getAssetsId
()
{
return
assetsId
;
}
public
void
setAssetsId
(
String
assetsId
)
{
this
.
assetsId
=
assetsId
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/customer/bean/request/SaveCustomerRequest.java
0 → 100644
View file @
557ba91c
package
com
.
jz
.
manage
.
moduls
.
controller
.
customer
.
bean
.
request
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.math.BigDecimal
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/10
* @Version:
*/
@Api
(
tags
=
"用户添加信息请求参数封装"
)
public
class
SaveCustomerRequest
extends
BasePageBean
{
@ApiModelProperty
(
value
=
"企业id"
)
@TableId
(
value
=
"department_id"
,
type
=
IdType
.
AUTO
)
private
Long
departmentId
;
@ApiModelProperty
(
value
=
"企业名称"
)
private
String
departmentName
;
@ApiModelProperty
(
value
=
"企业地址"
)
private
String
registeredAddress
;
@ApiModelProperty
(
value
=
"营业执照"
)
private
String
businessLicense
;
@ApiModelProperty
(
value
=
"统一社会信用代码"
)
private
String
unifiedCreditCode
;
@ApiModelProperty
(
value
=
"银行卡号"
)
private
String
bankCardNumber
;
@ApiModelProperty
(
value
=
"开户行地址"
)
private
String
bankAddress
;
@ApiModelProperty
(
value
=
"联系人姓名"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"联系人电话"
)
private
String
telephone
;
@ApiModelProperty
(
value
=
"账号名"
)
private
String
customerAccount
;
@ApiModelProperty
(
value
=
"账号手机号"
)
private
String
customerPhone
;
@ApiModelProperty
(
value
=
"密码"
)
private
String
password
;
@ApiModelProperty
(
value
=
"充值金额"
)
private
BigDecimal
balanceMoney
;
public
Long
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
Long
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
String
getRegisteredAddress
()
{
return
registeredAddress
;
}
public
void
setRegisteredAddress
(
String
registeredAddress
)
{
this
.
registeredAddress
=
registeredAddress
;
}
public
String
getBusinessLicense
()
{
return
businessLicense
;
}
public
void
setBusinessLicense
(
String
businessLicense
)
{
this
.
businessLicense
=
businessLicense
;
}
public
String
getUnifiedCreditCode
()
{
return
unifiedCreditCode
;
}
public
void
setUnifiedCreditCode
(
String
unifiedCreditCode
)
{
this
.
unifiedCreditCode
=
unifiedCreditCode
;
}
public
String
getBankCardNumber
()
{
return
bankCardNumber
;
}
public
void
setBankCardNumber
(
String
bankCardNumber
)
{
this
.
bankCardNumber
=
bankCardNumber
;
}
public
String
getLinkman
()
{
return
linkman
;
}
public
void
setLinkman
(
String
linkman
)
{
this
.
linkman
=
linkman
;
}
public
String
getBankAddress
()
{
return
bankAddress
;
}
public
void
setBankAddress
(
String
bankAddress
)
{
this
.
bankAddress
=
bankAddress
;
}
public
String
getCustomerPhone
()
{
return
customerPhone
;
}
public
void
setCustomerPhone
(
String
customerPhone
)
{
this
.
customerPhone
=
customerPhone
;
}
public
String
getCustomerAccount
()
{
return
customerAccount
;
}
public
void
setCustomerAccount
(
String
customerAccount
)
{
this
.
customerAccount
=
customerAccount
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
BigDecimal
getBalanceMoney
()
{
return
balanceMoney
;
}
public
void
setBalanceMoney
(
BigDecimal
balanceMoney
)
{
this
.
balanceMoney
=
balanceMoney
;
}
public
String
getTelephone
()
{
return
telephone
;
}
public
void
setTelephone
(
String
telephone
)
{
this
.
telephone
=
telephone
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/moduls/entity/Department.java
View file @
557ba91c
...
...
@@ -44,6 +44,10 @@ public class Department implements Serializable {
* 行业
*/
private
String
industry
;
/**
* 联系人
*/
private
String
linkman
;
/**
* 联系电话
*/
...
...
@@ -370,4 +374,11 @@ public class Department implements Serializable {
this
.
delFlag
=
delFlag
;
}
public
String
getLinkman
()
{
return
linkman
;
}
public
void
setLinkman
(
String
linkman
)
{
this
.
linkman
=
linkman
;
}
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/entity/MallCustomer.java
View file @
557ba91c
...
...
@@ -68,6 +68,10 @@ public class MallCustomer implements Serializable {
* 创建时间
*/
private
Date
creTime
;
/**
* 创建人
*/
private
String
crePerson
;
/**
* 更新时间
*/
...
...
@@ -198,4 +202,11 @@ public class MallCustomer implements Serializable {
this
.
delFlag
=
delFlag
;
}
public
String
getCrePerson
()
{
return
crePerson
;
}
public
void
setCrePerson
(
String
crePerson
)
{
this
.
crePerson
=
crePerson
;
}
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/mapper/MallCustomerDao.java
View file @
557ba91c
package
com
.
jz
.
manage
.
moduls
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.common.entity.MallCustomer
;
import
com.jz.manage.moduls.entity.MallCustomer
;
import
java.util.Map
;
/**
* 商城用户(TMallCustomer)表数据库访问层
...
...
@@ -12,4 +16,5 @@ import com.jz.common.entity.MallCustomer;
public
interface
MallCustomerDao
extends
BaseMapper
<
MallCustomer
>
{
MallCustomer
selectByUser
(
Map
map
);
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/DepartmentService.java
View file @
557ba91c
...
...
@@ -4,6 +4,7 @@ import com.jz.common.bean.PageInfoResponse;
import
com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto
;
import
com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -36,4 +37,10 @@ public interface DepartmentService {
* @param id
*/
void
audit
(
Long
id
);
/**
* 添加用户
* @param saveCustomerRequest
*/
void
add
(
SaveCustomerRequest
saveCustomerRequest
);
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/impl/DepartmentServiceImpl.java
View file @
557ba91c
...
...
@@ -10,16 +10,23 @@ import com.jz.common.exception.ResponseException;
import
com.jz.common.utils.DateUtils
;
import
com.jz.manage.moduls.controller.customer.bean.dto.CompanyDetailsDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.CustomerDto
;
import
com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto
;
import
com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest
;
import
com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest
;
import
com.jz.manage.moduls.entity.Department
;
import
com.jz.manage.moduls.entity.FinanceCustomerAssets
;
import
com.jz.manage.moduls.entity.FinanceCustomerBalance
;
import
com.jz.manage.moduls.entity.MallCustomer
;
import
com.jz.manage.moduls.mapper.DepartmentDao
;
import
com.jz.manage.moduls.mapper.FinanceCustomerAssetsDao
;
import
com.jz.manage.moduls.mapper.FinanceCustomerBalanceDao
;
import
com.jz.manage.moduls.mapper.MallCustomerDao
;
import
com.jz.manage.moduls.service.DepartmentService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -40,6 +47,13 @@ public class DepartmentServiceImpl implements DepartmentService {
@Autowired
private
FinanceCustomerAssetsDao
financeCustomerAssetsDao
;
@Autowired
private
MallCustomerDao
mallCustomerDao
;
@Autowired
private
FinanceCustomerBalanceDao
financeCustomerBalanceDao
;
/**
* 条件查询企业审核信息列表
*
...
...
@@ -98,6 +112,7 @@ public class DepartmentServiceImpl implements DepartmentService {
* @param id
*/
@Override
@Transactional
public
void
audit
(
Long
id
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"department_id"
,
id
);
...
...
@@ -124,4 +139,112 @@ public class DepartmentServiceImpl implements DepartmentService {
financeCustomerAssetsDao
.
insert
(
financeCustomerAssets
);
}
/**
* 添加用户
*
* @param
*/
@Override
@Transactional
public
void
add
(
SaveCustomerRequest
saveCustomerReq
)
{
// 校验信息
userCheck
(
saveCustomerReq
);
// 保存企业信息
saveCompany
(
saveCustomerReq
);
// 保存账号信息
MallCustomer
mallCustomer
=
new
MallCustomer
();
mallCustomer
.
setCustomerAccount
(
saveCustomerReq
.
getCustomerAccount
());
mallCustomer
.
setCustomerPhone
(
saveCustomerReq
.
getCustomerPhone
());
mallCustomer
.
setPassword
(
saveCustomerReq
.
getPassword
());
mallCustomer
.
setCreTime
(
DateUtils
.
getToday
());
mallCustomer
.
setCrePerson
(
"1"
);
mallCustomer
.
setDelFlag
(
"N"
);
mallCustomerDao
.
insert
(
mallCustomer
);
// 如果充值金额不为空
if
(
saveCustomerReq
.
getBalanceMoney
()
!=
null
)
{
// 获取最新的企业id
Long
departmentId
=
saveCustomerReq
.
getDepartmentId
();
// 新增一条企业客户资产
FinanceCustomerAssets
assets
=
new
FinanceCustomerAssets
();
if
(
departmentId
!=
null
)
{
try
{
assets
.
setDepartmentId
(
departmentId
);
assets
.
setUseMoney
(
saveCustomerReq
.
getBalanceMoney
());
assets
.
setTotalMoney
(
saveCustomerReq
.
getBalanceMoney
());
assets
.
setCreTime
(
DateUtils
.
getToday
());
assets
.
setCrePerson
(
String
.
valueOf
(
mallCustomer
.
getCustomerId
()));
int
insert
=
financeCustomerAssetsDao
.
insert
(
assets
);
System
.
out
.
println
(
insert
);
}
catch
(
Exception
e
)
{
throw
ResponseException
.
of
(
ResultCode
.
FAILURE
,
"新增企业资产失败!"
);
}
}
// 新增一条充值记录表
// 获取最新的资产id
Long
assetsId
=
assets
.
getAssetsId
();
FinanceCustomerBalance
balance
=
new
FinanceCustomerBalance
();
if
(
assetsId
!=
null
)
{
try
{
balance
.
setAssetsId
(
assetsId
);
balance
.
setBalanceMoney
(
saveCustomerReq
.
getBalanceMoney
());
balance
.
setCrePerson
(
String
.
valueOf
(
mallCustomer
.
getCustomerId
()));
balance
.
setCreTime
(
DateUtils
.
getToday
());
balance
.
setAuditStatus
(
"02"
);
financeCustomerBalanceDao
.
insert
(
balance
);
}
catch
(
Exception
e
)
{
throw
ResponseException
.
of
(
ResultCode
.
FAILURE
,
"新增充值记录失败!"
);
}
}
}
}
/**
* 保存企业信息
* @param saveCustomerReq
*/
private
void
saveCompany
(
SaveCustomerRequest
saveCustomerReq
)
{
Department
department
=
new
Department
();
// 添加创建人/创建时间
department
.
setCrePerson
(
"1"
);
department
.
setCreTime
(
DateUtils
.
getToday
());
// 基本信息
department
.
setDepartmentName
(
saveCustomerReq
.
getDepartmentName
());
department
.
setRegisteredAddress
(
saveCustomerReq
.
getRegisteredAddress
());
// 企业信息
department
.
setUnifiedCreditCode
(
saveCustomerReq
.
getUnifiedCreditCode
());
department
.
setBusinessLicense
(
saveCustomerReq
.
getBusinessLicense
());
department
.
setBankAddress
(
saveCustomerReq
.
getBankAddress
());
department
.
setBankCardNumber
(
saveCustomerReq
.
getBankCardNumber
());
// 联系人信息
department
.
setLinkman
(
saveCustomerReq
.
getLinkman
());
department
.
setTelephone
(
saveCustomerReq
.
getTelephone
());
// 已审核
department
.
setAuditStatus
(
"02"
);
}
/**
* 校验企业/账号是否存在
* @param saveCustomerReq
*/
private
void
userCheck
(
SaveCustomerRequest
saveCustomerReq
)
{
// 校验公司是否已存在
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"unified_credit_code"
,
saveCustomerReq
.
getUnifiedCreditCode
());
Department
department
=
tDepartmentDao
.
selectOne
(
queryWrapper
);
// 如果不为空
if
(
department
!=
null
)
{
throw
ResponseException
.
of
(
ResultCode
.
FAILURE
,
"公司已存在"
);
}
// 校验账号信息
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"customerAccount"
,
saveCustomerReq
.
getCustomerAccount
());
map
.
put
(
"customerPhone"
,
saveCustomerReq
.
getCustomerPhone
());
// 查询用户是否存在
MallCustomer
mallCustomer
=
mallCustomerDao
.
selectByUser
(
map
);
if
(
mallCustomer
!=
null
)
{
throw
ResponseException
.
of
(
ResultCode
.
FAILURE
,
"用户已存在,请重新输入!"
);
}
}
}
\ No newline at end of file
jz-dm-manage/src/main/resources/mapper/customer/DepartmentDao.xml
View file @
557ba91c
...
...
@@ -150,10 +150,10 @@
</select>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"departmentId"
useGeneratedKeys=
"true"
>
<
!--<
insert id="insert" keyProperty="departmentId" useGeneratedKeys="true">
insert into t_department(department_name, legal_representative, province, city, industry, telephone, registered_address, zone_code, depart_picture, business_license, tax_registration, depart_picture_time, business_license_time, tax_registration_time, unified_credit_code, bank_name, bank_card_number, bank_address, bank_no, audit_status, reject_reason, audit_person, audit_time, cre_time, cre_person, upt_time, upt_person, del_flag)
values (#{departmentName}, #{legalRepresentative}, #{province}, #{city}, #{industry}, #{telephone}, #{registeredAddress}, #{zoneCode}, #{departPicture}, #{businessLicense}, #{taxRegistration}, #{departPictureTime}, #{businessLicenseTime}, #{taxRegistrationTime}, #{unifiedCreditCode}, #{bankName}, #{bankCardNumber}, #{bankAddress}, #{bankNo}, #{auditStatus}, #{rejectReason}, #{auditPerson}, #{auditTime}, #{creTime}, #{crePerson}, #{uptTime}, #{uptPerson}, #{delFlag})
</insert>
</insert>
-->
<insert
id=
"insertOrUpdateBatch"
keyProperty=
"departmentId"
useGeneratedKeys=
"true"
>
insert into t_department(department_name, legal_representative, province, city, industry,
...
...
jz-dm-manage/src/main/resources/mapper/customer/MallCustomerDao.xml
View file @
557ba91c
...
...
@@ -165,4 +165,23 @@
delete from t_mall_customer where customer_id = #{customerId}
</delete>
<select
id=
"selectByUser"
resultType=
"com.jz.manage.moduls.entity.MallCustomer"
parameterType=
"map"
>
select
customer_id,
department_id,
password,
customer_account,
customer_name,
customer_phone
from t_mall_customer
where
1=1
and del_flag='N'
<if
test=
"customerPhone != null"
>
and customer_phone = #{customerPhone}
</if>
<if
test=
"customerAccount != null"
>
and customer_account = #{customerAccount}
</if>
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment