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
0c34d9b7
Commit
0c34d9b7
authored
Jul 22, 2024
by
zhaobiyan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!4
parents
7d2006a9
c05ab1d9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
902 deletions
+182
-902
TargetLogService.java
...udao/module/order/service/targetLog/TargetLogService.java
+0
-6
TargetLogServiceImpl.java
.../module/order/service/targetLog/TargetLogServiceImpl.java
+20
-734
TargetLogJob.java
...java/cn/iocoder/yudao/module/order/task/TargetLogJob.java
+80
-80
TestTargetLogJob.java
.../cn/iocoder/yudao/module/order/task/TestTargetLogJob.java
+82
-82
No files found.
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/targetLog/TargetLogService.java
View file @
0c34d9b7
...
...
@@ -16,10 +16,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public
interface
TargetLogService
extends
IService
<
TargetLogDO
>
{
//批量处理业绩归属问题
void
dealTargetLogTask
(
Long
orderId
,
Date
achievementTime
,
long
targetId
);
void
dealTargetLogTask2
(
Long
orderId
,
Date
achievementTime
,
long
targetId
);
/**
* 创建部门业绩日志
* @param createReqVO 创建信息
...
...
@@ -39,8 +35,6 @@ public interface TargetLogService extends IService<TargetLogDO> {
*/
void
deleteTargetLog
(
Long
id
);
List
<
TargetLogDO
>
selectList2
(
String
sDate
);
/**
* 获得部门业绩日志
* @param id 编号
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/targetLog/TargetLogServiceImpl.java
View file @
0c34d9b7
package
cn
.
iocoder
.
yudao
.
module
.
order
.
service
.
targetLog
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.security.core.LoginUser
;
import
cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.zTest
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO
;
import
cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2
;
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.service.order.OrderConsigneeService
;
import
cn.iocoder.yudao.module.order.service.order.OrderConsignorService
;
import
cn.iocoder.yudao.module.order.service.order.OrderQueryService
;
import
cn.iocoder.yudao.module.order.service.order.OrderService
;
import
cn.iocoder.yudao.module.order.enums.TargetLogEnum
;
import
cn.iocoder.yudao.module.order.service.order.impl.OrderTimeServiceImpl
;
import
cn.iocoder.yudao.module.order.vo.order.CustomDraweeVO
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -44,8 +31,7 @@ import cn.iocoder.yudao.module.order.dal.mysql.targetLog.TargetLogMapper;
*/
@Service
@Validated
public
class
TargetLogServiceImpl
extends
AbstractService
<
TargetLogMapper
,
TargetLogDO
>
implements
TargetLogService
{
public
class
TargetLogServiceImpl
extends
AbstractService
<
TargetLogMapper
,
TargetLogDO
>
implements
TargetLogService
{
@Resource
private
TargetLogMapper
targetLogMapper
;
...
...
@@ -59,21 +45,6 @@ public class TargetLogServiceImpl extends
@Resource
private
CustomerService
customerService
;
@Resource
private
OrderConsigneeService
orderConsigneeService
;
@Resource
private
OrderConsignorService
orderConsignorService
;
@Resource
ZTestMapper2
zTestMapper2
;
@Resource
OrderTimeServiceImpl
orderTimeService
;
public
List
<
TargetLogDO
>
selectList2
(
String
sDate
)
{
return
targetLogMapper
.
selectList2
(
sDate
);
}
@Override
public
Long
createTargetLog
(
TargetLogCreateReqVO
createReqVO
)
{
...
...
@@ -132,7 +103,7 @@ public class TargetLogServiceImpl extends
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
));
...
...
@@ -141,18 +112,16 @@ public class TargetLogServiceImpl extends
@Override
public
void
addTargetLogs
(
List
<
Long
>
orderIds
,
Date
achievementTime
,
TargetLogEnum
targetLogEnum
)
{
if
(
targetLogEnum
.
getType
()
==
3
)
{
//合单,合单前的所有订单业绩归0
if
(
targetLogEnum
.
getType
()
==
3
)
{
//合单,合单前的所有订单业绩归0
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
()));
}
else
if
(
targetLogEnum
.
getType
()
==
4
)
{
//拆单,分别计算每个订单的业绩归属
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
));
...
...
@@ -165,157 +134,35 @@ public class TargetLogServiceImpl extends
OrderDO
orderDO
=
orderService
.
selectOne
(
OrderDO:
:
getOrderNo
,
item
);
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectOne
(
TargetLogDO:
:
getOrderId
,
orderDO
.
getOrderId
());
if
(
targetLogDO
==
null
)
{
//获取装柜时间
Date
time
=
targetLogMapper
.
selectCabinetSealingTime
(
orderDO
.
getOrderId
());
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
;
Long
saleManid
=
info
.
getSalesmanId
();
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
();
//客户的客户经理为空,就把业绩归属设为0
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
||
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
}
}
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
(
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
();
if
(
info
.
getType
().
contains
(
"2"
))
{
//海外仓归属发货人
customerId
=
info
.
getConsignorVO
().
getCustomerId
();
}
else
{
customerId
=
orderConsigneeDO
.
getCustomerId
();
}
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ;
//
// }
}
if
(
info
.
getIsCargoControl
())
{
//非海外控货归属发货人
customerId
=
info
.
getConsignorVO
().
getCustomerId
();
}
else
{
//业绩归属收
货人
if
(
orderConsigneeDO
!=
null
)
{
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
0
;
if
(
info
.
getDrawee
()
==
1
)
{
//非海外非控货 付款人为发货人 归属发
货人
customerId
=
info
.
getConsignorVO
().
getCustomerId
();
}
else
{
//非海外非控货 付款人为其他 归属收货人
customerId
=
info
.
getConsigneeVO
().
getCustomerId
()
;
}
}
}
}
TargetLogDO
targetLogDO
=
new
TargetLogDO
();
targetLogDO
.
setOrderId
(
orderId
);
targetLogDO
.
setCustomerId
(
customerId
);
...
...
@@ -330,568 +177,7 @@ public class TargetLogServiceImpl extends
targetLogDO
.
setCompleteWeight
(
info
.
getVWeight
());
targetLogDO
.
setType
(
type
);
targetLogMapper
.
insert
(
targetLogDO
);
//customerService.updateCustomerIsNewToOld(customerId);
//
customerService.updateCustomerIsNewToOld(customerId);
}
}
public
void
dealTargetLogTask2
(
Long
orderId
,
Date
achievementTime
,
long
targetId
)
{
}
//按照新的业务规则计算业绩归属
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
)
{
info
.
setSalesmanId
(
0L
);
}
try
{
//客户经理
Long
customerId
=
0L
;
Long
saleManid
=
info
.
getSalesmanId
();
Date
d0
=
info
.
getRucangTime
();
int
loglev
=
0
;
String
s_gsf
=
"n"
;
int
n_gstype
=
0
;
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
();
loglev
=
1
;
s_gsf
=
"归发货客户"
;
n_gstype
=
1
;
//客户的客户经理为空,就把业绩归属设为0
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
11
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
11
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
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
(
consignorDO
!=
null
&&
!
consignorDO
.
getNoConsignee
()
&&
!
info
.
getHasConsignee
())
{
//getHasConsignee 是否有收货人
//控货无收货人,1-是,0-否
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
customerId
=
consignorDO
.
getId
();
loglev
=
2
;
n_gstype
=
1
;
s_gsf
=
"发货人档案设置控货无收货人且订单无收获人,归发货客户"
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
21
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
21
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
List
<
TargetOfferBackVO
>
offerBackVOList
=
targetLogMapper
.
getTargetOfferBackByOrerId
(
orderId
);
if
(
info
.
getDrawee
()
==
1
)
{
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
))
{
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId
=
consignorDO
.
getId
();
loglev
=
3
;
n_gstype
=
1
;
s_gsf
=
"发货人付运费,有报价单,归发货客户"
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
31
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
31
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
{
if
(
consignorDO
.
getDefaultPay
())
{
//如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId
=
consignorDO
.
getId
();
loglev
=
4
;
n_gstype
=
1
;
s_gsf
=
"发货人付运费,无报价单,默认付运费,归发货客户"
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
41
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
41
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
{
//业绩归属方是收货人
loglev
=
5
;
customerId
=
orderConsigneeDO
.
getCustomerId
();
n_gstype
=
2
;
s_gsf
=
"发货人付运费,无报价单,不默认付运费,归收货客户"
;
//校验客户的客户经理
if
(
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
51
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consigneeDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
51
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
}
}
else
if
(
info
.
getDrawee
()
==
2
)
{
//收货人付款 层级5 第一个
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
consigneeDO
.
getId
();
loglev
=
5
;
n_gstype
=
2
;
s_gsf
=
"收货人付运费,归收货客户"
;
if
(
consigneeDO
==
null
)
{
s_gsf
+=
",收货客户为空。"
;
saleManid
=
0L
;
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
if
(
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
||
consigneeDO
.
getIsInOpenSea
()
==
true
)
{
//if(consigneeDO.getSource() == 12)
//收货人客户经理为空时不算业绩
//客户来源是发货人推荐,不保留业绩记录 customer_source
//2024-06-03 添加的逻辑
s_gsf
+=
",收货人客户经理为空,货在公海池,发货人推荐,不算奖金。"
;
saleManid
=
0L
;
//删除业绩记录
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
s_gsf
+=
",发货人带来的收货人,有客户经理,归收货人客户经理。"
;
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
saleManid
=
consigneeDO
.
getCustomerService
();
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
if
(
info
.
getDrawee
()
==
3
)
{
//自定义付款
List
<
CustomDraweeVO
>
list
=
JSONObject
.
parseArray
(
info
.
getCustomDrawee
(),
CustomDraweeVO
.
class
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
s_gsf
=
"自定义付款,付款人不为空"
;
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
();
loglev
=
3
;
s_gsf
+=
"有报价单,发货人付运费,归发货客户"
;
n_gstype
=
1
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
31
;
s_gsf
+=
",客户经理为空,不算奖金。"
;
}
if
(
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
31
;
s_gsf
+=
",客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
if
(
CollectionUtil
.
isNotEmpty
(
offerBackVOList
)
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId
=
orderConsignorDO
.
getCustomerId
();
loglev
=
3
;
s_gsf
+=
"有报价单,发货人付清关费,归发货客户"
;
n_gstype
=
1
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
||
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
32
;
s_gsf
+=
",客户经理为空,或客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
freight
==
1
))
{
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId
=
orderConsignorDO
.
getCustomerId
();
loglev
=
3
;
n_gstype
=
1
;
s_gsf
+=
"无报价单,发货人档案设置默认付运费 且发货人付运费,归发货客户"
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
||
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
33
;
s_gsf
+=
",客户经理为空,或客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
if
(
consignorDO
.
getDefaultPay
()
&&
(
info
.
getDrawee
()
==
3
&&
clearanceFee
==
1
))
{
//层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
loglev
=
4
;
customerId
=
orderConsignorDO
.
getCustomerId
();
s_gsf
+=
"无报价单,发货人档案设置默认付运费 且发货人付清关费,归发货客户"
;
n_gstype
=
1
;
//校验客户的客户经理
if
(
consignorDO
.
getCustomerService
()
==
null
||
consignorDO
.
getCustomerService
()
==
0
||
consignorDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
1
;
s_gsf
+=
",客户经理为空,客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
else
{
customerId
=
orderConsigneeDO
.
getCustomerId
();
loglev
=
5
;
s_gsf
+=
",不满足自定义付款人前面的条件,归收货人"
;
n_gstype
=
2
;
//校验客户的客户经理
if
(
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
||
consigneeDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
51
;
s_gsf
+=
",客户经理为空,客户在公海池,不算奖金。"
;
}
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
}
}
//业绩归属收货人
if
(
orderConsigneeDO
==
null
)
{
s_gsf
=
"前4级都不满足,归收货人,收货人为空,不算奖金"
;
saleManid
=
0L
;
n_gstype
=
2
;
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
customerId
=
orderConsigneeDO
.
getCustomerId
()
!=
null
?
orderConsigneeDO
.
getCustomerId
()
:
0
;
loglev
=
5
;
s_gsf
=
"前4级都不满足,归收货人"
;
n_gstype
=
2
;
//校验客户的客户经理
if
(
consigneeDO
.
getCustomerService
()
==
null
||
consigneeDO
.
getCustomerService
()
==
0
)
{
saleManid
=
0L
;
s_gsf
+=
",收货人客户经理为空,不算奖金。"
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
52
;
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
if
(
consigneeDO
.
getIsInOpenSea
()
==
true
)
{
saleManid
=
0L
;
s_gsf
+=
",收货人客户在公海池,不算奖金。"
;
saleManid
=
0L
;
orderService
.
updateOrderSalesmanId
(
info
.
getOrderId
(),
0L
);
loglev
=
52
;
TargetLogDO
targetLogDO
=
targetLogMapper
.
selectById
(
targetId
);
//客户ID
targetLogDO
.
setCustomerId
(
customerId
);
//客户经理ID
targetLogDO
.
setUserId
(
saleManid
);
targetLogDO
.
setLoglev
(
loglev
);
targetLogDO
.
setGsf
(
s_gsf
);
targetLogDO
.
setGstype
(
n_gstype
);
targetLogDO
.
setUpdateTime
(
new
Date
());
targetLogMapper
.
updateById
(
targetLogDO
);
return
;
}
}
catch
(
Exception
e
)
{
zTest
m2
=
new
zTest
();
m2
.
setTestname
(
e
.
getMessage
()
+
"发生异常,"
+
info
.
getOrderNo
());
m2
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m2
);
}
}
}
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/task/TargetLogJob.java
View file @
0c34d9b7
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
;
String
sDate
=
""
;
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
]);
}
sDate
=
vars
[
0
]
+
"-"
+
vars
[
1
];
}
zTest
m
=
new
zTest
();
if
(
sDate
==
null
||
sDate
.
length
()
==
0
)
{
m
.
setTestname
(
"日期参数为空。"
);
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
return
""
;
}
//System.out.println("定时任务参数:" + param);
List
<
TargetLogDO
>
list
=
targetLogService
.
selectList2
(
sDate
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
m
.
setTestname
(
sDate
+
"获取业绩归属数据为空"
);
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
}
m
.
setTestname
(
sDate
+
"开始处理业绩归属数据:"
+
list
.
size
());
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
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
""
;
}
}
//
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;
//
String sDate = "";
//
//
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]);
//
}
//
sDate = vars[0] + "-" + vars[1];
//
}
//
//
zTest m = new zTest();
//
if (sDate == null || sDate.length() == 0) {
//
m.setTestname("日期参数为空。");
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
return "";
//
}
//
//
//System.out.println("定时任务参数:" + param);
//
List<TargetLogDO> list = targetLogService.selectList2(sDate);
//
if (CollectionUtil.isEmpty(list)) {
//
m.setTestname(sDate+"获取业绩归属数据为空");
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
}
//
//
m.setTestname(sDate+"开始处理业绩归属数据:"+list.size());
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
//
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-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/task/TestTargetLogJob.java
View file @
0c34d9b7
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
TestTargetLogJob
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
;
String
sDate
=
""
;
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
]);
}
sDate
=
vars
[
0
]
+
"-"
+
vars
[
1
];
}
zTest
m
=
new
zTest
();
if
(
sDate
==
null
||
sDate
.
length
()
==
0
)
{
m
.
setTestname
(
"日期参数为空。"
);
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
return
""
;
}
//System.out.println("定时任务参数:" + param);
List
<
TargetLogDO
>
list
=
targetLogService
.
selectList2
(
sDate
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
m
.
setTestname
(
sDate
+
"获取业绩归属数据为空"
);
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
}
m
.
setTestname
(
sDate
+
"开始处理业绩归属数据:"
+
list
.
size
());
m
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m
);
for
(
TargetLogDO
t
:
list
)
{
targetLogService
.
dealTargetLogTask2
(
t
.
getOrderId
(),
null
,
t
.
getId
());
}
zTest
m2
=
new
zTest
();
m2
.
setTestname
(
"业绩归属计算完毕"
);
m2
.
setCreatedate
(
new
Date
());
zTestMapper2
.
insert
(
m2
);
return
""
;
}
}
//
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 TestTargetLogJob 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;
//
String sDate = "";
//
//
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]);
//
}
//
sDate = vars[0] + "-" + vars[1];
//
}
//
//
zTest m = new zTest();
//
if (sDate == null || sDate.length() == 0) {
//
m.setTestname("日期参数为空。");
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
return "";
//
}
//
//
//System.out.println("定时任务参数:" + param);
//
List<TargetLogDO> list = targetLogService.selectList2(sDate);
//
//
if (CollectionUtil.isEmpty(list)) {
//
m.setTestname(sDate+"获取业绩归属数据为空");
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
}
//
//
m.setTestname(sDate+"开始处理业绩归属数据:"+list.size());
//
m.setCreatedate(new Date());
//
zTestMapper2.insert(m);
//
//
for (TargetLogDO t : list) {
//
targetLogService.dealTargetLogTask2(t.getOrderId(),
//
null, t.getId());
//
}
//
zTest m2 = new zTest();
//
m2.setTestname("业绩归属计算完毕");
//
m2.setCreatedate(new Date());
//
zTestMapper2.insert(m2);
//
return "";
//
}
//
}
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