ソースを参照

企业CA认证

FengChaoYu 6 ヶ月 前
コミット
f8ce1f520c

+ 28 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/AgentInfo.java

@@ -0,0 +1,28 @@
+package com.gree.mall.manager.bean.contract;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class AgentInfo {
+
+    @ApiModelProperty(value = "代理人姓名")
+    private String agentName = "";
+
+    @ApiModelProperty(value = "代理人证件号")
+    private String agentId = "";
+
+    @ApiModelProperty(value = "代理人手机号(仅支持国内运营商)")
+    private String agentMobile = "";
+
+    @ApiModelProperty(value = "代理人证件正面照下载地址")
+    private String agentIdFrontPath = "";
+
+    @ApiModelProperty(value = "代理人证件反面照下载地址")
+    private String agentIdBackPath = "";
+
+    @ApiModelProperty(value = "代理人银行卡号")
+    private String bankCardNo = "";
+}

+ 19 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/BankInfo.java

@@ -0,0 +1,19 @@
+package com.gree.mall.manager.bean.contract;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class BankInfo {
+
+    @ApiModelProperty(value = "代理人姓名")
+    private String bankName = "";
+
+    @ApiModelProperty(value = "代理人姓名")
+    private String bankId = "";
+
+    @ApiModelProperty(value = "代理人姓名")
+    private String subbranchName = "";
+}

+ 120 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/CompanyCaAuthVO.java

@@ -0,0 +1,120 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.IsYesNoEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@ApiModel
+@ZfireField(tbName = "a")
+public class CompanyCaAuthVO {
+
+    @ZfireField(hide = true)
+    private String companyCaAuthId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商户id")
+    private String companyWechatId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商户名称")
+    private String companyWechatName;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "所属公司")
+    private String belongCompany;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "所属公司编号")
+    private String belongCompanyCode;
+
+    @ApiModelProperty(value = "网点名称")
+    private String websitName;
+
+    @ApiModelProperty(value = "网点编号")
+    private String websitId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "公司名称")
+    private String companyName;
+
+    @ApiModelProperty(value = "公司地址")
+    private String companyAddress;
+
+    @ApiModelProperty(value = "统一社会信用代码")
+    private String taxNo;
+
+    @ApiModelProperty(value = "营业执照附件")
+    private String businessLicenseUrl;
+
+    @ApiModelProperty(value = "法人")
+    private String legalName;
+
+    @ApiModelProperty(value = "法人联系方式")
+    private String legalMobile;
+
+    @ApiModelProperty(value = "法人身份证")
+    private String legalIdCard;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大客户编号")
+    private String fadadaCustomerId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大认证交易号")
+    private String fadadaTransactionNo;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大认证地址")
+    private String fadadaAuthUrl;
+
+    @ApiModelProperty(value = "企业认证状态")
+    private IsYesNoEnum fadadaIsAuth;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大授权状态(0:未认证;1:管理员资料已提交;2:企业基本资料(没有申请表)已提交;3:已提交待审核;4:审核通过(认证完成);5:审核不通过;6:人工初审通过)")
+    private String fadadaStatus;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大不通过原因")
+    private String fadadaAuditFailReason;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大自动签授权交易号")
+    private String fadadaAuthAutoId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大自动签授权合同编号")
+    private String fadadaAuthAutoContractId;
+
+    @ApiModelProperty(value = "自动签章状态")
+    private IsYesNoEnum fadadaAuthAutoStatus;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大自动签授权地址")
+    private String fadadaAuthAutoUrl;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大自动签授权查看地址")
+    private String fadadaAuthAutoViewpdfUrl;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "法大大自动签授权下载地址")
+    private String fadadaAuthAutoDownloadUrl;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+}

+ 23 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/CompanyInfo.java

@@ -0,0 +1,23 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.fadada.sdk.verify.model.req.CompanyVerifyUrlParams;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class CompanyInfo extends CompanyVerifyUrlParams.CompanyInfo {
+
+    @ApiModelProperty(value = "企业名称")
+    private String companyName = "";
+
+    @ApiModelProperty(value = "统一社会信用代码")
+    private String creditNo = "";
+
+    @ApiModelProperty(value = "统一社会信用代码证件照路径")
+    private String creditImagePath = "";
+
+}

+ 32 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/LegalInfo.java

@@ -0,0 +1,32 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.fadada.sdk.verify.model.req.CompanyVerifyUrlParams;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class LegalInfo extends CompanyVerifyUrlParams.LegalInfo {
+
+    @ApiModelProperty(value = "法人姓名")
+    private String legalName = "";
+
+    @ApiModelProperty(value = "法人证件号")
+    private String legalId = "";
+
+    @ApiModelProperty(value = "法人手机号(仅支持国内运营商)")
+    private String legalMobile = "";
+
+    @ApiModelProperty(value = "法人证件正面照下载地址")
+    private String legalIdFrontPath = "";
+
+    @ApiModelProperty(value = "法人证件反面照下载地址")
+    private String legalIdBackPath = "";
+
+    @ApiModelProperty(value = "法人银行卡号")
+    private String bankCardNo = "";
+
+}

+ 4 - 1
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -9,6 +9,7 @@ import com.gree.mall.manager.bean.charging.ChargingStandardBean;
 import com.gree.mall.manager.bean.common.AmityUrlVO;
 import com.gree.mall.manager.bean.common.CallRecordOrderVo;
 import com.gree.mall.manager.bean.common.CallRecordVo;
+import com.gree.mall.manager.bean.contract.CompanyCaAuthVO;
 import com.gree.mall.manager.bean.contract.ContractTemplateVO;
 import com.gree.mall.manager.bean.contract.ContractWebsitBean;
 import com.gree.mall.manager.bean.contract.SettleRelaConfigVO;
@@ -717,5 +718,7 @@ public interface CommonMapper {
                                                     @Param("websitId") String websitId,
                                                     @Param("websitName") String websitName);
 
-    IPage<CallRecordOrderVo> listOrder(Page page,  @Param("ex") ZfireParamBean zfireParam);
+    IPage<CallRecordOrderVo> listOrder(Page page, @Param("ex") ZfireParamBean zfireParam);
+
+    IPage<CompanyCaAuthVO> companyCaAuthPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 }

+ 82 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/contract/CompanyCaAuthController.java

@@ -0,0 +1,82 @@
+package com.gree.mall.manager.controller.contract;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.contract.CompanyCaAuthVO;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.contract.CompanyCaAuthLogic;
+import com.gree.mall.manager.plus.entity.CompanyCaAuth;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@RestController
+@Api(value = "企业CA认证API", tags ={"企业CA认证API"} )
+@RequestMapping("/company/ca/auth")
+public class CompanyCaAuthController {
+
+    @Resource
+    CompanyCaAuthLogic companyCaAuthLogic;
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "企业CA认证-列表")
+    public ResponseHelper<IPage<CompanyCaAuthVO>> list(@RequestBody ZfireParamBean zfireParamBean) {
+        IPage<CompanyCaAuthVO> list = companyCaAuthLogic.list(zfireParamBean);
+        return ResponseHelper.success(list, new TypeReference<CompanyCaAuthVO>() {
+        });
+    }
+
+    @PostMapping("/list/export")
+    @ApiOperation(value = "企业CA认证-导出")
+    public void listExport(@RequestBody ZfireParamBean zfireParamBean, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        //2.查询要导出的内容
+        IPage<CompanyCaAuthVO> list = companyCaAuthLogic.list(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(list.getRecords(), zfireParamBean.getExportFields(), request, response);
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation(value = "企业CA认证-详情")
+    public ResponseHelper<CompanyCaAuth> detail(@RequestParam String companyCaAuthId) {
+        CompanyCaAuth detail = companyCaAuthLogic.detail(companyCaAuthId);
+        return ResponseHelper.success(detail);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "企业CA认证-添加")
+    public ResponseHelper add(@RequestBody CompanyCaAuth companyCaAuth) {
+        companyCaAuthLogic.add(companyCaAuth);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/update")
+    @ApiOperation(value = "企业CA认证-修改")
+    public ResponseHelper update(@RequestBody CompanyCaAuth companyCaAuth) {
+        companyCaAuthLogic.update(companyCaAuth);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/del")
+    @ApiOperation(value = "企业CA认证-删除")
+    public ResponseHelper delete(@RequestParam String companyCaAuthId) {
+        companyCaAuthLogic.delete(companyCaAuthId);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/get/auth")
+    @ApiOperation(value = "企业CA认证-获取法大大认证")
+    public ResponseHelper getAuth(@RequestParam String companyCaAuthId) throws Exception {
+        String url = companyCaAuthLogic.getAuth(companyCaAuthId);
+        return ResponseHelper.success(url);
+    }
+}

+ 30 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/fadada/ContractCommonController.java

@@ -0,0 +1,30 @@
+package com.gree.mall.manager.controller.fadada;
+
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.utils.fadada.Auth4FDDUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(value = "法大大通用API", tags ={"法大大通用API"} )
+@RequestMapping("fdd/common")
+public class ContractCommonController {
+
+    @PostMapping("view/contract")
+    @ApiOperation(value = "查看合同")
+    public ResponseHelper<String> viewContract(@RequestParam String contractId) {
+        String url = Auth4FDDUtil.viewContract(contractId);
+        return ResponseHelper.success(url);
+    }
+
+    @PostMapping("download/contract")
+    @ApiOperation(value = "下载合同")
+    public ResponseHelper<String> downloadContract(@RequestParam String contractId) {
+        String url = Auth4FDDUtil.downloadContract(contractId);
+        return ResponseHelper.success(url);
+    }
+}

+ 49 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/fadada/NotifyController.java

@@ -0,0 +1,49 @@
+package com.gree.mall.manager.controller.fadada;
+
+import com.gree.mall.manager.annotation.ApiNotAuth;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.fadada.FDDNotifyLogic;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.integration.redis.util.RedisLockRegistry;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RequiredArgsConstructor
+@RestController
+@Api(value = "法大大回调通知API", tags ={"法大大回调通知API"} )
+@RequestMapping("/fdd/notify")
+public class NotifyController {
+
+    private final FDDNotifyLogic fddNotifyLogic;
+    private final RedisLockRegistry redisLockRegistry;
+
+    @ApiNotAuth
+    @RequestMapping("/company/ca/auth")
+    @ApiOperation(value = "CA实名企业认证回调")
+    public ResponseHelper<String> caCompanyAuthResultPost(@RequestParam Map<String, String> params) throws Exception {
+        fddNotifyLogic.caCompanyAuthResult(params);
+        return ResponseHelper.success();
+    }
+
+    @ApiNotAuth
+    @RequestMapping("/company/ca/auth/auto")
+    @ApiOperation(value = "CA实名企业授权自动签回调")
+    public ResponseHelper<String> caCompanyAuthAutoResultPost(@RequestParam Map<String, String> params) throws Exception {
+        fddNotifyLogic.caCompanyAuthAutoResult(params);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/find/company/auth/result")
+    @ApiOperation(value = "CA实名企业结果查询")
+    public ResponseHelper<String> findCompanyAuthResult(@RequestParam String transactionNo) throws Exception {
+        fddNotifyLogic.queryCACompanyAuthResult(transactionNo);
+        return ResponseHelper.success();
+    }
+
+}

+ 189 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/contract/CompanyCaAuthLogic.java

@@ -0,0 +1,189 @@
+package com.gree.mall.manager.logic.contract;
+
+import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.contract.CompanyCaAuthVO;
+import com.gree.mall.manager.bean.contract.CompanyInfo;
+import com.gree.mall.manager.bean.contract.LegalInfo;
+import com.gree.mall.manager.commonmapper.CommonMapper;
+import com.gree.mall.manager.enums.IsYesNoEnum;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.CompanyCaAuth;
+import com.gree.mall.manager.plus.service.CompanyCaAuthService;
+import com.gree.mall.manager.utils.fadada.Auth4FDDUtil;
+import com.gree.mall.manager.utils.oss.OSSUtil;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class CompanyCaAuthLogic {
+
+    private final CommonLogic commonLogic;
+    private final CommonMapper commonMapper;
+    private final CompanyCaAuthService companyCaAuthService;
+    private final OSSUtil ossUtil;
+    @Value("${fadada.company.auth.page-modify}")
+    private String fddAuthPageModify;
+    @Value("${fadada.company.auth.verified-way}")
+    private String fddAuthVerifiedWay;
+    @Value("${fadada.company.auth.notify.url}")
+    private String fddAuthNotifyUrl;
+    @Value("${fadada.company.auth.return.url}")
+    private String fddAuthReturnUrl;
+
+    public IPage<CompanyCaAuthVO> list(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        FieldUtils.supplyParam(zfireParamBean, CompanyCaAuthVO.class, adminUser);
+        return commonMapper.companyCaAuthPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
+
+    public CompanyCaAuth detail(String companyCaAuthId) {
+        return companyCaAuthService.lambdaQuery()
+                .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuthId)
+                .one();
+    }
+
+    public void add(CompanyCaAuth companyCaAuth) {
+        CompanyCaAuth caAuth = companyCaAuthService.lambdaQuery()
+                .eq(CompanyCaAuth::getWebsitId, companyCaAuth.getWebsitId())
+                .one();
+        if (Objects.isNull(caAuth)) {
+            throw new RemoteServiceException("网点已存在");
+        }
+
+        this.checkInfo(companyCaAuth);
+        companyCaAuth.insert();
+    }
+
+    public void update(CompanyCaAuth companyCaAuth) {
+        this.checkInfo(companyCaAuth);
+        CompanyCaAuth byId = companyCaAuthService.getById(companyCaAuth.getCompanyCaAuthId());
+
+        // 对比关键信息是否变动
+        if (this.compareRequireValue(companyCaAuth, byId)) {
+            byId.setFadadaIsAuth(IsYesNoEnum.NO.getKey());
+        }
+        byId.updateById();
+    }
+
+    private void checkInfo(CompanyCaAuth companyCaAuth) {
+        if (StringUtils.isBlank(companyCaAuth.getCompanyName())) {
+            throw new RemoteServiceException("公司名称不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getCompanyAddress())) {
+            throw new RemoteServiceException("公司地址不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getTaxNo())) {
+            throw new RemoteServiceException("统一社会信用代码不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getBusinessLicenseUrl())) {
+            throw new RemoteServiceException("营业执照附件不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getLegalName())) {
+            throw new RemoteServiceException("法人不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getLegalMobile())) {
+            throw new RemoteServiceException("法人联系方式不能为空");
+        }
+        if (StringUtils.isBlank(companyCaAuth.getLegalIdCard())) {
+            throw new RemoteServiceException("法人身份证不能为空");
+        }
+    }
+
+    private boolean compareRequireValue(CompanyCaAuth c1, CompanyCaAuth c2) {
+        boolean flag = false;
+        if (!c1.getCompanyName().trim().equals(c2.getCompanyName().trim())) {
+            c2.setCompanyName(c1.getCompanyName().trim());
+            flag = true;
+        }
+        if (!c1.getCompanyAddress().trim().equals(c2.getCompanyAddress().trim())) {
+            c2.setCompanyAddress(c1.getCompanyAddress().trim());
+            flag = true;
+        }
+        if (!c1.getTaxNo().trim().equals(c2.getTaxNo().trim())) {
+            c2.setTaxNo(c1.getTaxNo().trim());
+            flag = true;
+        }
+        if (!c1.getBusinessLicenseUrl().trim().equals(c2.getBusinessLicenseUrl().trim())) {
+            c2.setBusinessLicenseUrl(c1.getBusinessLicenseUrl().trim());
+            flag = true;
+        }
+        if (!c1.getLegalName().trim().equals(c2.getLegalName().trim())) {
+            c2.setLegalName(c1.getLegalName().trim());
+            flag = true;
+        }
+        if (!c1.getLegalMobile().trim().equals(c2.getLegalMobile().trim())) {
+            c2.setLegalMobile(c1.getLegalMobile().trim());
+            flag = true;
+        }
+        if (!c1.getLegalIdCard().trim().equals(c2.getLegalIdCard().trim())) {
+            c2.setLegalIdCard(c1.getLegalIdCard().trim());
+            flag = true;
+        }
+        return flag;
+    }
+
+    public void delete(String companyCaAuthId) {
+        companyCaAuthService.lambdaUpdate()
+                .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuthId)
+                .remove();
+    }
+
+    public String getAuth(String companyCaAuthId) throws Exception {
+        CompanyCaAuth companyCaAuth = companyCaAuthService.getById(companyCaAuthId);
+        if (Objects.isNull(companyCaAuth)) {
+            throw new RemoteServiceException("企业CA认证不存在");
+        }
+
+        if (companyCaAuth.getFadadaIsAuth().equals(IsYesNoEnum.YES.getKey())) {
+            throw new RemoteServiceException("法大大已认证");
+        }
+
+        if (StringUtils.isBlank(companyCaAuth.getFadadaStatus()) && StringUtils.isNotBlank(companyCaAuth.getFadadaAuthUrl())) {
+            // 法大大认证状态为空并且认证地址不为空时返回认证地址
+            return companyCaAuth.getFadadaAuthUrl();
+        }
+
+        if (StringUtils.isBlank(companyCaAuth.getFadadaCustomerId())) {
+            String id = Auth4FDDUtil.regAccount("2", companyCaAuth.getWebsitId()).get("data", String.class);
+            companyCaAuth.setFadadaCustomerId(id);
+        }
+
+        CompanyInfo company = new CompanyInfo();
+        company.setCompanyName(companyCaAuth.getCompanyName());
+        company.setCreditNo(companyCaAuth.getTaxNo());
+        company.setCreditImagePath(ossUtil.getUrlWw(companyCaAuth.getBusinessLicenseUrl()));
+
+        LegalInfo legal = new LegalInfo();
+        legal.setLegalName(companyCaAuth.getLegalName());
+        legal.setLegalId(companyCaAuth.getLegalIdCard());
+        legal.setLegalMobile(companyCaAuth.getLegalMobile());
+
+        JSONObject resultJson = Auth4FDDUtil.getAuthCompanyUrl(companyCaAuth.getFadadaCustomerId(), this.fddAuthPageModify,
+                this.fddAuthVerifiedWay, null, null, null,
+                null, null, null, null, null,
+                null, null, null, null, null, this.fddAuthNotifyUrl,
+                null, company, legal, null, null);
+
+        JSONObject data = resultJson.getJSONObject("data");
+        String authUrl = Auth4FDDUtil.decodeUrl(data.get("url", String.class));
+
+        companyCaAuth.setFadadaTransactionNo(data.get("transactionNo", String.class))
+                .setFadadaAuthUrl(authUrl);
+        companyCaAuth.updateById();
+
+        return authUrl;
+    }
+}

+ 164 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/fadada/FDDNotifyLogic.java

@@ -0,0 +1,164 @@
+package com.gree.mall.manager.logic.fadada;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.gree.mall.manager.enums.IsYesNoEnum;
+import com.gree.mall.manager.plus.entity.CompanyCaAuth;
+import com.gree.mall.manager.plus.service.AdminWebsitService;
+import com.gree.mall.manager.plus.service.CompanyCaAuthService;
+import com.gree.mall.manager.utils.fadada.Auth4FDDUtil;
+import com.gree.mall.manager.utils.oss.OSSUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.integration.redis.util.RedisLockRegistry;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class FDDNotifyLogic {
+
+    private final RedisLockRegistry redisLockRegistry;
+    private final OSSUtil ossUtil;
+    private final CompanyCaAuthService companyCaAuthService;
+    private final AdminWebsitService adminWebsitService;
+    @Value("${fadada.company.auth.auto.notify.url}")
+    private String fddAuthAutoNotifyUrl;
+
+    /**
+     * CA实名企业认证回调
+     * @param params
+     */
+    public void caCompanyAuthResult(Map<String, String> params) {
+        log.info("CA法大大实名企业认证回调通知结果:{}", JSONUtil.toJsonStr(params));
+        if (!validCACompanyAuthSign(params)) {
+            return;
+        }
+        this.queryCACompanyAuthResult(params.get("serialNo"));
+    }
+
+    private boolean validCACompanyAuthSign(Map<String, String> params) {
+        if (CollectionUtil.isEmpty(params)) {
+            return false;
+        }
+        String authenticationType = params.get("authenticationType");
+        String certStatus = params.get("certStatus");
+        String customerId = params.get("customerId");
+        String serialNo = params.get("serialNo");
+        String status = params.get("status");
+        String statusDesc = params.get("statusDesc");
+        String timestamp = params.get("timestamp");
+        String sign = params.get("sign");
+        String signStr = authenticationType + certStatus + customerId + serialNo + status + statusDesc;
+        String newSign = Auth4FDDUtil.getMsgDigest(signStr, timestamp);
+        log.info("CA法大大实名企业认证回调验签:{} {}", sign, newSign);
+        return sign.equals(newSign);
+    }
+
+    public void queryCACompanyAuthResult(String transactionNo) {
+        CompanyCaAuth companyCaAuth = companyCaAuthService.lambdaQuery()
+                .eq(CompanyCaAuth::getFadadaTransactionNo, transactionNo)
+                .one();
+        if (Objects.isNull(companyCaAuth)) {
+            log.error("法大大实名企业交易号不存在:" + transactionNo);
+            return;
+        }
+
+        JSONObject info = Auth4FDDUtil.findCompanyCertInfo(transactionNo);
+        JSONObject data = info.getJSONObject("data");
+        JSONObject company = data.getJSONObject("company");
+        JSONObject manager = data.getJSONObject("manager");
+        String companyStatus = company.get("status", String.class);
+        String managerStatus = manager.get("status", String.class);
+        if (companyStatus.equals("4") && managerStatus.equals("2")) {
+            String authAutoId = IdWorker.get32UUID();
+            String authAutoContractId = IdWorker.getIdStr();
+            String authAutoUrl = Auth4FDDUtil.beforeAuthAuto(authAutoId, authAutoContractId,
+                    companyCaAuth.getFadadaCustomerId(), null, this.fddAuthAutoNotifyUrl);
+            companyCaAuthService.lambdaUpdate()
+                    .set(CompanyCaAuth::getFadadaIsAuth, IsYesNoEnum.YES.getKey())
+                    .set(CompanyCaAuth::getFadadaStatus, companyStatus)
+                    .set(CompanyCaAuth::getFadadaAuditFailReason, null)
+                    .set(CompanyCaAuth::getFadadaAuthAutoId, authAutoId)
+                    .set(CompanyCaAuth::getFadadaAuthAutoContractId, authAutoContractId)
+                    .set(CompanyCaAuth::getFadadaAuthAutoUrl, authAutoUrl)
+                    .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuth.getCompanyCaAuthId())
+                    .update();
+        } else {
+            String statusDesc = "";
+            if (!managerStatus.equals("2")) {
+                statusDesc = manager.get("auditFailReason", String.class);
+                companyCaAuthService.lambdaUpdate()
+                        .set(CompanyCaAuth::getFadadaIsAuth, IsYesNoEnum.NO.getKey())
+                        .set(CompanyCaAuth::getFadadaStatus, "M" + managerStatus)
+                        .set(CompanyCaAuth::getFadadaAuditFailReason, statusDesc)
+                        .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuth.getCompanyCaAuthId())
+                        .update();
+            } else {
+                statusDesc = company.get("auditFailReason", String.class);
+                companyCaAuthService.lambdaUpdate()
+                        .set(CompanyCaAuth::getFadadaIsAuth, IsYesNoEnum.NO.getKey())
+                        .set(CompanyCaAuth::getFadadaStatus, "C" + companyStatus)
+                        .set(CompanyCaAuth::getFadadaAuditFailReason, statusDesc)
+                        .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuth.getCompanyCaAuthId())
+                        .update();
+            }
+        }
+    }
+
+    public void caCompanyAuthAutoResult(Map<String, String> params) {
+        log.info("CA法大大实名企业授权自动签回调通知结果:{}", JSONUtil.toJsonStr(params));
+        if (!validCACompanyAuthAutoSign(params)) {
+            return;
+        }
+        this.queryCACompanyAuthAutoResult(params);
+    }
+
+    private boolean validCACompanyAuthAutoSign(Map<String, String> params) {
+        if (CollectionUtil.isEmpty(params)) {
+            return false;
+        }
+        String transactionId = params.get("transaction_id");
+        String timestamp = params.get("timestamp");
+        String sign = params.get("msg_digest");
+        String newSign = Auth4FDDUtil.getMsgDigest(transactionId, timestamp);
+        log.info("CA法大大实名企业授权自动签回调验签:{} {}", sign, newSign);
+        return sign.equals(newSign);
+    }
+
+    private void queryCACompanyAuthAutoResult(Map<String, String> params) {
+        String transactionId = params.get("transaction_id");
+        String contractId = params.get("contract_id");
+        String viewPdfUrl = params.get("viewpdf_url");
+        String downloadUrl = params.get("download_url");
+        CompanyCaAuth companyCaAuth = companyCaAuthService.lambdaQuery()
+                .eq(CompanyCaAuth::getFadadaAuthAutoId, transactionId)
+                .eq(CompanyCaAuth::getFadadaAuthAutoContractId, contractId)
+                .one();
+        if (Objects.isNull(companyCaAuth)) {
+            log.error("法大大企业授权自动签交易号不存在:" + transactionId);
+            return;
+        }
+
+        JSONObject info = Auth4FDDUtil.queryAuthAutoStatus(companyCaAuth.getFadadaCustomerId());
+        JSONObject data = info.getJSONObject("data");
+        String queryTransactionNo = data.get("transactionId", String.class);
+        String queryContractId = data.get("contractId", String.class);
+        String queryStatus = data.get("status", String.class);
+        if (queryTransactionNo.equals(transactionId) && queryContractId.equals(contractId) && queryStatus.equals("1")) {
+            companyCaAuthService.lambdaUpdate()
+                    .set(CompanyCaAuth::getFadadaAuthAutoStatus, IsYesNoEnum.YES.getKey())
+                    .set(CompanyCaAuth::getFadadaAuthAutoViewpdfUrl, viewPdfUrl)
+                    .set(CompanyCaAuth::getFadadaAuthAutoDownloadUrl, downloadUrl)
+                    .eq(CompanyCaAuth::getCompanyCaAuthId, companyCaAuth.getCompanyCaAuthId())
+                    .update();
+        }
+    }
+
+}

+ 6 - 6
mall-server-api/src/main/resources/bootstrap-dev.properties

@@ -118,14 +118,14 @@ fadada.app.host=https://testapi04.fadada.com/api/
 fadada.company.auth.page-modify=1
 fadada.company.auth.verified-way=3
 fadada.company.auth.return.url=
-fadada.company.auth.notify.url=${jiasm.system.url}/fdd/notify/company/ca/auth
-fadada.company.auth.auto.notify.url=${jiasm.system.url}/fdd/notify/company/ca/auth/auto
+fadada.company.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/auth
+fadada.company.auth.auto.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/auth/auto
 fadada.company.sign.return.url=
-fadada.company.sign.notify.url=${jiasm.system.url}/fdd/notify/company/ca/sign
+fadada.company.sign.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/sign
 fadada.websit.auth.page-modify=1
 fadada.websit.auth.verified-way=3
-fadada.websit.auth.notify.url=${jiasm.system.url}/fdd/notify/websit/auth
-fadada.websit.sign.notify.url=${jiasm.system.url}/fdd/notify/websit/batch/sign
-fadada.websit.person.auth.notify.url=${jiasm.system.url}/fdd/notify/websit/person
+fadada.websit.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/auth
+fadada.websit.sign.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/batch/sign
+fadada.websit.person.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/person
 
 

+ 6 - 6
mall-server-api/src/main/resources/bootstrap-test.properties

@@ -107,12 +107,12 @@ fadada.app.host=https://testapi04.fadada.com/api/
 fadada.company.auth.page-modify=1
 fadada.company.auth.verified-way=3
 fadada.company.auth.return.url=
-fadada.company.auth.notify.url=${jiasm.system.url}/fdd/notify/company/ca/auth
-fadada.company.auth.auto.notify.url=${jiasm.system.url}/fdd/notify/company/ca/auth/auto
+fadada.company.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/auth
+fadada.company.auth.auto.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/auth/auto
 fadada.company.sign.return.url=
-fadada.company.sign.notify.url=${jiasm.system.url}/fdd/notify/company/ca/sign
+fadada.company.sign.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/company/ca/sign
 fadada.websit.auth.page-modify=1
 fadada.websit.auth.verified-way=3
-fadada.websit.auth.notify.url=${jiasm.system.url}/fdd/notify/websit/auth
-fadada.websit.sign.notify.url=${jiasm.system.url}/fdd/notify/websit/batch/sign
-fadada.websit.person.auth.notify.url=${jiasm.system.url}/fdd/notify/websit/person
+fadada.websit.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/auth
+fadada.websit.sign.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/batch/sign
+fadada.websit.person.auth.notify.url=${sys.url}/${server.servlet.context-path}/fdd/notify/websit/person

+ 13 - 0
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1441,4 +1441,17 @@
         </where>
         ORDER BY b.belong_company_code, a.parent_id, a.sub_websit_id
     </select>
+
+    <select id="companyCaAuthPage" resultType="com.gree.mall.manager.bean.contract.CompanyCaAuthVO">
+        SELECT
+            ${ex.selected}
+        FROM
+            company_ca_auth a
+            LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
 </mapper>