Merge branch 'master' of http://git.xdadan.loc/tanex/emis-service into develop

This commit is contained in:
aike 2025-07-15 19:17:33 +08:00
commit 0caaa38f71
8 changed files with 163 additions and 38 deletions

View File

@ -88,7 +88,7 @@ public class EmisCommissionProfitController extends BaseController
for (int i = 0; i < billCodeSortList.length; i++) {
String subBillCode = billCodeSortList[i];
try {
emisCommissionProfitService.reCalcProfitByBillCode(subBillCode);
emisCommissionProfitService.reCalcProfitByBillCode(subBillCode,null);
} catch (Exception ex) {
return AjaxResult.error("计算失败-单号:[" + subBillCode + "]");
}

View File

@ -804,9 +804,9 @@ public class EmisCommonController extends EmisBaseController
* @return
*/
@GetMapping("/reCalcEmpProfitByBillCode")
public AjaxResult reCalcEmpProfitByBillCode(String billCode){
public AjaxResult reCalcEmpProfitByBillCode(String billCode,Integer postType){
try{
emisCommissionProfitService.reCalcProfitByBillCode(billCode);
emisCommissionProfitService.reCalcProfitByBillCode(billCode,postType);
}
catch (Exception ex){
ex.printStackTrace();

View File

@ -5234,7 +5234,7 @@ public class EmisBaseService {
emisWaybillProblemInfoService.deleteEmisWaybillProblemInfoByBillCode(emisWaybillSave.getBillCode());
}
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode(),null);
}
}
}

View File

@ -47,7 +47,7 @@ public interface IEmisCommissionProfitService
* @param billCode
* @return
*/
public void reCalcProfitByBillCode(String billCode);
public void reCalcProfitByBillCode(String billCode,Integer postType);
/**

View File

@ -180,7 +180,7 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
// 计算运单提成
for (EmisWaybill waybill : dataList) {
try {
reCalcProfitByBillCode(waybill.getBillCode());
reCalcProfitByBillCode(waybill.getBillCode(),null);
}catch (Exception ex){
ex.printStackTrace();
}
@ -310,7 +310,7 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
*/
@Override
@Transactional
public void reCalcProfitByBillCode(String billCode)
public void reCalcProfitByBillCode(String billCode,Integer postType)
{
String lockKey="reCalcProfitByBillCode"+billCode;
// 加锁查询
@ -349,41 +349,77 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
单证员 8
*/
// 根据不同岗位计算
for (int postTypeIndex = 1; postTypeIndex <= 8; postTypeIndex++) {
if(postType!=null ){
// 1.网点客服
if (postTypeIndex == ProfitPostType.SITE_KEFU_EMP.typeCode) {
if (postType == ProfitPostType.SITE_KEFU_EMP.typeCode) {
calcSiteFefuProfit(waybill);
}
// 2.快件单证
else if (postTypeIndex == ProfitPostType.KJDZ_EMP.typeCode) {
else if (postType == ProfitPostType.KJDZ_EMP.typeCode) {
calcKjdzProfit(waybill);
}
// 3.取件员
else if (postTypeIndex == ProfitPostType.TAKE_EMP.typeCode) {
else if (postType == ProfitPostType.TAKE_EMP.typeCode) {
calcTakeProfit(waybill);
}
// 4.网点操作员
else if (postTypeIndex == ProfitPostType.SITE_OP_EMP.typeCode) {
else if (postType == ProfitPostType.SITE_OP_EMP.typeCode) {
calcOpProfit(waybill);
}
// 5.派件员
else if (postTypeIndex == ProfitPostType.DISPATCH_EMP.typeCode) {
else if (postType == ProfitPostType.DISPATCH_EMP.typeCode) {
calcDispatchProfit(waybill);
}
// 6.销售联系人
else if (postTypeIndex == ProfitPostType.SALES_EMP.typeCode) {
else if (postType == ProfitPostType.SALES_EMP.typeCode) {
calcSalesProfit(waybill);
}
// 7.中转操作员
else if (postTypeIndex == ProfitPostType.MID_OP_EMP.typeCode) {
else if (postType == ProfitPostType.MID_OP_EMP.typeCode) {
calcMidOpProfit(waybill);
}
// 8.陆运海运单证员,按柜计算,不按单计算
else if (postTypeIndex == ProfitPostType.DZ_EMP.typeCode) {
else if (postType == ProfitPostType.DZ_EMP.typeCode) {
}
}
else {
// 根据不同岗位计算
for (int postTypeIndex = 1; postTypeIndex <= 8; postTypeIndex++) {
// 1.网点客服
if (postTypeIndex == ProfitPostType.SITE_KEFU_EMP.typeCode) {
calcSiteFefuProfit(waybill);
}
// 2.快件单证
else if (postTypeIndex == ProfitPostType.KJDZ_EMP.typeCode) {
calcKjdzProfit(waybill);
}
// 3.取件员
else if (postTypeIndex == ProfitPostType.TAKE_EMP.typeCode) {
calcTakeProfit(waybill);
}
// 4.网点操作员
else if (postTypeIndex == ProfitPostType.SITE_OP_EMP.typeCode) {
calcOpProfit(waybill);
}
// 5.派件员
else if (postTypeIndex == ProfitPostType.DISPATCH_EMP.typeCode) {
calcDispatchProfit(waybill);
}
// 6.销售联系人
else if (postTypeIndex == ProfitPostType.SALES_EMP.typeCode) {
calcSalesProfit(waybill);
}
// 7.中转操作员
else if (postTypeIndex == ProfitPostType.MID_OP_EMP.typeCode) {
calcMidOpProfit(waybill);
}
// 8.陆运海运单证员,按柜计算,不按单计算
else if (postTypeIndex == ProfitPostType.DZ_EMP.typeCode) {
}
}
}
// 运单打上已计算提成标记
emisWaybillMapper.updateHasDoProfit(waybill.getBillCode());
@ -889,7 +925,12 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
String billMonth= DateUtils.parseDateToStr(DateUtils.YYYY_MM,waybill.getSendDate());
SysUser empUser = getEmisStaffByCode(waybill.getOperateEmployeeCode());
SysUser empUser = getEmisStaffByCode(waybill.getOperateEmployeeCode().trim());
if(empUser==null){
return;
}
EmisTransLine transLine=getTransLineByCode(waybill.getTransLineType());
EmisCommissionQuote emisCommissionQuote = new EmisCommissionQuote();
@ -1070,14 +1111,26 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
if( isValueInExprScope(waybill.getBillWeight().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
@ -1088,7 +1141,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
if( isValueInExprScope(waybill.getTotalVolume().doubleValue(),exprItem) ) {
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(), exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -1099,7 +1159,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入提成
@ -1186,7 +1253,13 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
@ -1195,12 +1268,17 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
calcExprStr = getCalcFeeExpStr(waybill.getBillWeight(), exprItem);
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
// 体积计算
else if ("3".equals(quoteItem.getCalcType())) {
@ -1209,7 +1287,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
calcExprStr = getCalcFeeExpStr(waybill.getTotalVolume(), exprItem);
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}
@ -1220,7 +1305,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入提成
@ -1321,7 +1413,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按票计算:计算公式:" + calcExprStr + ",票数:1");
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 重量计算
else if ("2".equals(quoteItem.getCalcType())) {
@ -1330,7 +1429,13 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按重量计算:计算公式:" + calcExprStr + ",重量:"+waybill.getBillWeight().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getBillWeight());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 体积计算
@ -1339,7 +1444,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按体积计算:计算公式:" + calcExprStr + ",体积:"+waybill.getTotalVolume().stripTrailingZeros().toPlainString());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", waybill.getTotalVolume());
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 包裹数
else if ("4".equals(quoteItem.getCalcType())) {
@ -1348,7 +1460,13 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按包裹数:计算公式:" + calcExprStr + ",包裹数:"+1);
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal("1"));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
// 插入提成
@ -1453,7 +1571,14 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
.replaceAll("s", exprItem.getInitialWeight().toString())
.replaceAll("d", exprItem.getAdditionalWeight().toString());
log.info("按柜内票数:计算公式:" + calcExprStr + ",按柜内票数:"+siteBatch.getTotalWaybillQty());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
Map<String, Object> env = new HashMap<>();
env.put("w", new BigDecimal(siteBatch.getTotalWaybillQty().toString()));
env.put("s", exprItem.getInitialWeight());
env.put("d", exprItem.getAdditionalWeight());
profitMoney = Double.valueOf(AviatorEvaluator.execute(calcExp,env).toString());
}
}else{
continue;

View File

@ -389,7 +389,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
if ("6".equals(emisWaybillOld.getPaymentType()) && !"6".equals(emisWaybillSave.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode(),null);
}
if (!"6".equals(emisWaybillOld.getPaymentType()) && "6".equals(emisWaybillSave.getPaymentType())) {
// 删除提成

View File

@ -127,7 +127,7 @@ public class EmisWaybillProblemInfoServiceImpl extends EmisBaseService implement
EmisWaybill waybill = getWaybillByBillCode(emisWaybillProblemInfo.getBillCode());
if (!"6".equals(waybill.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode(),null);
}
// 删除运单的问题件记录
@ -175,7 +175,7 @@ public class EmisWaybillProblemInfoServiceImpl extends EmisBaseService implement
EmisWaybill waybill = getWaybillByBillCode(emisWaybillProblemInfo.getBillCode());
if (!"6".equals(waybill.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode(),null);
}
// 删除运单的问题件记录

View File

@ -1518,7 +1518,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
if ("6".equals(emisWaybillOld.getPaymentType()) && !"6".equals(emisWaybillSave.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode(),null);
}
if (!"6".equals(emisWaybillOld.getPaymentType()) && "6".equals(emisWaybillSave.getPaymentType())) {
// 删除提成
@ -3279,7 +3279,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 重新计算提成
if (!"6".equals(emisWaybillSave.getPaymentType()) && !"1".equals(emisWaybillSave.getBlVirtual())) {
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode(),null);
}
}catch (Exception ex){
@ -3719,7 +3719,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
redoGenerateBill(emisWaybillSave.getBillCode(),isForce);
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode(),null);
// 设置需要重新计算成本
emisWaybillMapper.cancelHasDoCostFee(emisWaybillSave.getBillCode());