Commit 33d1d35b authored by 5359's avatar 5359

测试环境文件提交

parent 72375a1c
......@@ -231,6 +231,27 @@ public class SignHclcController extends BaseController {
BeanUtils.copyProperties(dto, signUserInfoHclcHis);
signUserInfoHclcHisService.insert(iRequest, signUserInfoHclcHis);
//注销经办人用户
map = signHclcService.deletePersonAccount(iRequest, dto);
if ("0".equalsIgnoreCase(map.get("code").toString()) || "40051667".equalsIgnoreCase(map.get("code").toString()) || "000003".equalsIgnoreCase(map.get("code").toString())) {
// if ("N".equalsIgnoreCase(dto.getIsManagerFlag())) {
// map = organSignHclcService.unBindOrgansAgent(dto);
// }
signHclcService.deleteByPrimaryKey(dto);
//复制用户信息到历史表
//初始化经办人人脸识别信息
SignUserInfoHclc agentSignInfo = new SignUserInfoHclc();
agentSignInfo.setOpenId(dto.getOpenId() + "personHclc");
agentSignInfo = signHclcService.selectByPrimaryKey(iRequest, agentSignInfo);
SignUserInfoHclcHis agentUserInfoHclcHis = new SignUserInfoHclcHis();
BeanUtils.copyProperties(agentSignInfo, agentUserInfoHclcHis);
signUserInfoHclcHisService.insert(iRequest, agentUserInfoHclcHis);
signHclcService.deleteByPrimaryKey(agentSignInfo);
map.put("code", "0");
} else {
//重置结构用户信息为空
dto.setAccountId("");
dto.setAuthAccountId("");
......@@ -240,19 +261,6 @@ public class SignHclcController extends BaseController {
dto.setCreateMessage("");
dto.setManagerAuthFlag("N");
//注销经办人用户
//初始化经办人人脸识别信息
SignUserInfoHclc agentSignInfo = new SignUserInfoHclc();
agentSignInfo.setOpenId(dto.getOpenId());
// agentSignInfo.setIdNo(dto.getAgentIdNo());
// agentSignInfo.setMobile(dto.getMobile());
// agentSignInfo.setName(dto.getAgentName());
// agentSignInfo.setAccountId(dto.getAgentAccountId());
map = signHclcService.deletePersonAccount(iRequest, agentSignInfo);
if ("0".equalsIgnoreCase(map.get("code").toString()) || "40051667".equalsIgnoreCase(map.get("code").toString()) || "000003".equalsIgnoreCase(map.get("code").toString())) {
signHclcService.deleteByPrimaryKey(dto);
map.put("code", "0");
} else {
signHclcService.updateByPrimaryKey(iRequest, dto);
}
//机构已注销,accountaId为空的情况
......@@ -324,20 +332,20 @@ public class SignHclcController extends BaseController {
signUserInfoHclc.setOpenId(dto.getOpenId());
signUserInfoHclc = signHclcService.selectByPrimaryKey(iRequest, signUserInfoHclc);
if (Objects.nonNull(signUserInfoHclc) && Objects.nonNull(signUserInfoHclc.getOpenId())) {
if("Y".equalsIgnoreCase(dto.getManagerAuthFlag())){
map=organSignHclcService.bindOrgansAgent(signUserInfoHclc);
}else if("N".equalsIgnoreCase(dto.getManagerAuthFlag())){
map=organSignHclcService.unBindOrgansAgent(signUserInfoHclc);
}else{
if ("Y".equalsIgnoreCase(dto.getManagerAuthFlag())) {
map = organSignHclcService.bindOrgansAgent(signUserInfoHclc);
} else if ("N".equalsIgnoreCase(dto.getManagerAuthFlag())) {
map = organSignHclcService.unBindOrgansAgent(signUserInfoHclc);
} else {
map.put("code", "000003");
map.put("message", "managerAuthFlag参数有误,请检查!");
continue;
}
if("0".equalsIgnoreCase(map.get("code").toString())){
if ("0".equalsIgnoreCase(map.get("code").toString())) {
signHclcService.updateByPrimaryKeySelective(iRequest, dto);
map.put("code", "000000");
map.put("message", "操作成功!");
}else{
} else {
map.put("code", "000004");
}
}
......@@ -407,7 +415,8 @@ public class SignHclcController extends BaseController {
return map;
}
infoHclc.setIsManagerFlag("Y");
organSignHclcService.setOrganIndividualAssignment(iRequest, dto);
organSignHclcService.setOrganIndividualAssignment(iRequest, infoHclc);
organSignHclcService.bindOrgansAgent(infoHclc);
//原管理员角色
SignUserInfoHclc signUserInfoHclc = new SignUserInfoHclc();
......@@ -426,6 +435,41 @@ public class SignHclcController extends BaseController {
return map;
}
/**
* 外部机构绑定经办人
*
* @param request
* @param dto 外部机构绑定经办人
* @return Map
*/
@ResponseBody
@RequestMapping("/auth/api/bind/organs/agent")
public Map<String, Object> bindOrgansAgent(HttpServletRequest request,
@RequestBody SignUserInfoHclc dto) {
Map<String, Object> map = new HashMap<>();
IRequest iRequest = createRequestContext(request);
if (Objects.isNull(dto.getOpenId())) {
map.put("code", "000001");
map.put("message", "关键参数openId,调用失败!");
return map;
} else {
try {
dto = signInfoHclcMapper.selectByPrimaryKey(dto);
map = organSignHclcService.bindOrgansAgent(dto);
} catch (Exception e) {
map.put("code", "000003");
e.printStackTrace();
map.put("message", "操作失败" + e.getMessage() + ",请检查!");
return map;
}
}
map.put("code", "000000");
map.put("message", "操作成功!");
return map;
}
/**
* 下载微信图片资源上传业务系统
*
......
......@@ -29,4 +29,6 @@ public interface IOrganSignInfoHclcService extends IBaseService<SignUserInfoHclc
Map<String, Object> bindOrgansAgent(SignUserInfoHclc info);
Map<String, Object> unBindOrgansAgent(SignUserInfoHclc info);
void createOrgPersonInfo(String openId);
}
......@@ -62,7 +62,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
//业务系统接口信息
public static final String hclcSysName = "HCL_UPLOAD_FILE";
public static final String getManagerStatus = "getManagerStatus";
public static final String getManagerStatus = "GetAdminFlag";
private final static int HTTP_OK = 200;
......@@ -91,36 +91,46 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
//判断经办人是否管理员
String isManager;
//法人注册为管理员用户
if (info.getAgentType().compareTo(1L) == 0) {
isManager = "Y";
} else {
JSONObject param = new JSONObject();
param.put("name", info.getName());
param.put("org_name", info.getName());
param.put("agentIdNo", info.getAgentIdNo());
isManager = getManagerStatus(param);
}
//非管理员用户注册前判断企业是否已完成对应管理人角色注册
//注册前判断企业是否已完成对公打款认证
SignUserInfoHclc managerSignInfo = new SignUserInfoHclc();
if ("N".equalsIgnoreCase(isManager)) {
managerSignInfo.setIdNo(info.getIdNo());
managerSignInfo.setIsManagerFlag("Y");
managerSignInfo.setAuthFlag("Y");
List<SignUserInfoHclc> managerList = mapper.select(managerSignInfo);
if (Objects.isNull(managerList) || managerList.size() == 0) {
logger.error("请先完成企业电子合同管理人员注册!");
if ("N".equalsIgnoreCase(isManager)) {
logger.error("请先完成企业法人或管理人员注册!");
mapOrgan.put("code", "14");
mapOrgan.put("message", "请先完成企业电子合同管理人员注册!");
mapOrgan.put("message", "请先完成企业法人或管理人员注册!");
return mapOrgan;
}
info.setIsManagerFlag("N");
info.setManagerAuthFlag("N");
} else {
info.setIsManagerFlag("Y");
info.setManagerAuthFlag("Y");
managerSignInfo = managerList.get(0);
}
//用户信息不存在,新增用户信息,创建e签宝经办人账户,获取经办人人脸核验url
if (Objects.isNull(signInfoHclc)) {
info.setCtitype(2L);
info.setAuthFlag("N");
if ("N".equalsIgnoreCase(isManager)) {
info.setIsManagerFlag("N");
info.setManagerAuthFlag("N");
} else {
info.setIsManagerFlag("Y");
info.setManagerAuthFlag("Y");
}
signInfoHclc = this.insertSelective(iRequest, info);
accountStatus = "AGENT_ADD";
getUrlType = "AGENT";
......@@ -159,16 +169,18 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
//判断人脸核身认证状态,核验完成直接获取机构核验url
if ("SUCCESS".equalsIgnoreCase(signInfoHclcFace.getAuthStatus())) {
//非企业管理员用户不做对公打款认证
if ("N".equalsIgnoreCase(isManager)) {
//存在已完成公打款认证企业信息
if (Objects.nonNull(managerSignInfo.getOpenId())) {
//更新非企业管理员用户的企业认证信息
signInfoHclc.setAccountId(managerSignInfo.getAccountId());
signInfoHclc.setOrgAuthId(managerSignInfo.getOrgAuthId());
signInfoHclc.setAccountId("Y");
signInfoHclc.setAuthFlag("Y");
this.updateByPrimaryKey(iRequest, signInfoHclc);
createOrgPersonInfo(signInfoHclc.getOpenId());
mapOrgan.put("code", "2");
mapOrgan.put("message", "机构认证已完成,无需重复验证!");
mapOrgan.put("message", "机构认证已完成!");
return mapOrgan;
} else {
getUrlType = "ORG";
......@@ -341,6 +353,8 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
//判断人脸核身认证状态,核验完成直接结束任务
if (Objects.nonNull(signInfoHclcOrg)) {
if ("SUCCESS".equalsIgnoreCase(signInfoHclcOrg.getAuthStatus())) {
createOrgPersonInfo(signInfoHclc.getOpenId());
mapOrgan.put("code", "10");
mapOrgan.put("message", "企业对公打款认证已完成,无需重复验证!");
return mapOrgan;
......@@ -367,6 +381,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
if (Objects.nonNull(signInfoHclcOrg.getAuthId())) {
//判断对公打款认证状态,核验完成直接结束任务
if ("SUCCESS".equalsIgnoreCase(signInfoHclcOrg.getAuthStatus())) {
createOrgPersonInfo(signInfoHclc.getOpenId());
mapOrgan.put("code", "10");
mapOrgan.put("message", "企业对公打款认证已完成,无需重复验证!");
return mapOrgan;
......@@ -485,6 +500,30 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
return mapOrgan;
}
public void createOrgPersonInfo(String openId) {
SignUserInfoHclc userInfoHclc = new SignUserInfoHclc();
userInfoHclc.setOpenId(openId);
userInfoHclc = signInfoHclcMapper.selectByPrimaryKey(userInfoHclc);
SignUserInfoHclc personInfoHclc = new SignUserInfoHclc();
personInfoHclc.setOpenId(openId + "personHclc");
personInfoHclc = signInfoHclcMapper.selectByPrimaryKey(personInfoHclc);
if (Objects.isNull(personInfoHclc)) {
personInfoHclc = new SignUserInfoHclc();
personInfoHclc.setOpenId(openId + "personHclc");
personInfoHclc.setIdNo(userInfoHclc.getAgentIdNo());
personInfoHclc.setName(userInfoHclc.getAgentName());
personInfoHclc.setMobile(userInfoHclc.getMobile());
personInfoHclc.setAccountId(userInfoHclc.getAgentAccountId());
personInfoHclc.setSealId(userInfoHclc.getSealId());
personInfoHclc.setIsManagerFlag("N");
personInfoHclc.setManagerAuthFlag("N");
personInfoHclc.setCtitype(1L);
personInfoHclc.setAuthFlag("Y");
signInfoHclcMapper.insert(personInfoHclc);
}
}
public String getManagerStatus(JSONObject params) {
try {
......@@ -721,6 +760,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
/**
* 外部机构绑定经办人
*
* @param signInfoHclc
* @return
*/
......@@ -730,6 +770,12 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
JSONObject result = new JSONObject();
//绑定经办人账户
result.put("accountId", signInfoHclc.getAgentAccountId());
//默认经办人标志位
if ("Y".equalsIgnoreCase(signInfoHclc.getIsManagerFlag())) {
result.put("isDefault", "1");
} else {
result.put("isDefault", "0");
}
//当前登录账户ID
result.put("loginId", signInfoHclc.getAgentAccountId());
//机构账户
......@@ -748,7 +794,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
try {
//初始化接口信息
String url = iSignInfoHclcService.getApiUrl(signatureSysName,bindApiName);
String url = iSignInfoHclcService.getApiUrl(signatureSysName, bindApiName);
//发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, signHclcUtils1.APPLICATION_JSON);
......@@ -772,6 +818,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
/**
* 外部机构解绑经办人
*
* @param signInfoHclc
* @return
*/
......@@ -798,7 +845,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
try {
//初始化接口信息
String url = iSignInfoHclcService.getApiUrl(signatureSysName,unBindApiName);
String url = iSignInfoHclcService.getApiUrl(signatureSysName, unBindApiName);
//发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, signHclcUtils1.APPLICATION_JSON);
......@@ -847,6 +894,21 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
return map;
}
//企业管理员用户注销机构信息判断是否还存在非管理员经办人
SignUserInfoHclc userInfoHclc = new SignUserInfoHclc();
List<SignUserInfoHclc> userInfoHclcs = new ArrayList<>();
userInfoHclc.setIdNo(signInfoHclc.getIdNo());
userInfoHclc.setName(signInfoHclc.getName());
userInfoHclc.setAuthFlag("Y");
userInfoHclc.setIsManagerFlag("N");
userInfoHclcs = signInfoHclcMapper.select(signInfoHclc);
if (Objects.nonNull(userInfoHclcs) && userInfoHclcs.size() > 0) {
logger.debug("存在非管理员经办人,请先完成管理权限转移,再注销!");
map.put("code", "000013");
map.put("message", "存在非管理员经办人,请先完成管理权限转移,再注销!");
return map;
}
//业务方交互上下文信息
JSONObject result = new JSONObject();
//机构名称
......
......@@ -3,13 +3,17 @@ package com.hand.app.esignHclc.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hand.app.esignHclc.dto.SignUserInfoHclc;
import com.hand.app.esignHclc.dto.SignUserFaceHclc;
import com.hand.app.esignHclc.mapper.SignInfoHclcMapper;
import com.hand.app.esignHclc.service.IOrganSignInfoHclcService;
import com.hand.app.esignHclc.service.ISignInfoHclcFaceService;
import com.hand.app.esignHclc.service.ISignInfoHclcService;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
......@@ -20,11 +24,16 @@ import java.util.Objects;
* Time: 9:08
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SignInfoHclcFaceServiceImpl extends BaseServiceImpl<SignUserFaceHclc> implements ISignInfoHclcFaceService {
private final Object lock = new Object();
@Autowired
private ISignInfoHclcService iSignInfoHclcService;
@Autowired
private SignInfoHclcMapper signInfoHclcMapper;
@Autowired
private IOrganSignInfoHclcService iOrganSignInfoHclcService;
public void postAuthResult(IRequest iRequest, JSONObject params) {
......@@ -51,14 +60,34 @@ public class SignInfoHclcFaceServiceImpl extends BaseServiceImpl<SignUserFaceHcl
signInfoHclc.setOpenId(signInfoHclcFace.getOpenId());
signInfoHclc = iSignInfoHclcService.selectByPrimaryKey(iRequest, signInfoHclc);
//更新用户认证状态为Y--modify by lsy 20200813调整
if (signInfoHclc.getCtitype().compareTo(1L) == 0 || (signInfoHclc.getCtitype().compareTo(2L) == 0
//非管理员用户人脸识别后认证成功
&& ((Objects.nonNull(signInfoHclc.getIsManagerFlag()) && "N".equalsIgnoreCase(signInfoHclc.getIsManagerFlag()) && "1".equalsIgnoreCase(signInfoHclcFace.getAuthType()))
//管理员用户对公打款后认证成功
|| "2".equalsIgnoreCase(signInfoHclcFace.getAuthType())))) {
if (signInfoHclc.getCtitype().compareTo(1L) == 0) {
signInfoHclc.setAuthFlag("Y");
iSignInfoHclcService.updateByPrimaryKeySelective(iRequest, signInfoHclc);
} else if (signInfoHclc.getCtitype().compareTo(2L) == 0) {
//获取已注册企业认证信息
SignUserInfoHclc managerSignInfo = new SignUserInfoHclc();
managerSignInfo.setIdNo(signInfoHclc.getIdNo());
managerSignInfo.setIsManagerFlag("Y");
managerSignInfo.setAuthFlag("Y");
List<SignUserInfoHclc> managerList = signInfoHclcMapper.select(managerSignInfo);
//存在已注册企业认证信息,更新当前用户信息
if (Objects.nonNull(managerList) && managerList.size() > 0) {
managerSignInfo = managerList.get(0);
signInfoHclc.setAccountId(managerSignInfo.getAccountId());
signInfoHclc.setOrgAuthId(managerSignInfo.getOrgAuthId());
}
if ("N".equalsIgnoreCase(signInfoHclc.getIsManagerFlag()) || "2".equalsIgnoreCase(signInfoHclcFace.getAuthType()) || (Objects.nonNull(managerList) && managerList.size() > 0)) {
signInfoHclc.setAuthFlag("Y");
}
//企业认证成功新增一条对应个人信息
if ("Y".equalsIgnoreCase(signInfoHclc.getAuthFlag())) {
iOrganSignInfoHclcService.createOrgPersonInfo(signInfoHclc.getOpenId());
}
}
iSignInfoHclcService.updateByPrimaryKeySelective(iRequest, signInfoHclc);
} else {
//更新认证明细表状态
signInfoHclcFace.setAuthStatus("FAIL");
......
......@@ -1173,6 +1173,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
JSONArray signers = params.getJSONArray("signers");
JSONArray signersNew = new JSONArray();
String initiatorAccountId = "";
List<String> wxOpenIds = new ArrayList<>();
//获取发起人信息
SignUserInfoHclc signInfo = new SignUserInfoHclc();
......@@ -1215,7 +1216,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
if (signInfoHclcs.size() == 0) {
logger.error("create sign flows failed, account:{} is not defined in wx", name + idNo);
jsonResult.put("errCode", "2");
jsonResult.put("msg", "创建签署流程失败,用户" + name + idNo + "在移动端未完成实名认证,请先认证!");
jsonResult.put("msg", "创建签署流程失败,用户" + name + idNo + ((Objects.nonNull(agentIdNo) && !"".equalsIgnoreCase(agentIdNo)) ? ("经办人" + agentIdNo) : "") + "在移动端未完成实名认证授权,请先认证授权!");
return jsonResult;
} else {
signInfoHclc = signInfoHclcs.get(0);
......@@ -1233,6 +1234,11 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
json1.put("uniqueId", signInfoHclc.getOpenId());
}
//获取需要发送微信通知的签署人
if (!"HCLC".equalsIgnoreCase(role) && !"AGENT".equalsIgnoreCase(role)) {
wxOpenIds.add(signInfoHclc.getOpenId());
}
// //代理店设置发起人
// if ("AGENT".equalsIgnoreCase(role)) {
// initiatorAccountId = signInfoHclc.getAccountId();
......@@ -1287,6 +1293,19 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
}
//微信电子签约通知模板
JSONObject wxParams = new JSONObject();
wxParams = params.getJSONObject("attachments");
wxParams.put("templateId", "lyMDp1r6Jp5r7eSiho0otSby4tY0pXjZg1gbcA1poNI");
wxParams.put("first", "您好,您申请的融资租赁合同已经通过审核,可以进行签约流程!");
wxParams.put("keyword1", "承租人:");
wxParams.put("keyword2", "合同号:");
wxParams.put("keyword3", "机号:");
wxParams.put("keyword4", "签约时间:");
wxParams.put("remark", "请点击互动中心-融资租赁进行签约。谢谢!");
wxParams.put("url", "");
JSONObject result = new JSONObject();
//附件信息集合
result.put("attachments", params.get("attachments"));
......@@ -1380,6 +1399,14 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
}
}
//发送微信通知
if (Objects.nonNull(wxOpenIds) && wxOpenIds.size() > 0) {
for (String id : wxOpenIds) {
wxParams.put("openId", id);
sendWxTemplateMsg(wxParams);
}
}
} catch (Exception e) {
logger.error("create sign flows failed, msg:{}", e.getMessage());
jsonResult.put("errCode", "000004");
......
......@@ -77,9 +77,7 @@
<update id="setOrganIndividualAssignment" parameterType="com.hand.app.esignHclc.dto.SignUserInfoHclc">
update SIGN_USER_INFO_HCLC
<set>
<if test="isManagerFlag != null">is_manager_flag=#{isManagerFlag,jdbcType=VARCHAR},</if>
</set>
SET is_manager_flag= NVL(#{isManagerFlag,jdbcType=VARCHAR},'Y')
where open_id=#{openId}
AND manager_auth_flag='Y'
</update>
......
......@@ -113,7 +113,7 @@ thread.taskSize = 5
tsign.project.id=1000029
tsign.project.secret=2e66a86bbc6fa9000d4a5f272cbc70e1
#e签宝地址
tsign.api.url=http://139.196.17.22:8035
tsign.api.url=http://tsign-test.hitachics.com
#用户认证地址
tsign.face.api.url=https://smlopenapi.esign.cn
#用户认证用户
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment