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 List<CostFeeWaybillRel> selectCostFeeRelListByBillCode(String billCode);
|
||||||
|
|
||||||
|
// 获取最小化的运单信息
|
||||||
|
public EmisWaybill selectThinWaybillInfoByCostFeeCalc(String billCode);
|
||||||
|
|
||||||
// 成本和费用关系
|
// 成本和费用关系
|
||||||
public List<CostFeeWaybillRel> selectCostFeeRelListByCostNo(String costNo);
|
public List<CostFeeWaybillRel> selectCostFeeRelListByCostNo(String costNo);
|
||||||
|
|
||||||
|
|||||||
@ -643,41 +643,34 @@ public class EmisTmsCostFeeServiceImpl extends EmisBaseService implements IEmisT
|
|||||||
throw new EmisBizError(EmisBizErrorType.FAIL,"子运单数量为空,请检查");
|
throw new EmisBizError(EmisBizErrorType.FAIL,"子运单数量为空,请检查");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EmisWaybill> list = new ArrayList<EmisWaybill>();
|
// 计算每单的固定成本
|
||||||
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||||
EmisWaybill item=new EmisWaybill();
|
String billCode=billCodeItem.getBillCode();
|
||||||
item.setBillCode(billCodeItem.getBillCode());
|
// 根据运单号删除该运单计算的费用
|
||||||
list.add(item);
|
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();
|
|
||||||
|
|
||||||
// 计数处理
|
reCalcCostFeeOnlyOne(costNo,null,false);
|
||||||
CountDownLatch latch = new CountDownLatch(realGroupSize);
|
|
||||||
//多线程运行
|
|
||||||
long startTime=System.currentTimeMillis();
|
|
||||||
|
|
||||||
for(int i=0; i<realGroupSize;i++){
|
// 合并运单费用
|
||||||
Runnable doRunnable=new MultiDoBillThread(
|
for (CostFeeWaybillRel billCodeItem: listBillCodeRel) {
|
||||||
mutiOrderList.get(i),
|
mergeCostFeeByBillCode(billCodeItem.getBillCode());
|
||||||
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;
|
return 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user