md
This commit is contained in:
parent
053dd0702d
commit
7f34eed37f
@ -13,6 +13,13 @@ package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.vo.FeeItem;
|
||||
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
|
||||
import com.xdadan.erp.emis.service.IEmisWaybillService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -29,7 +36,6 @@ import com.xdadan.erp.common.core.controller.BaseController;
|
||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||
import com.xdadan.erp.common.enums.BusinessType;
|
||||
import com.xdadan.erp.common.utils.StringUtils;
|
||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisQuotePrice;
|
||||
@ -48,6 +54,9 @@ public class EmisQuotePriceController extends BaseController
|
||||
@Autowired
|
||||
private IEmisQuotePriceService emisQuotePriceService;
|
||||
|
||||
@Autowired
|
||||
private IEmisWaybillService emisWaybillService;
|
||||
|
||||
/**
|
||||
* 查询费用报价列表
|
||||
*/
|
||||
@ -61,11 +70,24 @@ public class EmisQuotePriceController extends BaseController
|
||||
}
|
||||
|
||||
@RequestMapping("/calcWaybillFee")
|
||||
public TableDataInfo calcWaybillFee(EmisQuotePrice emisQuotePrice)
|
||||
public AjaxResult calcWaybillFee(@RequestBody WaybillOrder waybillOrder)
|
||||
{
|
||||
startPage();
|
||||
List<EmisQuotePrice> list = emisQuotePriceService.selectEmisQuotePriceList(emisQuotePrice);
|
||||
return getDataTable(list);
|
||||
try {
|
||||
|
||||
EmisWaybill emisWaybillCalc = waybillOrder.toDb();
|
||||
emisWaybillService.calcWaybillFee(emisWaybillCalc);
|
||||
|
||||
// 设置费用列表返回
|
||||
FeeItem feeItem = new FeeItem();
|
||||
List<FeeItem> feeList=feeItem.cvtToVoList(emisWaybillCalc.getFeeitemList());
|
||||
|
||||
waybillOrder.setFeeItems(feeList);
|
||||
|
||||
return AjaxResult.success("下单成功", waybillOrder);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -98,7 +98,9 @@ public class EmisWaybillController extends BaseController
|
||||
waybillOrder.setBillCode(emisElectronicPagService.realMatchWaybill());
|
||||
}
|
||||
|
||||
emisWaybillService.realSubmitOrder(waybillOrder);
|
||||
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
||||
|
||||
emisWaybillService.realSubmitOrder(emisWaybillSave);
|
||||
|
||||
JSONObject jObjOut = new JSONObject();
|
||||
jObjOut.put("billCode", waybillOrder.getBillCode());
|
||||
|
||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisQuotePrice;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillFeeitem;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisQuotePriceService
|
||||
* @Description 费用报价
|
||||
* @author linfso
|
||||
@ -35,6 +36,8 @@ public interface IEmisQuotePriceService
|
||||
*/
|
||||
public List<EmisQuotePrice> selectEmisQuotePriceList(EmisQuotePrice emisQuotePrice);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增费用报价
|
||||
*
|
||||
|
||||
@ -11,6 +11,7 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillFeeitem;
|
||||
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
|
||||
|
||||
/**
|
||||
@ -98,9 +99,13 @@ public interface IEmisWaybillService
|
||||
|
||||
public WaybillOrder getWaybillDetail(String billCode);
|
||||
|
||||
public int realSubmitOrder(WaybillOrder waybillOrder) throws Exception;
|
||||
// public int realSubmitOrder(WaybillOrder waybillOrder) throws Exception;
|
||||
|
||||
public int realSubmitOrder(EmisWaybill emisWaybill) throws Exception;
|
||||
|
||||
|
||||
//计算运单费用
|
||||
public int calcWaybillFee(EmisWaybill emisWaybill) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -199,31 +199,30 @@ public class EmisWaybillServiceImpl implements IEmisWaybillService
|
||||
|
||||
/**
|
||||
* 下单接口
|
||||
* @param waybillOrder
|
||||
* @param emisWaybillSave
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int realSubmitOrder(WaybillOrder waybillOrder) throws Exception {
|
||||
public int realSubmitOrder(EmisWaybill emisWaybillSave) throws Exception {
|
||||
|
||||
boolean isNew = true;
|
||||
EmisWaybill emisWaybillOld = null;
|
||||
|
||||
if( !StringUtils.isEmpty(waybillOrder.getBillCode()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByBillCode(waybillOrder.getBillCode());
|
||||
if( !StringUtils.isEmpty(emisWaybillSave.getBillCode()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByBillCode(emisWaybillSave.getBillCode());
|
||||
if(emisWaybillOld!=null){
|
||||
isNew=false;
|
||||
}
|
||||
}else{
|
||||
if( !StringUtils.isEmpty(waybillOrder.getOrderSn()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByOrderSn(waybillOrder.getOrderSn());
|
||||
if( !StringUtils.isEmpty(emisWaybillSave.getOrderSn()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByOrderSn(emisWaybillSave.getOrderSn());
|
||||
if(emisWaybillOld!=null){
|
||||
isNew=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断运单状态,如果已锁账,则不允许修改
|
||||
// 下单超过 24小时
|
||||
|
||||
@ -233,60 +232,86 @@ public class EmisWaybillServiceImpl implements IEmisWaybillService
|
||||
}
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybillNew = waybillOrder.toDb();
|
||||
|
||||
// 新增
|
||||
if(isNew){
|
||||
|
||||
//补齐数据
|
||||
emisWaybillSave.preInsert();
|
||||
String orderSn = WaybillHelper.genOrderSn();
|
||||
emisWaybillNew.setOrderSn(orderSn);
|
||||
emisWaybillNew.preInsert();
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillNew);
|
||||
|
||||
// 订单号
|
||||
emisWaybillSave.setOrderSn(orderSn);
|
||||
|
||||
// 登记网点
|
||||
emisWaybillSave.setRegisterSiteCode(emisWaybillSave.getCreateSite());
|
||||
emisWaybillSave.setRegisterManCode(SecurityUtils.getLoginUser().getUser().getEmpCode());
|
||||
|
||||
// 发件网点
|
||||
emisWaybillSave.setSendSiteCode(emisWaybillSave.getCreateSite());
|
||||
emisWaybillSave.setSendSiteName(SecurityUtils.getLoginUser().getUser().getOwnerSiteName());
|
||||
|
||||
// 目的网点
|
||||
emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteCode());
|
||||
|
||||
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||
|
||||
// 产生主键插入其他数据
|
||||
|
||||
// private List<EmisWaybillCargo> cargoList;
|
||||
// private List<EmisWaybillFeeitem> feeitemList;
|
||||
// private List<EmisWaybillAttachment> attachmentList;
|
||||
|
||||
// 插入费用
|
||||
List<EmisWaybillFeeitem> feeitemList=emisWaybillNew.getFeeitemList();
|
||||
List<EmisWaybillFeeitem> feeitemList=emisWaybillSave.getFeeitemList();
|
||||
if(!CollectionUtils.isEmpty(feeitemList)){
|
||||
for (EmisWaybillFeeitem feeItem:feeitemList) {
|
||||
feeItem.setWaybillId(emisWaybillNew.getId());
|
||||
feeItem.setWaybillId(emisWaybillSave.getId());
|
||||
emisWaybillFeeitemMapper.insertEmisWaybillFeeitem(feeItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入商品信息
|
||||
if(!CollectionUtil.isEmpty(emisWaybillNew.getCargoList() )){
|
||||
List<EmisWaybillCargo> cargoList=emisWaybillNew.getCargoList();
|
||||
if(!CollectionUtil.isEmpty(emisWaybillSave.getCargoList() )){
|
||||
List<EmisWaybillCargo> cargoList=emisWaybillSave.getCargoList();
|
||||
for (EmisWaybillCargo cargoItem:cargoList) {
|
||||
cargoItem.setWaybillId(emisWaybillNew.getId());
|
||||
cargoItem.setWaybillId(emisWaybillSave.getId());
|
||||
emisWaybillCargoMapper.insertEmisWaybillCargo(cargoItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入附件信息
|
||||
if(!CollectionUtil.isEmpty(emisWaybillNew.getAttachmentList() )){
|
||||
List<EmisWaybillAttachment> attachmentList=emisWaybillNew.getAttachmentList();
|
||||
if(!CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){
|
||||
List<EmisWaybillAttachment> attachmentList=emisWaybillSave.getAttachmentList();
|
||||
for (EmisWaybillAttachment attachmentItem:attachmentList) {
|
||||
attachmentItem.setWaybillId(emisWaybillNew.getId());
|
||||
attachmentItem.setWaybillId(emisWaybillSave.getId());
|
||||
emisWaybillAttachmentMapper.insertEmisWaybillAttachment(attachmentItem);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
emisWaybillNew.setId(emisWaybillOld.getId());
|
||||
emisWaybillNew.preUpdate();
|
||||
emisWaybillSave.setId(emisWaybillOld.getId());
|
||||
emisWaybillSave.preUpdate();
|
||||
|
||||
emisWaybillMapper.updateEmisWaybill(emisWaybillNew);
|
||||
emisWaybillMapper.updateEmisWaybill(emisWaybillSave);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运单费用计算接口
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int calcWaybillFee(EmisWaybill emisWaybill) throws Exception {
|
||||
|
||||
// 获取资费列表
|
||||
// 获取结算重量
|
||||
// emisWaybill.getSettlementWeight().floatValue();
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user