Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
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
fulixin
dsk-operate-sys-cscec
Commits
34ef544f
Commit
34ef544f
authored
May 23, 2023
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户合作情况相关接口
parent
12fb1e96
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
227 additions
and
54 deletions
+227
-54
CustomerController.java
...a/com/dsk/web/controller/customer/CustomerController.java
+12
-2
BusinessAddDto.java
...m/src/main/java/com/dsk/system/domain/BusinessAddDto.java
+4
-0
CustomerBusinessSearchDto.java
...system/domain/customer/dto/CustomerBusinessSearchDto.java
+31
-0
CustomerBusinessListVo.java
...dsk/system/domain/customer/vo/CustomerBusinessListVo.java
+36
-0
CustomerListVo.java
...ava/com/dsk/system/domain/customer/vo/CustomerListVo.java
+5
-1
BusinessInfoMapper.java
...c/main/java/com/dsk/system/mapper/BusinessInfoMapper.java
+18
-10
CustomerMapper.java
...m/src/main/java/com/dsk/system/mapper/CustomerMapper.java
+4
-0
IBusinessInfoService.java
...ain/java/com/dsk/system/service/IBusinessInfoService.java
+15
-8
ICustomerService.java
...rc/main/java/com/dsk/system/service/ICustomerService.java
+4
-0
BusinessInfoServiceImpl.java
.../com/dsk/system/service/impl/BusinessInfoServiceImpl.java
+29
-17
CustomerServiceImpl.java
...java/com/dsk/system/service/impl/CustomerServiceImpl.java
+23
-10
BusinessInfoMapper.xml
...src/main/resources/mapper/business/BusinessInfoMapper.xml
+20
-1
CustomerMapper.xml
.../main/resources/mapper/system/customer/CustomerMapper.xml
+26
-5
No files found.
dsk-admin/src/main/java/com/dsk/web/controller/customer/CustomerController.java
View file @
34ef544f
...
@@ -4,8 +4,8 @@ import com.dsk.common.annotation.RepeatSubmit;
...
@@ -4,8 +4,8 @@ import com.dsk.common.annotation.RepeatSubmit;
import
com.dsk.common.core.controller.BaseController
;
import
com.dsk.common.core.controller.BaseController
;
import
com.dsk.common.core.domain.AjaxResult
;
import
com.dsk.common.core.domain.AjaxResult
;
import
com.dsk.common.core.page.TableDataInfo
;
import
com.dsk.common.core.page.TableDataInfo
;
import
com.dsk.common.utils.PageUtils
;
import
com.dsk.system.domain.customer.Customer
;
import
com.dsk.system.domain.customer.Customer
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -69,8 +69,18 @@ public class CustomerController extends BaseController {
...
@@ -69,8 +69,18 @@ public class CustomerController extends BaseController {
*/
*/
@PreAuthorize
(
"@ss.hasPermi('customer:user:list')"
)
@PreAuthorize
(
"@ss.hasPermi('customer:user:list')"
)
@GetMapping
(
"/user/list"
)
@GetMapping
(
"/user/list"
)
public
AjaxResult
selectU
serList
(){
public
AjaxResult
u
serList
(){
return
AjaxResult
.
success
(
baseService
.
selectUserList
());
return
AjaxResult
.
success
(
baseService
.
selectUserList
());
}
}
/**
* 获取客户项目(合作情况)列表
*/
@PreAuthorize
(
"@ss.hasPermi('customer:business:list')"
)
@GetMapping
(
"/business/list"
)
public
TableDataInfo
businessList
(
CustomerBusinessSearchDto
dto
){
startPage
();
return
getDataTable
(
baseService
.
selectBusinessList
(
dto
));
}
}
}
dsk-system/src/main/java/com/dsk/system/domain/BusinessAddDto.java
View file @
34ef544f
...
@@ -54,6 +54,10 @@ public class BusinessAddDto {
...
@@ -54,6 +54,10 @@ public class BusinessAddDto {
* 可见范围
* 可见范围
*/
*/
private
Integer
isPrivate
;
private
Integer
isPrivate
;
/**
* 客户id
*/
private
String
customerId
;
public
Double
getInvestmentAmount
()
{
public
Double
getInvestmentAmount
()
{
return
Double
.
parseDouble
(
investmentAmount
);
return
Double
.
parseDouble
(
investmentAmount
);
...
...
dsk-system/src/main/java/com/dsk/system/domain/customer/dto/CustomerBusinessSearchDto.java
0 → 100644
View file @
34ef544f
package
com
.
dsk
.
system
.
domain
.
customer
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 客户合作情况筛选对象
* @author lcl
* @create 2023/5/16
*/
@Data
public
class
CustomerBusinessSearchDto
implements
Serializable
{
/**
* 企业id
*/
private
String
customerId
;
/**
* 企业id
*/
private
Long
userId
;
/**
* 项目阶段
*/
private
String
projectStage
;
/**
* 项目状态
*/
private
Integer
status
;
}
dsk-system/src/main/java/com/dsk/system/domain/customer/vo/CustomerBusinessListVo.java
0 → 100644
View file @
34ef544f
package
com
.
dsk
.
system
.
domain
.
customer
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 客户合作情况列表对象
*
* @author lcl
* @create 2023/5/22
*/
@Data
public
class
CustomerBusinessListVo
implements
Serializable
{
/**
* 项目id
*/
private
Integer
id
;
/**
* 项目名称
*/
private
String
projcetName
;
/**
* 项目阶段
*/
private
String
projectStage
;
/**
* 投资金额
*/
private
String
investmentAmount
;
/**
* 状态
*/
private
Integer
status
;
}
dsk-system/src/main/java/com/dsk/system/domain/customer/vo/CustomerListVo.java
View file @
34ef544f
...
@@ -37,7 +37,11 @@ public class CustomerListVo {
...
@@ -37,7 +37,11 @@ public class CustomerListVo {
/**
/**
* 注册资本(字符串)
* 注册资本(字符串)
*/
*/
private
String
registerCapitalStr
;
private
String
registerCapital
;
/**
* 社会统一信用代码
*/
private
String
creditCode
;
/**
/**
* 企业性质
* 企业性质
*/
*/
...
...
dsk-system/src/main/java/com/dsk/system/mapper/BusinessInfoMapper.java
View file @
34ef544f
...
@@ -2,24 +2,27 @@ package com.dsk.system.mapper;
...
@@ -2,24 +2,27 @@ package com.dsk.system.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.dsk.common.core.domain.entity.BusinessInfo
;
import
com.dsk.common.core.domain.entity.BusinessInfo
;
import
com.dsk.common.dtos.BusinessInfoDto
;
import
com.dsk.system.domain.BusinessAddDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto
;
import
com.dsk.system.domain.customer.vo.CustomerBusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 项目详情Mapper接口
* 项目详情Mapper接口
*
*
* @author lxl
* @author lxl
* @date 2023-05-17
* @date 2023-05-17
*/
*/
public
interface
BusinessInfoMapper
@Mapper
public
interface
BusinessInfoMapper
extends
BaseMapper
<
BusinessInfo
>
{
{
/**
/**
* 查询项目详情
* 查询项目详情
*
*
* @param id 项目详情主键
* @param id 项目详情主键
* @return 项目详情
* @return 项目详情
*/
*/
...
@@ -33,7 +36,7 @@ public interface BusinessInfoMapper
...
@@ -33,7 +36,7 @@ public interface BusinessInfoMapper
/**
/**
* 查询项目详情列表
* 查询项目详情列表
*
*
* @param dto 项目详情
* @param dto 项目详情
* @return 项目详情集合
* @return 项目详情集合
*/
*/
...
@@ -41,7 +44,7 @@ public interface BusinessInfoMapper
...
@@ -41,7 +44,7 @@ public interface BusinessInfoMapper
/**
/**
* 新增项目详情
* 新增项目详情
*
*
* @param businessInfo 项目详情
* @param businessInfo 项目详情
* @return 结果
* @return 结果
*/
*/
...
@@ -49,7 +52,7 @@ public interface BusinessInfoMapper
...
@@ -49,7 +52,7 @@ public interface BusinessInfoMapper
/**
/**
* 修改项目详情
* 修改项目详情
*
*
* @param businessInfo 项目详情
* @param businessInfo 项目详情
* @return 结果
* @return 结果
*/
*/
...
@@ -57,7 +60,7 @@ public interface BusinessInfoMapper
...
@@ -57,7 +60,7 @@ public interface BusinessInfoMapper
/**
/**
* 删除项目详情
* 删除项目详情
*
*
* @param id 项目详情主键
* @param id 项目详情主键
* @return 结果
* @return 结果
*/
*/
...
@@ -65,9 +68,14 @@ public interface BusinessInfoMapper
...
@@ -65,9 +68,14 @@ public interface BusinessInfoMapper
/**
/**
* 批量删除项目详情
* 批量删除项目详情
*
*
* @param ids 需要删除的数据主键集合
* @param ids 需要删除的数据主键集合
* @return 结果
* @return 结果
*/
*/
public
int
deleteBusinessInfoByIds
(
Long
[]
ids
);
public
int
deleteBusinessInfoByIds
(
Long
[]
ids
);
int
selectCountByStatusAndCustomerId
(
@Param
(
"status"
)
Integer
status
,
@Param
(
"customerId"
)
String
customerId
);
List
<
CustomerBusinessListVo
>
selectCustomerBusinessList
(
CustomerBusinessSearchDto
dto
);
}
}
dsk-system/src/main/java/com/dsk/system/mapper/CustomerMapper.java
View file @
34ef544f
...
@@ -21,5 +21,9 @@ public interface CustomerMapper extends BaseMapper<Customer> {
...
@@ -21,5 +21,9 @@ public interface CustomerMapper extends BaseMapper<Customer> {
List
<
CustomerListVo
>
selectList
(
@Param
(
"dto"
)
CustomerSearchDto
dto
);
List
<
CustomerListVo
>
selectList
(
@Param
(
"dto"
)
CustomerSearchDto
dto
);
List
<
Customer
>
selectUserList
(
Long
userId
);
Customer
selectByCompanyIdAndUserId
(
@Param
(
"companyId"
)
Integer
companyId
,
@Param
(
"userId"
)
Long
userId
);
}
}
dsk-system/src/main/java/com/dsk/system/service/IBusinessInfoService.java
View file @
34ef544f
...
@@ -5,21 +5,23 @@ import com.dsk.common.core.domain.entity.BusinessInfo;
...
@@ -5,21 +5,23 @@ import com.dsk.common.core.domain.entity.BusinessInfo;
import
com.dsk.common.dtos.BusinessInfoDto
;
import
com.dsk.common.dtos.BusinessInfoDto
;
import
com.dsk.system.domain.BusinessAddDto
;
import
com.dsk.system.domain.BusinessAddDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto
;
import
com.dsk.system.domain.customer.vo.CustomerBusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 项目详情Service接口
* 项目详情Service接口
*
*
* @author ruoyi
* @author ruoyi
* @date 2023-05-17
* @date 2023-05-17
*/
*/
public
interface
IBusinessInfoService
public
interface
IBusinessInfoService
{
{
/**
/**
* 查询项目详情
* 查询项目详情
*
*
* @param id 项目详情主键
* @param id 项目详情主键
* @return 项目详情
* @return 项目详情
*/
*/
...
@@ -27,7 +29,7 @@ public interface IBusinessInfoService
...
@@ -27,7 +29,7 @@ public interface IBusinessInfoService
/**
/**
* 查询项目详情列表
* 查询项目详情列表
*
*
* @param dto 项目详情
* @param dto 项目详情
* @return 项目详情集合
* @return 项目详情集合
*/
*/
...
@@ -41,7 +43,7 @@ public interface IBusinessInfoService
...
@@ -41,7 +43,7 @@ public interface IBusinessInfoService
/**
/**
* 新增项目详情
* 新增项目详情
*
*
* @param dto 项目详情
* @param dto 项目详情
* @return 结果
* @return 结果
*/
*/
...
@@ -49,7 +51,7 @@ public interface IBusinessInfoService
...
@@ -49,7 +51,7 @@ public interface IBusinessInfoService
/**
/**
* 修改项目详情
* 修改项目详情
*
*
* @param businessInfo 项目详情
* @param businessInfo 项目详情
* @return 结果
* @return 结果
*/
*/
...
@@ -57,7 +59,7 @@ public interface IBusinessInfoService
...
@@ -57,7 +59,7 @@ public interface IBusinessInfoService
/**
/**
* 批量删除项目详情
* 批量删除项目详情
*
*
* @param ids 需要删除的项目详情主键集合
* @param ids 需要删除的项目详情主键集合
* @return 结果
* @return 结果
*/
*/
...
@@ -65,9 +67,14 @@ public interface IBusinessInfoService
...
@@ -65,9 +67,14 @@ public interface IBusinessInfoService
/**
/**
* 删除项目详情信息
* 删除项目详情信息
*
*
* @param id 项目详情主键
* @param id 项目详情主键
* @return 结果
* @return 结果
*/
*/
public
int
deleteBusinessInfoById
(
Long
id
);
public
int
deleteBusinessInfoById
(
Long
id
);
int
selectCountByStatusAndCustomerId
(
Integer
status
,
String
customerId
);
List
<
CustomerBusinessListVo
>
selectCustomerBusinessList
(
CustomerBusinessSearchDto
dto
);
}
}
dsk-system/src/main/java/com/dsk/system/service/ICustomerService.java
View file @
34ef544f
package
com
.
dsk
.
system
.
service
;
package
com
.
dsk
.
system
.
service
;
import
com.dsk.system.domain.customer.Customer
;
import
com.dsk.system.domain.customer.Customer
;
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.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
;
...
@@ -25,4 +27,6 @@ public interface ICustomerService {
...
@@ -25,4 +27,6 @@ public interface ICustomerService {
List
<
Customer
>
selectUserList
();
List
<
Customer
>
selectUserList
();
List
<
CustomerBusinessListVo
>
selectBusinessList
(
CustomerBusinessSearchDto
dto
);
}
}
dsk-system/src/main/java/com/dsk/system/service/impl/BusinessInfoServiceImpl.java
View file @
34ef544f
...
@@ -13,6 +13,8 @@ import com.dsk.common.utils.DateUtils;
...
@@ -13,6 +13,8 @@ import com.dsk.common.utils.DateUtils;
import
com.dsk.common.utils.SecurityUtils
;
import
com.dsk.common.utils.SecurityUtils
;
import
com.dsk.system.domain.BusinessAddDto
;
import
com.dsk.system.domain.BusinessAddDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.BusinessListDto
;
import
com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto
;
import
com.dsk.system.domain.customer.vo.CustomerBusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
com.dsk.system.domain.vo.BusinessListVo
;
import
com.dsk.system.mapper.BusinessInfoMapper
;
import
com.dsk.system.mapper.BusinessInfoMapper
;
import
com.dsk.system.mapper.BusinessRelateCompanyMapper
;
import
com.dsk.system.mapper.BusinessRelateCompanyMapper
;
...
@@ -31,8 +33,7 @@ import javax.annotation.Resource;
...
@@ -31,8 +33,7 @@ import javax.annotation.Resource;
* @date 2023-05-17
* @date 2023-05-17
*/
*/
@Service
@Service
public
class
BusinessInfoServiceImpl
implements
IBusinessInfoService
public
class
BusinessInfoServiceImpl
implements
IBusinessInfoService
{
{
@Resource
@Resource
private
BusinessInfoMapper
businessInfoMapper
;
private
BusinessInfoMapper
businessInfoMapper
;
@Resource
@Resource
...
@@ -47,8 +48,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -47,8 +48,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
* @return 项目详情
* @return 项目详情
*/
*/
@Override
@Override
public
BusinessInfo
selectBusinessInfoById
(
Long
id
)
public
BusinessInfo
selectBusinessInfoById
(
Long
id
)
{
{
return
businessInfoMapper
.
selectBusinessInfoById
(
id
);
return
businessInfoMapper
.
selectBusinessInfoById
(
id
);
}
}
...
@@ -59,8 +59,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -59,8 +59,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
* @return 项目详情
* @return 项目详情
*/
*/
@Override
@Override
public
List
<
BusinessListVo
>
selectBusinessInfoList
(
BusinessListDto
dto
)
public
List
<
BusinessListVo
>
selectBusinessInfoList
(
BusinessListDto
dto
)
{
{
return
businessInfoMapper
.
selectBusinessInfoList
(
dto
);
return
businessInfoMapper
.
selectBusinessInfoList
(
dto
);
}
}
...
@@ -77,13 +76,12 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -77,13 +76,12 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
*/
*/
@Override
@Override
@Transactional
@Transactional
public
AjaxResult
insertBusinessInfo
(
BusinessAddDto
dto
)
public
AjaxResult
insertBusinessInfo
(
BusinessAddDto
dto
)
{
{
//新增项目主信息
//新增项目主信息
BusinessInfo
businessInfo
=
new
BusinessInfo
();
BusinessInfo
businessInfo
=
new
BusinessInfo
();
BeanUtil
.
copyProperties
(
dto
,
businessInfo
);
BeanUtil
.
copyProperties
(
dto
,
businessInfo
);
int
addBusiness
=
businessInfoMapper
.
insertBusinessInfo
(
businessInfo
);
int
addBusiness
=
businessInfoMapper
.
insertBusinessInfo
(
businessInfo
);
if
(
addBusiness
>
0
)
{
if
(
addBusiness
>
0
)
{
//获取登陆用户的部门id
//获取登陆用户的部门id
// Long deptId = SecurityUtils.getLoginUser().getDeptId();
// Long deptId = SecurityUtils.getLoginUser().getDeptId();
Long
deptId
=
100
l
;
Long
deptId
=
100
l
;
...
@@ -91,7 +89,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -91,7 +89,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
int
addbusinessUser
=
businessUserMapper
.
insertBusinessUser
(
new
BusinessUser
(
businessInfo
.
getId
(),
deptId
.
intValue
(),
dto
.
getUserId
(),
1
));
int
addbusinessUser
=
businessUserMapper
.
insertBusinessUser
(
new
BusinessUser
(
businessInfo
.
getId
(),
deptId
.
intValue
(),
dto
.
getUserId
(),
1
));
//新增项目-关联企业信息
//新增项目-关联企业信息
int
addRelateCompany
=
businessRelateCompanyMapper
.
insertBusinessRelateCompany
(
new
BusinessRelateCompany
(
businessInfo
.
getId
(),
dto
.
getCompanyId
(),
dto
.
getOwnerCompany
(),
"业主"
));
int
addRelateCompany
=
businessRelateCompanyMapper
.
insertBusinessRelateCompany
(
new
BusinessRelateCompany
(
businessInfo
.
getId
(),
dto
.
getCompanyId
(),
dto
.
getOwnerCompany
(),
"业主"
));
return
addbusinessUser
>
0
&&
addRelateCompany
>
0
?
AjaxResult
.
success
()
:
AjaxResult
.
error
();
return
addbusinessUser
>
0
&&
addRelateCompany
>
0
?
AjaxResult
.
success
()
:
AjaxResult
.
error
();
}
}
return
AjaxResult
.
error
();
return
AjaxResult
.
error
();
...
@@ -104,8 +102,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -104,8 +102,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
updateBusinessInfo
(
BusinessInfo
businessInfo
)
public
int
updateBusinessInfo
(
BusinessInfo
businessInfo
)
{
{
businessInfo
.
setUpdateTime
(
DateUtils
.
getNowDate
());
businessInfo
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
businessInfoMapper
.
updateBusinessInfo
(
businessInfo
);
return
businessInfoMapper
.
updateBusinessInfo
(
businessInfo
);
}
}
...
@@ -117,8 +114,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -117,8 +114,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteBusinessInfoByIds
(
Long
[]
ids
)
public
int
deleteBusinessInfoByIds
(
Long
[]
ids
)
{
{
return
businessInfoMapper
.
deleteBusinessInfoByIds
(
ids
);
return
businessInfoMapper
.
deleteBusinessInfoByIds
(
ids
);
}
}
...
@@ -129,8 +125,24 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
...
@@ -129,8 +125,24 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteBusinessInfoById
(
Long
id
)
public
int
deleteBusinessInfoById
(
Long
id
)
{
{
return
businessInfoMapper
.
deleteBusinessInfoById
(
id
);
return
businessInfoMapper
.
deleteBusinessInfoById
(
id
);
}
}
/**
* 查询项目数量
*
* @param status 项目状态
* @param customerId 客户id
* @return 项目数量
*/
@Override
public
int
selectCountByStatusAndCustomerId
(
Integer
status
,
String
customerId
)
{
return
businessInfoMapper
.
selectCountByStatusAndCustomerId
(
status
,
customerId
);
}
@Override
public
List
<
CustomerBusinessListVo
>
selectCustomerBusinessList
(
CustomerBusinessSearchDto
dto
)
{
return
businessInfoMapper
.
selectCustomerBusinessList
(
dto
);
}
}
}
dsk-system/src/main/java/com/dsk/system/service/impl/CustomerServiceImpl.java
View file @
34ef544f
...
@@ -4,15 +4,17 @@ import cn.hutool.core.bean.BeanException;
...
@@ -4,15 +4,17 @@ import cn.hutool.core.bean.BeanException;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.dsk.common.exception.ServiceException
;
import
com.dsk.common.exception.ServiceException
;
import
com.dsk.common.utils.DskOpenApiUtil
;
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
;
import
com.dsk.system.domain.customer.CustomerUser
;
import
com.dsk.system.domain.customer.CustomerUser
;
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.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.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.ICustomerService
;
import
com.dsk.system.service.ICustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -35,23 +37,21 @@ public class CustomerServiceImpl implements ICustomerService {
...
@@ -35,23 +37,21 @@ public class CustomerServiceImpl implements ICustomerService {
private
CustomerMapper
baseMapper
;
private
CustomerMapper
baseMapper
;
@Resource
@Resource
private
CustomerUserMapper
customerUserMapper
;
private
CustomerUserMapper
customerUserMapper
;
@Autowired
@Autowired
private
DskOpenApiUtil
dskOpenApiUtil
;
private
IBusinessInfoService
businessInfoService
;
@Override
@Override
public
List
<
CustomerListVo
>
selectList
(
CustomerSearchDto
dto
)
{
public
List
<
CustomerListVo
>
selectList
(
CustomerSearchDto
dto
)
{
dto
.
setUserId
(
SecurityUtils
.
getUserId
());
dto
.
setUserId
(
SecurityUtils
.
getUserId
());
List
<
CustomerListVo
>
vos
=
baseMapper
.
selectList
(
dto
);
List
<
CustomerListVo
>
vos
=
baseMapper
.
selectList
(
dto
);
for
(
CustomerListVo
vo
:
vos
)
{
vos
.
parallelStream
().
forEach
(
vo
->
{
//TODO 客户项目相关统计
//合作项目
//合作项目
vo
.
setCooperationProject
(
1
);
vo
.
setCooperationProject
(
businessInfoService
.
selectCountByStatusAndCustomerId
(
2
,
vo
.
getCustomerId
())
);
//跟进项目
//跟进项目
vo
.
setFollowProject
(
1
);
vo
.
setFollowProject
(
businessInfoService
.
selectCountByStatusAndCustomerId
(
1
,
vo
.
getCustomerId
())
);
//储备项目
//储备项目
vo
.
setReserveProject
(
1
);
vo
.
setReserveProject
(
businessInfoService
.
selectCountByStatusAndCustomerId
(
0
,
vo
.
getCustomerId
())
);
}
}
);
return
vos
;
return
vos
;
}
}
...
@@ -69,9 +69,15 @@ public class CustomerServiceImpl implements ICustomerService {
...
@@ -69,9 +69,15 @@ public class CustomerServiceImpl implements ICustomerService {
@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
(
"企业名称不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyName
()))
throw
new
BeanException
(
"企业名称不能为空"
);
if
(
ObjectUtils
.
isEmpty
(
customer
.
getCompanyId
()))
throw
new
BeanException
(
"企业id不能为空"
);
final
Long
userId
=
SecurityUtils
.
getUserId
();
final
Long
userId
=
SecurityUtils
.
getUserId
();
customer
.
setCreateId
(
userId
);
customer
.
setCreateId
(
userId
);
customer
.
setUpdateId
(
userId
);
customer
.
setUpdateId
(
userId
);
//查重
Customer
verifyCustomer
=
baseMapper
.
selectByCompanyIdAndUserId
(
customer
.
getCompanyId
(),
userId
);
if
(!
ObjectUtils
.
isEmpty
(
verifyCustomer
))
{
throw
new
ServiceException
(
"当前客户信息已存在,请勿重复添加!"
);
}
int
i
=
baseMapper
.
insert
(
customer
);
int
i
=
baseMapper
.
insert
(
customer
);
if
(
i
==
0
)
throw
new
ServiceException
(
"客户信息添加错误!"
);
if
(
i
==
0
)
throw
new
ServiceException
(
"客户信息添加错误!"
);
...
@@ -93,6 +99,13 @@ public class CustomerServiceImpl implements ICustomerService {
...
@@ -93,6 +99,13 @@ public class CustomerServiceImpl implements ICustomerService {
@Override
@Override
public
List
<
Customer
>
selectUserList
()
{
public
List
<
Customer
>
selectUserList
()
{
return
baseMapper
.
selectList
(
Wrappers
.<
Customer
>
lambdaQuery
());
return
baseMapper
.
selectUserList
(
SecurityUtils
.
getUserId
());
}
@Override
public
List
<
CustomerBusinessListVo
>
selectBusinessList
(
CustomerBusinessSearchDto
dto
)
{
if
(
ObjectUtils
.
isEmpty
(
dto
.
getCustomerId
()))
throw
new
BeanException
(
"客户id不能为空"
);
dto
.
setUserId
(
SecurityUtils
.
getUserId
());
return
businessInfoService
.
selectCustomerBusinessList
(
dto
);
}
}
}
}
dsk-system/src/main/resources/mapper/business/BusinessInfoMapper.xml
View file @
34ef544f
...
@@ -236,4 +236,23 @@
...
@@ -236,4 +236,23 @@
#{id}
#{id}
</foreach>
</foreach>
</delete>
</delete>
</mapper>
\ No newline at end of file
<select
id=
"selectCountByStatusAndCustomerId"
resultType=
"java.lang.Integer"
>
select count(id) from business_info
<where>
<if
test=
"status != null "
>
and `status` = #{status}
</if>
<if
test=
"customerId != null and customerId != ''"
>
and `customer_id` = #{customerId}
</if>
</where>
</select>
<select
id=
"selectCustomerBusinessList"
resultType=
"com.dsk.system.domain.customer.vo.CustomerBusinessListVo"
>
select
bi.id, bi.project_name, pi.investment_amount, pi.project_stage, pi.status
from business_info bi
left join business_user bu on bi.id = bu.business_id
where bi.customer_id = #{customerId} and (bu.user_id = #{userId} or bi.is_private = 1))
<if
test=
"projectStage != null and projectStage != '' "
>
and bi.project_stage = #{projectStage}
</if>
<if
test=
"status != null "
>
and bi.status = #{status}
</if>
order by bi.create_time desc
</select>
</mapper>
dsk-system/src/main/resources/mapper/system/customer/CustomerMapper.xml
View file @
34ef544f
...
@@ -2,13 +2,18 @@
...
@@ -2,13 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.dsk.system.mapper.CustomerMapper"
>
<mapper
namespace=
"com.dsk.system.mapper.CustomerMapper"
>
<sql
id=
"Base_Bean"
>
ct.customer_id, ct.company_id, ct.company_name, ct.legal_person, ct.credit_code,
ct.register_capital, 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.business_scope,
ct.business_characteristic, ct.decision_chain, ct.bid_characteristic, ct.performance_characteristic,
ct.other_ms_characteistic, ct.create_id, ct.create_time, ct.update_id, ct.update_time
</sql>
<select
id=
"selectList"
resultType=
"com.dsk.system.domain.customer.vo.CustomerListVo"
>
<select
id=
"selectList"
resultType=
"com.dsk.system.domain.customer.vo.CustomerListVo"
>
select
select
ct.customer_id, ct.company_id, ct.company_name, ct.legal_person, ct.register_capital_str,
u.nick_name followUser,
ct.register_capital, ct.company_nature, ct.company_level, ct.credit_level, ct.super_company,
<include
refid=
"Base_Bean"
></include>
ct.is_on, ct.is_major, ct.company_attribute, ct.main_business, ct.business_scope,
ct.business_characteristic, ct.decision_chain, ct.bid_characteristic, ct.performance_characteristic,
ct.other_ms_characteistic, u.nick_name followUser
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
join sys_user u on ctu.user_id = u.user_id
join sys_user u on ctu.user_id = u.user_id
...
@@ -16,5 +21,21 @@
...
@@ -16,5 +21,21 @@
<if
test=
"dto.companyName != null and dto.companyName != '' "
>
and ct.company_name like concat('%',#{dto.companyName},'%')
</if>
<if
test=
"dto.companyName != null and dto.companyName != '' "
>
and ct.company_name like concat('%',#{dto.companyName},'%')
</if>
</select>
</select>
<select
id=
"selectUserList"
resultType=
"com.dsk.system.domain.customer.Customer"
>
select
ct.customer_id, ct.company_name
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
where ctu.user_id = #{userId}
</select>
<select
id=
"selectByCompanyIdAndUserId"
resultType=
"com.dsk.system.domain.customer.Customer"
>
select
<include
refid=
"Base_Bean"
></include>
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
where ct.company_id = ${companyId} and ctu.user_id = #{userId}
</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