|
@@ -15,6 +15,7 @@ import com.dgtly.system.service.IAssRelcustomerinfoService;
|
|
|
import com.dgtly.system.service.ICustomersExtService;
|
|
|
import com.dgtly.system.service.ISysUserExtService;
|
|
|
import com.dgtly.system.service.ISysUserService;
|
|
|
+import com.dgtly.system.util.AuthType;
|
|
|
import com.dgtly.wxportal.config.ESignConfig;
|
|
|
import com.dgtly.wxportal.domain.ESignUpPDFModal;
|
|
|
import com.dgtly.wxportal.domain.OrderFile;
|
|
@@ -270,6 +271,102 @@ public class EsignController extends ApiBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 收货/自主下单/自提授权
|
|
|
+ *
|
|
|
+ * * 没有注册就注册,注册完就认证,然后再点击签署按钮,获取经销商用户id,对应主体id
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "收货/自主下单/自提授权", notes = "参数:{'userId':'xxx','customerCode':'xxx','customerName':'xxx','clientName':'xxx','clientPost':'xxx','trusteeName':'xxx','trusteePost':'xxx','authType':'xxx','redirectUrl':'xxx'}"+
|
|
|
+ "\n(userId:用户id" +
|
|
|
+ "\n(customerCode:经销商编码" +
|
|
|
+ "\n(customerName:经销商名称" +
|
|
|
+ "\n(clientName: 委托人名称" +
|
|
|
+ "\n(clientPost: 委托人职务" +
|
|
|
+ "\n(trusteeName: 受托人名称" +
|
|
|
+ "\n(trusteePost: 受托人职务" +
|
|
|
+ "\n(authType:委托标记" +
|
|
|
+ "\n(redirectUrl:签署完成跳转地址")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "params", paramType = "body")
|
|
|
+ })
|
|
|
+ @PostMapping("empowerByAuth")
|
|
|
+ public Object empowerByAuth() {
|
|
|
+
|
|
|
+ ParameterObject obj = getParameterObject();
|
|
|
+ obj.checkParameterNotNull("userId,customerCode,customerName,clientName,clientPost,trusteeName,trusteePost,authType,redirectUrl");
|
|
|
+ try {
|
|
|
+ String authName="";
|
|
|
+ String authType = obj.getString("authType");
|
|
|
+ if(AuthType.IS_CONSIGNEE.equals(authType)){
|
|
|
+ authName=AuthType.IS_CONSIGNEE_NAME;
|
|
|
+ }else if(AuthType.IS_INDEPENDENTLY.equals(authType)){
|
|
|
+ authName=AuthType.IS_INDEPENDENTLY_NAME;
|
|
|
+ }else if(AuthType.IS_SELFDELIVERY.equals(authType)){
|
|
|
+ authName=AuthType.IS_SELFDELIVERY_NAME;
|
|
|
+ }
|
|
|
+ String userId = obj.getString("userId");
|
|
|
+ String customerCode = obj.getString("customerCode");
|
|
|
+ String customerName = obj.getString("customerName");
|
|
|
+ String clientName = obj.getString("clientName");
|
|
|
+ String clientPost = obj.getString("clientPost");
|
|
|
+ String trusteeName = obj.getString("trusteeName");
|
|
|
+ String trusteePost=obj.getString("trusteePost");
|
|
|
+ String redirectUrl = obj.getString("redirectUrl");
|
|
|
+ logger.info("签署完成跳转地址:{}",redirectUrl);
|
|
|
+
|
|
|
+ String businessScene = "委托授权";
|
|
|
+ String fileName = UUID.randomUUID()+"_授权.pdf";
|
|
|
+ /*根据userId查询个人注册后accountId*/
|
|
|
+ String signerAccountId = "";
|
|
|
+ SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
|
|
|
+ if (sysUser!=null){
|
|
|
+ signerAccountId=sysUser.getAccountId();
|
|
|
+ }
|
|
|
+ /*根据订单id关联查询企业注册后id*/
|
|
|
+ String authorizedAccountId =customersExtService.selectChainsCodeByOrderId(customerCode);
|
|
|
+ // authorizedAccountId = "563c540b67354026a5f84f6c5b9d8eb0";
|
|
|
+// signService.signAuth(authorizedAccountId);
|
|
|
+ logger.info("签署人认证id:{}",authorizedAccountId);
|
|
|
+
|
|
|
+ /*4、保存订单id和flowId*/
|
|
|
+ OrderFile orderFile = new OrderFile();
|
|
|
+ orderFile.setChainsCode(customerCode);
|
|
|
+ orderFile.setCustomersCode(authorizedAccountId);
|
|
|
+ orderFile.setSignerId(signerAccountId);
|
|
|
+ orderFile.setSignerName(sysUser.getUserName());
|
|
|
+ String trusteePostName=trusteePost.replaceAll("1","经销商负责人").replaceAll("2","财务").replaceAll("3","仓管");
|
|
|
+ orderFile.setBeentrustPost(trusteePostName);
|
|
|
+ String clientPostName=clientPost.replaceAll("1","经销商负责人").replaceAll("2","财务").replaceAll("3","仓管");
|
|
|
+ orderFile.setEntrustPost(clientPostName);
|
|
|
+ orderFile.setAuthType(authType);
|
|
|
+ orderFile.setTypes(2);
|
|
|
+ orderFile.setEntrustName(clientName);
|
|
|
+ orderFile.setBeentrustName(trusteeName);
|
|
|
+ orderFile.setChainsName(customerName);
|
|
|
+ orderFile.setAuthName(authName);
|
|
|
+
|
|
|
+ ESignUpPDFModal fileModal = eSignService.uploadEmpowerByAuth(orderFile);
|
|
|
+ /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
|
|
|
+ Object fileId = fileModal.getFileId();
|
|
|
+ logger.info("签署授权返回文件id:{}",fileId);
|
|
|
+ /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
|
|
|
+ String flowId = signService.oneStepFlowempowerByAuth(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(),fileName, signerAccountId, authorizedAccountId,redirectUrl);
|
|
|
+ logger.info("签署授权一步发起完成流程id:{}",flowId);
|
|
|
+ orderFile.setFlowId(flowId);
|
|
|
+ orderFileService.insertOrderFile(orderFile);
|
|
|
+ logger.info("保存授权签署附件");
|
|
|
+ File f = new File(fileModal.getFilePath());
|
|
|
+ f.delete();
|
|
|
+ logger.info("授权成功");
|
|
|
+ return AjaxResult.success("授权成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("授权失败:{}",e.getMessage());
|
|
|
+ return AjaxResult.error("授权失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 经销商通过签署地址签署后,回调此方法,通过flowId得到签署后的文件下载地址并保存url
|
|
|
*/
|