md
This commit is contained in:
parent
cce84cf2aa
commit
2ee0da8581
@ -1,15 +1,13 @@
|
||||
package com.xdadan.erp.emis.domain.vo;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillAttachment;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillCargo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class Attachment extends VoBase<EmisWaybillAttachment,Attachment> implements Serializable {
|
||||
public class Attachment extends VoBase<EmisWaybillAttachment,Attachment> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -49,6 +47,7 @@ public class Attachment extends VoBase<EmisWaybillAttachment,Attachment> impleme
|
||||
return voItem;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EmisWaybillAttachment toDb(Attachment voItem){
|
||||
EmisWaybillAttachment dbItem = new EmisWaybillAttachment();
|
||||
@ -68,11 +67,11 @@ public class Attachment extends VoBase<EmisWaybillAttachment,Attachment> impleme
|
||||
return dbItem;
|
||||
}
|
||||
|
||||
public static List<EmisWaybillAttachment> toDBList(List<Attachment> voList){
|
||||
return toDBList(voList);
|
||||
public List<EmisWaybillAttachment> cvtToDbList(List<Attachment> voList){
|
||||
return toDbList(voList);
|
||||
}
|
||||
|
||||
public static List<Attachment> toVoList(List<EmisWaybillAttachment> dbList){
|
||||
public List<Attachment> cvtToVoList(List<EmisWaybillAttachment> dbList){
|
||||
return toVoList(dbList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,11 +152,11 @@ public class Cargo extends VoBase<EmisWaybillCargo,Cargo> implements Serializabl
|
||||
return dbItem;
|
||||
}
|
||||
|
||||
public static List<EmisWaybillCargo> toDBList(List<Cargo> voList){
|
||||
return toDBList(voList);
|
||||
public List<EmisWaybillCargo> cvtToDbList(List<Cargo> voList){
|
||||
return toDbList(voList);
|
||||
}
|
||||
|
||||
public static List<Cargo> toVoList(List<EmisWaybillCargo> dbList){
|
||||
public List<Cargo> cvtToVoList(List<EmisWaybillCargo> dbList){
|
||||
return toVoList(dbList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.xdadan.erp.emis.domain.vo;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillAttachment;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillCargo;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillFeeitem;
|
||||
import lombok.Data;
|
||||
|
||||
@ -63,11 +61,11 @@ public class FeeItem extends VoBase<EmisWaybillFeeitem,FeeItem> {
|
||||
return dbItem;
|
||||
}
|
||||
|
||||
public static List<EmisWaybillFeeitem> toDBList(List<FeeItem> voList){
|
||||
return toDBList(voList);
|
||||
public List<EmisWaybillFeeitem> cvtToDbList(List<FeeItem> voList){
|
||||
return toDbList(voList);
|
||||
}
|
||||
|
||||
public static List<FeeItem> toVoList(List<EmisWaybillFeeitem> dbList){
|
||||
public List<FeeItem> cvtToVoList(List<EmisWaybillFeeitem> dbList){
|
||||
return toVoList(dbList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
package com.xdadan.erp.emis.domain.vo;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillCargo;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class VoBase<DB,VO> {
|
||||
public abstract VO toVo(DB dbItem);
|
||||
public abstract DB toDb(VO voItem);
|
||||
|
||||
public abstract VO toVo(DB dbItem);
|
||||
public abstract DB toDb(VO voItem);
|
||||
/**
|
||||
* 转换为数据库类型
|
||||
* @param voList
|
||||
* @return
|
||||
*/
|
||||
public List<DB> toDbList(List<VO> voList){
|
||||
|
||||
if(!CollectionUtils.isEmpty(voList)){
|
||||
List<DB> list = new ArrayList<>();
|
||||
for (VO voItem: voList){
|
||||
@ -34,7 +33,7 @@ public abstract class VoBase<DB,VO> {
|
||||
* @param dbList
|
||||
* @return
|
||||
*/
|
||||
public List<VO> toVoList(List<DB> dbList){
|
||||
public List<VO> toVoList(List<DB> dbList){
|
||||
|
||||
if(!CollectionUtils.isEmpty(dbList)){
|
||||
List<VO> list = new ArrayList<>();
|
||||
@ -47,4 +46,5 @@ public abstract class VoBase<DB,VO> {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -238,10 +238,14 @@ public class WaybillOrder implements Serializable {
|
||||
|
||||
WaybillOrder voItem = new WaybillOrder();
|
||||
|
||||
Cargo cargoCvt = new Cargo();
|
||||
FeeItem feeItemCvt = new FeeItem();
|
||||
Attachment attachmentCvt = new Attachment();
|
||||
|
||||
// 转换其他list
|
||||
voItem.setCargoList(Cargo.toVoList(dbCargoList));
|
||||
voItem.setFeeItems(FeeItem.toVoList(dbFeeitemList));
|
||||
voItem.setAttachmentList(Attachment.toVoList(dbAttachmentList));
|
||||
voItem.setCargoList(cargoCvt.cvtToVoList(dbCargoList));
|
||||
voItem.setFeeItems(feeItemCvt.cvtToVoList(dbFeeitemList));
|
||||
voItem.setAttachmentList(attachmentCvt.cvtToVoList(dbAttachmentList));
|
||||
|
||||
// 收件人
|
||||
Reciever reciever = new Reciever();
|
||||
@ -468,13 +472,16 @@ public class WaybillOrder implements Serializable {
|
||||
* 转为数据库类型值
|
||||
* @return
|
||||
*/
|
||||
public static EmisWaybill toDb(){
|
||||
public EmisWaybill toDb(){
|
||||
EmisWaybill dbWaybill = new EmisWaybill();
|
||||
|
||||
Cargo cargoCvt = new Cargo();
|
||||
FeeItem feeItemCvt = new FeeItem();
|
||||
Attachment attachmentCvt = new Attachment();
|
||||
// 设置货物信息
|
||||
dbWaybill.setCargoList(Cargo.toDBList(this.getCargoList()));
|
||||
dbWaybill.setFeeitemList(FeeItem.toDBList(this.getFeeItems()));
|
||||
dbWaybill.setAttachmentList(Attachment.toDBList(this.getAttachmentList()));
|
||||
dbWaybill.setCargoList(cargoCvt.cvtToDbList(this.getCargoList()));
|
||||
dbWaybill.setFeeitemList(feeItemCvt.cvtToDbList(this.getFeeItems()));
|
||||
dbWaybill.setAttachmentList(attachmentCvt.cvtToDbList(this.getAttachmentList()));
|
||||
|
||||
dbWaybill.setOrderSn(this.getOrderSn());
|
||||
dbWaybill.setCustOrderId(this.getCustOrderId());
|
||||
|
||||
@ -226,7 +226,7 @@ public class EmisWaybillServiceImpl implements IEmisWaybillService
|
||||
throw new Exception("已锁账,不允许修改");
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybillNew = WaybillOrder.toDb();
|
||||
EmisWaybill emisWaybillNew = waybillOrder.toDb();
|
||||
|
||||
// 新增
|
||||
if(isNew){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user