|
@@ -23,6 +23,8 @@ import com.ruoyi.agent.mapper.AgentMapper;
|
|
|
import com.ruoyi.agent.service.IAgentAccountCodeService;
|
|
import com.ruoyi.agent.service.IAgentAccountCodeService;
|
|
|
import com.ruoyi.agent.service.IAgentBalanceRecordService;
|
|
import com.ruoyi.agent.service.IAgentBalanceRecordService;
|
|
|
import com.ruoyi.agent.service.IAgentService;
|
|
import com.ruoyi.agent.service.IAgentService;
|
|
|
|
|
+import com.ruoyi.base.platform.domain.vo.PlatformInfoVo;
|
|
|
|
|
+import com.ruoyi.base.platform.service.IPlatformInfoService;
|
|
|
import com.ruoyi.business.domain.bo.BusinessBo;
|
|
import com.ruoyi.business.domain.bo.BusinessBo;
|
|
|
import com.ruoyi.business.domain.vo.BusinessVo;
|
|
import com.ruoyi.business.domain.vo.BusinessVo;
|
|
|
import com.ruoyi.business.service.IBusinessService;
|
|
import com.ruoyi.business.service.IBusinessService;
|
|
@@ -32,10 +34,9 @@ import com.ruoyi.common.enums.ExceptionEnum;
|
|
|
import com.ruoyi.common.enums.InviteType;
|
|
import com.ruoyi.common.enums.InviteType;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.BeanCopyUtils;
|
|
import com.ruoyi.common.utils.BeanCopyUtils;
|
|
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.ShareCodeUtils;
|
|
import com.ruoyi.common.utils.ShareCodeUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import com.ruoyi.base.platform.domain.vo.PlatformInfoVo;
|
|
|
|
|
-import com.ruoyi.base.platform.service.IPlatformInfoService;
|
|
|
|
|
import com.ruoyi.tool.service.JzqService;
|
|
import com.ruoyi.tool.service.JzqService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -170,16 +171,16 @@ public class AgentServiceImpl implements IAgentService {
|
|
|
//生成邀请码
|
|
//生成邀请码
|
|
|
String inviteCode = ShareCodeUtils.idToCode(Long.parseLong(add.getPhone()));
|
|
String inviteCode = ShareCodeUtils.idToCode(Long.parseLong(add.getPhone()));
|
|
|
add.setInviteCode(InviteType.AGENT.getCode() + inviteCode);
|
|
add.setInviteCode(InviteType.AGENT.getCode() + inviteCode);
|
|
|
- //签合同 TODO
|
|
|
|
|
-// Boolean signFlag = jzqService.uploadPersSign(bo.getIdCard(), bo.getSignImage());
|
|
|
|
|
-// if(!signFlag){
|
|
|
|
|
-// throw new ServiceException(AgentExceptionEnum.Agent_SIGN_FAIL);
|
|
|
|
|
-// }
|
|
|
|
|
-// String contractNo = jzqService.applySign(buildSignatories(add));
|
|
|
|
|
-// if (StringUtils.isEmpty(contractNo)) {
|
|
|
|
|
-// throw new ServiceException(AgentExceptionEnum.Agent_SIGN_CONTRACT_FAIL);
|
|
|
|
|
-// }
|
|
|
|
|
-// add.setContractNo(contractNo);
|
|
|
|
|
|
|
+ //签合同
|
|
|
|
|
+ Boolean signFlag = jzqService.uploadPersSign(bo.getIdCard(), bo.getSignImage());
|
|
|
|
|
+ if(!signFlag){
|
|
|
|
|
+ throw new ServiceException(AgentExceptionEnum.Agent_SIGN_FAIL);
|
|
|
|
|
+ }
|
|
|
|
|
+ String contractNo = jzqService.applySign(buildSignatories(add));
|
|
|
|
|
+ if (StringUtils.isEmpty(contractNo)) {
|
|
|
|
|
+ throw new ServiceException(AgentExceptionEnum.Agent_SIGN_CONTRACT_FAIL);
|
|
|
|
|
+ }
|
|
|
|
|
+ add.setContractNo(contractNo);
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
if (flag) {
|
|
|
bo.setAgentId(add.getAgentId());
|
|
bo.setAgentId(add.getAgentId());
|
|
@@ -187,22 +188,8 @@ public class AgentServiceImpl implements IAgentService {
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private JSONArray buildSignatories(Agent agent) {
|
|
|
|
|
- /**
|
|
|
|
|
- * 签约方1(个人)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ private Map<String, Object> buildSignatories(Agent agent) {
|
|
|
JSONArray signatories = new JSONArray();
|
|
JSONArray signatories = new JSONArray();
|
|
|
- SignatoryReq sReq = new SignatoryReq();
|
|
|
|
|
- sReq.setFullName(agent.getRealName()); //姓名
|
|
|
|
|
- sReq.setIdentityType(1); //证件类型
|
|
|
|
|
- sReq.setIdentityCard(agent.getIdCard());//身份证号
|
|
|
|
|
- sReq.setMobile(agent.getPhone()); //手机号
|
|
|
|
|
- sReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.3047,\"offsetY\":0.2677}]},{\"page\":4,\"chaptes\":[{\"offsetX\":0.2378,\"offsetY\":0.1681}]}]");//坐标(X Y)定位签字位置
|
|
|
|
|
- // sReq.setSearchKey("服务组件");//关键字定位签字位置
|
|
|
|
|
- sReq.setNoNeedVerify(1); //取消签约前短信校验
|
|
|
|
|
- sReq.setServerCaAuto(0);//是否使用自动签署完成,0或null不使用,1自动(当且只当合同处理方式为部份自动或收集批量签时有效)
|
|
|
|
|
- sReq.setSignLevel(1);//签字类型,标准图形章或公章:0标准图形章,1公章或手写,2公章手写或手写,3个人方形标准章(用户类型是个人且姓名2-4个字符生效,其他情况默认使用系统标准图形章)
|
|
|
|
|
- signatories.add(sReq);
|
|
|
|
|
|
|
|
|
|
PlatformInfoVo platformInfoVo = platformInfoService.getInfo();
|
|
PlatformInfoVo platformInfoVo = platformInfoService.getInfo();
|
|
|
/**
|
|
/**
|
|
@@ -219,7 +206,73 @@ public class AgentServiceImpl implements IAgentService {
|
|
|
eReq.setNoNeedVerify(1);
|
|
eReq.setNoNeedVerify(1);
|
|
|
eReq.setServerCaAuto(1);//当前签约方自动签署
|
|
eReq.setServerCaAuto(1);//当前签约方自动签署
|
|
|
signatories.add(eReq);
|
|
signatories.add(eReq);
|
|
|
- return signatories;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 签约方1(个人)
|
|
|
|
|
+ */
|
|
|
|
|
+ SignatoryReq sReq = new SignatoryReq();
|
|
|
|
|
+ sReq.setFullName(agent.getRealName()); //姓名
|
|
|
|
|
+ sReq.setIdentityType(1); //证件类型
|
|
|
|
|
+ sReq.setIdentityCard(agent.getIdCard());//身份证号
|
|
|
|
|
+ sReq.setMobile(agent.getPhone()); //手机号
|
|
|
|
|
+ sReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.3047,\"offsetY\":0.2677}]},{\"page\":4,\"chaptes\":[{\"offsetX\":0.2378,\"offsetY\":0.1681}]}]");//坐标(X Y)定位签字位置
|
|
|
|
|
+ // sReq.setSearchKey("服务组件");//关键字定位签字位置
|
|
|
|
|
+ sReq.setNoNeedVerify(1); //取消签约前短信校验
|
|
|
|
|
+ sReq.setServerCaAuto(0);//是否使用自动签署完成,0或null不使用,1自动(当且只当合同处理方式为部份自动或收集批量签时有效)
|
|
|
|
|
+ sReq.setSignLevel(1);//签字类型,标准图形章或公章:0标准图形章,1公章或手写,2公章手写或手写,3个人方形标准章(用户类型是个人且姓名2-4个字符生效,其他情况默认使用系统标准图形章)
|
|
|
|
|
+ signatories.add(sReq);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> templateParams = new HashMap<>();
|
|
|
|
|
+ templateParams.put("enterpriseFullName", platformInfoVo.getEnterpriseFullName());
|
|
|
|
|
+ templateParams.put("legalPersonName", platformInfoVo.getLegalPersonName());
|
|
|
|
|
+ templateParams.put("uscCode", platformInfoVo.getUscCode());
|
|
|
|
|
+ templateParams.put("contractSigner", platformInfoVo.getContractSigner());
|
|
|
|
|
+ templateParams.put("signerMobile", platformInfoVo.getSignerMobile());
|
|
|
|
|
+ templateParams.put("registeredAddress", platformInfoVo.getRegisteredAddress());
|
|
|
|
|
+ if (AgentLevel.COUNTY_AGENT.equals(agent.getAgentLevel())) {
|
|
|
|
|
+ templateParams.put("regionIdCard", agent.getIdCard());
|
|
|
|
|
+ templateParams.put("regionRealName", agent.getRealName());
|
|
|
|
|
+ templateParams.put("regionPhone", agent.getPhone());
|
|
|
|
|
+ Agent parentAgent = loadById(agent.getParentAgentId(), true);
|
|
|
|
|
+ templateParams.put("idCard", parentAgent.getIdCard());
|
|
|
|
|
+ templateParams.put("realName", parentAgent.getRealName());
|
|
|
|
|
+ templateParams.put("phone", parentAgent.getPhone());
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 签约方1(个人)
|
|
|
|
|
+ */
|
|
|
|
|
+ SignatoryReq spReq = new SignatoryReq();
|
|
|
|
|
+ spReq.setFullName(parentAgent.getRealName()); //姓名
|
|
|
|
|
+ spReq.setIdentityType(1); //证件类型
|
|
|
|
|
+ spReq.setIdentityCard(parentAgent.getIdCard());//身份证号
|
|
|
|
|
+ spReq.setMobile(parentAgent.getPhone()); //手机号
|
|
|
|
|
+ spReq.setChapteJson("[{\"page\":0,\"chaptes\":[{\"offsetX\":0.3047,\"offsetY\":0.2677}]},{\"page\":4,\"chaptes\":[{\"offsetX\":0.2378,\"offsetY\":0.1681}]}]");//坐标(X Y)定位签字位置
|
|
|
|
|
+ // spReq.setSearchKey("服务组件");//关键字定位签字位置
|
|
|
|
|
+ spReq.setNoNeedVerify(1); //取消签约前短信校验
|
|
|
|
|
+ spReq.setServerCaAuto(0);//是否使用自动签署完成,0或null不使用,1自动(当且只当合同处理方式为部份自动或收集批量签时有效)
|
|
|
|
|
+ spReq.setSignLevel(1);//签字类型,标准图形章或公章:0标准图形章,1公章或手写,2公章手写或手写,3个人方形标准章(用户类型是个人且姓名2-4个字符生效,其他情况默认使用系统标准图形章)
|
|
|
|
|
+ signatories.add(spReq);
|
|
|
|
|
+ } else if (AgentLevel.PROVINCE_AGENT.equals(agent.getAgentLevel())) {
|
|
|
|
|
+ templateParams.put("idCard", agent.getIdCard());
|
|
|
|
|
+ templateParams.put("realName", agent.getRealName());
|
|
|
|
|
+ templateParams.put("phone", agent.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ Date date = new Date();
|
|
|
|
|
+ templateParams.put("signDate", DateUtils.parseDateToStr("yyyy年MM月dd日", date));
|
|
|
|
|
+ templateParams.put("signExpireDate", DateUtils.parseDateToStr("yyyy年MM月dd日", DateUtils.addYears(date, 1)));
|
|
|
|
|
+ //构建请求参数
|
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
|
+ params.put("serverCa", 1); //使用云证书
|
|
|
|
|
+ params.put("fileType", 2);
|
|
|
|
|
+ if (AgentLevel.PROVINCE_AGENT.equals(agent.getAgentLevel())) {
|
|
|
|
|
+ params.put("templateNo", "bgvp9cRmZcc=");
|
|
|
|
|
+ params.put("contractName", "软件代理销售合同"); //合同名称
|
|
|
|
|
+ } else {
|
|
|
|
|
+ params.put("templateNo", "QVzFDwUCzFg=");
|
|
|
|
|
+ params.put("contractName", "软件代理销售三方协议"); //合同名称
|
|
|
|
|
+ }
|
|
|
|
|
+ params.put("templateParams", templateParams.toString());
|
|
|
|
|
+ params.put("positionType", 2); //指定签字位置类型(0签字坐标,1表单域,2关键字)
|
|
|
|
|
+ params.put("signatories", signatories.toString());
|
|
|
|
|
+ return params;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|