From fd044454184641e4829791bab3caca87a0b853ad Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Sun, 9 Mar 2025 00:08:05 +0800 Subject: [PATCH] =?UTF-8?q?e=E7=AD=BE=E5=AE=9D=E6=A8=A1=E7=89=88=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=8D=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BaiduMapServiceImpl.java | 11 +- .../controller/admin/EsignController.java | 2 +- .../EsignContractFillingFileServiceImpl.java | 215 ++++++++++++++++++ .../impl/EsignContractServiceImpl.java | 11 +- .../impl/EsignPlatformInfoServiceImpl.java | 4 +- 5 files changed, 234 insertions(+), 9 deletions(-) diff --git a/mall-common/src/main/java/com/suisung/mall/common/service/impl/BaiduMapServiceImpl.java b/mall-common/src/main/java/com/suisung/mall/common/service/impl/BaiduMapServiceImpl.java index 6f4bc472..edc140e5 100644 --- a/mall-common/src/main/java/com/suisung/mall/common/service/impl/BaiduMapServiceImpl.java +++ b/mall-common/src/main/java/com/suisung/mall/common/service/impl/BaiduMapServiceImpl.java @@ -15,6 +15,7 @@ import cn.hutool.json.JSONUtil; import com.suisung.mall.common.pojo.dto.GpsDTO; import com.suisung.mall.common.pojo.res.BaiduMapLbsRes; import com.suisung.mall.common.utils.RestTemplateHttpUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -27,6 +28,7 @@ import java.net.URLConnection; /** * 百度坐标系转换类 */ +@Slf4j @Service public class BaiduMapServiceImpl { @@ -141,7 +143,9 @@ public class BaiduMapServiceImpl { } if (city_limit != null) { - apiUrl.append("&city_limit").append(city_limit); + apiUrl.append("&city_limit=").append(city_limit); + } else { + apiUrl.append("&city_limit=false"); } if (StrUtil.isNotBlank(coord_type)) { @@ -151,8 +155,11 @@ public class BaiduMapServiceImpl { if (StrUtil.isNotBlank(ret_coordtype)) { apiUrl.append("&ret_coordtype=").append(ret_coordtype); } + + String reqUrl = apiUrl.toString(); + log.debug("apiUrl: {}", reqUrl); - String respJson = RestTemplateHttpUtil.sendGet(apiUrl.toString(), String.class); + String respJson = RestTemplateHttpUtil.sendGet(reqUrl, String.class); return JSONUtil.parseObj(respJson); } } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/esign/controller/admin/EsignController.java b/mall-shop/src/main/java/com/suisung/mall/shop/esign/controller/admin/EsignController.java index d455a8ed..469484bf 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/esign/controller/admin/EsignController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/esign/controller/admin/EsignController.java @@ -33,7 +33,7 @@ public class EsignController extends BaseControllerImpl { @ApiOperation(value = "店铺基础信息表-查找所有店铺编号和名称", notes = "店铺基础信息表-查找所有店铺编号和名称") @RequestMapping(value = "/testcase", method = RequestMethod.POST) public Object testCase() { - return esignContractFillingFileService.fillDocTemplate("11", "11"); + return esignContractFillingFileService.fillDocTemplate("yyzz787654566543", "91450881MADEQ92533"); } @ApiOperation(value = "基于文件发起签署电子合同", notes = "基于文件发起签署电子合同") diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractFillingFileServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractFillingFileServiceImpl.java index 8ba52629..53cc3d11 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractFillingFileServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractFillingFileServiceImpl.java @@ -105,6 +105,220 @@ public class EsignContractFillingFileServiceImpl extends BaseServiceImpl() {{ + put("componentKey", "plat_contracts"); + put("componentValue", "《平台商户入驻服务框架协议》和《小发同城服务费结算》"); + }}); + + // 签署时间 + for (int i = 1; i <= 3; i++) { + int finalI = i; + list.add(new HashMap() {{ + put("componentKey", "mch_sign_date" + finalI); + put("componentValue", today); + }}); + } + + list.add(new HashMap() {{ + put("componentKey", "plat_sign_date1"); + put("componentValue", today); + }}); + + + // 甲方公司名称 + for (int i = 1; i <= 16; i++) { + int finalI = i; + list.add(new HashMap() {{ + put("componentKey", "mch_company" + finalI); + put("componentValue", mchCompany); + }}); + } + + for (int i = 1; i <= 4; i++) { + int finalI = i; + list.add(new HashMap() {{ + put("componentKey", "mch_legal_person_name" + finalI); + put("componentValue", legalPersonName); + }}); + } + + for (int i = 1; i <= 2; i++) { + int finalI = i; + list.add(new HashMap() {{ + put("componentKey", "mch_legal_person_mobile" + finalI); + put("componentValue", shopMerchEntry.getLegal_person_mobile()); + }}); + } + + list.add(new HashMap() {{ + put("componentKey", "mch_legal_person_id_number1"); + put("componentValue", shopMerchEntry.getLegal_person_id_number()); + }}); + + list.add(new HashMap() {{ + put("componentKey", "mch_store_name1"); + put("componentValue", shopMerchEntry.getStore_name()); + }}); + + list.add(new HashMap() {{ + put("componentKey", "rule_no"); + put("componentValue", 3); + }}); + + list.add(new HashMap() {{ + put("componentKey", "mch_ratio"); + put("componentValue", shopMerchEntry.getSplit_ratio()); + }}); + + list.add(new HashMap() {{ + put("componentKey", "settlement_method"); + put("componentValue", shopMerchEntry.getSettlement_method()); + }}); + + list.add(new HashMap() {{ + put("componentKey", "mch_address1"); + put("componentValue", shopMerchEntry.getStore_address()); + }}); + + // 乙方公司名称 + list.add(new HashMap() {{ + put("componentKey", "plat_company1"); + put("componentValue", platCompany + "和代理商"); + }}); + + for (int i = 2; i <= 3; i++) { + int finalI = i; + list.add(new HashMap() {{ + put("componentKey", "plat_company" + finalI); + put("componentValue", platCompany); + }}); + } + + list.add(new HashMap() {{ + put("componentKey", "plat_mobile1"); + put("componentValue", finalEsignPlatformInfo.getLegal_person_mobile()); + }}); + + list.add(new HashMap() {{ + put("componentKey", "plat_email1"); + put("componentValue", finalEsignPlatformInfo.getEmail()); + }}); + + fillJson.put("components", list); + + String jsonParma = fillJson.toString(); + + //生成签名鉴权方式的的header + Map header = null; + try { + header = EsignHttpHelper.signAndBuildSignAndJsonHeader(appId, appSecret, jsonParma, requestType.name(), apiaddr, true); + //发起接口请求 + EsignHttpResponse createByDocTemplate = EsignHttpHelper.doCommHttp(serverUrl, apiaddr, requestType, jsonParma, header, true); + log.info("合同生成数据:{}", createByDocTemplate); + if (createByDocTemplate.getStatus() != 200) { + return false; + } + + EsignContractFillingFile esignContractFillingFile = new EsignContractFillingFile(); + + JSONObject jsonObject = JSONUtil.parseObj(createByDocTemplate.getBody()).getJSONObject("data"); + esignContractFillingFile.setUnsigned_contract_url(jsonObject.getStr("fileDownloadUrl")); + + // 把合同文件 url 上传到cos服务器 + String cosFileName = TENGXUN_DEFAULT_DIR.concat("/").concat("contract") + .concat("/").concat(mchLicenseNumber).concat("/") + .concat(jsonObject.getStr("fileId")).concat(".pdf"); + // 上传到cos服务器 + String localFileUrl = ossService.uploadObject4OSS(esignContractFillingFile.getUnsigned_contract_url(), cosFileName); + esignContractFillingFile.setUnsigned_contract_local_url(localFileUrl); + + esignContractFillingFile.setDoc_template_id(templateId); + esignContractFillingFile.setContract_number(contractNumber + seq); + esignContractFillingFile.setContract_name(fileName); + esignContractFillingFile.setStore_id(contractNumber); + esignContractFillingFile.setMobile(mchMobile); + esignContractFillingFile.setDoc_template_filling_values(jsonParma); + esignContractFillingFile.setSeq(seq); + esignContractFillingFile.setStatus(CommonConstant.Enable); + + if (esignContractFillingFileService.trySaveRecord(esignContractFillingFile)) { + successCnt += 1; + } + + } catch (EsignDemoException e) { + throw new RuntimeException(e); + } + } + + return successCnt > 0; + } + + /** + * 更加双方营业执照号码填充合同模版,生成合同文件地址 + * + * @param mchLicenseNumber 入驻商家(甲方)的营业执照号 + * @param platLicenseNumber 平台方(代理商方)(乙方)营业执照号 + * @return + */ + public Boolean fillDocTemplate2(String mchLicenseNumber, String platLicenseNumber) { + // 获取平台方的信息 + EsignPlatformInfo esignPlatformInfo = new EsignPlatformInfo(); + if (StrUtil.isNotEmpty(platLicenseNumber)) { + esignPlatformInfo = esignPlatformInfoService.getEsignPlatformInfo(null, platLicenseNumber); + } + if (ObjectUtils.isEmpty(esignPlatformInfo)) { + esignPlatformInfo = esignPlatformInfoService.getEsignPlatformInfo(0, ""); + } + + if (ObjectUtils.isEmpty(esignPlatformInfo)) { + log.error("缺少平台方(代理商方)信息"); + return null; + } + + // 获取入驻商家(审批通过的)的信息 + ShopMerchEntry shopMerchEntry = shopMerchEntryService.getShopMerchEntryByLicenseNumber("", mchLicenseNumber, CommonConstant.MCH_APPR_STA_PASS); + if (shopMerchEntry == null) { + log.error("缺少商家入驻信息"); + return null; + } + + String apiaddr = "/v3/files/create-by-doc-template"; + EsignRequestType requestType = EsignRequestType.POST; + // 获取平台方(代理商方)合同模版信息 JSONArray templates = JSONUtil.parseArray(esignPlatformInfo.getDoc_template()); if (ObjectUtils.isEmpty(templates) || templates.size() != 3) { @@ -321,6 +535,7 @@ public class EsignContractFillingFileServiceImpl extends BaseServiceImpl implements EsignContractService { - /** - * @param s - * @param s1 - * @return - */ + @Override public Object signFlowCreateByFile() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("docs", new JSONArray() { + }); return null; } } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignPlatformInfoServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignPlatformInfoServiceImpl.java index 77a53159..d37503ef 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignPlatformInfoServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignPlatformInfoServiceImpl.java @@ -11,6 +11,7 @@ package com.suisung.mall.shop.esign.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.suisung.mall.common.constant.CommonConstant; import com.suisung.mall.common.modules.esign.EsignPlatformInfo; import com.suisung.mall.common.utils.phone.PhoneNumberUtils; import com.suisung.mall.core.web.service.impl.BaseServiceImpl; @@ -34,7 +35,8 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - if (ObjectUtils.isEmpty(type)) { + queryWrapper.eq("status", CommonConstant.Enable); + if (!ObjectUtils.isEmpty(type)) { queryWrapper.eq("type", type); }