md
This commit is contained in:
parent
76a0d25e79
commit
296370f77c
@ -51,6 +51,9 @@ public interface EmisTmsCostFeeMapper extends BaseMapper<EmisTmsCostFee>
|
||||
*/
|
||||
public List<CostFeeWaybillRel> selectCostFeeRelListByBillCode(String billCode);
|
||||
|
||||
// 获取最小化的运单信息
|
||||
public EmisWaybill selectThinWaybillInfoByCostFeeCalc(String billCode);
|
||||
|
||||
// 成本和费用关系
|
||||
public List<CostFeeWaybillRel> selectCostFeeRelListByCostNo(String costNo);
|
||||
|
||||
|
||||
@ -643,41 +643,34 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"子运单数量为空,请检查");
|
||||
}
|
||||
|
||||
List<EmisWaybill> list = new ArrayList<EmisWaybill>();
|
||||
// 计算每单的固定成本
|
||||
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||
EmisWaybill item=new EmisWaybill();
|
||||
item.setBillCode(billCodeItem.getBillCode());
|
||||
list.add(item);
|
||||
String billCode=billCodeItem.getBillCode();
|
||||
// 根据运单号删除该运单计算的费用
|
||||
emisTmsCostFeeSplitMapper.deleteEmisTmsCostFeeSplitByBillCode(billCode);
|
||||
|
||||
EmisWaybill waybill=billCodeItem.getWaybillDetail();
|
||||
// 虚拟单取主单
|
||||
EmisWaybill mainWaybill=null;
|
||||
String mainBillCode = billCode;
|
||||
if( "1".equals(waybill.getBlVirtual()) ){
|
||||
mainBillCode=waybill.getMasterBillCode();
|
||||
mainWaybill=emisTmsCostFeeMapper.selectThinWaybillInfoByCostFeeCalc(mainBillCode);
|
||||
}else{
|
||||
mainWaybill=waybill;
|
||||
}
|
||||
|
||||
// 计算固定成本费用-取件费
|
||||
reCalcFixedCostFee(billCode,mainBillCode,waybill,mainWaybill);
|
||||
}
|
||||
|
||||
// 多线程并发处理
|
||||
if(!CollectionUtil.isEmpty(list)){
|
||||
List<List<EmisWaybill> > mutiOrderList = ListUtils.partition(list, 100);
|
||||
int realGroupSize=mutiOrderList.size();
|
||||
// 计算总批次的费用
|
||||
|
||||
// 计数处理
|
||||
CountDownLatch latch = new CountDownLatch(realGroupSize);
|
||||
//多线程运行
|
||||
long startTime=System.currentTimeMillis();
|
||||
reCalcCostFeeOnlyOne(costNo,null,false);
|
||||
|
||||
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");
|
||||
// 合并运单费用
|
||||
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||
mergeCostFeeByBillCode(billCodeItem.getBillCode());
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user