md
This commit is contained in:
parent
658afa7c5f
commit
dd45d34815
@ -192,7 +192,7 @@ public class EmisTmsCostFeeController extends BaseController
|
||||
public AjaxResult reCalcSplitCostFee(@RequestBody EmisTmsCostFee emisTmsCostFee)
|
||||
{
|
||||
try {
|
||||
return toAjax(emisTmsCostFeeService.reCalcSplitCostFee(emisTmsCostFee.getCostNo(),null,true));
|
||||
return toAjax(emisTmsCostFeeService.reCalcCostFeeAll(emisTmsCostFee.getCostNo()));
|
||||
}catch(EmisBizError ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
||||
|
||||
@ -100,7 +100,15 @@ public interface IEmisTmsCostFeeService
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int reCalcSplitCostFee(String costNo,String billCode,boolean isMerge) throws EmisBizError;
|
||||
public int reCalcCostFeeOnlyOne(String costNo,String billCode,boolean isMerge) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 重算批次费用,包含固定费用
|
||||
* @param costNo
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int reCalcCostFeeAll(String costNo) throws EmisBizError;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -13,6 +13,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
@ -434,7 +435,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
if(!CollectionUtil.isEmpty(listBillCodeRel)){
|
||||
for(CostFeeWaybillRel item:listBillCodeRel){
|
||||
try {
|
||||
reCalcSplitCostFee(item.getCostNo(),billCode,false);
|
||||
reCalcCostFeeOnlyOne(item.getCostNo(),billCode,false);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -458,7 +459,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
if(!CollectionUtil.isEmpty(listCostFee)){
|
||||
for(EmisTmsCostFee item:listCostFee){
|
||||
try {
|
||||
reCalcSplitCostFee(item.getCostNo(),null,true);
|
||||
reCalcCostFeeOnlyOne(item.getCostNo(),null,true);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -467,6 +468,54 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
log.debug("redoCalcCostFeeWaitCost===>end");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int reCalcCostFeeAll(String costNo) throws EmisBizError {
|
||||
|
||||
List<CostFeeWaybillRel> listBillCodeRel=emisTmsCostFeeMapper.selectCostFeeRelListByCostNo(costNo);
|
||||
if(CollectionUtil.isEmpty(listBillCodeRel)){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"子运单数量为空,请检查");
|
||||
}
|
||||
|
||||
List<EmisWaybill> list = new ArrayList<EmisWaybill>();
|
||||
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||
EmisWaybill item=new EmisWaybill();
|
||||
item.setBillCode(item.getBillCode());
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
// 多线程并发处理
|
||||
if(!CollectionUtil.isEmpty(list)){
|
||||
List<List<EmisWaybill> > mutiOrderList = ListUtils.partition(list, 10);
|
||||
int realGroupSize=mutiOrderList.size();
|
||||
|
||||
// 计数处理
|
||||
CountDownLatch latch = new CountDownLatch(realGroupSize);
|
||||
//多线程运行
|
||||
long startTime=System.currentTimeMillis();
|
||||
|
||||
for(int i=0; i<realGroupSize;i++){
|
||||
Runnable doRunnable=new MultiDoBillThread(
|
||||
mutiOrderList.get(i),
|
||||
latch,
|
||||
"MultiDoBillThread==>"+i);
|
||||
Thread doThread = new Thread(doRunnable, "Calc CostFee MultiDoBillThread-"+i);
|
||||
doThread.start();
|
||||
}
|
||||
|
||||
try {
|
||||
latch.await(300, TimeUnit.SECONDS);
|
||||
// 线程结束后计算所有员工提成
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
}
|
||||
long endTime=System.currentTimeMillis(); //获取结束时间
|
||||
log.info("Profit MultiDoBillThread End escape time: "+(endTime-startTime)+"ms");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运单变动批量计算运单利润
|
||||
* @throws EmisBizError
|
||||
@ -508,6 +557,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 多线程处理
|
||||
class MultiDoBillThread implements Runnable {
|
||||
private List<EmisWaybill> dataList = null;
|
||||
@ -558,14 +608,16 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成本分摊重算
|
||||
* @param costNo
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 成本分摊重算
|
||||
* @param costNo
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Override
|
||||
public int reCalcSplitCostFee(String costNo,String calcBillCode,boolean isMerge) throws EmisBizError {
|
||||
public int reCalcCostFeeOnlyOne(String costNo,String calcBillCode,boolean isMerge) throws EmisBizError {
|
||||
// 获取最新的数据
|
||||
EmisTmsCostFee oldCostFee = emisTmsCostFeeMapper.selectEmisTmsCostFeeByCostNo(costNo);
|
||||
// /* 总票数 总重量 总体积 */
|
||||
@ -860,7 +912,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
emisTmsCostFeeMapper.updateEmisTmsCostFee(emisTmsCostFee);
|
||||
|
||||
// 计算分摊费用
|
||||
// reCalcSplitCostFee(costNo);
|
||||
// reCalcCostFeeOnlyOne(costNo);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -894,7 +946,7 @@ public class EmisTmsCostFeeServiceImpl implements IEmisTmsCostFeeService
|
||||
EmisTmsCostFee emisTmsCostFee=emisTmsCostFeeMapper.selectEmisTmsCostFeeById(id);
|
||||
emisTmsCostFeeMapper.deleteEmisTmsCostFeeById(id);
|
||||
// try {
|
||||
// reCalcSplitCostFee(emisTmsCostFee.getCostNo());
|
||||
// reCalcCostFeeOnlyOne(emisTmsCostFee.getCostNo());
|
||||
// } catch (EmisBizError emisBizError) {
|
||||
// emisBizError.printStackTrace();
|
||||
// }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user