md
This commit is contained in:
parent
183fa7de10
commit
37140c9cea
@ -195,7 +195,30 @@ public class EmisWaybillController extends BaseController
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Log(title = "计算体积重量", businessType = BusinessType.OTHER)
|
||||
@PostMapping(value = "/calcVolumeWeight")
|
||||
public AjaxResult calcVolumeWeight(@RequestBody WaybillOrder waybillOrder)
|
||||
{
|
||||
try {
|
||||
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
||||
|
||||
emisWaybillService.calcVolumeWeight(emisWaybillSave);
|
||||
|
||||
JSONObject jObjRst = new JSONObject();
|
||||
jObjRst.put("volumeWeight", emisWaybillSave.getVolumeWeight());
|
||||
return AjaxResult.success("计算成功", jObjRst);
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -115,6 +115,8 @@ public interface IEmisWaybillService
|
||||
//计算运单费用
|
||||
public void calcWaybillFee(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
// 计算体积重量
|
||||
public void calcVolumeWeight(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
// 计算结算重量
|
||||
public void calcSettledWeight(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
@ -567,8 +567,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
if (
|
||||
StringUtils.isEmpty(emisWaybill.getProductType())
|
||||
|| emisWaybill.getBillWeight() == null
|
||||
|| emisWaybill.getTotalVolume() == null
|
||||
|| emisWaybill.getBillWeight() == null
|
||||
|| emisWaybill.getTotalVolume() == null
|
||||
)
|
||||
{
|
||||
|
||||
@ -606,6 +606,37 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void calcVolumeWeight(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
|
||||
if (
|
||||
StringUtils.isEmpty(emisWaybill.getProductType())
|
||||
|| emisWaybill.getTotalVolume() == null
|
||||
)
|
||||
{
|
||||
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "参数不完整");
|
||||
}
|
||||
|
||||
double totalVolume=emisWaybill.getTotalVolume().doubleValue();
|
||||
|
||||
// 获取产品信息
|
||||
EmisTransProduct emisTransProduct = getTransProductByCode(emisWaybill.getProductType());
|
||||
|
||||
// 获取泡重比,计算体积重量
|
||||
EmisTransLine emisTransLine= getTransLineByCode(emisTransProduct.getTransLineCode());
|
||||
|
||||
double volumeWeight=0.0D;
|
||||
if(!StringUtils.isEmpty(emisTransLine.getMeterRate())) {
|
||||
volumeWeight=totalVolume * (1000000 / Double.valueOf(emisTransLine.getMeterRate()));
|
||||
DecimalFormat df = new DecimalFormat("#.#####");
|
||||
volumeWeight= Double.parseDouble(df.format(volumeWeight));
|
||||
}
|
||||
emisWaybill.setVolumeWeight(BigDecimal.valueOf(volumeWeight));
|
||||
emisWaybill.setMeterType(emisTransLine.getMeterRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmisWaybill> selectEmisWaybillByMutiBillCode(String[] billCodes){
|
||||
return emisWaybillMapper.selectEmisWaybillByMutiBillCode(billCodes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user