Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
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
Administrator
dsk-cr20g
Commits
b54c462e
Commit
b54c462e
authored
Jun 01, 2023
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段添加,逻辑修改
parent
24888aae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
8 deletions
+48
-8
CustomerController.java
...a/com/dsk/web/controller/customer/CustomerController.java
+12
-0
Customer.java
...rc/main/java/com/dsk/system/domain/customer/Customer.java
+4
-0
CustomerListVo.java
...ava/com/dsk/system/domain/customer/vo/CustomerListVo.java
+4
-0
EnterpriseService.java
...ain/java/com/dsk/system/dskService/EnterpriseService.java
+8
-0
CustomerMapper.java
...m/src/main/java/com/dsk/system/mapper/CustomerMapper.java
+1
-1
CustomerServiceImpl.java
...java/com/dsk/system/service/impl/CustomerServiceImpl.java
+16
-4
CustomerMapper.xml
.../main/resources/mapper/system/customer/CustomerMapper.xml
+3
-3
No files found.
dsk-admin/src/main/java/com/dsk/web/controller/customer/CustomerController.java
View file @
b54c462e
package
com
.
dsk
.
web
.
controller
.
customer
;
package
com
.
dsk
.
web
.
controller
.
customer
;
import
cn.hutool.core.bean.BeanException
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.http.HttpException
;
import
cn.hutool.http.HttpException
;
...
@@ -15,6 +16,7 @@ import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
...
@@ -15,6 +16,7 @@ import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import
com.dsk.system.domain.customer.dto.CustomerSearchDto
;
import
com.dsk.system.domain.customer.dto.CustomerSearchDto
;
import
com.dsk.system.service.ICustomerService
;
import
com.dsk.system.service.ICustomerService
;
import
com.dsk.web.controller.search.service.BusinessOpportunityRadarService
;
import
com.dsk.web.controller.search.service.BusinessOpportunityRadarService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -66,6 +68,16 @@ public class CustomerController extends BaseController {
...
@@ -66,6 +68,16 @@ public class CustomerController extends BaseController {
@PostMapping
()
@PostMapping
()
@RepeatSubmit
@RepeatSubmit
public
AjaxResult
add
(
@RequestBody
Customer
customer
)
{
public
AjaxResult
add
(
@RequestBody
Customer
customer
)
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
throw
new
BeanException
(
"企业名称不能为空"
);
try
{
Map
<
String
,
Object
>
map
=
opportunityRadarService
.
enterpriseByName
(
customer
.
getCompanyName
());
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"data"
)))
{
customer
.
setCompanyId
(
MapUtil
.
getInt
(
BeanUtil
.
beanToMap
(
map
.
get
(
"data"
)),
"jskEid"
));
}
}
catch
(
Exception
e
)
{
logger
.
debug
(
"获取企业id错误!error:{}"
,
e
.
getMessage
());
}
baseService
.
add
(
customer
);
return
AjaxResult
.
success
(
baseService
.
add
(
customer
));
return
AjaxResult
.
success
(
baseService
.
add
(
customer
));
}
}
...
...
dsk-system/src/main/java/com/dsk/system/domain/customer/Customer.java
View file @
b54c462e
...
@@ -29,6 +29,10 @@ public class Customer implements Serializable {
...
@@ -29,6 +29,10 @@ public class Customer implements Serializable {
* jsk企业id
* jsk企业id
*/
*/
private
Integer
companyId
;
private
Integer
companyId
;
/**
* 城投企业id
*/
private
String
uipId
;
/**
/**
* 客户名称(企业名称)
* 客户名称(企业名称)
*/
*/
...
...
dsk-system/src/main/java/com/dsk/system/domain/customer/vo/CustomerListVo.java
View file @
b54c462e
...
@@ -14,6 +14,10 @@ public class CustomerListVo {
...
@@ -14,6 +14,10 @@ public class CustomerListVo {
* jsk企业id
* jsk企业id
*/
*/
private
Integer
companyId
;
private
Integer
companyId
;
/**
* 城投企业id
*/
private
String
uipId
;
/**
/**
* 客户名称(企业名称)
* 客户名称(企业名称)
*/
*/
...
...
dsk-system/src/main/java/com/dsk/system/dskService/EnterpriseService.java
View file @
b54c462e
package
com
.
dsk
.
system
.
dskService
;
package
com
.
dsk
.
system
.
dskService
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.dsk.common.core.domain.R
;
import
com.dsk.common.core.domain.R
;
import
com.dsk.common.core.domain.model.*
;
import
com.dsk.common.core.domain.model.*
;
import
com.dsk.common.core.page.TableDataInfo
;
import
com.dsk.common.core.page.TableDataInfo
;
...
@@ -128,4 +129,11 @@ public class EnterpriseService {
...
@@ -128,4 +129,11 @@ public class EnterpriseService {
Map
<
String
,
Object
>
map
=
dskOpenApiUtil
.
requestBody
(
"/operate/enterprise/financial"
,
BeanUtil
.
beanToMap
(
body
,
false
,
false
));
Map
<
String
,
Object
>
map
=
dskOpenApiUtil
.
requestBody
(
"/operate/enterprise/financial"
,
BeanUtil
.
beanToMap
(
body
,
false
,
false
));
return
BeanUtil
.
toBean
(
map
,
R
.
class
);
return
BeanUtil
.
toBean
(
map
,
R
.
class
);
}
}
public
R
getUipId
(
String
companyName
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"companyName"
,
companyName
);
Map
<
String
,
Object
>
map
=
dskOpenApiUtil
.
requestBody
(
"/operate/enterprise/getUipId"
,
params
);
return
BeanUtil
.
toBean
(
map
,
R
.
class
);
}
}
}
dsk-system/src/main/java/com/dsk/system/mapper/CustomerMapper.java
View file @
b54c462e
...
@@ -23,7 +23,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
...
@@ -23,7 +23,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
List
<
Customer
>
selectUserList
(
Long
userId
);
List
<
Customer
>
selectUserList
(
Long
userId
);
Customer
selectByCompany
IdAndUserId
(
@Param
(
"companyId"
)
Integer
companyId
,
@Param
(
"userId"
)
Long
userId
);
Customer
selectByCompany
NameAndUserId
(
@Param
(
"companyName"
)
String
companyName
,
@Param
(
"userId"
)
Long
userId
);
}
}
dsk-system/src/main/java/com/dsk/system/service/impl/CustomerServiceImpl.java
View file @
b54c462e
...
@@ -2,7 +2,9 @@ package com.dsk.system.service.impl;
...
@@ -2,7 +2,9 @@ package com.dsk.system.service.impl;
import
cn.hutool.core.bean.BeanException
;
import
cn.hutool.core.bean.BeanException
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.dsk.common.core.domain.R
;
import
com.dsk.common.exception.ServiceException
;
import
com.dsk.common.exception.ServiceException
;
import
com.dsk.common.utils.SecurityUtils
;
import
com.dsk.common.utils.SecurityUtils
;
import
com.dsk.system.domain.customer.Customer
;
import
com.dsk.system.domain.customer.Customer
;
...
@@ -12,6 +14,7 @@ import com.dsk.system.domain.customer.dto.CustomerSearchDto;
...
@@ -12,6 +14,7 @@ import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import
com.dsk.system.domain.customer.vo.CustomerBusinessListVo
;
import
com.dsk.system.domain.customer.vo.CustomerBusinessListVo
;
import
com.dsk.system.domain.customer.vo.CustomerListVo
;
import
com.dsk.system.domain.customer.vo.CustomerListVo
;
import
com.dsk.system.domain.customer.vo.CustomerVo
;
import
com.dsk.system.domain.customer.vo.CustomerVo
;
import
com.dsk.system.dskService.EnterpriseService
;
import
com.dsk.system.mapper.CustomerMapper
;
import
com.dsk.system.mapper.CustomerMapper
;
import
com.dsk.system.mapper.CustomerUserMapper
;
import
com.dsk.system.mapper.CustomerUserMapper
;
import
com.dsk.system.service.IBusinessInfoService
;
import
com.dsk.system.service.IBusinessInfoService
;
...
@@ -41,6 +44,8 @@ public class CustomerServiceImpl implements ICustomerService {
...
@@ -41,6 +44,8 @@ public class CustomerServiceImpl implements ICustomerService {
private
CustomerUserMapper
customerUserMapper
;
private
CustomerUserMapper
customerUserMapper
;
@Autowired
@Autowired
private
IBusinessInfoService
businessInfoService
;
private
IBusinessInfoService
businessInfoService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Override
@Override
public
List
<
CustomerListVo
>
selectList
(
CustomerSearchDto
dto
)
{
public
List
<
CustomerListVo
>
selectList
(
CustomerSearchDto
dto
)
{
...
@@ -70,13 +75,20 @@ public class CustomerServiceImpl implements ICustomerService {
...
@@ -70,13 +75,20 @@ public class CustomerServiceImpl implements ICustomerService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
add
(
Customer
customer
)
{
public
boolean
add
(
Customer
customer
)
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
throw
new
BeanException
(
"企业名称不能为空"
);
try
{
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyId
()))
throw
new
BeanException
(
"企业id不能为空"
);
R
res
=
enterpriseService
.
getUipId
(
customer
.
getCompanyName
());
final
Long
userId
=
SecurityUtils
.
getUserId
();
if
(!
ObjectUtils
.
isEmpty
(
res
.
getData
()))
{
customer
.
setUipId
(
MapUtil
.
getStr
(
BeanUtil
.
beanToMap
(
res
.
getData
()),
"uipId"
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"获取城投平台企业id错误!error:{}"
,
e
.
getMessage
());
}
Long
userId
=
SecurityUtils
.
getUserId
();
customer
.
setCreateId
(
userId
);
customer
.
setCreateId
(
userId
);
customer
.
setUpdateId
(
userId
);
customer
.
setUpdateId
(
userId
);
//查重
//查重
Customer
verifyCustomer
=
baseMapper
.
selectByCompany
IdAndUserId
(
customer
.
getCompanyId
(),
userId
);
Customer
verifyCustomer
=
baseMapper
.
selectByCompany
NameAndUserId
(
customer
.
getCompanyName
(),
userId
);
if
(!
ObjectUtils
.
isEmpty
(
verifyCustomer
))
{
if
(!
ObjectUtils
.
isEmpty
(
verifyCustomer
))
{
throw
new
ServiceException
(
"当前客户信息已存在,请勿重复添加!"
);
throw
new
ServiceException
(
"当前客户信息已存在,请勿重复添加!"
);
}
}
...
...
dsk-system/src/main/resources/mapper/system/customer/CustomerMapper.xml
View file @
b54c462e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"com.dsk.system.mapper.CustomerMapper"
>
<mapper
namespace=
"com.dsk.system.mapper.CustomerMapper"
>
<sql
id=
"Base_Bean"
>
<sql
id=
"Base_Bean"
>
ct.customer_id, ct.company_id, ct.company_name, ct.legal_person, ct.credit_code, ct.register_capital,
ct.customer_id, ct.company_id, ct.
uip_id, ct.
company_name, ct.legal_person, ct.credit_code, ct.register_capital,
ct.province_id, ct.city_id, ct.district_id, ct.register_address, ct.company_nature, ct.company_level,
ct.province_id, ct.city_id, ct.district_id, ct.register_address, ct.company_nature, ct.company_level,
ct.credit_level, ct.super_company, ct.is_on, ct.is_major, ct.company_attribute, ct.main_business,
ct.credit_level, ct.super_company, ct.is_on, ct.is_major, ct.company_attribute, ct.main_business,
ct.business_scope, ct.customer_level, ct.business_characteristic, ct.decision_chain, ct.bid_characteristic,
ct.business_scope, ct.customer_level, ct.business_characteristic, ct.decision_chain, ct.bid_characteristic,
...
@@ -29,12 +29,12 @@
...
@@ -29,12 +29,12 @@
where ctu.user_id = #{userId}
where ctu.user_id = #{userId}
</select>
</select>
<select
id=
"selectByCompany
Id
AndUserId"
resultType=
"com.dsk.system.domain.customer.Customer"
>
<select
id=
"selectByCompany
Name
AndUserId"
resultType=
"com.dsk.system.domain.customer.Customer"
>
select
select
<include
refid=
"Base_Bean"
></include>
<include
refid=
"Base_Bean"
></include>
from customer ct
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
join customer_user ctu on ct.customer_id = ctu.customer_id
where ct.company_
id = ${companyId
} and ctu.user_id = #{userId}
where ct.company_
name = #{companyName
} and ctu.user_id = #{userId}
</select>
</select>
</mapper>
</mapper>
...
...
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