zhangding 4 年 前
コミット
d8146f1137
16 ファイル変更416 行追加588 行削除
  1. 20 0
      suishenbang-api/src/main/java/com/dgtly/ApiApplication.java
  2. 1 0
      suishenbang-api/src/main/resources/application-dev.yml
  3. 15 12
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java
  4. 56 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/ConfirmCollectLineDetailModel.java
  5. 49 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/ConfirmCollectOtherDeliveryModel.java
  6. 0 348
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/EMetaHanaSalesOrder.java
  7. 125 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/EReceivingNote.java
  8. 0 26
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/mapper/EMetaHanaSalesOrderMapper.java
  9. 10 13
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/ESignService.java
  10. 0 29
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEMetaHanaSalesOrderService.java
  11. 31 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEReceivingNoteService.java
  12. 0 51
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EMetaHanaSalesOrderServiceImpl.java
  13. 70 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EReceivingNoteServiceImpl.java
  14. 14 16
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java
  15. 25 11
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFUtil.java
  16. 0 82
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/EMetaHanaSalesOrderMapper.xml

+ 20 - 0
suishenbang-api/src/main/java/com/dgtly/ApiApplication.java

@@ -3,9 +3,16 @@ package com.dgtly;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.web.client.RestTemplate;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
+import java.nio.charset.Charset;
+import java.util.List;
+
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 @EnableSwagger2
 @EnableAsync
@@ -28,4 +35,17 @@ public class ApiApplication {
                 "(♥◠‿◠)ノ゙ 通誉企业云平台  ლ(´ڡ`ლ)゙"
         );
     }
+
+    @Bean
+    public RestTemplate restTemplate() {
+        RestTemplate restTemplate = new RestTemplate();
+        List<HttpMessageConverter<?>> httpMessageConverters = restTemplate.getMessageConverters();
+        httpMessageConverters.stream().forEach(httpMessageConverter -> {
+            if(httpMessageConverter instanceof StringHttpMessageConverter){
+                StringHttpMessageConverter messageConverter = (StringHttpMessageConverter) httpMessageConverter;
+                messageConverter.setDefaultCharset(Charset.forName("UTF-8"));
+            }
+        });
+        return restTemplate;
+    }
 }

+ 1 - 0
suishenbang-api/src/main/resources/application-dev.yml

@@ -12,6 +12,7 @@ ruoyi:
   addressEnabled: true
   #是否开启swagger
   openSwagger: true
+  cloudPath: http://10.32.2.212:8000/
 #接口安全验证
 security:
   #接口过期时间

+ 15 - 12
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -66,8 +66,11 @@ public class EsignController extends ApiBaseController {
      * 没有注册就注册,注册完就认证,然后再点击签署按钮,获取经销商用户id,对应主体id
      * E签宝一步发起签署
      */
-    @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','userId':'xxx'}" +
+    @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','userId':'xxx','deliveryNumber':'xxx','shipmentNumber':'xxx','belongTo':'xxx'}" +
             "\n(orderId:订单编号" +
+            "\n(deliveryNumber:交货单号" +
+            "\n(shipmentNumber:运单号" +
+            "\n(belongTo:经销商代号" +
             "\n(userId:用户id")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params", paramType = "body")
@@ -76,9 +79,13 @@ public class EsignController extends ApiBaseController {
     public Object dealerSign() {
 
         ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("orderId,userId");
+        obj.checkParameterNotNull("orderId,userId,deliveryNumber,shipmentNumber,belongTo");
         String orderId = obj.getString("orderId");
         String userId = obj.getString("userId");
+        String deliveryNumber = obj.getString("deliveryNumber");
+        String shipmentNumber = obj.getString("shipmentNumber");
+        String belongTo = obj.getString("belongTo");
+
 
         String businessScene = "订单签收";
         String fileName = orderId+"_签收订单.pdf";
@@ -94,8 +101,7 @@ public class EsignController extends ApiBaseController {
         String chainsCode = customersExtService.selectchainsCodeByOrderId(orderId);
         /*首先根据订单id-orderId查询订单是否已被签署*/
         OrderFile orderFlag = orderFileService.selectOrderFileById(orderId);
-        if (orderFlag==null) {
-            Map<String,Object> map = eSignService.upload(orderId);
+            Map<String,Object> map = eSignService.upload(deliveryNumber,shipmentNumber,belongTo,sysUser.getSysUserExt().getOrgName());
             /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
             Object fileId = map.get("fileId");
             Object size = map.get("size");
@@ -113,16 +119,13 @@ public class EsignController extends ApiBaseController {
             orderFile.setFlowId(flowId);
             orderFileService.insertOrderFile(orderFile);
             return result;
-        }else{
-            return AjaxResult.error("订单已签署");
-        }
     }
 
-    @PostMapping("/testPDF")
-    @ResponseBody
-    public Map<String,Object> aaa(){
-       return eSignService.upload("0583133446");
-    }
+//    @PostMapping("/testPDF")
+//    @ResponseBody
+//    public Map<String,Object> aaa(){
+//       return eSignService.upload("0583133446");
+//    }
 
 
 

+ 56 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/ConfirmCollectLineDetailModel.java

@@ -0,0 +1,56 @@
+package com.dgtly.wxportal.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * 交货单明细
+ * @author ZhangDing
+ * @version 1.0
+ * @descption: TODO
+ * @company 神州数码通用软件(洛阳)有限公司
+ * @copyright (c) 2019 LuoYang DGT Co'Ltd Inc. All rights reserved.
+ * @date 2020-10-22 14:37
+ * @since JDK1.8
+ */
+public class ConfirmCollectLineDetailModel {
+    //  物料名称
+    private String materialName;
+    //  交货数量
+    private String deliveryCount = "0";
+    //    规格
+    private String sizeDim;
+    //    确认到货数量
+    private String confirmQuantity = "0";
+
+    public String getMaterialName() {
+        return materialName;
+    }
+
+    public void setMaterialName(String materialName) {
+        this.materialName = materialName;
+    }
+
+    public String getDeliveryCount() {
+        return deliveryCount;
+    }
+
+    public void setDeliveryCount(String deliveryCount) {
+        this.deliveryCount = deliveryCount;
+    }
+
+    public String getSizeDim() {
+        return sizeDim;
+    }
+
+    public void setSizeDim(String sizeDim) {
+        this.sizeDim = sizeDim;
+    }
+
+    public String getConfirmQuantity() {
+        return confirmQuantity;
+    }
+
+    public void setConfirmQuantity(String confirmQuantity) {
+        this.confirmQuantity = confirmQuantity;
+    }
+}

+ 49 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/ConfirmCollectOtherDeliveryModel.java

@@ -0,0 +1,49 @@
+package com.dgtly.wxportal.domain;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 交货单
+ * @author ZhangDing
+ * @version 1.0
+ * @descption: TODO
+ * @company 神州数码通用软件(洛阳)有限公司
+ * @copyright (c) 2019 LuoYang DGT Co'Ltd Inc. All rights reserved.
+ * @date 2020-10-22 14:36
+ * @since JDK1.8
+ */
+public class ConfirmCollectOtherDeliveryModel {
+
+    // 交货单号
+    private String deliveryNumber;
+    //重量
+    private String weight = "0";
+    //    交货单行明细
+    private List<ConfirmCollectLineDetailModel> deliveryLineDetail = new ArrayList<>();
+
+    public String getDeliveryNumber() {
+        return deliveryNumber;
+    }
+
+    public void setDeliveryNumber(String deliveryNumber) {
+        this.deliveryNumber = deliveryNumber;
+    }
+
+    public String getWeight() {
+        return weight;
+    }
+
+    public void setWeight(String weight) {
+        this.weight = weight;
+    }
+
+    public List<ConfirmCollectLineDetailModel> getDeliveryLineDetail() {
+        return deliveryLineDetail;
+    }
+
+    public void setDeliveryLineDetail(List<ConfirmCollectLineDetailModel> deliveryLineDetail) {
+        this.deliveryLineDetail = deliveryLineDetail;
+    }
+}

+ 0 - 348
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/EMetaHanaSalesOrder.java

@@ -1,348 +0,0 @@
-package com.dgtly.wxportal.domain;
-
-import com.dgtly.common.core.domain.BaseEntity;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author csz
- * @since 2020-07-30
- */
-public class EMetaHanaSalesOrder extends BaseEntity {
-
-    private static final long serialVersionUID = 1L;
-
-    private String docNumber;
-
-
-    private String docItem;
-
-
-    private String salesOrg;
-
-
-    private String salesOrgName;
-
-    private String distributionChannel;
-
-    private String customerCode;
-
-    private String customerName;
-
-    private String route;
-
-    private String division;
-
-    private String salesGroup;
-
-    private String plant;
-
-    private String docType;
-
-    private String createDate;
-
-    private String createDateItem;
-
-    private String deliverStatus;
-
-    private String materialCode;
-
-    private String materialName;
-
-    private String sizeDim;
-
-    private String creditDate;
-
-    private String creditStatus;
-
-    private String rejectReason;
-
-    private BigDecimal noDeliverQty;
-
-    private BigDecimal noDeliverWt;
-
-    private BigDecimal noDeliverAmt;
-
-    private BigDecimal deliverQty;
-
-    private BigDecimal deliverWt;
-
-    private BigDecimal deliverAmt;
-
-    /** 创建时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date expectedTime;
-
-    private String expectedTimeStr;//预期到货时间 字符串
-
-    public String getDocNumber() {
-        return docNumber;
-    }
-
-    public void setDocNumber(String docNumber) {
-        this.docNumber = docNumber;
-    }
-
-    public String getDocItem() {
-        return docItem;
-    }
-
-    public void setDocItem(String docItem) {
-        this.docItem = docItem;
-    }
-
-    public String getSalesOrg() {
-        return salesOrg;
-    }
-
-    public void setSalesOrg(String salesOrg) {
-        this.salesOrg = salesOrg;
-    }
-
-    public String getSalesOrgName() {
-        return salesOrgName;
-    }
-
-    public void setSalesOrgName(String salesOrgName) {
-        this.salesOrgName = salesOrgName;
-    }
-
-    public String getDistributionChannel() {
-        return distributionChannel;
-    }
-
-    public void setDistributionChannel(String distributionChannel) {
-        this.distributionChannel = distributionChannel;
-    }
-
-    public String getCustomerCode() {
-        return customerCode;
-    }
-
-    public void setCustomerCode(String customerCode) {
-        this.customerCode = customerCode;
-    }
-
-    public String getCustomerName() {
-        return customerName;
-    }
-
-    public void setCustomerName(String customerName) {
-        this.customerName = customerName;
-    }
-
-    public String getRoute() {
-        return route;
-    }
-
-    public void setRoute(String route) {
-        this.route = route;
-    }
-
-    public String getDivision() {
-        return division;
-    }
-
-    public void setDivision(String division) {
-        this.division = division;
-    }
-
-    public String getSalesGroup() {
-        return salesGroup;
-    }
-
-    public void setSalesGroup(String salesGroup) {
-        this.salesGroup = salesGroup;
-    }
-
-    public String getPlant() {
-        return plant;
-    }
-
-    public void setPlant(String plant) {
-        this.plant = plant;
-    }
-
-    public String getDocType() {
-        return docType;
-    }
-
-    public void setDocType(String docType) {
-        this.docType = docType;
-    }
-
-    public String getCreateDate() {
-        return createDate;
-    }
-
-    public void setCreateDate(String createDate) {
-        this.createDate = createDate;
-    }
-
-    public String getCreateDateItem() {
-        return createDateItem;
-    }
-
-    public void setCreateDateItem(String createDateItem) {
-        this.createDateItem = createDateItem;
-    }
-
-    public String getDeliverStatus() {
-        return deliverStatus;
-    }
-
-    public void setDeliverStatus(String deliverStatus) {
-        this.deliverStatus = deliverStatus;
-    }
-
-    public String getMaterialCode() {
-        return materialCode;
-    }
-
-    public void setMaterialCode(String materialCode) {
-        this.materialCode = materialCode;
-    }
-
-    public String getMaterialName() {
-        return materialName;
-    }
-
-    public void setMaterialName(String materialName) {
-        this.materialName = materialName;
-    }
-
-    public String getSizeDim() {
-        return sizeDim;
-    }
-
-    public void setSizeDim(String sizeDim) {
-        this.sizeDim = sizeDim;
-    }
-
-    public String getCreditDate() {
-        return creditDate;
-    }
-
-    public void setCreditDate(String creditDate) {
-        this.creditDate = creditDate;
-    }
-
-    public String getCreditStatus() {
-        return creditStatus;
-    }
-
-    public void setCreditStatus(String creditStatus) {
-        this.creditStatus = creditStatus;
-    }
-
-    public String getRejectReason() {
-        return rejectReason;
-    }
-
-    public void setRejectReason(String rejectReason) {
-        this.rejectReason = rejectReason;
-    }
-
-    public BigDecimal getNoDeliverQty() {
-        return noDeliverQty;
-    }
-
-    public void setNoDeliverQty(BigDecimal noDeliverQty) {
-        this.noDeliverQty = noDeliverQty;
-    }
-
-    public BigDecimal getNoDeliverWt() {
-        return noDeliverWt;
-    }
-
-    public void setNoDeliverWt(BigDecimal noDeliverWt) {
-        this.noDeliverWt = noDeliverWt;
-    }
-
-    public BigDecimal getNoDeliverAmt() {
-        return noDeliverAmt;
-    }
-
-    public void setNoDeliverAmt(BigDecimal noDeliverAmt) {
-        this.noDeliverAmt = noDeliverAmt;
-    }
-
-    public BigDecimal getDeliverQty() {
-        return deliverQty;
-    }
-
-    public void setDeliverQty(BigDecimal deliverQty) {
-        this.deliverQty = deliverQty;
-    }
-
-    public BigDecimal getDeliverWt() {
-        return deliverWt;
-    }
-
-    public void setDeliverWt(BigDecimal deliverWt) {
-        this.deliverWt = deliverWt;
-    }
-
-    public BigDecimal getDeliverAmt() {
-        return deliverAmt;
-    }
-
-    public void setDeliverAmt(BigDecimal deliverAmt) {
-        this.deliverAmt = deliverAmt;
-    }
-
-    public Date getExpectedTime() {
-        return expectedTime;
-    }
-
-    public void setExpectedTime(Date expectedTime) {
-        this.expectedTime = expectedTime;
-    }
-
-    public String getExpectedTimeStr() {
-        return expectedTimeStr;
-    }
-
-    public void setExpectedTimeStr(String expectedTimeStr) {
-        this.expectedTimeStr = expectedTimeStr;
-    }
-
-    @Override
-    public String toString() {
-        return "MetaHanaSalesOrder{" +
-                "docNumber='" + docNumber + '\'' +
-                ", docItem='" + docItem + '\'' +
-                ", salesOrg='" + salesOrg + '\'' +
-                ", salesOrgName='" + salesOrgName + '\'' +
-                ", distributionChannel='" + distributionChannel + '\'' +
-                ", customerCode='" + customerCode + '\'' +
-                ", customerName='" + customerName + '\'' +
-                ", route='" + route + '\'' +
-                ", division='" + division + '\'' +
-                ", salesGroup='" + salesGroup + '\'' +
-                ", plant='" + plant + '\'' +
-                ", docType='" + docType + '\'' +
-                ", createDate='" + createDate + '\'' +
-                ", createDateItem='" + createDateItem + '\'' +
-                ", deliverStatus='" + deliverStatus + '\'' +
-                ", materialCode='" + materialCode + '\'' +
-                ", materialName='" + materialName + '\'' +
-                ", sizeDim='" + sizeDim + '\'' +
-                ", creditDate='" + creditDate + '\'' +
-                ", creditStatus='" + creditStatus + '\'' +
-                ", rejectReason='" + rejectReason + '\'' +
-                ", noDeliverQty=" + noDeliverQty +
-                ", noDeliverWt=" + noDeliverWt +
-                ", noDeliverAmt=" + noDeliverAmt +
-                ", deliverQty=" + deliverQty +
-                ", deliverWt=" + deliverWt +
-                ", deliverAmt=" + deliverAmt +
-                '}';
-    }
-}

+ 125 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/EReceivingNote.java

@@ -0,0 +1,125 @@
+package com.dgtly.wxportal.domain;
+
+import com.dgtly.common.core.domain.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 收货单
+ * </p>
+ *
+ * @author csz
+ * @since 2020-07-30
+ */
+public class EReceivingNote extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+
+    //    订单号
+    private String orderNumber;
+    //    订单创建时间
+    private String orderCreationTime;
+    //    交货单号
+    private String deliveryNumber;
+    //    运单号
+    private String shipmentNumber;
+    //    交货地址
+    private String shipToAddress;
+    //    重量
+    private String weight = "0";
+    //    本交货单行明细
+    private List<ConfirmCollectLineDetailModel> deliveryLineDetail = new ArrayList<>();
+    //    其他交货单数据
+    private List<ConfirmCollectOtherDeliveryModel> otherDeliveryModels = new ArrayList<>();
+    //经销商代号
+    private String belongTo;
+    //  经销商名称
+    private String customerName;
+
+
+    public String getOrderNumber() {
+        return orderNumber;
+    }
+
+    public void setOrderNumber(String orderNumber) {
+        this.orderNumber = orderNumber;
+    }
+
+    public String getOrderCreationTime() {
+        return orderCreationTime;
+    }
+
+    public void setOrderCreationTime(String orderCreationTime) {
+        this.orderCreationTime = orderCreationTime;
+    }
+
+    public String getDeliveryNumber() {
+        return deliveryNumber;
+    }
+
+    public void setDeliveryNumber(String deliveryNumber) {
+        this.deliveryNumber = deliveryNumber;
+    }
+
+    public String getShipmentNumber() {
+        return shipmentNumber;
+    }
+
+    public void setShipmentNumber(String shipmentNumber) {
+        this.shipmentNumber = shipmentNumber;
+    }
+
+    public String getShipToAddress() {
+        return shipToAddress;
+    }
+
+    public void setShipToAddress(String shipToAddress) {
+        this.shipToAddress = shipToAddress;
+    }
+
+    public String getWeight() {
+        return weight;
+    }
+
+    public void setWeight(String weight) {
+        this.weight = weight;
+    }
+
+    public List<ConfirmCollectLineDetailModel> getDeliveryLineDetail() {
+        return deliveryLineDetail;
+    }
+
+    public void setDeliveryLineDetail(List<ConfirmCollectLineDetailModel> deliveryLineDetail) {
+        this.deliveryLineDetail = deliveryLineDetail;
+    }
+
+    public List<ConfirmCollectOtherDeliveryModel> getOtherDeliveryModels() {
+        return otherDeliveryModels;
+    }
+
+    public void setOtherDeliveryModels(List<ConfirmCollectOtherDeliveryModel> otherDeliveryModels) {
+        this.otherDeliveryModels = otherDeliveryModels;
+    }
+
+    public String getBelongTo() {
+        return belongTo;
+    }
+
+    public void setBelongTo(String belongTo) {
+        this.belongTo = belongTo;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+}

+ 0 - 26
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/mapper/EMetaHanaSalesOrderMapper.java

@@ -1,26 +0,0 @@
-package com.dgtly.wxportal.mapper;
-
-
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
-import org.apache.ibatis.annotations.MapKey;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author csz
- * @since 2020-07-30
- */
-public interface EMetaHanaSalesOrderMapper {
-
-    List<EMetaHanaSalesOrder> selectDistinctMetaHanaSalesOrder(EMetaHanaSalesOrder metaHanaSalesOrder);
-
-    @MapKey("order_number")
-    Map<String,Map<String,Object>> selectOrderExcepTimeByList(List<String> orderNumbers);
-
-    List<EMetaHanaSalesOrder> selectDistinctMetaHanaSalesOrder1(EMetaHanaSalesOrder metaHanaSalesOrder);
-}

+ 10 - 13
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/ESignService.java

@@ -1,13 +1,8 @@
 package com.dgtly.wxportal.service;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.dgtly.system.domain.CustomersExt;
 import com.dgtly.system.domain.SysUser;
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
-import org.springframework.stereotype.Service;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -20,14 +15,16 @@ import java.util.Map;
  * @since JDK1.8
  */
 public interface ESignService {
-    /**
-     * @descption:
-     * @param:
-     * @return:
-     * @auther: ZhangDing
-     * @date: 2020-10-10 11:31
-     */
-     Map<String,Object> upload(String orderId);
+
+  /**
+   * 根据订单和运单好生成PDF并上传至E签宝
+   * @param deliveryNumber 交货单
+   * @param shipmentNumber 运单号
+   * @param belongTo 经销商代码
+   * @param customerName 经销商名和曾
+   * @return
+   */
+  Map<String,Object> upload(String deliveryNumber,String shipmentNumber,String belongTo,String customerName);
 
 
      String verificationUser();

+ 0 - 29
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEMetaHanaSalesOrderService.java

@@ -1,29 +0,0 @@
-package com.dgtly.wxportal.service;
-
-
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
-
-import java.util.List;
-
-/**
- * <p>
- * 服务类
- * </p>
- *
- * @author csz
- * @since 2020-07-30
- */
-
-public interface IEMetaHanaSalesOrderService {
-
-    /**
-     * 根据 条件查询去重后SalesOrderList 可分页
-     *
-     * @param metaHanaSalesOrder
-     * @return
-     */
-
-    List<EMetaHanaSalesOrder> selectDistinctMetaHanaSalesOrder(EMetaHanaSalesOrder metaHanaSalesOrder);
-
-
-}

+ 31 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEReceivingNoteService.java

@@ -0,0 +1,31 @@
+package com.dgtly.wxportal.service;
+
+
+import com.dgtly.wxportal.domain.EReceivingNote;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author csz
+ * @since 2020-07-30
+ */
+
+public interface IEReceivingNoteService {
+
+    /**
+     *  根据交货单活和运单号查询 交货单详情
+     * @param deliveryNumber  交货单号
+     * @param shipmentNumber  运单号
+     * @param belongTo  经销商代号
+     * @param customerName  经销商名称
+     * @return
+     */
+    EReceivingNote selectEReceivingNote(String deliveryNumber,String shipmentNumber,String belongTo
+            ,String customerName);
+
+
+}

+ 0 - 51
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EMetaHanaSalesOrderServiceImpl.java

@@ -1,51 +0,0 @@
-package com.dgtly.wxportal.service.impl;
-
-import com.dgtly.common.utils.DateUtils;
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
-import com.dgtly.wxportal.mapper.EMetaHanaSalesOrderMapper;
-import com.dgtly.wxportal.service.IEMetaHanaSalesOrderService;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author qxp
- * @since 2020-07-30
- */
-@Service
-public class EMetaHanaSalesOrderServiceImpl implements IEMetaHanaSalesOrderService {
-
-    @Resource
-    private EMetaHanaSalesOrderMapper eMetaHanaSalesOrderMapper;
-
-
-    @Override
-    public List<EMetaHanaSalesOrder> selectDistinctMetaHanaSalesOrder(EMetaHanaSalesOrder metaHanaSalesOrder) {
-
-        /*List<String> orderNumbers = new ArrayList<>();
-        List<MetaHanaSalesOrder> list =  metaHanaSalesOrderMapper.selectDistinctMetaHanaSalesOrder(metaHanaSalesOrder);
-        for(MetaHanaSalesOrder m:list){
-            orderNumbers.add(m.getDocNumber());
-        }
-        Map<String,Map<String,Object>> timeList = metaHanaSalesOrderMapper.selectOrderExcepTimeByList(orderNumbers);
-        for(MetaHanaSalesOrder m:list){
-            if(timeList.containsKey(m.getDocNumber())){
-
-                m.setExpectedTime((Date)timeList.get(m.getDocNumber()).get("expected_time"));
-            }
-
-        }*/
-        if(metaHanaSalesOrder.getExpectedTime() != null){
-            metaHanaSalesOrder.setExpectedTimeStr(DateUtils.dateTime(metaHanaSalesOrder.getExpectedTime()));
-        }
-        List<EMetaHanaSalesOrder> list =  eMetaHanaSalesOrderMapper.selectDistinctMetaHanaSalesOrder(metaHanaSalesOrder);
-        return list;
-    }
-
-
-}

+ 70 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EReceivingNoteServiceImpl.java

@@ -0,0 +1,70 @@
+package com.dgtly.wxportal.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.dgtly.common.exception.base.BaseException;
+import com.dgtly.wxportal.domain.EReceivingNote;
+import com.dgtly.wxportal.service.IEReceivingNoteService;
+import com.dgtly.wxportal.utils.qywxutils.QyWxSendMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Formatter;
+import java.util.List;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author qxp
+ * @since 2020-07-30
+ */
+@Service
+public class EReceivingNoteServiceImpl implements IEReceivingNoteService {
+
+    private static final Logger logger = LoggerFactory.getLogger(EReceivingNoteServiceImpl.class);
+    @Autowired
+    private RestTemplate restTemplate;
+
+
+    @Value(value = "${ruoyi.cloudPath}")
+    private String cloudPath;
+
+
+    //确认收货接口
+    private String confirmUrl="order/order/deliver-quantity-confirm/confirmCollectQuery";
+
+
+    @Override
+    public EReceivingNote selectEReceivingNote(String deliveryNumber,String shipmentNumber,String belongTo
+                                                                 ,String customerName ) {
+        String url = cloudPath +confirmUrl;
+        String queryStr = "?deliveryNumber=%s&shipmentNumber=%s&belongTo=%s";
+        queryStr = new Formatter().format(queryStr,deliveryNumber,shipmentNumber,belongTo).toString();
+        url = url+queryStr;
+        String str= "";
+        EReceivingNote receivingNote ;
+        try{
+            str = restTemplate.getForObject(url, String.class);
+            System.out.println(str);
+            JSONObject json = JSONObject.parseObject(str);
+            if(json.getInteger("code")==200){
+                 receivingNote = json.getObject("data",EReceivingNote.class);
+
+            }else{
+                throw new BaseException("order",json.getString("message"));
+            }
+        }catch(Exception e){
+            logger.error("查询基础订单详情报错"+url,e);
+            throw e;
+        }
+
+        return receivingNote;
+    }
+
+
+}

+ 14 - 16
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java

@@ -2,10 +2,10 @@ package com.dgtly.wxportal.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.dgtly.system.domain.CustomersExt;
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
+import com.dgtly.wxportal.domain.EReceivingNote;
 import com.dgtly.system.domain.SysUser;
 import com.dgtly.system.service.ICustomersExtService;
-import com.dgtly.wxportal.service.IEMetaHanaSalesOrderService;
+import com.dgtly.wxportal.service.IEReceivingNoteService;
 import com.dgtly.system.service.ISysUserService;
 import com.dgtly.wxportal.config.ESignConfig;
 import com.dgtly.wxportal.service.ESignService;
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,17 +48,15 @@ public class ESignServiceImpl implements ESignService {
     @Autowired
     private ESignConfig eSignConfig;
     @Autowired
-    private IEMetaHanaSalesOrderService iMetaHanaSalesOrderService;
+    private IEReceivingNoteService iMetaHanaSalesOrderService;
 
     @Override
-    public Map<String,Object> upload(String orderId) {
-        //根据订单id生成pdf文件
-        EMetaHanaSalesOrder order = new EMetaHanaSalesOrder();
-        order.setDocNumber(orderId);
-        List<EMetaHanaSalesOrder> metaHanaSalesOrders = iMetaHanaSalesOrderService.selectDistinctMetaHanaSalesOrder(order);
+    public Map<String,Object> upload(String deliveryNumber,String shipmentNumber,String belongTo,String customerName) {
+
+        EReceivingNote receivingNote = iMetaHanaSalesOrderService.selectEReceivingNote(deliveryNumber,shipmentNumber,belongTo,customerName);
         Map<String,Object> map = new HashMap<>();
         //创建PDF
-        String filePath = creatPdf(metaHanaSalesOrders);
+        String filePath = creatPdf(receivingNote);
         String md5 = ESignUploadUtil.getStringContentMD5(filePath);
         String contentTtpe = "application/pdf";
         int fileLength = ESignUploadUtil.getFileSize(filePath);
@@ -71,7 +70,7 @@ public class ESignServiceImpl implements ESignService {
         String res = eSignHttpUtil.upLoadFile(uploadUrl,filePath,md5,contentTtpe,fileLength);
 
         map.put("fileId",fileId);
-        map.put("size",metaHanaSalesOrders.size());
+        map.put("size",10);
         return map;
     }
 
@@ -178,7 +177,7 @@ public class ESignServiceImpl implements ESignService {
      * @param
      * @return
      */
-    private String creatPdf(List<EMetaHanaSalesOrder> metaHanaSalesOrders){
+    private String creatPdf(EReceivingNote receivingNote){
 
         String fileUrl = "";
         try {
@@ -187,8 +186,9 @@ public class ESignServiceImpl implements ESignService {
 
             // 2.建立一个书写器(Writer)与document对象关联
             String uploadPath = eSignConfig.getFileUrl() ;
-            File file = new File(uploadPath+File.separator+"PDFDemo.pdf");
-            fileUrl = uploadPath+"/PDFDemo.pdf";
+            String filePath = uploadPath+File.separator+new Date().getTime()+"PDFDemo.pdf";
+            File file = new File(filePath);
+            fileUrl = filePath;
             file.createNewFile();
 
             PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
@@ -203,9 +203,7 @@ public class ESignServiceImpl implements ESignService {
             document.addKeywords("");// 关键字
             document.addCreator("");// 创建者
             // 4.向文档中添加内容
-            PDFUtil.generateEPDF(document,metaHanaSalesOrders.get(0).getCustomerName()
-            ,metaHanaSalesOrders.get(0).getDocNumber(),
-             metaHanaSalesOrders
+            PDFUtil.generateEPDF(document,receivingNote
                     );
 
             // 5.关闭文档

+ 25 - 11
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFUtil.java

@@ -1,6 +1,8 @@
 package com.dgtly.wxportal.utils.pdf;
 
-import com.dgtly.wxportal.domain.EMetaHanaSalesOrder;
+import com.dgtly.wxportal.domain.ConfirmCollectLineDetailModel;
+import com.dgtly.wxportal.domain.ConfirmCollectOtherDeliveryModel;
+import com.dgtly.wxportal.domain.EReceivingNote;
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.*;
 import com.itextpdf.text.pdf.draw.DottedLineSeparator;
@@ -190,7 +192,7 @@ public class PDFUtil {
 
 
                 // 4.向文档中添加内容
-                PDFUtil.generateEPDF(document,"XXX公司",null,null);
+                //PDFUtil.generateEPDF(document,"XXX公司",null,null);
 
                 // 5.关闭文档
                 document.close();
@@ -226,7 +228,7 @@ public class PDFUtil {
 
 
 
-    public  static void generateEPDF(Document document,String name,String docNumber,List<EMetaHanaSalesOrder> metaHanaSalesOrders) throws Exception {
+    public  static void generateEPDF(Document document,EReceivingNote receivingNote) throws Exception {
         // 段落
         Paragraph paragraph = new Paragraph("立    邦   随   身  邦  收  货  单", titlefont);
         paragraph.setAlignment(1); //设置文字居中 0靠左   1,居中     2,靠右
@@ -251,8 +253,8 @@ public class PDFUtil {
         Paragraph p1 = new Paragraph();
         p1.add(new Chunk(new LineSeparator()));
         document.add(p1);
-        Paragraph paragraph1 = new Paragraph("客户名称: " +name+"                           " +
-        "                                                     订单号: " +docNumber+"", namefont);
+        Paragraph paragraph1 = new Paragraph("客户名称: " +receivingNote.getCustomerName()+"                           " +
+        "                                                     订单号: " +receivingNote.getOrderNumber()+"", namefont);
         paragraph1.setLeading(20f); //行间距
         paragraph1.setSpacingBefore(5f); //设置段落上空白
         paragraph1.setSpacingAfter(5f); //设置段落下空白
@@ -285,19 +287,31 @@ public class PDFUtil {
         image.scalePercent(40); //依照比例缩放
         //document.add(image);
         // 表格
-        PdfPTable table = createTable(new float[] { 100, 80, 80});
+        PdfPTable table = createTable(new float[] { 100, 80, 80,80});
         table.addCell(createCell("物品明细", headfont, Element.ALIGN_CENTER, 8, false));
         table.addCell(createCell("材料名称", keyfont, Element.ALIGN_CENTER));
         table.addCell(createCell("规格", keyfont, Element.ALIGN_CENTER));
         table.addCell(createCell("数量", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("到货数量", keyfont, Element.ALIGN_CENTER));
 //        table.addCell(createCell("未交货数量", keyfont, Element.ALIGN_CENTER));
 //        table.addCell(createCell("发货数量", keyfont, Element.ALIGN_CENTER));
 //        table.addCell(createCell("已收货数量", keyfont, Element.ALIGN_CENTER));
-        for (EMetaHanaSalesOrder metaHanaSalesOrder1:metaHanaSalesOrders) {
-            table.addCell(createCell(metaHanaSalesOrder1.getMaterialName(), textfont));
-            table.addCell(createCell(metaHanaSalesOrder1.getSizeDim(), textfont));
-            table.addCell(createCell(metaHanaSalesOrder1.getDeliverQty().toString(), textfont));
+        for (ConfirmCollectLineDetailModel line:receivingNote.getDeliveryLineDetail()) {
+            table.addCell(createCell(line.getMaterialName(), textfont));
+            table.addCell(createCell(line.getSizeDim(), textfont));
+            table.addCell(createCell(line.getConfirmQuantity().toString(), textfont));
+            table.addCell(createCell(line.getDeliveryCount().toString(), textfont));
         }
+        for(ConfirmCollectOtherDeliveryModel otherLine:receivingNote.getOtherDeliveryModels()){
+            table.addCell(createCell("同运单交货单:"+otherLine.getDeliveryNumber()+"   重量:"+otherLine.getWeight(), keyfont, Element.ALIGN_CENTER,4));
+            for (ConfirmCollectLineDetailModel line:otherLine.getDeliveryLineDetail()) {
+                table.addCell(createCell(line.getMaterialName(), textfont));
+                table.addCell(createCell(line.getSizeDim(), textfont));
+                table.addCell(createCell(line.getConfirmQuantity().toString(), textfont));
+                table.addCell(createCell(line.getDeliveryCount().toString(), textfont));
+            }
+        }
+
         document.add(table);
 
 
@@ -584,7 +598,7 @@ public class PDFUtil {
          * @param colspan
          * @return
          */
-        public PdfPCell createCell(String value, Font font, int align, int colspan) {
+        public static PdfPCell createCell(String value, Font font, int align, int colspan) {
             PdfPCell cell = new PdfPCell();
             cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
             cell.setHorizontalAlignment(align);

+ 0 - 82
suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/EMetaHanaSalesOrderMapper.xml

@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.dgtly.wxportal.mapper.EMetaHanaSalesOrderMapper">
-
-    <resultMap type="EMetaHanaSalesOrder" id="MetaHanaSalesResult">
-        <result property="docNumber"    column="DOC_NUMBER"    />
-        <result property="docItem"    column="DOC_ITEM"    />
-        <result property="salesOrg"    column="SALES_ORG"    />
-        <result property="salesOrgName"    column="SALES_ORG_NAME"    />
-        <result property="distributionChannel"    column="DISTRIBUTION_CHANNEL"    />
-        <result property="customerCode"    column="CUSTOMER_CODE"    />
-        <result property="customerName"    column="CUSTOMER_NAME"    />
-        <result property="route"    column="ROUTE"    />
-        <result property="division"    column="DIVISION"    />
-        <result property="salesGroup"    column="SALES_GROUP"    />
-        <result property="plant"    column="PLANT"    />
-        <result property="docType"    column="DOC_TYPE"    />
-        <result property="createDate"    column="CREATE_DATE"    />
-        <result property="createDateItem"    column="CREATE_DATE_ITEM"    />
-        <result property="deliverStatus"    column="DELIVER_STATUS"    />
-        <result property="materialCode"    column="MATERIAL_CODE"    />
-        <result property="materialName"    column="MATERIAL_NAME"    />
-        <result property="sizeDim"    column="SIZE_DIM"    />
-        <result property="creditDate"    column="CREDIT_DATE"    />
-        <result property="creditStatus"    column="CREDIT_STATUS"    />
-        <result property="rejectReason"    column="REJECT_REASON"    />
-        <result property="noDeliverQty"    column="NO_DELIVER_QTY"    />
-        <result property="noDeliverWt"    column="NO_DELIVER_WT"    />
-        <result property="noDeliverAmt"    column="NO_DELIVER_AMT"    />
-        <result property="deliverQty"    column="DELIVER_QTY"    />
-        <result property="deliverWt"    column="DELIVER_WT"    />
-        <result property="deliverAmt"    column="DELIVER_AMT"    />
-    </resultMap>
-    <sql id="selectMetaHanaSalesOrderVo">
-        select DOC_NUMBER, DOC_ITEM, SALES_ORG, SALES_ORG_NAME, DISTRIBUTION_CHANNEL, CUSTOMER_CODE, CUSTOMER_NAME, ROUTE,
-        DIVISION, SALES_GROUP, PLANT, DOC_TYPE, CREATE_DATE, CREATE_DATE_ITEM, DELIVER_STATUS, MATERIAL_CODE, MATERIAL_NAME, SIZE_DIM
-         , CREDIT_DATE, CREDIT_STATUS, REJECT_REASON, NO_DELIVER_QTY, NO_DELIVER_WT, NO_DELIVER_AMT, DELIVER_QTY, DELIVER_WT, DELIVER_AMT from meta_hana_sales_order
-    </sql>
-    <select id="selectDistinctMetaHanaSalesOrder" parameterType="EMetaHanaSalesOrder" resultMap="MetaHanaSalesResult">
-        select DOC_NUMBER, DOC_ITEM, SALES_ORG, SALES_ORG_NAME, DISTRIBUTION_CHANNEL, CUSTOMER_CODE, CUSTOMER_NAME, ROUTE,
-        DIVISION, SALES_GROUP, PLANT, DOC_TYPE, CREATE_DATE, CREATE_DATE_ITEM, DELIVER_STATUS, MATERIAL_CODE, MATERIAL_NAME, SIZE_DIM
-        , CREDIT_DATE, CREDIT_STATUS, REJECT_REASON, NO_DELIVER_QTY, NO_DELIVER_WT, NO_DELIVER_AMT, DELIVER_QTY, DELIVER_WT, DELIVER_AMT from meta_hana_sales_order
-        <where>
-            <if test="docNumber != null  and docNumber != ''"> and DOC_NUMBER = #{docNumber}</if>
-        </where>
-    </select>
-
-    <select id="selectOrderExcepTimeByList" parameterType="String" resultType="Map">
-        select order_number ,expected_time
-        from sales_order_base
-        where order_number in
-        <foreach collection="list" item="orderNumber" open="(" separator="," close=")">
-            #{orderNumber}
-        </foreach>
-    </select>
-
-    <select id="selectDistinctMetaHanaSalesOrder1" parameterType="EMetaHanaSalesOrder" resultMap="MetaHanaSalesResult">
-        select distinct mhso.DOC_NUMBER, mhso.CUSTOMER_CODE, mhso.CUSTOMER_NAME,
-        mhso.CREATE_DATE, mhso.CREDIT_DATE, mhso.CREDIT_STATUS, mhso.REJECT_REASON
-            ,sob.expected_time as expectedTime
-
-        from meta_hana_sales_order mhso
-        LEFT JOIN sales_order_base sob
-        on mhso.DOC_NUMBER = sob.order_number
-        <where>
-            <if test="docNumber != null  and docNumber != ''"> and mhso.DOC_NUMBER like concat('%', #{docNumber}, '%')</if>
-            <if test="salesOrg != null  and salesOrg != ''"> and mhso.SALES_ORG =#{salesOrg}</if>
-            <if test="salesOrgName != null  and salesOrgName != ''"> and mhso.SALES_ORG_NAME like concat('%', #{salesOrgName}, '%')</if>
-            <if test="customerCode != null  and customerCode != ''"> and mhso.CUSTOMER_CODE like concat('%', #{customerCode}, '%')</if>
-            <if test="customerName != null  and customerName != ''"> and mhso.CUSTOMER_NAME like concat('%', #{customerName}, '%')</if>
-            <if test="docType != null  and docType != ''"> and mhso.DOC_TYPE = #{docType}</if>
-            <if test="creditStatus != null  and creditStatus != ''"> and mhso.CREDIT_STATUS = #{creditStatus}</if>
-            <if test="params.start_expectedTime != null and params.start_expectedTime != ''"><!-- 开始时间检索 -->
-                and date_format(expected_time,'%y%m%d') &gt;= date_format(#{params.start_expectedTime},'%y%m%d')
-            </if>
-            <if test="params.end_expectedTime != null and params.end_expectedTime != ''"><!-- 结束时间检索 -->
-                and date_format(expected_time,'%y%m%d') &lt;= date_format(#{params.end_expectedTime},'%y%m%d')
-            </if>
-        </where>
-    </select>
-
-</mapper>