Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-staff
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c28b0310
authored
Jan 20, 2026
by
DESKTOP-3F024UL\tianming
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提成计算相关
1 parent
2fcc9a38
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
141 additions
and
86 deletions
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/CommissionMethodEnum.java → rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/CommissionTypeEnum.java
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/ProductConfigTypeEnum.java → rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/GoodsConfigTypeEnum.java
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/PerformanceConditionTypeEnum.java
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/model/PerformanceParamConfigCondition.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/mapper/StaffProductPerformanceMapper.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceCalService.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceDetailService.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceService.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffProductPerformanceService.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/util/StaffPerformanceOrderUtil.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/util/DataCalUtil.java
rpc-dj-staff/src/main/resources/META-INF/orm/StaffPerformanceDetailMapper.xml
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/Commission
Method
Enum.java
→
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/Commission
Type
Enum.java
View file @
c28b031
...
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
...
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
*/
*/
@AllArgsConstructor
@AllArgsConstructor
@Getter
@Getter
public
enum
Commission
Method
Enum
{
public
enum
Commission
Type
Enum
{
BL
(
"BL"
,
"比例"
,
BigDecimal
.
ZERO
,
BigDecimal
.
valueOf
(
100
)),
BL
(
"BL"
,
"比例"
,
BigDecimal
.
ZERO
,
BigDecimal
.
valueOf
(
100
)),
XS
(
"XS"
,
"系数"
,
BigDecimal
.
ONE
,
BigDecimal
.
valueOf
(
10
)),
XS
(
"XS"
,
"系数"
,
BigDecimal
.
ONE
,
BigDecimal
.
valueOf
(
10
)),
GDJE
(
"GDJE"
,
"固定金额"
,
BigDecimal
.
ZERO
,
BigDecimal
.
valueOf
(
9999999
));
GDJE
(
"GDJE"
,
"固定金额"
,
BigDecimal
.
ZERO
,
BigDecimal
.
valueOf
(
9999999
));
...
@@ -20,8 +20,8 @@ public enum CommissionMethodEnum {
...
@@ -20,8 +20,8 @@ public enum CommissionMethodEnum {
private
final
BigDecimal
min
;
private
final
BigDecimal
min
;
private
final
BigDecimal
max
;
private
final
BigDecimal
max
;
public
static
Commission
Method
Enum
getByCode
(
String
code
)
{
public
static
Commission
Type
Enum
getByCode
(
String
code
)
{
for
(
Commission
Method
Enum
value
:
values
())
{
for
(
Commission
Type
Enum
value
:
values
())
{
if
(
value
.
getCode
().
equals
(
code
))
{
if
(
value
.
getCode
().
equals
(
code
))
{
return
value
;
return
value
;
}
}
...
@@ -31,10 +31,10 @@ public enum CommissionMethodEnum {
...
@@ -31,10 +31,10 @@ public enum CommissionMethodEnum {
// 检测区间
// 检测区间
public
static
boolean
check
(
String
code
,
BigDecimal
value
)
{
public
static
boolean
check
(
String
code
,
BigDecimal
value
)
{
Commission
MethodEnum
commissionMethod
Enum
=
getByCode
(
code
);
Commission
TypeEnum
commissionType
Enum
=
getByCode
(
code
);
if
(
commission
Method
Enum
==
null
)
{
if
(
commission
Type
Enum
==
null
)
{
return
false
;
return
false
;
}
}
return
value
.
doubleValue
()
>=
commission
MethodEnum
.
getMin
().
doubleValue
()
&&
value
.
doubleValue
()
<=
commissionMethod
Enum
.
getMax
().
doubleValue
();
return
value
.
doubleValue
()
>=
commission
TypeEnum
.
getMin
().
doubleValue
()
&&
value
.
doubleValue
()
<=
commissionType
Enum
.
getMax
().
doubleValue
();
}
}
}
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/
Product
ConfigTypeEnum.java
→
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/
Goods
ConfigTypeEnum.java
View file @
c28b031
...
@@ -3,22 +3,31 @@ package cn.com.glsx.dj.staff.enums;
...
@@ -3,22 +3,31 @@ package cn.com.glsx.dj.staff.enums;
/**
/**
* 商品配置类型枚举
* 商品配置类型枚举
*/
*/
public
enum
ProductConfigTypeEnum
implements
BaseEnum
<
Integer
,
String
>
{
public
enum
GoodsConfigTypeEnum
implements
BaseEnum
<
Byte
,
String
>
{
ALL_PRODUCT
(-
1
,
"全部商品"
),
ALL_PRODUCT
(
(
byte
)
-
1
,
"全部商品"
),
PRODUCT_CATEGORY
(
0
,
"商品分类"
),
PRODUCT_CATEGORY
(
(
byte
)
0
,
"商品分类"
),
DESIGNATED_PRODUCT
(
1
,
"圈定产品"
),
DESIGNATED_PRODUCT
(
(
byte
)
1
,
"圈定产品"
),
DESIGNATED_PACKAGE
(
2
,
"圈定套餐"
);
DESIGNATED_PACKAGE
(
(
byte
)
2
,
"圈定套餐"
);
private
final
Integer
code
;
private
final
Byte
code
;
private
final
String
desc
;
private
final
String
desc
;
ProductConfigTypeEnum
(
Integer
code
,
String
desc
)
{
GoodsConfigTypeEnum
(
Byte
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
}
}
public
static
GoodsConfigTypeEnum
getByCode
(
Byte
goodsConfigType
)
{
for
(
GoodsConfigTypeEnum
type
:
GoodsConfigTypeEnum
.
values
())
{
if
(
type
.
getCode
().
equals
(
goodsConfigType
))
{
return
type
;
}
}
return
null
;
}
@Override
@Override
public
Integer
getCode
()
{
public
Byte
getCode
()
{
return
code
;
return
code
;
}
}
...
...
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/enums/PerformanceConditionTypeEnum.java
0 → 100644
View file @
c28b031
package
cn
.
com
.
glsx
.
dj
.
staff
.
enums
;
/**
* 绩效参数配置条件类型枚举
*/
public
enum
PerformanceConditionTypeEnum
implements
BaseEnum
<
Byte
,
String
>
{
PENETRATION_RATE_LIMIT
((
byte
)
1
,
"渗透率限制"
),
ORDER_COUNT_DEDUCTION
((
byte
)
2
,
"订单数不足扣减"
),
TARGET_ACHIEVEMENT_REWARD
((
byte
)
3
,
"整体指标达成奖励"
),
ORDER_EXCLUSION_INCLUSION
((
byte
)
4
,
"订单数剔除/包含"
);
private
final
Byte
code
;
private
final
String
desc
;
PerformanceConditionTypeEnum
(
Byte
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
static
PerformanceConditionTypeEnum
getByCode
(
Number
code
)
{
if
(
code
==
null
)
{
return
null
;
}
for
(
PerformanceConditionTypeEnum
type
:
PerformanceConditionTypeEnum
.
values
())
{
if
(
type
.
getCode
().
equals
(
code
.
intValue
()))
{
return
type
;
}
}
return
null
;
}
@Override
public
Byte
getCode
()
{
return
code
;
}
@Override
public
String
getDesc
()
{
return
desc
;
}
}
rpc-dj-staff-api/src/main/java/cn/com/glsx/dj/staff/model/PerformanceParamConfigCondition.java
View file @
c28b031
...
@@ -34,13 +34,13 @@ public class PerformanceParamConfigCondition implements Serializable {
...
@@ -34,13 +34,13 @@ public class PerformanceParamConfigCondition implements Serializable {
@Column
(
name
=
"performance_param_config_id"
)
@Column
(
name
=
"performance_param_config_id"
)
private
Integer
performanceParamConfigId
;
private
Integer
performanceParamConfigId
;
@ApiModelProperty
(
notes
=
"条件类型(1:渗透率限制,2.订单数不足扣减,3.整体指标达成奖励,4.订单数剔除/包含)"
)
@ApiModelProperty
(
notes
=
"条件类型(1:渗透率限制,2.订单数不足扣减,3.整体指标达成奖励,4.订单数剔除/包含)
, 详见PerformanceConditionTypeEnum
"
)
@Column
(
name
=
"condition_type"
)
@Column
(
name
=
"condition_type"
)
private
Integer
conditionType
;
private
Byte
conditionType
;
@ApiModelProperty
(
notes
=
"条件商品配置类型(-1:全部商品,0:商品分类,1:圈定产品,2圈定套餐)"
)
@ApiModelProperty
(
notes
=
"条件商品配置类型(-1:全部商品,0:商品分类,1:圈定产品,2圈定套餐)
, 详见ProductConfigTypeEnum
"
)
@Column
(
name
=
"condition_goods_config_type"
)
@Column
(
name
=
"condition_goods_config_type"
)
private
Integer
conditionGoodsConfigType
;
private
Byte
conditionGoodsConfigType
;
@ApiModelProperty
(
notes
=
"条件商品分类(一级)"
)
@ApiModelProperty
(
notes
=
"条件商品分类(一级)"
)
@Column
(
name
=
"condition_goods_type"
)
@Column
(
name
=
"condition_goods_type"
)
...
...
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/mapper/StaffProductPerformanceMapper.java
View file @
c28b031
...
@@ -19,5 +19,5 @@ public interface StaffProductPerformanceMapper extends OreMapper<StaffProductPer
...
@@ -19,5 +19,5 @@ public interface StaffProductPerformanceMapper extends OreMapper<StaffProductPer
@Param
(
"staffPhone"
)
String
staffPhone
,
@Param
(
"staffPhone"
)
String
staffPhone
,
@Param
(
"updatedBy"
)
String
updatedBy
);
@Param
(
"updatedBy"
)
String
updatedBy
);
List
<
StaffProductPerformanceDTO
>
listStaffPerformance
(
@Param
(
"dto"
)
StaffProductPerformanceDTO
dto
);
List
<
StaffProductPerformanceDTO
>
listStaffPerformance
(
StaffProductPerformanceDTO
dto
);
}
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceCalService.java
View file @
c28b031
This diff is collapsed.
Click to expand it.
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceDetailService.java
View file @
c28b031
...
@@ -50,9 +50,9 @@ public class StaffPerformanceDetailService {
...
@@ -50,9 +50,9 @@ public class StaffPerformanceDetailService {
return
;
return
;
}
}
// 1. 调用mapper,通过update更新相同merchantId businessType brandId childBrandId
// 1. 逻辑删除旧数据
// performanceMonth的记录的deletedFlag = 'D'
StaffPerformanceDetail
query
=
StaffPerformanceDetail
.
builder
()
StaffPerformanceDetail
query
=
StaffPerformanceDetail
.
builder
()
.
staffPhone
(
performanceDetailDTOS
.
get
(
0
).
getStaffPhone
())
.
merchantId
(
config
.
getMerchantId
())
.
merchantId
(
config
.
getMerchantId
())
.
businessType
(
config
.
getBusinessType
())
.
businessType
(
config
.
getBusinessType
())
.
brandId
(
config
.
getBrandId
())
.
brandId
(
config
.
getBrandId
())
...
...
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffPerformanceService.java
View file @
c28b031
...
@@ -5,7 +5,7 @@ import cn.com.glsx.dj.staff.dto.StaffPerformanceCalContextDTO;
...
@@ -5,7 +5,7 @@ import cn.com.glsx.dj.staff.dto.StaffPerformanceCalContextDTO;
import
cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO
;
import
cn.com.glsx.dj.staff.dto.StaffPerformanceDetailDTO
;
import
cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO
;
import
cn.com.glsx.dj.staff.dto.StaffProductPerformanceDTO
;
import
cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO
;
import
cn.com.glsx.dj.staff.dto.performance.StaffPerformanceDTO
;
import
cn.com.glsx.dj.staff.enums.Commission
Method
Enum
;
import
cn.com.glsx.dj.staff.enums.Commission
Type
Enum
;
import
cn.com.glsx.dj.staff.mapper.StaffPerformanceMapper
;
import
cn.com.glsx.dj.staff.mapper.StaffPerformanceMapper
;
import
cn.com.glsx.dj.staff.model.StaffBeisenBaseInfo
;
import
cn.com.glsx.dj.staff.model.StaffBeisenBaseInfo
;
import
cn.com.glsx.dj.staff.model.StaffPerformance
;
import
cn.com.glsx.dj.staff.model.StaffPerformance
;
...
@@ -52,43 +52,31 @@ public class StaffPerformanceService {
...
@@ -52,43 +52,31 @@ public class StaffPerformanceService {
log
.
error
(
"输入数据无效: context 为空或 performanceDetailDTOS 为空"
);
log
.
error
(
"输入数据无效: context 为空或 performanceDetailDTOS 为空"
);
return
;
return
;
}
}
String
staffPhone
=
context
.
getStaffPhone
();
// 1. 根据 merchantId, businessType, brandId, childBrandId 分组
Integer
merchantId
=
context
.
getMerchantId
();
Map
<
String
,
List
<
StaffPerformanceDetailDTO
>>
groupedMap
=
groupPerformanceDetails
(
performanceDetailDTOS
);
Byte
businessType
=
context
.
getBusinessType
();
Integer
brandId
=
context
.
getBrandId
();
Integer
childBrandId
=
context
.
getChildBrandId
();
String
performanceMonth
=
context
.
getPerformanceMonth
();
if
(
merchantId
==
null
||
businessType
==
null
||
brandId
==
null
||
childBrandId
==
null
||
StringUtils
.
isBlank
(
performanceMonth
)
||
StringUtils
.
isBlank
(
staffPhone
))
{
log
.
error
(
"输入数据无效: merchantId={}, businessType={}, brandId={}, childBrandId={}, performanceMonth={}, staffPhone={}"
,
merchantId
,
businessType
,
brandId
,
childBrandId
,
performanceMonth
,
staffPhone
);
return
;
}
// 2. 检查是否处于新人保护期
// 2. 检查是否处于新人保护期
boolean
isNewcomerProtection
=
checkNewcomerProtection
(
context
.
getStaffPhone
(),
context
.
getPerformanceMonth
());
boolean
isNewcomerProtection
=
checkNewcomerProtection
(
context
.
getStaffPhone
(),
context
.
getPerformanceMonth
());
List
<
StaffPerformance
>
insertList
=
new
ArrayList
<>();
// 3. 构建 StaffPerformance
Date
now
=
new
Date
();
StaffPerformance
staffPerformance
=
buildStaffPerformance
(
performanceDetailDTOS
,
context
,
isNewcomerProtection
);
for
(
List
<
StaffPerformanceDetailDTO
>
groupList
:
groupedMap
.
values
())
{
if
(
CollectionUtils
.
isEmpty
(
groupList
))
{
continue
;
}
// 3. 构建 StaffPerformance
StaffPerformance
staffPerformance
=
buildStaffPerformance
(
groupList
,
context
,
isNewcomerProtection
,
now
);
insertList
.
add
(
staffPerformance
);
// 4. 逻辑删除旧数据
// 4. 逻辑删除旧数据
staffPerformanceMapper
.
removeStaffPerformance
(
staffPerformance
);
staffPerformanceMapper
.
removeStaffPerformance
(
staffPerformance
);
}
// 5. 批量插入新数据
if
(
CollectionUtils
.
isNotEmpty
(
insertList
))
{
staffPerformanceMapper
.
insertList
(
insertList
);
}
}
/**
// 5. 插入新数据
* 对详情数据进行分组
staffPerformanceMapper
.
insertSelective
(
staffPerformance
);
*/
private
Map
<
String
,
List
<
StaffPerformanceDetailDTO
>>
groupPerformanceDetails
(
List
<
StaffPerformanceDetailDTO
>
details
)
{
return
details
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getMerchantId
()
+
"_"
+
dto
.
getBusinessType
()
+
"_"
+
dto
.
getBrandId
()
+
"_"
+
dto
.
getChildBrandId
()));
}
}
/**
/**
...
@@ -136,8 +124,7 @@ public class StaffPerformanceService {
...
@@ -136,8 +124,7 @@ public class StaffPerformanceService {
*/
*/
private
StaffPerformance
buildStaffPerformance
(
List
<
StaffPerformanceDetailDTO
>
groupList
,
private
StaffPerformance
buildStaffPerformance
(
List
<
StaffPerformanceDetailDTO
>
groupList
,
StaffPerformanceCalContextDTO
context
,
StaffPerformanceCalContextDTO
context
,
boolean
isNewcomerProtection
,
boolean
isNewcomerProtection
)
{
Date
now
)
{
StaffPerformanceDetailDTO
first
=
groupList
.
get
(
0
);
StaffPerformanceDetailDTO
first
=
groupList
.
get
(
0
);
StaffPerformance
staffPerformance
=
new
StaffPerformance
();
StaffPerformance
staffPerformance
=
new
StaffPerformance
();
...
@@ -153,6 +140,7 @@ public class StaffPerformanceService {
...
@@ -153,6 +140,7 @@ public class StaffPerformanceService {
staffPerformance
.
setChildBrandName
(
first
.
getChildBrandName
());
staffPerformance
.
setChildBrandName
(
first
.
getChildBrandName
());
staffPerformance
.
setMonth
(
first
.
getMonth
());
staffPerformance
.
setMonth
(
first
.
getMonth
());
Date
now
=
new
Date
();
staffPerformance
.
setCreatedBy
(
CommonConstants
.
DEFAULT_UPDATE_BY
);
staffPerformance
.
setCreatedBy
(
CommonConstants
.
DEFAULT_UPDATE_BY
);
staffPerformance
.
setUpdatedBy
(
CommonConstants
.
DEFAULT_UPDATE_BY
);
staffPerformance
.
setUpdatedBy
(
CommonConstants
.
DEFAULT_UPDATE_BY
);
staffPerformance
.
setCreatedDate
(
now
);
staffPerformance
.
setCreatedDate
(
now
);
...
@@ -193,7 +181,7 @@ public class StaffPerformanceService {
...
@@ -193,7 +181,7 @@ public class StaffPerformanceService {
// 遍历详情计算
// 遍历详情计算
for
(
StaffPerformanceDetailDTO
detail
:
groupList
)
{
for
(
StaffPerformanceDetailDTO
detail
:
groupList
)
{
// 判断是否为系数类型 (假设 'XS' 为系数代码)
// 判断是否为系数类型 (假设 'XS' 为系数代码)
if
(
Commission
Method
Enum
.
XS
.
getCode
().
equals
(
detail
.
getCommissionType
()))
{
if
(
Commission
Type
Enum
.
XS
.
getCode
().
equals
(
detail
.
getCommissionType
()))
{
if
(
detail
.
getCommissionTypeValue
()
!=
null
)
{
if
(
detail
.
getCommissionTypeValue
()
!=
null
)
{
multiplyCoeff
=
multiplyCoeff
.
multiply
(
detail
.
getCommissionTypeValue
());
multiplyCoeff
=
multiplyCoeff
.
multiply
(
detail
.
getCommissionTypeValue
());
}
}
...
...
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/StaffProductPerformanceService.java
View file @
c28b031
This diff is collapsed.
Click to expand it.
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/service/staffPerformance/util/StaffPerformanceOrderUtil.java
View file @
c28b031
...
@@ -3,8 +3,9 @@ package cn.com.glsx.dj.staff.service.staffPerformance.util;
...
@@ -3,8 +3,9 @@ package cn.com.glsx.dj.staff.service.staffPerformance.util;
import
cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO
;
import
cn.com.glsx.dj.smartcarlife.dto.merchantPerformanceConfig.MerchantPerformanceProductDefineDTO
;
import
cn.com.glsx.dj.smartcarlife.model.MerchantPerformanceProductDefineItem
;
import
cn.com.glsx.dj.smartcarlife.model.MerchantPerformanceProductDefineItem
;
import
cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO
;
import
cn.com.glsx.dj.staff.dto.StaffPerformanceSubOrderDTO
;
import
cn.com.glsx.dj.staff.enums.
Product
ConfigTypeEnum
;
import
cn.com.glsx.dj.staff.enums.
Goods
ConfigTypeEnum
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.core.util.RpcAssert
;
import
cn.com.glsx.framework.core.util.RpcAssert
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -81,37 +82,47 @@ public class StaffPerformanceOrderUtil {
...
@@ -81,37 +82,47 @@ public class StaffPerformanceOrderUtil {
* @param productDefine 圈定商品定义(含套餐)
* @param productDefine 圈定商品定义(含套餐)
* @return 匹配数量
* @return 匹配数量
*/
*/
public
static
long
countMatchingOrders
(
List
<
StaffPerformanceSubOrderDTO
>
orders
,
public
static
Integer
countMatchingOrders
(
List
<
StaffPerformanceSubOrderDTO
>
orders
,
Integer
goodsConfigType
,
Byte
goodsConfigType
,
Integer
goodsType
,
Integer
goodsType
,
Integer
secondaryGoodsType
,
Integer
secondaryGoodsType
,
Integer
thirdLevelGoodsType
,
Integer
thirdLevelGoodsType
,
MerchantPerformanceProductDefineDTO
productDefine
)
{
MerchantPerformanceProductDefineDTO
productDefine
)
{
if
(
CollectionUtils
.
isEmpty
(
orders
)
||
goodsConfigType
==
null
)
{
if
(
CollectionUtils
.
isEmpty
(
orders
))
{
return
0
;
return
0
;
}
}
// 3. 根据配置类型分别处理
GoodsConfigTypeEnum
configType
=
GoodsConfigTypeEnum
.
getByCode
(
goodsConfigType
);
if
(
configType
==
null
)
{
throw
new
RpcServiceException
(
"不支持的商品配置类型: "
+
goodsConfigType
);
}
switch
(
configType
)
{
case
DESIGNATED_PACKAGE:
RpcAssert
.
assertNotNull
(
productDefine
,
DefaultErrorEnum
.
DATA_NULL
,
"conditionProductDefine be null"
);
RpcAssert
.
assertNotEmpty
(
productDefine
.
getPackageItemList
(),
DefaultErrorEnum
.
DATA_NULL
,
"conditionProductDefine.getPackageItemList() is empty"
);
if
(
goodsConfigType
==
2
)
{
Map
<
String
,
List
<
StaffPerformanceSubOrderDTO
>>
groupedOrders
=
orders
.
stream
()
RpcAssert
.
assertNotNull
(
productDefine
,
DefaultErrorEnum
.
DATA_NULL
,
.
collect
(
Collectors
.
groupingBy
(
StaffPerformanceSubOrderDTO:
:
getOrderCode
));
"conditionProductDefine be null"
);
return
(
int
)
groupedOrders
.
values
().
stream
()
RpcAssert
.
assertNotEmpty
(
productDefine
.
getPackageItemList
(),
DefaultErrorEnum
.
DATA_NULL
,
.
filter
(
o
->
isOrderMatchPackage
(
o
,
productDefine
.
getPackageItemList
()))
"conditionProductDefine.getPackageItemList() is empty"
);
.
count
();
case
ALL_PRODUCT:
Map
<
String
,
List
<
StaffPerformanceSubOrderDTO
>>
groupedOrders
=
orders
.
stream
()
case
PRODUCT_CATEGORY:
.
collect
(
Collectors
.
groupingBy
(
StaffPerformanceSubOrderDTO:
:
getOrderCode
));
case
DESIGNATED_PRODUCT:
return
groupedOrders
.
values
().
stream
()
return
(
int
)
orders
.
stream
()
.
filter
(
o
->
isOrderMatchPackage
(
o
,
productDefine
.
getPackageItemList
()))
.
filter
(
o
->
isOrderMatchCategory
(
o
,
.
count
();
goodsConfigType
,
}
else
{
goodsType
,
return
orders
.
stream
()
secondaryGoodsType
,
.
filter
(
o
->
isOrderMatchCategory
(
o
,
thirdLevelGoodsType
,
goodsConfigType
.
byteValue
(),
productDefine
))
goodsType
,
.
count
();
secondaryGoodsType
,
default
:
thirdLevelGoodsType
,
throw
new
RpcServiceException
(
"不支持的商品配置类型: "
+
goodsConfigType
);
productDefine
))
.
count
();
}
}
}
}
/**
/**
...
@@ -134,12 +145,12 @@ public class StaffPerformanceOrderUtil {
...
@@ -134,12 +145,12 @@ public class StaffPerformanceOrderUtil {
RpcAssert
.
assertNotNull
(
goodsConfigType
,
DefaultErrorEnum
.
DATA_NULL
,
"goodsConfigType不能为空"
);
RpcAssert
.
assertNotNull
(
goodsConfigType
,
DefaultErrorEnum
.
DATA_NULL
,
"goodsConfigType不能为空"
);
// TODO 改用枚举
// TODO 改用枚举
// -1:全部商品
// -1:全部商品
if
(
Objects
.
equals
(
Product
ConfigTypeEnum
.
ALL_PRODUCT
.
getCode
(),
goodsConfigType
))
{
if
(
Objects
.
equals
(
Goods
ConfigTypeEnum
.
ALL_PRODUCT
.
getCode
(),
goodsConfigType
))
{
return
true
;
return
true
;
}
}
// 0:商品分类
// 0:商品分类
if
(
Objects
.
equals
(
Product
ConfigTypeEnum
.
PRODUCT_CATEGORY
.
getCode
(),
goodsConfigType
))
{
if
(
Objects
.
equals
(
Goods
ConfigTypeEnum
.
PRODUCT_CATEGORY
.
getCode
(),
goodsConfigType
))
{
boolean
match
=
true
;
boolean
match
=
true
;
if
(
goodsType
!=
null
)
{
if
(
goodsType
!=
null
)
{
match
=
match
&&
Objects
.
equals
(
goodsType
,
order
.
getGoodsType
());
match
=
match
&&
Objects
.
equals
(
goodsType
,
order
.
getGoodsType
());
...
@@ -154,7 +165,7 @@ public class StaffPerformanceOrderUtil {
...
@@ -154,7 +165,7 @@ public class StaffPerformanceOrderUtil {
}
}
// 1:圈定产品
// 1:圈定产品
if
(
Objects
.
equals
(
Product
ConfigTypeEnum
.
DESIGNATED_PRODUCT
.
getCode
(),
goodsConfigType
))
{
if
(
Objects
.
equals
(
Goods
ConfigTypeEnum
.
DESIGNATED_PRODUCT
.
getCode
(),
goodsConfigType
))
{
RpcAssert
.
assertNotNull
(
productDefine
,
DefaultErrorEnum
.
DATA_NULL
,
RpcAssert
.
assertNotNull
(
productDefine
,
DefaultErrorEnum
.
DATA_NULL
,
"productDefine不能为空"
);
"productDefine不能为空"
);
return
productDefine
.
getItemList
().
stream
()
return
productDefine
.
getItemList
().
stream
()
...
...
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/util/DataCalUtil.java
View file @
c28b031
...
@@ -6,6 +6,9 @@ import java.math.BigDecimal;
...
@@ -6,6 +6,9 @@ import java.math.BigDecimal;
public
class
DataCalUtil
{
public
class
DataCalUtil
{
public
static
BigDecimal
divideToPercent
(
BigDecimal
dividend
,
BigDecimal
divisor
)
{
public
static
BigDecimal
divideToPercent
(
BigDecimal
dividend
,
BigDecimal
divisor
)
{
if
(
dividend
==
null
||
divisor
==
null
)
{
return
null
;
}
if
(
divisor
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
divisor
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
return
null
;
return
null
;
}
}
...
@@ -14,8 +17,10 @@ public class DataCalUtil {
...
@@ -14,8 +17,10 @@ public class DataCalUtil {
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
.
ROUND_HALF_UP
);
}
}
public
static
BigDecimal
divide
(
BigDecimal
dividend
,
BigDecimal
divisor
)
{
public
static
BigDecimal
divide
(
BigDecimal
dividend
,
BigDecimal
divisor
)
{
if
(
dividend
==
null
||
divisor
==
null
)
{
return
null
;
}
if
(
divisor
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
divisor
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
return
BigDecimal
.
ZERO
;
return
BigDecimal
.
ZERO
;
}
}
...
...
rpc-dj-staff/src/main/resources/META-INF/orm/StaffPerformanceDetailMapper.xml
View file @
c28b031
...
@@ -71,7 +71,8 @@
...
@@ -71,7 +71,8 @@
updated_by = #{updatedBy},
updated_by = #{updatedBy},
updated_date = now()
updated_date = now()
WHERE
WHERE
merchant_id = #{merchantId,jdbcType=INTEGER}
staff_phone = #{staffPhone,jdbcType=VARCHAR}
AND merchant_id = #{merchantId,jdbcType=INTEGER}
AND business_type = #{businessType,jdbcType=TINYINT}
AND business_type = #{businessType,jdbcType=TINYINT}
AND brand_id = #{brandId,jdbcType=INTEGER}
AND brand_id = #{brandId,jdbcType=INTEGER}
AND child_brand_id = #{childBrandId,jdbcType=INTEGER}
AND child_brand_id = #{childBrandId,jdbcType=INTEGER}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment