|
@@ -1,5 +1,6 @@
|
|
|
package com.dgtly.wxportal.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dgtly.common.annotation.ApiPassToken;
|
|
|
import com.dgtly.common.config.Global;
|
|
|
import com.dgtly.common.config.ServerConfig;
|
|
@@ -16,6 +17,7 @@ import com.dgtly.wxportal.config.ESignConfig;
|
|
|
import com.dgtly.wxportal.domain.ESignUpPDFModal;
|
|
|
import com.dgtly.wxportal.domain.OrderFile;
|
|
|
import com.dgtly.wxportal.service.*;
|
|
|
+import com.dgtly.wxportal.utils.ESign.ESignUrl;
|
|
|
import com.dgtly.wxportal.utils.file.fileDownloadUtil;
|
|
|
import com.sun.org.apache.xpath.internal.operations.Bool;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -23,6 +25,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@@ -67,12 +70,15 @@ public class EsignController extends ApiBaseController {
|
|
|
* 没有注册就注册,注册完就认证,然后再点击签署按钮,获取经销商用户id,对应主体id
|
|
|
* E签宝一步发起签署
|
|
|
*/
|
|
|
- @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','userId':'xxx','deliveryNumber':'xxx','shipmentNumber':'xxx','belongTo':'xxx'}" +
|
|
|
+ @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','userId':'xxx','deliveryNumber':'xxx','shipmentNumber':'xxx','belongTo':'xxx','redirectUrl':'xxx','wareHouseCode':'xxx','wareHouseName':'xxx'}" +
|
|
|
"\n(orderId:订单编号" +
|
|
|
"\n(deliveryNumber:交货单号" +
|
|
|
"\n(shipmentNumber:运单号" +
|
|
|
"\n(belongTo:经销商代号" +
|
|
|
- "\n(userId:用户id")
|
|
|
+ "\n(userId:用户id" +
|
|
|
+ "\n(wareHouseCode:仓库代号" +
|
|
|
+ "\n(wareHouseName:仓库名称" +
|
|
|
+ "\n redirectUrl:签署完成跳转地址")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "params", paramType = "body")
|
|
|
})
|
|
@@ -80,12 +86,15 @@ public class EsignController extends ApiBaseController {
|
|
|
public Object dealerSign() {
|
|
|
|
|
|
ParameterObject obj = getParameterObject();
|
|
|
- obj.checkParameterNotNull("orderId,userId,deliveryNumber,shipmentNumber,belongTo");
|
|
|
+ obj.checkParameterNotNull("orderId,userId,deliveryNumber,shipmentNumber,belongTo,redirectUrl");
|
|
|
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 wareHouseCode = obj.getString("wareHouseCode");
|
|
|
+ String wareHouseName = obj.getString("wareHouseName");
|
|
|
+ String redirectUrl = obj.getString("redirectUrl");
|
|
|
|
|
|
|
|
|
String businessScene = "订单签收";
|
|
@@ -99,20 +108,24 @@ public class EsignController extends ApiBaseController {
|
|
|
/*根据订单id关联查询企业注册后id*/
|
|
|
String authorizedAccountId =customersExtService.selectOrgIdByOrderId(orderId);
|
|
|
/* 根据订单id关联查询企业代号*/
|
|
|
- String chainsCode = customersExtService.selectchainsCodeByOrderId(orderId);
|
|
|
+// String chainsCode = customersExtService.selectChainsCodeByOrderId(orderId);
|
|
|
/*首先根据订单id-orderId查询订单是否已被签署*/
|
|
|
// OrderFile orderFlag = orderFileService.selectOrderFileById(orderId);
|
|
|
- ESignUpPDFModal fileModal = eSignService.upload(deliveryNumber,shipmentNumber,belongTo,sysUser.getSysUserExt().getOrgName());
|
|
|
+ ESignUpPDFModal fileModal = eSignService.upload(deliveryNumber,shipmentNumber,belongTo,sysUser.getSysUserExt().getOrgName(),sysUser.getUserName());
|
|
|
/*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
|
|
|
Object fileId =fileModal.getFileId();
|
|
|
/*2、调用E签宝接口一步发起流程,得到返回的流程id*/
|
|
|
- String flowId = signService.oneStepFlow(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(), fileName, signerAccountId, authorizedAccountId);
|
|
|
+ String flowId = signService.oneStepFlow(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(), fileName, signerAccountId, authorizedAccountId,redirectUrl);
|
|
|
/*3、调用E签宝获取签署地址*/
|
|
|
String result = signService.processExecuteUrl(flowId, signerAccountId, authorizedAccountId);
|
|
|
/*4、保存订单id和flowId*/
|
|
|
OrderFile orderFile = new OrderFile();
|
|
|
orderFile.setOrderId(orderId);
|
|
|
- orderFile.setChainsCode(chainsCode);
|
|
|
+ orderFile.setDeliveryNumber(deliveryNumber);
|
|
|
+ orderFile.setShipmentNumber(shipmentNumber);
|
|
|
+ orderFile.setWareHouseCode(wareHouseCode);
|
|
|
+ orderFile.setWareHouseName(wareHouseName);
|
|
|
+ orderFile.setChainsCode(belongTo);
|
|
|
orderFile.setCustomersCode(authorizedAccountId);
|
|
|
orderFile.setSignerId(signerAccountId);
|
|
|
orderFile.setSignerName(sysUser.getUserName());
|
|
@@ -121,12 +134,6 @@ public class EsignController extends ApiBaseController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-// @PostMapping("/testPDF")
|
|
|
-// @ResponseBody
|
|
|
-// public Map<String,Object> aaa(){
|
|
|
-// return eSignService.upload("0583133446");
|
|
|
-// }
|
|
|
-
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -142,19 +149,73 @@ public class EsignController extends ApiBaseController {
|
|
|
obj.checkParameterNotNull("flowId,signResult");
|
|
|
String flowId = obj.getString("flowId");
|
|
|
String signResult = obj.getString("signResult");
|
|
|
+ OrderFile orderFlag = orderFileService.selectOrderFileByFlowId(flowId);
|
|
|
+
|
|
|
if ("2".equals(signResult)) {
|
|
|
- String fileUrl = signService.processDocumentDownload(flowId);
|
|
|
+
|
|
|
+ /*异步调用回调接口*/
|
|
|
+ signService.callbackNotice(orderFlag);
|
|
|
+ /*异步保存文件*/
|
|
|
+ signService.saveFile(flowId,orderFlag);
|
|
|
+
|
|
|
+
|
|
|
+// String fileUrl = signService.processDocumentDownload(flowId);
|
|
|
/*下载保存签署后的文件,返回文件存储地址*/
|
|
|
- OrderFile orderFlag = orderFileService.selectOrderFileByFlowId(flowId);
|
|
|
- fileDownloadUtil.downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
|
|
|
- OrderFile orderFile = new OrderFile();
|
|
|
- orderFile.setFlowId(flowId);
|
|
|
- orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/"+"pdf/"+orderFlag.getOrderId() + "_签收订单.pdf");
|
|
|
- orderFileService.updateOrderFileByFlowId(orderFile);
|
|
|
+// fileDownloadUtil.downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
|
|
|
+// OrderFile orderFile = new OrderFile();
|
|
|
+// orderFile.setFlowId(flowId);
|
|
|
+// orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/"+"pdf/"+orderFlag.getOrderId() + "_签收订单.pdf");
|
|
|
+// orderFileService.updateOrderFileByFlowId(orderFile);
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
+ /*@Async
|
|
|
+ public String notice(OrderFile orderFlag){
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+// json.put("flowId", flowId);
|
|
|
+ JSONObject jsonObject = eSignHttpUtil.doGetGetJson(ESignUrl.ProcessExecuteSignersUrl, json,flowId);
|
|
|
+ return jsonObject.toJSONString();
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Async
|
|
|
+ public void saveFlle(String flowId,OrderFile orderFlag){
|
|
|
+ String fileUrl = signService.processDocumentDownload(flowId);
|
|
|
+ *//*下载保存签署后的文件,返回文件存储地址*//*
|
|
|
+ fileDownloadUtil.downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
|
|
|
+ OrderFile orderFile = new OrderFile();
|
|
|
+ orderFile.setFlowId(flowId);
|
|
|
+ orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/"+"pdf/"+orderFlag.getOrderId() + "_签收订单.pdf");
|
|
|
+ orderFileService.updateOrderFileByFlowId(orderFile);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查看已签署PDF历史文件
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查看已签署PDF历史文件",notes = "参数:{'orderId':'xxx','deliveryNumber':'xxxx','shipmentNumber':'xxx'}" +
|
|
|
+ "\n(orderId:订单编号" +
|
|
|
+ "\n(deliveryNumber:交货单号" +
|
|
|
+ "\n(shipmentNumber:运单号")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "params", paramType = "body")
|
|
|
+ })
|
|
|
+ @PostMapping("getHisFile")
|
|
|
+ public Object getHisFile() {
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
+ obj.checkParameterNotNull("orderId,deliveryNumber,shipmentNumber");
|
|
|
+ String orderId = obj.getString("orderId");
|
|
|
+ String deliveryNumber = obj.getString("deliveryNumber");
|
|
|
+ String shipmentNumber = obj.getString("shipmentNumber");
|
|
|
+ OrderFile orderFile = orderFileService.selectOrderFileByParam(orderId,deliveryNumber,shipmentNumber);
|
|
|
+ if(orderFile != null){
|
|
|
+ return AjaxResult.success().putKV("url",serverConfig.getUrl()+orderFile.getFileUrl());
|
|
|
+ }else{
|
|
|
+ return AjaxResult.success("文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "E签宝个人认证", notes = "参数:{'userId':'XXXXXXX','redirectUrl':'xxxx'}" +
|
|
|
"\n(userId:待认证用户id" +
|