yujia 7 лет назад
Родитель
Сommit
1833a854f0

+ 208 - 2
src/main/java/com/uas/platform/b2c/logistics/controller/InvoiceController.java

@@ -1,11 +1,25 @@
 package com.uas.platform.b2c.logistics.controller;
 
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import com.uas.platform.b2c.core.utils.StringUtilB2C;
+import com.uas.platform.b2c.logistics.model.InvoiceFOrder;
+import com.uas.platform.b2c.logistics.service.InvoiceFOrderService;
 import com.uas.platform.b2c.logistics.service.InvoiceService;
+import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.uas.platform.core.model.Status;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.management.OperationsException;
 
 /**
  * 出货单 TODO (换货上,以后可以考虑用共表)
@@ -22,6 +36,198 @@ public class InvoiceController {
 
 	@Autowired
 	private InvoiceService invoiceService;
+
+	@Autowired
+	private InvoiceFOrderService inForService;
 	
 	private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	@RequestMapping(value = "/convert", method = RequestMethod.GET)
+	public ResultMap convert() {
+		return invoiceService.convert();
+	}
+
+
+	/**
+	 * 订单转出货
+	 *
+	 * @param orid the orid 订单号
+	 * @return InvoiceFOrder 返回InvoiceFOrder对象
+	 */
+	@RequestMapping(value = "/create/{orid}/order", method = RequestMethod.PUT)
+	@ApiOperation(value = "订单转出货", httpMethod = "PUT")
+	public InvoiceFOrder send(@ApiParam(required = true, value = "订单id") @PathVariable Long orid) {
+		logger.log("客户出货单信息管理", "转出货", "转出货的订单id=" + orid + ",操作人:" + SystemSession.getUser().getUserUU() + "-" + SystemSession.getUser().getUserName());
+		return inForService.createInvoiceFOrder(orid);
+	}
+
+	/**
+	 * 平台发货
+	 *
+	 * @param inid the inid 发货单号
+	 * @return InvoiceFOrder 返回InvoiceFOrder对象
+	 */
+	@RequestMapping(value = "/{inid}/send", method = RequestMethod.PUT)
+	@ApiOperation(value = "平台发货", httpMethod = "PUT")
+	public InvoiceFOrder sendorder(@ApiParam(required = true, value = "发货单号") @PathVariable String inid) {
+		logger.log("客户出货单信息管理", "平台发货", "平台发货的流水号:" + inid + ",操作人:" + SystemSession.getUser().getUserUU() + "-" +SystemSession.getUser().getUserName());
+		return inForService.sendInvoiceFOrder(inid);
+	}
+
+	/**
+	 * 平台根据状态查看卖家出货单
+	 *
+	 * @param params  the params 分页参数
+	 * @param keyword the keyword 搜索字符串
+	 * @param status  the status 状态
+	 * @return page 返回InvoiceFOrder的page对象
+	 */
+	@RequestMapping(value = "/admin", method = RequestMethod.GET)
+	@ApiOperation(value = "平台根据状态查看卖家出货单", httpMethod = "GET")
+	public Page<InvoiceFOrder> findAdminInFor(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword, @ApiParam(required = true, value = "出货单状态") String status) {
+		logger.log("客户出货单信息管理", "平台根据状态查看卖家出货单");
+		PageInfo pageInfo = new PageInfo(params);
+		return inForService.findAdminInFor(pageInfo, keyword, status);
+	}
+
+	/**
+	 * 查看待出货
+	 *
+	 * @param params  the params 分页参数
+	 * @param keyword the keyword 搜索字符串
+	 * @return page 返回InvoiceFOrder的page对象
+	 */
+	@RequestMapping(value = "/tobeshipped", method = RequestMethod.GET)
+	@ApiOperation(value = "查看待出货状态出货单", httpMethod = "GET")
+	public Page<InvoiceFOrder> findToBeShipped(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword) {
+		logger.log("客户出货单信息管理", "查看待出货");
+		PageInfo info = new PageInfo(params);
+		info.filter("status", Status.TOBESHIPPED.value());
+		return inForService.findPageByStatus(info, keyword);
+	}
+
+	/**
+	 * 查看待收货
+	 *
+	 * @param params  the params 分页参数
+	 * @param keyword the keyword 搜索字符串
+	 * @return page 返回InvoiceFOrder的page对象
+	 */
+	@RequestMapping(value = "/inbound", method = RequestMethod.GET)
+	@ApiOperation(value = "查看待收货状态出货单", httpMethod = "GET")
+	public Page<InvoiceFOrder> findInbound(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword) {
+		logger.log("客户出货单信息管理", "查看待收货");
+		PageInfo info = new PageInfo(params);
+		info.filter("status", Status.INBOUND.value());
+		return inForService.findPageByStatus(info, keyword);
+	}
+
+	/**
+	 * 查看已收货
+	 *
+	 * @param params  the params 分页参数
+	 * @param keyword the keyword 搜索字符串
+	 * @return page 返回InvoiceFOrder的page对象
+	 */
+	@RequestMapping(value = "/received", method = RequestMethod.GET)
+	@ApiOperation(value = "查看已收货状态出货单", httpMethod = "GET")
+	public Page<InvoiceFOrder> findReceived(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword) {
+		logger.log("客户出货单信息管理", "查看已收货");
+		PageInfo info = new PageInfo(params);
+		info.filter("status", Status.RECEIVED.value());
+		return inForService.findPageByStatus(info, keyword);
+	}
+
+	/**
+	 * 查看已付款
+	 *
+	 * @param params  the params 分页参数
+	 * @param keyword the keyword 搜索字符串
+	 * @return page 返回InvoiceFOrder的page对象
+	 */
+	@RequestMapping(value = "/paid", method = RequestMethod.GET)
+	@ApiOperation(value = "查看已付款状态出货单", httpMethod = "GET")
+	public Page<InvoiceFOrder> findPaid(@ApiParam(required = true, value = "分页参数") PageParams params, @ApiParam(required = true, value = "搜索字符串") String keyword) {
+		logger.log("客户出货单信息管理", "查看已付款");
+		PageInfo info = new PageInfo(params);
+		info.filter("status", Status.PAID.value());
+		return inForService.findPageByStatus(info, keyword);
+	}
+
+	/**
+	 * 根据转出货单id查看出货单信息
+	 *
+	 * @param inid the inid 出货单号
+	 * @return InvoiceFOrder 返回InvoiceFOrder对象
+	 */
+	@RequestMapping(value = "/{inid}/find", method = RequestMethod.GET)
+	@ApiOperation(value = "根据转出货单id查看出货单信息", httpMethod = "GET")
+	public InvoiceFOrder getInvoiceFOrder(@ApiParam(required = true, value = "出货单号") @PathVariable Long inid) {
+		logger.log("客户出货单信息管理", "产看客户出货单信息");
+		return inForService.getInvoiceFOrder(inid);
+	}
+
+	/**
+	 * 平台收货后,订单转出货单
+	 * Updated by huxz
+	 * @param postDate 所有转出货单的订单map集合
+	 * @return string 返回success
+	 */
+	@RequestMapping(value = "/batch/create", method = RequestMethod.POST)
+	@ApiOperation(value = "平台收货后,订单转出货单", httpMethod = "POST")
+	public String convertInvoiceFOrder(@ApiParam(required = true, value = "所有转出货单的订单map集合") @RequestBody String postDate) {
+		JSONObject jsonObject = FastjsonUtils.parseObject(postDate);
+		assert logger != null;
+		logger.log("客户出货单信息管理", "批量转出货单id号:" + jsonObject.getString("ids") + ",操作者:" + SystemSession.getUser().getUserUU() + "-" + SystemSession.getUser().getUserName());
+		try {
+			inForService.convertInvoiceFOrder(jsonObject);
+		} catch (OperationsException e) {
+			e.printStackTrace();
+		}
+		return "success";
+	}
+
+
+	/**
+	 * 平台对买家订单发货
+	 * Updated by huxz
+	 * @param json 所有转出货单的订单map集合
+	 * @id 买家订单主键
+	 * @return string 返回success
+	 */
+	@RequestMapping(value = "/ship", method = RequestMethod.POST)
+	public ResultMap orderShip(@RequestBody String json, Long id) {
+		return inForService.orderShip(json, id);
+	}
+
+	/**
+	 * 2016年3月7日 下午1:41:02
+	 * 批量确认出货和单个确认出货共用的方法
+	 *
+	 * @param json 请求体的信息
+	 * @return string 返回success
+	 */
+	@RequestMapping(value = "/batch/send", method = RequestMethod.PUT)
+	public String batchOrSingleFOrSend(@RequestBody String json) {
+		try {
+			inForService.batchOrSingleFOrSend(json);
+		} catch (OperationsException e) {
+			e.printStackTrace();
+		}
+		return "success";
+	}
+
+	/**
+	 * 根据出货单号查看出货详情
+	 *
+	 * @param invoiceid the invoiceid 出货单号
+	 * @return InvoiceFOrder 返回InvoiceFOrder对象
+	 */
+	@RequestMapping(value = "/{invoiceid}/code", method = RequestMethod.GET)
+	@ApiOperation(value = "根据出货单号查看出货详情", httpMethod = "GET")
+	public InvoiceFOrder getInvoiceFOrder(@ApiParam(required = true, value = "出货单号") @PathVariable String invoiceid) {
+		logger.log("客户出货单信息管理", "根据出货单号查看出货详情");
+		invoiceid = StringUtilB2C.decodeValue(invoiceid);
+		return inForService.getInvoiceFOrder(invoiceid);
+	}
 }

+ 3 - 11
src/main/java/com/uas/platform/b2c/logistics/dao/InvoiceDao.java

@@ -18,7 +18,7 @@ public interface InvoiceDao extends JpaSpecificationExecutor<Invoice>, JpaReposi
 	 * @param invoiceid 发货单号
 	 * @return Invoice 返回Invoice对象
 	 */
-	public Invoice findByInvoiceid(String invoiceid);
+	Invoice findByInvoiceid(String invoiceid);
 
 	/**
 	 * 通过来源单号和单据类型查询
@@ -27,7 +27,7 @@ public interface InvoiceDao extends JpaSpecificationExecutor<Invoice>, JpaReposi
 	 * @param piclass  the piclass 单据类型
 	 * @return invoice 返回Invoice对象
 	 */
-	public Invoice findBySourceidAndPiclass(String sourceid, Integer piclass);
+	Invoice findBySourceidAndPiclass(String sourceid, Integer piclass);
 
 	/**
 	 * 通过来源单号查询出货单
@@ -35,13 +35,5 @@ public interface InvoiceDao extends JpaSpecificationExecutor<Invoice>, JpaReposi
 	 * @param sourceid the sourceid 来源单号
 	 * @return invoice 返回Invoice对象
 	 */
-	public Invoice findBySourceid(String sourceid);
-
-	/**
-	 * 买家根据换货单号获取商城针对买家换货单发货给买家的出货单
-	 *
-	 * @param changeId 换货单号
-	 * @return invoice 返回Invoice对象
-	 */
-	Invoice getInvoiceBySourceid(String changeId);
+	Invoice findBySourceid(String sourceid);
 }

+ 140 - 14
src/main/java/com/uas/platform/b2c/logistics/model/Invoice.java

@@ -1,7 +1,9 @@
 package com.uas.platform.b2c.logistics.model;
 
 
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.trade.order.model.Document;
+import com.uas.platform.b2c.trade.order.model.Order;
 import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.core.model.Status;
 import com.uas.platform.core.persistence.StatusColumn;
@@ -91,10 +93,16 @@ public class Invoice extends Document implements Serializable {
 	private String sourceid;
 
 	/**
-	 * 来源采购单
+	 * 来源销售订单订单号
 	 */
-	@Column(name = "pu_id")
-	private Long puid;
+	@Column(name = "in_puid")
+	private String puid;
+
+	/**
+	 * 来源销售订单id
+	 */
+	@Column(name = "in_purchaseid")
+	private Long purchaseid;
 
 
 	/**
@@ -106,7 +114,7 @@ public class Invoice extends Document implements Serializable {
 	/**
 	 * 是否是UAS的来源
 	 */
-	@Column(name = "or_uaspurcid")
+	@Column(name = "in_uaspurcid")
 	private Long uasPurcid;
 
 	/**
@@ -248,6 +256,24 @@ public class Invoice extends Document implements Serializable {
 	@Column(name = "in_orid")
 	private String orid;
 
+	/**
+	 * 来源订单id
+	 */
+	@Column(name = "in_orderid")
+	private Long orderId;
+
+	/**
+	 * 送样单id
+	 */
+	@Column(name = "in_proofingid")
+	private Long proofingid;
+
+	/**
+	 * uas获取状态 待上传 (202) | 已下载 (203)| 已同意(221) | 不同意(222)
+	 */
+	@Column(name = "in_sendstatus")
+	private Integer sendstatus;
+
 	@Transient
 	private Boolean isSelfSeller;
 
@@ -476,15 +502,6 @@ public class Invoice extends Document implements Serializable {
 		return this;
 	}
 
-	public Long getPuid() {
-		return puid;
-	}
-
-	public Invoice setPuid(Long puid) {
-		this.puid = puid;
-		return this;
-	}
-
 	public String getRemark() {
 		return remark;
 	}
@@ -616,6 +633,51 @@ public class Invoice extends Document implements Serializable {
 		return this;
 	}
 
+	public String getPuid() {
+		return puid;
+	}
+
+	public Invoice setPuid(String puid) {
+		this.puid = puid;
+		return this;
+	}
+
+	public Long getPurchaseid() {
+		return purchaseid;
+	}
+
+	public Invoice setPurchaseid(Long purchaseid) {
+		this.purchaseid = purchaseid;
+		return this;
+	}
+
+    public Long getOrderId() {
+        return orderId;
+    }
+
+    public Invoice setOrderId(Long orderId) {
+        this.orderId = orderId;
+        return this;
+    }
+
+    public Long getProofingid() {
+		return proofingid;
+	}
+
+	public Invoice setProofingid(Long proofingid) {
+		this.proofingid = proofingid;
+		return this;
+	}
+
+	public Integer getSendstatus() {
+		return sendstatus;
+	}
+
+	public Invoice setSendstatus(Integer sendstatus) {
+		this.sendstatus = sendstatus;
+		return this;
+	}
+
 	/**
 	 * @Tip 对象初始化时必须给历史记录赋值
 	 */
@@ -638,11 +700,75 @@ public class Invoice extends Document implements Serializable {
 		this.buyeruu = purchase.getBuyeruu();
 		this.buyername = purchase.getBuyername();
 		this.jsonSpAddress = purchase.getJsonAddress();
-		this.puid = purchase.getId();
+		this.purchaseid = purchase.getId();
+		this.puid = purchase.getPurchaseid();
 		this.sourceid = purchase.getPurchaseid();
 		this.storeid = purchase.getStoreid();
 		this.orid = purchase.getOrderid();
 		this.remark = purchase.getPurchaseRemark();
 		this.fare = purchase.getFare();
 	}
+
+    public Invoice(Order order, String invoiceId) {
+        if (order == null) {
+            return ;
+        }
+        this.statushistory = "";
+        this.invoiceDetails = new HashSet<>();
+        this.invoiceid = invoiceId;
+        this.createtime = new Date();
+        this.buyeruu = order.getBuyeruu();
+        this.buyerentername = order.getBuyerentername();
+        this.buyername = order.getBuyername();
+        this.buyerenuu = order.getBuyerenuu();
+        this.sellerenuu = order.getSellerenuu();
+        this.sellername = order.getSellername();
+        this.jsonSpAddress = order.getJsonAddress();
+
+        this.currency = order.getCurrency();
+        this.orderId = order.getId();
+        this.orid = order.getOrderid();
+        this.sourceid = order.getOrderid();
+        this.proofingid = order.getProofingid();
+        this.uasPurcid = order.getUasPurcid();
+        this.remark = order.getOrderRemark();
+        this.fare = order.getFare();
+    }
+
+    public Invoice(InvoiceFPurchase fPurchase) {
+        this.invoiceid = fPurchase.getInvoiceid();
+        this.buyeruu = fPurchase.getBuyeruu();
+        this.buyerenuu = fPurchase.getBuyerenuu();
+        this.buyername = fPurchase.getBuyername();
+        this.buyerentername = fPurchase.getBuyerentername();
+        this.sellerenuu = fPurchase.getSellerenuu();
+        this.sellername = fPurchase.getSellername();
+        this.piclass = Type.Invoice_Vender_code.value();
+        this.sourceid = fPurchase.getSourceid();
+        this.purchaseid = fPurchase.getPuid();
+        this.remark = fPurchase.getInfpuRemark();
+        this.uasPurcid = fPurchase.getUasPurcid();
+        this.jsonSpAddress = fPurchase.getJsonSpAddress();
+        this.jsonSdAddress = fPurchase.getJsonSdAddress();
+        this.logistics = fPurchase.getLogistics();
+        this.createtime = fPurchase.getCreattime();
+        this.status = fPurchase.getStatus();
+        this.currency = fPurchase.getCurrencyName();
+        this.taxes = fPurchase.getTaxes();
+        this.fare = fPurchase.getFare();
+        this.jsonRule = fPurchase.getJsonRule();
+        this.jsonTakeSelf = fPurchase.getJsonTakeSelf();
+        this.price = fPurchase.getPrice();
+        this.ensurePrice = fPurchase.getEnsurePrice();
+        this.transationPrice = fPurchase.getTransationPrice();
+        this.statushistory = fPurchase.getStatushistory();
+        this.qty = fPurchase.getNumber();
+        this.sendType = fPurchase.getSendType();
+        this.deliveryType = fPurchase.getDeliveryType();
+        this.selfDeliveryName = fPurchase.getSelfDeliveryName();
+        this.selfDeliveryPhone = fPurchase.getSelfDeliveryPhone();
+        this.storeid = fPurchase.getStoreid();
+        this.orid = fPurchase.getOrid();
+        this.proofingid = fPurchase.getProofingid();
+    }
 }

+ 372 - 59
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceDetail.java

@@ -1,6 +1,11 @@
 package com.uas.platform.b2c.logistics.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.utils.NumberUtil;
+import com.uas.platform.b2c.trade.order.model.OrderDetail;
+import com.uas.platform.b2c.trade.order.model.PurchaseDetail;
+import com.uas.platform.core.exception.IllegalStatusException;
+import com.uas.platform.core.model.Status;
 import com.uas.platform.core.persistence.StatusColumn;
 import org.codehaus.jackson.annotate.JsonIgnore;
 
@@ -10,7 +15,6 @@ import javax.persistence.*;
  * 发货单(来源于订单的)明细
  * 
  * @author ChenHao
- *
  */
 @Entity
 @Table(name = "trade$invoice_detail")
@@ -21,6 +25,12 @@ public class InvoiceDetail {
 	@Column(name = "id")
 	private Long id;
 
+	/**
+	 * 发货单明细编号
+	 */
+	@Column(name = "detail_id", unique = true)
+	private String detailid;
+
 	/**
 	 * 主表
 	 * 
@@ -37,10 +47,28 @@ public class InvoiceDetail {
 	private Short detno;
 
 	/**
-	 * 发货单明细编号
+	 * 采购单明细id
 	 */
-	@Column(name = "detail_id", unique = true)
-	private String detailid;
+	@Column(name = "detail_orderdetail_id")
+	private Long orderDetailId;
+
+	/**
+	 * 采购单明细单号
+	 */
+	@Column(name = "detail_order_detailid")
+	private String orderDetailid;
+
+	/**
+	 * 销售单明细单号
+	 */
+	@Column(name = "detail_purchase_detailid")
+	private String purchaseDetailid;
+
+	/**
+	 * 销售单明细主键
+	 */
+	@Column(name = "detail_purchasedetail_id")
+	private Long purchaseDetailId;
 
 	/**
 	 * 来源id(父级)
@@ -61,10 +89,22 @@ public class InvoiceDetail {
 	private String batchCode;
 
 	/**
-	 * 对应的器件uuid
+	 * 明细的评论
 	 */
-	@Column(name = "cmp_uuid")
-	private String uuid;
+	@Column(name = "detail_remark", length = 4000)
+	private String remark;
+
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
+	/**
+	 * 物料id
+	 */
+	@Column(name = "detail_productid")
+	private Long productid;
 
 	/**
 	 * 库存 现货 1311 呆滞库存, 1312 ,(暂时不用) 废料 1313
@@ -72,6 +112,12 @@ public class InvoiceDetail {
 	@Column(name = "go_original")
 	private Integer original;
 
+	/**
+	 * 对应的器件uuid
+	 */
+	@Column(name = "cmp_uuid")
+	private String uuid;
+
 	/**
 	 * 原厂型号
 	 */
@@ -84,11 +130,37 @@ public class InvoiceDetail {
 	@Column(name = "ki_name")
 	private String kiName;
 
+
+	/**
+	 * 类目ID
+	 */
+	@Column(name = "go_kind_uuid")
+	private Long kindUuid;
+
+
+	/**
+	 * 品牌中文名称
+	 */
+	@Column(name = "br_name_cn")
+	private String brandNameCn;
+
 	/**
-	 * 器件所属品牌
+	 * 品牌英文名称
 	 */
-	@Column(name = "br_name")
-	private String brName;
+	@Column(name = "br_name_en")
+	private String brandNameEn;
+
+	/**
+	 * 品牌品牌id
+	 */
+	@Column(name = "br_name_id")
+	private Long brandid;
+
+	/**
+	 * 品牌品牌uuid
+	 */
+	@Column(name = "br_name_uuid")
+	private String branduuid;
 
 	/**
 	 * 图片path
@@ -105,14 +177,14 @@ public class InvoiceDetail {
 	/**
 	 * 数量
 	 */
-	@Column(name = "detail_number")
-	private Double number;
+	@Column(name = "detail_qty")
+	private Double qty;
 
 	/**
 	 * 币种名称
 	 */
-	@Column(name = "cr_name")
-	private String currencyName;
+	@Column(name = "detail_currency")
+	private String currency;
 
 	/**
 	 * 金额小计
@@ -132,17 +204,6 @@ public class InvoiceDetail {
 	@Column(name = "transation_price")
 	private Double transationPrice;
 
-	/**
-	 * 客户退货数量
-	 */
-	@Column(name = "detail_returnqty")
-	private Double returnQty;
-
-	/**
-	 * 客户换货数量
-	 */
-	@Column(name = "detail_changeqty")
-	private Double changeQty;
 
 	/*
 	 * 税金
@@ -150,10 +211,11 @@ public class InvoiceDetail {
 	@Column(name = "detail_taxes")
 	private Double taxes;
 
-	/*
+
+	/**
 	 * 税率
 	 */
-	@Column(name = "tax")
+	@Column(name = "detail_tax")
 	private Short tax;
 
 	/*
@@ -162,6 +224,25 @@ public class InvoiceDetail {
 	@Column(name = "detail_taxunitprice")
 	private Double taxunitprice;
 
+
+	/**
+	 * 商城最长交期
+	 */
+	@Column(name = "go_b2cmaxdelivery")
+	private Short b2cMaxDelivery;
+
+	/**
+	 * 商城最短交期
+	 */
+	@Column(name = "go_b2cmindelivery")
+	private Short b2cMinDelivery;
+
+	/**
+	 * 规格信息
+	 */
+	@Column(name = "detail_spec", length = 4000)
+	private String spec;
+
 	/**
 	 * 发货单明细状态
 	 */
@@ -237,14 +318,6 @@ public class InvoiceDetail {
 		this.kiName = kiName;
 	}
 
-	public String getBrName() {
-		return brName;
-	}
-
-	public void setBrName(String brName) {
-		this.brName = brName;
-	}
-
 	public String getImg() {
 		return img;
 	}
@@ -265,20 +338,112 @@ public class InvoiceDetail {
 		this.unitprice = unitprice;
 	}
 
-	public Double getNumber() {
-		return number;
+	public String getRemark() {
+		return remark;
+	}
+
+	public InvoiceDetail setRemark(String remark) {
+		this.remark = remark;
+		return this;
+	}
+
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public InvoiceDetail setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+		return this;
+	}
+
+	public Long getProductid() {
+		return productid;
+	}
+
+	public InvoiceDetail setProductid(Long productid) {
+		this.productid = productid;
+		return this;
+	}
+
+	public Long getKindUuid() {
+		return kindUuid;
 	}
 
-	public void setNumber(Double number) {
-		this.number = number;
+	public InvoiceDetail setKindUuid(Long kindUuid) {
+		this.kindUuid = kindUuid;
+		return this;
 	}
 
-	public String getCurrencyName() {
-		return currencyName;
+	public String getBrandNameCn() {
+		return brandNameCn;
 	}
 
-	public void setCurrencyName(String currencyName) {
-		this.currencyName = currencyName;
+	public InvoiceDetail setBrandNameCn(String brandNameCn) {
+		this.brandNameCn = brandNameCn;
+		return this;
+	}
+
+	public Long getBrandid() {
+		return brandid;
+	}
+
+	public InvoiceDetail setBrandid(Long brandid) {
+		this.brandid = brandid;
+		return this;
+	}
+
+	public String getBranduuid() {
+		return branduuid;
+	}
+
+	public InvoiceDetail setBranduuid(String branduuid) {
+		this.branduuid = branduuid;
+		return this;
+	}
+
+	public Double getQty() {
+		return qty;
+	}
+
+	public InvoiceDetail setQty(Double qty) {
+		this.qty = qty;
+		return this;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public InvoiceDetail setCurrency(String currency) {
+		this.currency = currency;
+		return this;
+	}
+
+	public Short getB2cMaxDelivery() {
+		return b2cMaxDelivery;
+	}
+
+	public InvoiceDetail setB2cMaxDelivery(Short b2cMaxDelivery) {
+		this.b2cMaxDelivery = b2cMaxDelivery;
+		return this;
+	}
+
+	public Short getB2cMinDelivery() {
+		return b2cMinDelivery;
+	}
+
+	public InvoiceDetail setB2cMinDelivery(Short b2cMinDelivery) {
+		this.b2cMinDelivery = b2cMinDelivery;
+		return this;
+	}
+
+	public String getSpec() {
+		return spec;
+	}
+
+	public InvoiceDetail setSpec(String spec) {
+		this.spec = spec;
+		return this;
 	}
 
 	public Double getPrice() {
@@ -331,22 +496,6 @@ public class InvoiceDetail {
 		this.transationPrice = transationPrice;
 	}
 
-	public Double getReturnQty() {
-		return returnQty;
-	}
-
-	public void setReturnQty(Double returnQty) {
-		this.returnQty = returnQty;
-	}
-
-	public Double getChangeQty() {
-		return changeQty;
-	}
-
-	public void setChangeQty(Double changeQty) {
-		this.changeQty = changeQty;
-	}
-
 	public Double getTaxes() {
 		return taxes;
 	}
@@ -370,10 +519,174 @@ public class InvoiceDetail {
 	public void setTaxunitprice(Double taxunitprice) {
 		this.taxunitprice = taxunitprice;
 	}
+
+	public Long getOrderDetailId() {
+		return orderDetailId;
+	}
+
+	public InvoiceDetail setOrderDetailId(Long orderDetailId) {
+		this.orderDetailId = orderDetailId;
+		return this;
+	}
+
+	public String getOrderDetailid() {
+		return orderDetailid;
+	}
+
+	public InvoiceDetail setOrderDetailid(String orderDetailid) {
+		this.orderDetailid = orderDetailid;
+		return this;
+	}
+
+	public String getPurchaseDetailid() {
+		return purchaseDetailid;
+	}
+
+	public InvoiceDetail setPurchaseDetailid(String purchaseDetailid) {
+		this.purchaseDetailid = purchaseDetailid;
+		return this;
+	}
+
+	public Long getPurchaseDetailId() {
+		return purchaseDetailId;
+	}
+
+	public InvoiceDetail setPurchaseDetailId(Long purchaseDetailId) {
+		this.purchaseDetailId = purchaseDetailId;
+		return this;
+	}
+
+	public String getBrandNameEn() {
+		return brandNameEn;
+	}
+
+	public InvoiceDetail setBrandNameEn(String brandNameEn) {
+		this.brandNameEn = brandNameEn;
+		return this;
+	}
+
+
+	/**
+	 * 根据采购单明细生成发货单明细
+	 *
+	 * @param puDetail 采购单明细
+	 */
+	public InvoiceDetail(PurchaseDetail puDetail) {
+		if (puDetail == null) {
+			throw new IllegalStatusException("采购单明细已失效");
+		}
+		this.purchaseDetailId = puDetail.getId();
+		this.batchCode = puDetail.getBatchCode();
+		this.uuid = puDetail.getUuid();
+		this.original = puDetail.getOriginal();
+		this.cmpCode = puDetail.getCmpCode();
+		this.kiName = puDetail.getKiName();
+		this.kindUuid = puDetail.getKindUuid();
+		this.brandNameEn = puDetail.getBrName();
+		this.brandNameCn = puDetail.getBrandNameCn();
+		this.branduuid = puDetail.getBranduuid();
+		this.brandid = puDetail.getBrandid();
+		this.img = puDetail.getImg();
+		this.unitprice = puDetail.getUnitprice();
+		this.taxunitprice = puDetail.getTaxUnitPrice();
+		this.qty = puDetail.getNumber();
+		this.taxes = puDetail.getTaxes();
+		this.price = puDetail.getPrice();
+		this.ensurePrice = puDetail.getEnsurePrice();
+		this.transationPrice = puDetail.getTransationPrice();
+		this.currency = puDetail.getCurrencyName();
+		this.tax = puDetail.getTax();
+		this.b2cMinDelivery = puDetail.getB2cMinDelivery();
+		this.b2cMaxDelivery = puDetail.getB2cMaxDelivery();
+		this.remark = puDetail.getRemark();
+		this.goodsnumber = puDetail.getGoodsnumber();
+		this.productid = puDetail.getProductid();
+		this.orderDetailId = puDetail.getOrDetailId();
+		this.orderDetailid = puDetail.getOrderdetailid();
+	}
+
+	/**
+	 * 根据采购单明细生成发货单明细
+	 *
+	 * @param puDetail 采购单明细
+	 */
+	public InvoiceDetail(PurchaseDetail puDetail, Double qty) {
+		this(puDetail);
+		this.qty = qty;
+		this.taxes = puDetail.getTaxes();
+		this.price = NumberUtil.mul(qty, this.taxunitprice);
+		this.ensurePrice = this.price;
+		this.transationPrice = this.price;
+
+	}
+
+
+	/**
+	 * 根据订单明细和id生成发货单明细对象
+	 *
+	 * @param detail 订单明细
+	 * @param detailId 明细id
+	 */
+	public InvoiceDetail(OrderDetail detail, String detailId) {
+		this();
+		this.detailid = detailId;
+		this.uuid = detail.getUuid();
+		this.batchCode = detail.getBatchCode();
+		this.cmpCode = detail.getCmpCode();
+		this.uuid = detail.getUuid();
+		this.brandNameEn = detail.getBrName();
+		this.brandNameCn = detail.getBrandNameCn();
+		this.brandid = detail.getBrandid();
+		this.branduuid = detail.getBranduuid();
+		this.kindUuid = detail.getKindUuid();
+		this.kiName = detail.getKiName();
+		this.img = detail.getImg();
+		this.original = detail.getOriginal();
+		this.unitprice = detail.getUnitprice();
+		this.taxunitprice = detail.getTaxUnitprice();
+		Double taxRate = detail.getTaxRate() == null ? 0 : detail.getTaxRate();
+		this.tax = Double.valueOf(taxRate * 100).shortValue();
+		this.taxes = detail.getTaxes();
+		this.qty = detail.getNumber();
+		this.currency = detail.getCurrencyName();
+		this.price = detail.getPrice();
+		this.ensurePrice = detail.getEnsurePrice();
+		this.orderDetailId = detail.getId();
+		this.orderDetailid = detail.getDetailid();
+		this.status = Status.TOBESHIPPED.value();
+		this.goodsnumber = detail.getGoodsnumber();
+		this.b2cMinDelivery = detail.getB2cMinDelivery();
+		this.b2cMaxDelivery = detail.getB2cMaxDelivery();
+		this.remark = detail.getRemark();
+		this.spec = detail.getSpec();
+		this.productid = detail.getProductId();
+	}
+
+	/**
+	 * 根据订单明细和id生成发货单明细对象
+	 *
+	 * @param detail 订单明细
+	 * @param detailId 明细id
+	 */
+	public InvoiceDetail(OrderDetail detail, String detailId, Double qty) {
+		this(detail, detailId);
+		this.taxes = NumberUtil.mul(NumberUtil.sub(this.taxunitprice, this.unitprice), qty);
+		this.qty = qty;
+		this.price = NumberUtil.mul(qty, this.taxunitprice);
+		this.ensurePrice = this.price;
+	}
+
 	/**
 	 * 平台换货单明细 生成供应商换货出货单明细
 	 */
 	public InvoiceDetail() {
+	}
+
+	/**
+	 *
+	 * @param fPurchaseDetail
+	 */
+	public InvoiceDetail(InvoiceFPurchaseDetail fPurchaseDetail) {
 
 	}
 

+ 6 - 1
src/main/java/com/uas/platform/b2c/logistics/service/InvoiceService.java

@@ -1,7 +1,12 @@
 package com.uas.platform.b2c.logistics.service;
 
+import com.uas.platform.b2c.trade.support.ResultMap;
+
 /**
- * The interface Invoice service.
+ * 出货单接口
  */
 public interface InvoiceService {
+
+
+    ResultMap convert();
 }

+ 33 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceServiceImpl.java

@@ -1,9 +1,42 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.uas.platform.b2c.logistics.dao.InvoiceDao;
+import com.uas.platform.b2c.logistics.dao.InvoiceFOrderDao;
+import com.uas.platform.b2c.logistics.dao.InvoiceFPurchaseDao;
+import com.uas.platform.b2c.logistics.model.Invoice;
+import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
 import com.uas.platform.b2c.logistics.service.InvoiceService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 @Service
 public class InvoiceServiceImpl implements InvoiceService {
 
+    private final InvoiceDao invoiceDao;
+
+    private final InvoiceFPurchaseDao invoiceFPurchaseDao;
+
+    private final InvoiceFOrderDao invoiceFOrderDao;
+
+    @Autowired
+    public InvoiceServiceImpl(InvoiceDao invoiceDao, InvoiceFPurchaseDao invoiceFPurchaseDao, InvoiceFOrderDao invoiceFOrderDao) {
+        this.invoiceDao = invoiceDao;
+        this.invoiceFPurchaseDao = invoiceFPurchaseDao;
+        this.invoiceFOrderDao = invoiceFOrderDao;
+    }
+
+    @Override
+    public ResultMap convert() {
+        List<InvoiceFPurchase> invoiceFPurchases = invoiceFPurchaseDao.findAll();
+        List<Invoice> invoices = new ArrayList<>();
+        Invoice invoice = null;
+        for (InvoiceFPurchase fPurchase : invoiceFPurchases) {
+            invoice = new Invoice(fPurchase);
+        }
+        return null;
+    }
 }

+ 26 - 0
src/main/java/com/uas/platform/b2c/logistics/util/ModelConvertUtil.java

@@ -0,0 +1,26 @@
+package com.uas.platform.b2c.logistics.util;
+
+import com.uas.platform.b2c.logistics.model.Invoice;
+import com.uas.platform.b2c.logistics.model.InvoiceDetail;
+import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
+import com.uas.platform.b2c.logistics.model.InvoiceFPurchaseDetail;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * model转换
+ *
+ * @author yuj 2018-09-07 19:10
+ */
+public class ModelConvertUtil {
+
+    public Invoice invoiceFPurchaseConvertInvoice(InvoiceFPurchase fPurchase) {
+        Invoice invoice =  new Invoice(fPurchase);
+        Set<InvoiceDetail> set = new HashSet<>();
+        for (InvoiceFPurchaseDetail fPurchaseDetail : fPurchase.getInvoiceFPurchaseDetails()) {
+
+        }
+        return invoice;
+    }
+}