Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
57305141
Commit
57305141
authored
Jul 02, 2024
by
lanbaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-07-02提交
parent
0d9f8ec0
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
729 additions
and
97 deletions
+729
-97
pom.xml
yudao-module-customer/yudao-module-customer-core/pom.xml
+15
-0
CustomerServiceImpl.java
...module/customer/service/customer/CustomerServiceImpl.java
+2
-2
CustomerLevelLogServiceImpl.java
...service/customerLevelLog/CustomerLevelLogServiceImpl.java
+3
-1
CustomerMerge.java
...r/yudao/module/customer/vo/customer/vo/CustomerMerge.java
+18
-0
pom.xml
yudao-module-customer/yudao-module-customer-rest/pom.xml
+5
-0
CustomerController.java
...ustomer/controller/admin/customer/CustomerController.java
+278
-15
CustomerDetailController.java
...roller/admin/customerDetail/CustomerDetailController.java
+8
-4
TargetLogMapper.java
...dao/module/order/dal/mysql/targetLog/TargetLogMapper.java
+9
-0
OrderServiceImpl.java
...dao/module/order/service/order/impl/OrderServiceImpl.java
+41
-15
TargetLogService.java
...udao/module/order/service/targetLog/TargetLogService.java
+5
-0
TargetLogServiceImpl.java
.../module/order/service/targetLog/TargetLogServiceImpl.java
+270
-57
TargetLogJob.java
...java/cn/iocoder/yudao/module/order/task/TargetLogJob.java
+69
-0
ProductBrankServiceImpl.java
...product/service/productbrank/ProductBrankServiceImpl.java
+2
-1
ProductBrankController.java
...controller/admin/productbrank/ProductBrankController.java
+4
-2
No files found.
yudao-module-customer/yudao-module-customer-core/pom.xml
View file @
57305141
...
...
@@ -41,5 +41,20 @@
<version>
${revision}
</version>
</dependency>
<!--财务模块依赖-->
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-wealth-core
</artifactId>
<version>
${revision}
</version>
</dependency>
<!--产品模块依赖-->
<!--
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-product-core</artifactId>
<version>${revision}</version>
</dependency>-->
</dependencies>
</project>
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customer/CustomerServiceImpl.java
View file @
57305141
...
...
@@ -2570,7 +2570,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
// 当新客户(已有已装柜订单)分配给其他客户经理,客户经理接收后,业绩类型变成老客户
// 其他情况不需更新注:业绩类型只会从新客户更新到老客户,不反向更新
if
(
Boolean
.
TRUE
.
equals
(
customer
.
getIsNew
()))
{
//根据部门业绩日志表中的信息把新客户变为老客户
lanbm 2024-05-08 添加注释
//根据部门业绩日志表中的信息把新客户变为老客户
//ecw_target_log 部门业绩日志表
customerMapper
.
updateCustomerIsNewToOldByTargetLog
(
customerId
);
}
...
...
@@ -2593,7 +2593,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
//分配确认接收回调
applicationContext
.
publishEvent
(
new
AssignConfirmedCustomerEvent
(
customerId
,
customerService
));
//
lanbm 2024-05-08
添加接收确认后判断客户是新客户还是老客户逻辑
//添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO
customer2
=
customerMapper
.
selectById
(
customerId
);
ReceiveCustomerCalTypeEvent
event
=
new
ReceiveCustomerCalTypeEvent
();
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customerLevelLog/CustomerLevelLogServiceImpl.java
View file @
57305141
...
...
@@ -44,7 +44,9 @@ import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.LEVEL_LO
@Slf4j
@Service
@Validated
public
class
CustomerLevelLogServiceImpl
extends
AbstractService
<
CustomerLevelLogMapper
,
CustomerLevelLogDO
>
implements
CustomerLevelLogService
{
public
class
CustomerLevelLogServiceImpl
extends
AbstractService
<
CustomerLevelLogMapper
,
CustomerLevelLogDO
>
implements
CustomerLevelLogService
{
@Resource
private
CustomerLevelLogMapper
levelLogMapper
;
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/vo/customer/vo/CustomerMerge.java
0 → 100644
View file @
57305141
package
cn
.
iocoder
.
yudao
.
module
.
customer
.
vo
.
customer
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
@ApiModel
(
"管理后台 - 客户 Response VO"
)
@Data
@ToString
(
callSuper
=
true
)
public
class
CustomerMerge
{
@ApiModelProperty
(
value
=
"id1"
)
private
Long
id1
;
@ApiModelProperty
(
value
=
"id2"
)
private
Long
id2
;
}
yudao-module-customer/yudao-module-customer-rest/pom.xml
View file @
57305141
...
...
@@ -24,6 +24,11 @@
<version>
${revision}
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-sale-core
</artifactId>
<version>
${revision}
</version>
</dependency>
</dependencies>
</project>
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customer/CustomerController.java
View file @
57305141
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.customer.controller.admin.customer;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
import
cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
...
@@ -13,23 +14,31 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils
;
import
cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert
;
import
cn.iocoder.yudao.module.customer.convert.customerBank.CustomerBankConvert
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.CustomerCommissionDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.follow.CustomerFollowDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBankDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerLevelLog.CustomerLevelLogDO
;
import
cn.iocoder.yudao.module.customer.dal.mysql.customerDetail.CustomerDetailMapper
;
import
cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto
;
import
cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO
;
import
cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto
;
import
cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
cn.iocoder.yudao.module.customer.service.customer.commission.CustomerCommissionService
;
import
cn.iocoder.yudao.module.customer.service.customer.complaint.CustomerComplaintService
;
import
cn.iocoder.yudao.module.customer.service.customer.complaint.follow.CustomerFollowService
;
import
cn.iocoder.yudao.module.customer.service.customerBank.CustomerBankService
;
import
cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService
;
import
cn.iocoder.yudao.module.customer.service.customerCredit.CustomerCreditService
;
import
cn.iocoder.yudao.module.customer.service.customerLevel.CustomerLevelService
;
import
cn.iocoder.yudao.module.customer.service.customerLevelLog.CustomerLevelLogServiceImpl
;
import
cn.iocoder.yudao.module.customer.service.customerPublicCatchLog.CustomerPublicCatchLogService
;
import
cn.iocoder.yudao.module.customer.service.zhongPao.ZhongPaoService
;
import
cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsCreateReqVO
;
...
...
@@ -47,11 +56,17 @@ import cn.iocoder.yudao.module.ecw.service.internalMessage.InternalMessageServic
import
cn.iocoder.yudao.module.ecw.service.paramValid.ParamValidatorService
;
import
cn.iocoder.yudao.module.member.api.user.MemberUserApi
;
import
cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.productbrandempower.ProductBrandEmpowerDO
;
import
cn.iocoder.yudao.module.product.service.productbrandempower.ProductBrandEmpowerServiceImpl
;
import
cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO
;
import
cn.iocoder.yudao.module.sale.service.offer.OfferService
;
import
cn.iocoder.yudao.module.system.api.file.FileMakeApi
;
import
cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO
;
import
cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum
;
import
cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO
;
import
cn.iocoder.yudao.module.wealth.service.receipt.ReceiptServiceImpl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.Api
;
...
...
@@ -133,6 +148,31 @@ public class CustomerController {
@Resource
private
FileMakeApi
fileMakeApi
;
//客户详情信息
@Resource
CustomerDetailMapper
customerDetailMapper
;
@Resource
OfferService
offerService
;
//客户跟进
@Resource
CustomerFollowService
customerFollowService
;
@Resource
private
CustomerComplaintService
customerComplaintService
;
@Resource
private
ReceiptServiceImpl
receiptService
;
@Resource
private
ProductBrandEmpowerServiceImpl
productBrandEmpowerService
;
//客户登记日志
@Resource
private
CustomerLevelLogServiceImpl
customerLevelLogService
;
public
CustomerController
()
{
}
...
...
@@ -208,7 +248,6 @@ public class CustomerController {
@Valid
@RequestBody
CustomerUpdateReqVO
updateReqVO
)
{
//SELECT arrival_confirm from ecw_customer 到仓确认
List
<
CustomerContactsUpdateReqVO
>
customerContacts
=
updateReqVO
.
getCustomerContacts
();
if
(!
CollectionUtils
.
isEmpty
(
customerContacts
))
{
...
...
@@ -313,10 +352,232 @@ public class CustomerController {
return
success
(
true
);
}
@GetMapping
(
"/mergeCus"
)
@ApiOperation
(
"合并客户信息"
)
public
CommonResult
<
Boolean
>
mergeCus
(
@Valid
CustomerMerge
par
)
{
//1. 保留客户和非主客户,不能在两个不同的客户经理名下,
// 请先确认两个客户在同一个客户经理名下
//2. 被合并客户,提交后会直接删除
//3. 合并后,非主客户的联系人,跟进记录,报价单,订单,
// 客户投诉,品牌授权都迁移到保留客户中,其他信息不会迁移,
// 如需要维护非主客户的客户档案信息到保留客户中,请先维护好再操作
if
(
par
.
getId1
()
==
null
)
{
return
success
(
false
);
}
if
(
par
.
getId2
()
==
null
)
{
return
success
(
false
);
}
CustomerDO
customerDO1
=
customerService
.
getById
(
par
.
getId1
());
if
(
customerDO1
==
null
)
{
throw
exception
(
new
ErrorCode
(
0
,
"保留客户未查询到"
));
}
if
(
customerDO1
.
getCustomerService
()
==
null
)
{
throw
exception
(
new
ErrorCode
(
0
,
"保留客户的客户经理为空"
));
}
CustomerDO
customerDO2
=
customerService
.
getById
(
par
.
getId2
());
if
(
customerDO2
==
null
)
{
throw
exception
(
new
ErrorCode
(
0
,
"被合并客户未查询到"
));
}
if
(
customerDO2
.
getCustomerService
()
==
null
)
{
throw
exception
(
new
ErrorCode
(
0
,
"被合并客户客户经理为空"
));
}
if
(
customerDO1
.
getCustomerService
()
!=
customerDO2
.
getCustomerService
())
{
throw
exception
(
new
ErrorCode
(
0
,
"保留客户和被合并客户客户经理不相同"
));
}
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
if
(
doMergeCus
(
customerDO1
,
customerDO2
,
loginUserId
))
return
success
(
true
);
else
return
success
(
false
);
}
private
boolean
doMergeCus
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
/*
提交验证:
当保留客户和非主客户的客户经理均不为空且不是同一个用户(允许客户在公海),
弹出提示:保留客户和非主客户,不能在两个不同的客户经理名下,
请先确认两个客户在同一个客户经理名下,不允许提交
当非主客户/保留客户在移交过程中,不允许合并,弹出提示
当允许提交,先弹出上面的注意事项提示,确认后提交
1. 非主客户中的客户联系人所有信息追加到保留客户中,注意:关联账号也需要一并追加
2. 非主客户中的所有关联订单中的客户编号需要更新为保留客户,业绩归属为非主客户,
也需要同时更新为保留客户(此处需要注意有一些订单的收发货人是同一个客户,
还需要注意控货订单的情况,控货权)
3. 非主客户的跟进记录,报价单,客户投诉,品牌授权,
财务相关单据(收款单,佣金请款单,佣金付款单),都需要更新为保留客户
4. 非主客户关联的注册会员信息
4. 提交成功后,非主客户删除,插入记录到保留客户,
备注:客户合并,删除XXX非主客户编号
注意:此处要求是在保留客户中能查询到非主客户的所有信息,
不清楚数据库逻辑结构,此处需要开发查找出所有的关联关系
非主客户关联的订单/收款单/佣金情况单,佣金付款单有在途流程,
需要测试这种情况是否影响合并
*/
//把客户2的联系方式合并到客户1
doMogeContact
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并报价单
doMogeOffer
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并跟进记录
doMergeCustomerFollow
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并客户投诉
doMergeCustomerComplaint
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并收款单信息
doMergeeReceipt
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并产品品牌授权
doMergeProductBrandEmpower
(
customerDO1
,
customerDO2
,
loginUserId
);
//合并客户信用日志
doMergeCustomerLevelLog
(
customerDO1
,
customerDO2
,
loginUserId
);
return
true
;
}
//合并客户信用日志
private
void
doMergeCustomerLevelLog
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
/*
LambdaQueryWrapperX q2 =
new LambdaQueryWrapperX<>().
eq(CustomerLevelLogDO::getCustomerId,
customerDO2.getId());
List<CustomerLevelLogDO> list =
customerLevelLogService.selectList(q2);
if (CollectionUtil.isEmpty(list)) return;
for (CustomerLevelLogDO d : list
) {
d.setCustomerId(customerDO1.getId());
customerLevelLogService.updateById(d);
}*/
}
//合并产品品牌授权
private
void
doMergeProductBrandEmpower
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
ProductBrandEmpowerDO
>().
eq
(
ProductBrandEmpowerDO:
:
getCustomerId
,
customerDO2
.
getId
());
List
<
ProductBrandEmpowerDO
>
list
=
productBrandEmpowerService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isEmpty
(
list
))
return
;
for
(
ProductBrandEmpowerDO
d
:
list
)
{
d
.
setCustomerId
(
customerDO1
.
getId
());
productBrandEmpowerService
.
updateById
(
d
);
}
}
private
void
doMergeCustomerComplaint
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
CustomerComplaintDO
>().
eq
(
CustomerComplaintDO:
:
getCustomerId
,
customerDO2
.
getId
());
List
<
CustomerComplaintDO
>
list
=
customerComplaintService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isEmpty
(
list
))
return
;
for
(
CustomerComplaintDO
d
:
list
)
{
d
.
setCustomerId
(
customerDO1
.
getId
());
customerComplaintService
.
updateById
(
d
);
}
}
//合并收款单
private
void
doMergeeReceipt
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
ReceiptDO
>().
eq
(
ReceiptDO:
:
getCustomerId
,
customerDO2
.
getId
());
List
<
ReceiptDO
>
list
=
receiptService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isEmpty
(
list
))
return
;
for
(
ReceiptDO
d
:
list
)
{
d
.
setCustomerId
(
customerDO1
.
getId
());
receiptService
.
updateById
(
d
);
}
}
//合并客户跟进
private
void
doMergeCustomerFollow
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
CustomerFollowDO
>().
eq
(
CustomerFollowDO:
:
getCustomerId
,
customerDO2
.
getId
());
List
<
CustomerFollowDO
>
list
=
customerFollowService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isEmpty
(
list
))
return
;
for
(
CustomerFollowDO
d
:
list
)
{
d
.
setCustomerId
(
customerDO1
.
getId
());
customerFollowService
.
updateById
(
d
);
}
}
//合并报价单
private
void
doMogeOffer
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
OfferDO
>().
eq
(
OfferDO:
:
getRelationId
,
customerDO2
.
getId
());
List
<
OfferDO
>
list
=
offerService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isEmpty
(
list
))
return
;
for
(
OfferDO
o
:
list
)
{
o
.
setRelationId
(
customerDO1
.
getId
());
o
.
setUpdateTime
(
new
Date
());
offerService
.
updateById
(
o
);
}
}
//合并联系人
private
void
doMogeContact
(
CustomerDO
customerDO1
,
CustomerDO
customerDO2
,
long
loginUserId
)
{
LambdaQueryWrapperX
q2
=
new
LambdaQueryWrapperX
<
CustomerContactsDO
>().
eq
(
CustomerContactsDO:
:
getCustomerId
,
customerDO2
.
getId
());
List
<
CustomerContactsDO
>
cuscontactList2
=
customerContactsService
.
selectList
(
q2
);
if
(
CollectionUtil
.
isNotEmpty
(
cuscontactList2
))
{
for
(
CustomerContactsDO
d
:
cuscontactList2
)
{
d
.
setCustomerId
(
customerDO1
.
getId
());
d
.
setUpdateTime
(
new
Date
());
d
.
setUpdater
(
String
.
valueOf
(
loginUserId
));
customerContactsService
.
updateById
(
d
);
}
}
}
@GetMapping
(
"/get"
)
@ApiOperation
(
"获得客户详情"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
CustomerDetailRespVO
>
getCustomer
(
@RequestParam
(
"id"
)
Long
id
)
{
CustomerDetailRespVO
respVO
=
customerService
.
getCustomerDetailRespVO
(
id
);
if
(
Objects
.
isNull
(
respVO
))
{
...
...
@@ -368,7 +629,8 @@ public class CustomerController {
@GetMapping
(
"/get-wait-for-confirm"
)
@ApiOperation
(
"获得待接收列表"
)
//@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getWaitConfirmList
(
@Valid
CustomerPageReqDTO
customerPageReqVO
,
PageVO
page
)
{
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getWaitConfirmList
(
@Valid
CustomerPageReqDTO
customerPageReqVO
,
PageVO
page
)
{
//lanbm 2024-05-26 添加注释
//customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
List
<
Long
>
setCustomerService
=
new
ArrayList
<>();
...
...
@@ -389,7 +651,8 @@ public class CustomerController {
@GetMapping
(
"/get-potential"
)
@ApiOperation
(
"获得潜在客户列表"
)
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getPotentialList
(
@Valid
CustomerPageReqDTO
pageVO
,
PageVO
page
)
{
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getPotentialList
(
@Valid
CustomerPageReqDTO
pageVO
,
PageVO
page
)
{
// 20230331 全部客户列表,当客户经理不是空时,排除公海客户
if
(
pageVO
.
getCustomerService
()
!=
null
)
{
...
...
@@ -426,16 +689,17 @@ public class CustomerController {
@GetMapping
(
"/delay/approval/info"
)
@ApiOperation
(
"获取客户延期调入公海池的审批详情"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
@ApiImplicitParam
(
value
=
"客户ID"
,
name
=
"customerId"
,
required
=
true
,
dataType
=
"Long"
)
public
CommonResult
<
CustomerDelayApprovalInfoDto
>
getDelayApprovalInfo
(
@RequestParam
(
"customerId"
)
Long
customerId
)
{
CustomerDelayApprovalInfoDto
delayApprovalInfoDto
=
customerService
.
getDelayApprovalInfo
(
customerId
);
CustomerDelayApprovalInfoDto
delayApprovalInfoDto
=
customerService
.
getDelayApprovalInfo
(
customerId
);
return
success
(
delayApprovalInfoDto
);
}
@GetMapping
(
"/delay/approval"
)
@ApiOperation
(
"获取客户延期调入公海池的审批详情"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
@ApiImplicitParam
(
value
=
"审批ID"
,
name
=
"approvalId"
,
required
=
true
,
dataType
=
"Long"
)
public
CommonResult
<
CustomerDelayApprovalInfoDto
>
getDelayApproval
(
@RequestParam
(
"approvalId"
)
Long
approvalId
)
{
CustomerDelayApprovalInfoDto
delayApprovalInfoDto
=
customerService
.
getDelayApproval
(
approvalId
);
...
...
@@ -444,7 +708,7 @@ public class CustomerController {
@PostMapping
(
"/delay/approval"
)
@ApiOperation
(
"客户延期调入公海池的审批申请"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:postpone')")
//@PreAuthorize("@ss.hasPermission('ecw:customer:postpone')")
@Idempotent
(
timeout
=
5
)
public
CommonResult
<
Boolean
>
delayApproval
(
@RequestBody
CustomerDelayApprovalInfoDto
delayApprovalInfoDto
)
{
customerService
.
delayApproval
(
delayApprovalInfoDto
);
...
...
@@ -453,7 +717,7 @@ public class CustomerController {
@PutMapping
(
"/cancel/delay/approval"
)
@ApiOperation
(
"取消客户延期调入公海池的审批申请"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:update')")
//@PreAuthorize("@ss.hasPermission('ecw:customer:update')")
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"审批id"
,
name
=
"approveId"
,
required
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
value
=
"原因"
,
name
=
"reason"
,
dataType
=
"String"
)
...
...
@@ -493,7 +757,7 @@ public class CustomerController {
@PutMapping
(
"/cancel/handover/approval"
)
@ApiOperation
(
"取消客户移交的审批申请"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:update')")
//@PreAuthorize("@ss.hasPermission('ecw:customer:update')")
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"审批id"
,
name
=
"approveId"
,
required
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
value
=
"原因"
,
name
=
"reason"
,
dataType
=
"String"
)
...
...
@@ -507,7 +771,7 @@ public class CustomerController {
@GetMapping
(
"/get-mine"
)
@ApiOperation
(
"获得我的客户列表"
)
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
//
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public
CommonResult
<
PageResult
<
CustomerRespVO
>>
getMine
(
@Valid
CustomerPageReqDTO
customerPageReqVO
,
PageVO
page
)
{
//customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
...
...
@@ -585,7 +849,6 @@ public class CustomerController {
//公海池捞取客户,修改客户业绩类型需要调整此处的逻辑
//lanbm 2024-05-07 处理
customerService
.
catchCustomer
(
id
);
return
success
(
true
);
}
...
...
@@ -720,7 +983,8 @@ public class CustomerController {
@GetMapping
(
"/potential-export-excel"
)
@ApiOperation
(
"潜在客户列表导出"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportPotentialCustomerExcel
(
@Valid
CustomerExportReqDTO
exportReqVO
,
public
CommonResult
<
Boolean
>
exportPotentialCustomerExcel
(
@Valid
CustomerExportReqDTO
exportReqVO
,
HttpServletResponse
response
)
throws
IOException
{
if
(
CollectionUtil
.
isNotEmpty
(
exportReqVO
.
getCustomerService
()))
{
exportReqVO
.
setIsInOpenSea
(
false
);
...
...
@@ -788,7 +1052,6 @@ public class CustomerController {
public
CommonResult
<
Boolean
>
changeCustomerFcl
(
@Valid
@RequestBody
CustomerChangeFclReqVO
customerChangeFclReqVO
)
{
customerService
.
changeCustomerFcl
(
customerChangeFclReqVO
);
return
success
(
true
);
}
...
...
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customerDetail/CustomerDetailController.java
View file @
57305141
...
...
@@ -49,7 +49,8 @@ public class CustomerDetailController {
@GetMapping
(
"/offerPage"
)
@ApiOperation
(
"获取报价分页"
)
public
CommonResult
<
PageResult
<
CustomerOfferBackVo
>>
getOfferPage
(
@RequestParam
(
"customerId"
)
Long
customerId
,
PageParam
page
)
{
PageResult
<
CustomerOfferBackVo
>
pageResult
=
customerDetailService
.
getCustomerOfferPage
(
customerId
,
page
);
PageResult
<
CustomerOfferBackVo
>
pageResult
=
customerDetailService
.
getCustomerOfferPage
(
customerId
,
page
);
return
success
(
pageResult
);
}
...
...
@@ -81,7 +82,8 @@ public class CustomerDetailController {
@GetMapping
(
"/receiptPage"
)
@ApiOperation
(
"获取账单分页"
)
public
CommonResult
<
PageResult
<
CustomerReceivableBackVO
>>
getReceiptPage
(
@RequestParam
(
"customerId"
)
Long
customerId
,
PageParam
page
)
{
PageResult
<
CustomerReceivableBackVO
>
pageResult
=
customerDetailService
.
getReceiptPage
(
customerId
,
page
);
PageResult
<
CustomerReceivableBackVO
>
pageResult
=
customerDetailService
.
getReceiptPage
(
customerId
,
page
);
return
success
(
pageResult
);
}
...
...
@@ -90,7 +92,8 @@ public class CustomerDetailController {
@ApiOperation
(
"获取跟进分页"
)
@ApiImplicitParam
(
name
=
"customerId"
,
value
=
"客户ID"
,
required
=
true
,
dataType
=
"Long"
)
public
CommonResult
<
PageResult
<
CustomerFollowBackVo
>>
getFollwPage
(
@RequestParam
(
"customerId"
)
Long
customerId
,
PageParam
page
)
{
PageResult
<
CustomerFollowBackVo
>
pageResult
=
customerDetailService
.
getFollowPage
(
customerId
,
page
);
PageResult
<
CustomerFollowBackVo
>
pageResult
=
customerDetailService
.
getFollowPage
(
customerId
,
page
);
return
success
(
pageResult
);
}
...
...
@@ -103,7 +106,8 @@ public class CustomerDetailController {
@GetMapping
(
"/levelLogPage"
)
@ApiOperation
(
"获得客户等级日志分页"
)
public
CommonResult
<
PageResult
<
CustomerLevelLogBackVO
>>
getLevelLogPage
(
@RequestParam
(
"customerId"
)
Long
customerId
,
PageParam
page
)
{
public
CommonResult
<
PageResult
<
CustomerLevelLogBackVO
>>
getLevelLogPage
(
@RequestParam
(
"customerId"
)
Long
customerId
,
PageParam
page
)
{
return
success
(
customerLevelLogService
.
getLevelLogPage
(
customerId
,
page
));
}
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/dal/mysql/targetLog/TargetLogMapper.java
View file @
57305141
...
...
@@ -69,4 +69,13 @@ public interface TargetLogMapper extends AbstractMapper<TargetLogDO> {
"</script>"
})
List
<
TargetOfferBackVO
>
getTargetOfferBackByOrerId
(
Long
orderId
);
@Select
({
"<script>"
,
"select * from ecw_target_log where deleted=0 and DATE_FORMAT(create_time,'%Y-%m')='2024-06'"
,
"</script>"
})
List
<
TargetLogDO
>
selectList2
();
}
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderServiceImpl.java
View file @
57305141
...
...
@@ -961,25 +961,41 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
private
void
addOrderSalesmanCustomerService
(
OrderDO
order
)
{
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
order
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
order
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
orderConsignorDO
.
getCustomerId
());
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
orderConsigneeDO
.
getCustomerId
());
//收货人
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
order
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
order
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
orderConsignorDO
.
getCustomerId
());
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
orderConsigneeDO
.
getCustomerId
());
//收货人
if
(
Objects
.
nonNull
(
order
.
getType
())
&&
order
.
getType
().
contains
(
"2"
))
{
// 海外仓归属发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
order
.
setSalesmanId
(
consignorDO
.
getCustomerService
()
!=
null
?
consignorDO
.
getCustomerService
()
:
0
);
}
else
{
if
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
order
.
getHasConsignee
())
{
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
order
.
getHasConsignee
())
{
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if
(
consignorDO
!=
null
)
{
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
order
.
setSalesmanId
(
consignorDO
.
getCustomerService
()
!=
null
?
consignorDO
.
getCustomerService
()
:
0
);
}
}
else
{
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
order
.
getOrderId
());
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
&&
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
order
.
getOrderId
());
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
&&
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
order
.
setSalesmanId
(
consignorDO
.
getCustomerService
()
!=
null
?
consignorDO
.
getCustomerService
()
:
0
);
...
...
@@ -992,14 +1008,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
0
);
order
.
setSalesmanId
(
consigneeDO
.
getCustomerService
()
!=
null
?
consigneeDO
.
getCustomerService
()
:
0
);
}
}
else
if
(
order
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
}
else
if
(
order
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
if
(
consigneeDO
!=
null
)
{
order
.
setCustomerId
(
orderConsigneeDO
.
getCustomerId
());
order
.
setSalesmanId
(
consigneeDO
.
getCustomerService
());
}
else
{
order
.
setSalesmanId
(
0L
);
}
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
order
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
...
...
@@ -1065,7 +1083,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
order
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
orderConsignorDO
.
getCustomerId
());
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
orderConsigneeDO
.
getCustomerId
());
//收货人
if
(
Objects
.
nonNull
(
order
.
getType
())
&&
order
.
getType
().
contains
(
"2"
))
{
//层级1
if
(
Objects
.
nonNull
(
order
.
getType
())
&&
order
.
getType
().
contains
(
"2"
))
{
//层级1
// 海外仓归属发货人
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
order
.
setSalesmanId
(
consignorDO
.
getCustomerService
()
!=
null
?
consignorDO
.
getCustomerService
()
:
0
);
...
...
@@ -1078,7 +1097,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
else
{
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
order
.
getDrawee
()
==
1
&&
createReqVO
.
getOfferId
()
!=
null
)
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
...
...
@@ -1103,9 +1123,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order
.
setSalesmanId
(
0L
);
// order.setSalesmanId(0L);
}
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
}
else
if
(
order
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
order
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
order
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)).
collect
(
Collectors
.
toList
());
...
...
@@ -1418,7 +1440,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private
void
setAddOrderCustomerServiceCustomerId
(
OrderCreateReqVO
createReqVO
,
OrderDO
order
,
CustomerDO
consignorDO
,
CustomerDO
consigneeDO
,
OrderConsignorDO
orderConsignorDO
,
OrderConsigneeDO
orderConsigneeDO
)
{
private
void
setAddOrderCustomerServiceCustomerId
(
OrderCreateReqVO
createReqVO
,
OrderDO
order
,
CustomerDO
consignorDO
,
CustomerDO
consigneeDO
,
OrderConsignorDO
orderConsignorDO
,
OrderConsigneeDO
orderConsigneeDO
)
{
// 补充业绩规则判断
if
(
Objects
.
nonNull
(
order
.
getType
())
&&
order
.
getType
().
contains
(
"2"
))
{
//如果是海外仓
order
.
setCustomerId
(
orderConsignorDO
.
getCustomerId
());
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/targetLog/TargetLogService.java
View file @
57305141
...
...
@@ -16,6 +16,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public
interface
TargetLogService
extends
IService
<
TargetLogDO
>
{
//批量处理业绩归属问题
public
void
dealTargetLogTask
(
Long
orderId
,
Date
achievementTime
,
long
targetId
);
/**
* 创建部门业绩日志
* @param createReqVO 创建信息
...
...
@@ -35,6 +38,8 @@ public interface TargetLogService extends IService<TargetLogDO> {
*/
void
deleteTargetLog
(
Long
id
);
List
<
TargetLogDO
>
selectList2
();
/**
* 获得部门业绩日志
* @param id 编号
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/targetLog/TargetLogServiceImpl.java
View file @
57305141
...
...
@@ -59,9 +59,13 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
private
OrderConsigneeService
orderConsigneeService
;
@Resource
private
OrderConsignorService
orderConsignorService
;
private
OrderConsignorService
orderConsignorService
;
public
List
<
TargetLogDO
>
selectList2
()
{
return
targetLogMapper
.
selectList2
();
}
@Override
public
Long
createTargetLog
(
TargetLogCreateReqVO
createReqVO
)
{
// 插入
...
...
@@ -119,7 +123,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
public
void
addTargetLog
(
Long
orderId
,
Date
achievementTime
,
TargetLogEnum
targetLogEnum
)
{
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
if
(
targetLogEnum
.
getType
()
==
1
||
targetLogEnum
.
getType
()
==
3
)
{
//装柜和合单
dealTargetLog
(
orderId
,
achievementTime
,
targetLogEnum
.
getType
());
dealTargetLog
(
orderId
,
achievementTime
,
targetLogEnum
.
getType
());
}
else
if
(
targetLogEnum
.
getType
()
==
2
||
targetLogEnum
.
getType
()
==
4
)
{
//退仓和拆单
targetLogMapper
.
delete
(
new
LambdaQueryWrapperX
<
TargetLogDO
>()
.
eq
(
TargetLogDO:
:
getOrderId
,
orderId
));
...
...
@@ -132,12 +136,12 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
orderIds
.
stream
().
forEach
(
item
->
targetLogMapper
.
delete
(
new
LambdaQueryWrapperX
<
TargetLogDO
>()
.
eq
(
TargetLogDO:
:
getOrderId
,
item
)));
}
else
if
(
targetLogEnum
.
getType
()
==
4
)
{
//拆单,分别计算每个订单的业绩归属
orderIds
.
stream
().
forEach
(
item
->
dealTargetLog
(
item
,
achievementTime
,
targetLogEnum
.
getType
()));
orderIds
.
stream
().
forEach
(
item
->
dealTargetLog
(
item
,
achievementTime
,
targetLogEnum
.
getType
()));
}
}
@Override
public
List
<
TargetLogDO
>
getTargetLogListByUserIds
(
List
<
Long
>
collect
,
Date
startTime
,
Date
endTime
)
{
public
List
<
TargetLogDO
>
getTargetLogListByUserIds
(
List
<
Long
>
collect
,
Date
startTime
,
Date
endTime
)
{
List
<
TargetLogDO
>
targetLogDOS
=
targetLogMapper
.
selectList
(
new
LambdaQueryWrapperX
<
TargetLogDO
>()
.
betweenIfPresent
(
TargetLogDO:
:
getAchievementTime
,
startTime
,
endTime
)
.
in
(
TargetLogDO:
:
getUserId
,
collect
));
...
...
@@ -152,75 +156,115 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
if
(
targetLogDO
==
null
)
{
Date
time
=
targetLogMapper
.
selectCabinetSealingTime
(
orderDO
.
getOrderId
());
if
(
time
!=
null
)
{
dealTargetLog
(
orderDO
.
getOrderId
(),
time
,
TargetLogEnum
.
LOADING
.
getType
());
dealTargetLog
(
orderDO
.
getOrderId
(),
time
,
TargetLogEnum
.
LOADING
.
getType
());
}
}
});
}
private
void
dealTargetLog
(
Long
orderId
,
Date
achievementTime
,
Integer
type
)
{
long
selectCount
=
targetLogMapper
.
selectCount
(
TargetLogDO:
:
getOrderId
,
orderId
);
private
void
dealTargetLog
(
Long
orderId
,
Date
achievementTime
,
Integer
type
)
{
long
selectCount
=
targetLogMapper
.
selectCount
(
TargetLogDO:
:
getOrderId
,
orderId
);
if
(
selectCount
>
0L
)
{
return
;
}
OrderBackInfoDto
info
=
orderQueryService
.
info
(
orderId
);
if
(
info
!=
null
&&
info
.
getSalesmanId
()!=
null
&&
info
.
getSalesmanId
()>
0L
)
{
//客户经理
if
(
info
!=
null
&&
info
.
getSalesmanId
()
!=
null
&&
info
.
getSalesmanId
()
>
0L
)
{
//客户经理
Long
customerId
=
0L
;
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
info
.
getConsignorVO
().
getCustomerId
());
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
info
.
getConsigneeVO
().
getCustomerId
());
//收货人
if
(
info
.
getType
().
contains
(
"2"
))
{
//海外仓归属发货人
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
info
.
getConsignorVO
().
getCustomerId
());
//收货人
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
info
.
getConsigneeVO
().
getCustomerId
());
if
(
info
.
getType
().
contains
(
"2"
))
{
//海外仓归属发货人
//customerId = info.getConsignorVO().getCustomerId(); //二期需求修改
customerId
=
consignorDO
.
getId
();
}
else
{
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
if
(
info
.
getIsCargoControl
()){
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
if
(
info
.
getIsCargoControl
())
{
customerId
=
info
.
getConsignorVO
().
getCustomerId
();
}
else
{
if
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
info
.
getHasConsignee
()){
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if
(
consignorDO
!=
null
){
}
else
{
if
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
info
.
getHasConsignee
())
{
//getHasConsignee 是否有收货人
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if
(
consignorDO
!=
null
)
{
customerId
=
consignorDO
.
getId
();
}
}
else
{
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
orderId
)
;
if
(
info
.
getDrawee
()
==
1
)
{
//发货人付款
if
(
info
.
getDrawee
()
==
1
&&
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
}
else
{
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
orderId
);
if
(
info
.
getDrawee
()
==
1
)
{
//发货人付款
/*
if (info.getDrawee() == 1 &&
CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId = consignorDO.getId();
}
else
if
(
info
.
getDrawee
()
==
1
&&
consignorDO
.
getDefaultPay
()
){
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
}else if(info.getDrawee() == 1 &&
consignorDO.getDefaultPay() ){
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId = consignorDO.getId();
}else{
//业绩归属方是收货人
customerId = orderConsigneeDO.getCustomerId() ;
}*/
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId
=
consignorDO
.
getId
();
}
else
{
if
(
consignorDO
.
getDefaultPay
())
{
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId
=
consignorDO
.
getId
();
}
else
{
//业绩归属方是收货人
customerId
=
orderConsigneeDO
.
getCustomerId
();
}
}
else
if
(
info
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
customerId
=
orderConsigneeDO
.
getCustomerId
()!=
null
?
orderConsigneeDO
.
getCustomerId
():
consigneeDO
.
getId
();
}
else
if
(
info
.
getDrawee
()
==
3
)
{
//自定义付款
}
}
else
if
(
info
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
consigneeDO
.
getId
();
}
else
if
(
info
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
info
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)
).
collect
(
Collectors
.
toList
());
List
<
CustomDraweeVO
>
clearanceFeeList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"clearanceFee"
)
).
collect
(
Collectors
.
toList
());
int
freight
=
freightList
.
get
(
0
).
getValue
()
;
//运费
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)
).
collect
(
Collectors
.
toList
());
List
<
CustomDraweeVO
>
clearanceFeeList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"clearanceFee"
)
).
collect
(
Collectors
.
toList
());
int
freight
=
freightList
.
get
(
0
).
getValue
()
;
//运费
int
clearanceFee
=
clearanceFeeList
.
get
(
0
).
getValue
();
//清关费
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()==
3
&&
freight
==
1
)){
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()==
3
&&
clearanceFee
==
1
)){
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId
=
orderConsignorDO
.
getCustomerId
();
}
else
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()==
3
&&
clearanceFee
==
1
))
{
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
{
customerId
=
orderConsigneeDO
.
getCustomerId
()
;
customerId
=
orderConsignorDO
.
getCustomerId
()
;
}
else
{
customerId
=
orderConsigneeDO
.
getCustomerId
()
;
}
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ;
...
...
@@ -231,8 +275,9 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
}
else
{
//业绩归属收货人
if
(
orderConsigneeDO
!=
null
){
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
():
0
;
if
(
orderConsigneeDO
!=
null
)
{
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
0
;
}
...
...
@@ -255,7 +300,175 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
targetLogDO
.
setCompleteWeight
(
info
.
getVWeight
());
targetLogDO
.
setType
(
type
);
targetLogMapper
.
insert
(
targetLogDO
);
// customerService.updateCustomerIsNewToOld(customerId);
//customerService.updateCustomerIsNewToOld(customerId);
}
}
//按照新的业务规则计算业绩归属
public
void
dealTargetLogTask
(
Long
orderId
,
Date
achievementTime
,
long
targetId
)
{
long
selectCount
=
targetLogMapper
.
selectCount
(
TargetLogDO:
:
getOrderId
,
orderId
);
if
(
selectCount
>
0L
)
{
return
;
}
//获取订单信息
OrderBackInfoDto
info
=
orderQueryService
.
info
(
orderId
);
if
(
info
==
null
)
{
return
;
}
if
(
info
.
getSalesmanId
()
==
null
)
{
return
;
}
if
(
info
.
getSalesmanId
()
==
0
l
)
{
return
;
}
//客户经理
Long
customerId
=
0L
;
CustomerDO
consignorDO
=
customerService
.
getCustomer
(
info
.
getConsignorVO
().
getCustomerId
());
//收货人
CustomerDO
consigneeDO
=
customerService
.
getCustomer
(
info
.
getConsigneeVO
().
getCustomerId
());
if
(
info
.
getType
().
contains
(
"2"
))
{
//层级1: 订单为海外仓订单,业绩归属发货人+
//发货人归属客户经理(判断优先级最高,只要是海外仓,不需要判断其他条件)
//海外仓归属发货人
//customerId = info.getConsignorVO().getCustomerId();
//二期需求修改
customerId
=
consignorDO
.
getId
();
}
else
{
OrderConsigneeDO
orderConsigneeDO
=
orderConsigneeService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsigneeDO
>().
eq
(
OrderConsigneeDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsigneeDO:
:
getId
).
last
(
"limit 1"
));
OrderConsignorDO
orderConsignorDO
=
orderConsignorService
.
getOne
(
new
LambdaQueryWrapper
<
OrderConsignorDO
>().
eq
(
OrderConsignorDO:
:
getOrderId
,
info
.
getOrderId
()).
orderByDesc
(
OrderConsignorDO:
:
getId
).
last
(
"limit 1"
));
if
(
info
.
getIsCargoControl
())
{
//控货订单目前按发货人来算
customerId
=
info
.
getConsignorVO
().
getCustomerId
();
}
else
{
if
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
info
.
getHasConsignee
())
{
//getHasConsignee 是否有收货人
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if
(
consignorDO
!=
null
)
{
customerId
=
consignorDO
.
getId
();
}
}
else
{
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
orderId
);
if
(
info
.
getDrawee
()
==
1
)
{
//发货人付款
/*
if (info.getDrawee() == 1 &&
CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId = consignorDO.getId();
}else if(info.getDrawee() == 1 &&
consignorDO.getDefaultPay() ){
// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId = consignorDO.getId();
}else{
//业绩归属方是收货人
customerId = orderConsigneeDO.getCustomerId() ;
}*/
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId
=
consignorDO
.
getId
();
}
else
{
if
(
consignorDO
.
getDefaultPay
())
{
//如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId
=
consignorDO
.
getId
();
}
else
{
//业绩归属方是收货人
customerId
=
orderConsigneeDO
.
getCustomerId
();
}
}
}
else
if
(
info
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
consigneeDO
.
getId
();
}
else
if
(
info
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
info
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
CustomDraweeVO
>
freightList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"freight"
)).
collect
(
Collectors
.
toList
());
List
<
CustomDraweeVO
>
clearanceFeeList
=
list
.
stream
().
filter
(
s
->
s
.
getName
().
equals
(
"clearanceFee"
)).
collect
(
Collectors
.
toList
());
int
freight
=
freightList
.
get
(
0
).
getValue
();
//运费
int
clearanceFee
=
clearanceFeeList
.
get
(
0
).
getValue
();
//清关费
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId
=
orderConsignorDO
.
getCustomerId
();
}
else
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId
=
orderConsignorDO
.
getCustomerId
();
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId
=
orderConsignorDO
.
getCustomerId
();
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId
=
orderConsignorDO
.
getCustomerId
();
}
else
{
customerId
=
orderConsigneeDO
.
getCustomerId
();
}
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ;
//
// }
}
}
else
{
//业绩归属收货人
if
(
orderConsigneeDO
!=
null
)
{
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
0
;
}
}
}
}
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
info
.
getSalesmanId
());
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
}
}
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/task/TargetLogJob.java
0 → 100644
View file @
57305141
package
cn
.
iocoder
.
yudao
.
module
.
order
.
task
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.quartz.core.handler.JobHandler
;
import
cn.iocoder.yudao.framework.tenant.core.job.TenantJob
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.zTest
;
import
cn.iocoder.yudao.module.order.dal.dataobject.targetLog.TargetLogDO
;
import
cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2
;
import
cn.iocoder.yudao.module.order.service.targetLog.TargetLogServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
@Component
@TenantJob
@Slf4j
public
class
TargetLogJob
implements
JobHandler
{
@Resource
ZTestMapper2
zTestMapper2
;
@Resource
TargetLogServiceImpl
targetLogService
;
@Override
public
String
execute
(
String
param
)
throws
Exception
{
int
var1
=
30
;
int
var2
=
3
;
int
var3
=
6
;
if
(
StringUtils
.
isNotBlank
(
param
))
{
String
[]
vars
=
param
.
split
(
StrUtil
.
COMMA
);
if
(
vars
.
length
>
0
)
{
var1
=
Integer
.
parseInt
(
vars
[
0
]);
}
if
(
vars
.
length
>
1
)
{
var2
=
Integer
.
parseInt
(
vars
[
1
]);
}
if
(
vars
.
length
>
2
)
{
var3
=
Integer
.
parseInt
(
vars
[
2
]);
}
}
zTest
m
=
new
zTest
();
m
.
setTestname
(
"开始计算业绩归属"
);
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
//System.out.println("定时任务参数:" + param);
List
<
TargetLogDO
>
list
=
targetLogService
.
selectList2
();
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
for
(
TargetLogDO
t
:
list
)
{
targetLogService
.
dealTargetLogTask
(
t
.
getOrderId
(),
null
,
t
.
getId
());
}
}
zTest
m2
=
new
zTest
();
m2
.
setTestname
(
"业绩归属计算完毕"
);
m2
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m2
);
return
""
;
}
}
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/productbrank/ProductBrankServiceImpl.java
View file @
57305141
...
...
@@ -303,7 +303,8 @@ public class ProductBrankServiceImpl extends AbstractService<ProductBrankMapper,
if
(
total
==
null
)
{
total
=
0L
;
}
List
<
ProductBrandMyEmpowerRespVO
>
list
=
productBrandEmpowerMapper
.
getBrankByCustomer
(
pageReqVO
);
List
<
ProductBrandMyEmpowerRespVO
>
list
=
productBrandEmpowerMapper
.
getBrankByCustomer
(
pageReqVO
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
...
...
yudao-module-product/yudao-module-product-rest/src/main/java/cn/iocoder/yudao/module/product/controller/admin/productbrank/ProductBrankController.java
View file @
57305141
...
...
@@ -171,8 +171,10 @@ public class ProductBrankController {
@PostMapping
(
"/getBrankByCustomer"
)
@ApiOperation
(
"查看某客户授权的品牌"
)
//@PreAuthorize("@ss.hasPermission('ecw:product-brank:query')")
public
CommonResult
<
PageResult
<
ProductBrandMyEmpowerRespVO
>>
getBrankByCustomer
(
@Valid
@RequestBody
ProductBrankByCustomerPageReqVO
createReqVO
)
{
PageResult
<
ProductBrandMyEmpowerRespVO
>
pageResult
=
productBrankService
.
getBrankByCustomer
(
createReqVO
);
public
CommonResult
<
PageResult
<
ProductBrandMyEmpowerRespVO
>>
getBrankByCustomer
(
@Valid
@RequestBody
ProductBrankByCustomerPageReqVO
createReqVO
)
{
PageResult
<
ProductBrandMyEmpowerRespVO
>
pageResult
=
productBrankService
.
getBrankByCustomer
(
createReqVO
);
return
success
(
pageResult
);
}
@GetMapping
(
"/export-excel"
)
...
...
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