修复:1>调用企信宝验证高管;2>无感签约
This commit is contained in:
@ -35,5 +35,6 @@ public class BusOperAndAgentAndMer implements Serializable {
|
||||
|
||||
private String merNo;
|
||||
private String isNothing;
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package org.dromara.payment.util;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 启信宝 配置属性
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "qixingbao")
|
||||
public class QiXingBaoProperties {
|
||||
private String authVersion;
|
||||
|
||||
private String appKey;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
private String getEmployeesUrl;
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package org.dromara.payment.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.Value;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.dromara.common.core.exception.base.BaseException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QiXingClient {
|
||||
@Resource
|
||||
private QiXingBaoProperties qiXingBaoProperties;
|
||||
|
||||
public JSONArray getEmployees(String keyword, Integer skip){
|
||||
// 生成时间戳(毫秒)
|
||||
String timestamp = String.valueOf(Instant.now().toEpochMilli());
|
||||
// 生成签名:appkey + timestamp + secret_key的MD5
|
||||
String sign = DigestUtils.md5Hex(qiXingBaoProperties.getAppKey() + timestamp + qiXingBaoProperties.getSecretKey());
|
||||
// 构建请求URL
|
||||
String url = qiXingBaoProperties.getGetEmployeesUrl() + "?keyword=" + keyword;
|
||||
if (skip != null) {
|
||||
url += "&skip=" + skip;
|
||||
}
|
||||
// 创建HTTP请求
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
|
||||
// 设置Header参数
|
||||
httpGet.setHeader("Auth-Version", qiXingBaoProperties.getAuthVersion());
|
||||
httpGet.setHeader("appkey", qiXingBaoProperties.getAppKey());
|
||||
httpGet.setHeader("timestamp", timestamp);
|
||||
httpGet.setHeader("sign", sign);
|
||||
|
||||
// 执行请求并处理响应
|
||||
HttpResponse response = null;
|
||||
String responseBody = null;
|
||||
try {
|
||||
response = httpClient.execute(httpGet);
|
||||
responseBody = EntityUtils.toString(response.getEntity());
|
||||
log.info("调用启信开放开平:返回信息:" + responseBody);
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
JSONObject responseBodyJson = JSONObject.parseObject(responseBody);
|
||||
String status = responseBodyJson.getString("status");
|
||||
if(!"200".equals(status)){
|
||||
throw new BaseException("调用启信开放开平:返回状态:" + status + ",Json:" + responseBody);
|
||||
}
|
||||
JSONObject data = responseBodyJson.getJSONObject("data");
|
||||
JSONArray items = data.getJSONArray("items");
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package org.dromara.payment.worker.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 自雇者白名单
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode()
|
||||
@TableName("user_worker_white")
|
||||
public class UserWorkerWhite {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
private Long mer_id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String cardId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package org.dromara.payment.worker.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.payment.worker.domain.UserWorker;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 自雇者视图白名单
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = UserWorkerWhite.class)
|
||||
public class UserWorkerWhiteVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
private Long mer_id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String cardId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.payment.worker.mapper;
|
||||
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.payment.worker.domain.vo.UserWorkerWhite;
|
||||
import org.dromara.payment.worker.domain.vo.UserWorkerWhiteVo;
|
||||
|
||||
/**
|
||||
* 自雇者白名单Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
public interface UserWorkerWhiteMapper extends BaseMapperPlus<UserWorkerWhite, UserWorkerWhiteVo> {
|
||||
}
|
||||
@ -9,6 +9,9 @@ import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.constant.GlobalConstants;
|
||||
@ -28,6 +31,7 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.map.api.RemoteSignJZQService;
|
||||
import org.dromara.payment.api.worker.RemoteUserWokerService;
|
||||
import org.dromara.payment.api.worker.domain.RemoteUserWorkerZipVo;
|
||||
import org.dromara.payment.channel.domain.BusChannelProduct;
|
||||
import org.dromara.payment.common.domain.CommonSelConditionEntity;
|
||||
import org.dromara.payment.merchant.domain.bo.BusMerchantBo;
|
||||
import org.dromara.payment.merchant.domain.vo.BusOperAndAgentAndMer;
|
||||
@ -35,6 +39,7 @@ import org.dromara.payment.merchant.mapper.BusMerchantMapper;
|
||||
import org.dromara.payment.sys.domain.vo.SysSydVo;
|
||||
import org.dromara.payment.sys.mapper.SysSydMapper;
|
||||
import org.dromara.payment.taxRecords.service.impl.AsyncTaxRecordsService;
|
||||
import org.dromara.payment.util.QiXingClient;
|
||||
import org.dromara.payment.worker.domain.UserWorker;
|
||||
import org.dromara.payment.worker.domain.UserWorkerAccount;
|
||||
import org.dromara.payment.worker.domain.bo.UserWokerOperBo;
|
||||
@ -42,6 +47,7 @@ import org.dromara.payment.worker.domain.bo.UserWorkerBo;
|
||||
import org.dromara.payment.worker.domain.vo.*;
|
||||
import org.dromara.payment.worker.mapper.UserWorkerAccountMapper;
|
||||
import org.dromara.payment.worker.mapper.UserWorkerMapper;
|
||||
import org.dromara.payment.worker.mapper.UserWorkerWhiteMapper;
|
||||
import org.dromara.payment.worker.service.IIdCardAndOtherService;
|
||||
import org.dromara.settlement.api.RemoteAccountService;
|
||||
import org.dromara.settlement.api.domain.Account;
|
||||
@ -72,6 +78,7 @@ import java.util.stream.Collectors;
|
||||
public class UserWorkerBusinessServiceImpl extends BaseService implements IUserWorkerBusinessService {
|
||||
|
||||
private final UserWorkerBusinessMapper baseMapper;
|
||||
private final UserWorkerWhiteMapper userWorkerWhiteMapper;
|
||||
|
||||
@DubboReference
|
||||
private RemoteSignJZQService remoteSignJZQService;
|
||||
@ -106,6 +113,9 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
@Resource
|
||||
public AsyncTaxRecordsService asyncTaxRecordsService;
|
||||
|
||||
@Resource
|
||||
private QiXingClient qiXingClient;
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo<UserWorkerBusinessVo> selUserWorkByMerServInfo(PageQuery pageQuery, Long sydId, Long merId, Integer busType) {
|
||||
@ -341,8 +351,6 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
try{
|
||||
this.tencentIdCardAndOtherService.cardId2(item.getName(),item.getIdCard(),code);
|
||||
@ -353,6 +361,14 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
}
|
||||
}
|
||||
|
||||
//验证 董事长、监事、高管
|
||||
Boolean isManager = valadationEmployees(LoginHelper.getBusId(), busOperAndAgentAndMer.getName(), item.getName(), item.getIdCard());
|
||||
if(isManager){
|
||||
item.setErrorMsg(item.getName() + "是高管");
|
||||
nopassList.add(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(userWorker != null){
|
||||
UserWorkerBusiness userWorkerBusinessBo = new UserWorkerBusiness();
|
||||
userWorkerBusinessBo.setWorkId(userWorker.getWorkId());
|
||||
@ -408,11 +424,13 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
vo.setDownId(uuid);
|
||||
RedisUtils.setCacheObject(GlobalConstants.USERWORK_SIGN_ERROR_KEY+uuid,nopassList, Duration.ofDays(15));
|
||||
}
|
||||
|
||||
if(!userWorkerList.isEmpty()){
|
||||
this.userWorkerMapper.insertBatch(userWorkerList);
|
||||
}
|
||||
if(!passlist.isEmpty()){
|
||||
this.isSign(passlist,sydId,busType,busOperAndAgentAndMer.getIsNothing());
|
||||
this.baseMapper.insertBatch(passlist);
|
||||
//TODO无感签约
|
||||
//无感签约
|
||||
if("1".equals(busOperAndAgentAndMer.getIsNothing())){
|
||||
for(UserWorkerBusiness pass : passlist){
|
||||
String contractCode = remoteSignJZQService.signProJzq(pass.getId(), "http://open.xinzishe.com", "1");
|
||||
@ -423,9 +441,7 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!userWorkerList.isEmpty()){
|
||||
this.userWorkerMapper.insertBatch(userWorkerList);
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
@ -435,6 +451,44 @@ public class UserWorkerBusinessServiceImpl extends BaseService implements IUserW
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否是高管
|
||||
* @param merId
|
||||
* @param companyName
|
||||
* @param workName
|
||||
* @param workCardId
|
||||
* @return
|
||||
*/
|
||||
private Boolean valadationEmployees(Long merId,String companyName,String workName,String workCardId){
|
||||
//判断此人是否在白名单里,
|
||||
LambdaQueryWrapper<UserWorkerWhite> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserWorkerWhite::getMer_id, merId);
|
||||
wrapper.eq(UserWorkerWhite::getName, workName);
|
||||
wrapper.eq(UserWorkerWhite::getCardId, workCardId);
|
||||
UserWorkerWhite userWorkerWhite = userWorkerWhiteMapper.selectOne(wrapper);
|
||||
if(userWorkerWhite != null){
|
||||
return false;
|
||||
}
|
||||
|
||||
JSONArray employees = qiXingClient.getEmployees(companyName, 0);
|
||||
if(!employees.isEmpty()){
|
||||
for (int i = 0; i < employees.size(); i++) {
|
||||
JSONObject jsonObject = employees.getJSONObject(i);
|
||||
String name = jsonObject.getString("name");
|
||||
String title = jsonObject.getString("title");
|
||||
String isHistory = jsonObject.getString("is_history");
|
||||
if("0".equals(isHistory) && workName.equals(name) && checkTitle(title)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private boolean checkTitle(String title) {
|
||||
return (title.contains("董事长") ||
|
||||
title.contains("监事") ||
|
||||
title.contains("高管"));
|
||||
}
|
||||
@Override
|
||||
public List<UploadExcelItem> selErrorList(String uuid) {
|
||||
if(StringUtils.isEmpty(uuid)){
|
||||
|
||||
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selOpAndAgentInfosByMerInfo" parameterType="org.dromara.payment.merchant.domain.bo.BusMerchantBo"
|
||||
resultType="org.dromara.payment.merchant.domain.vo.BusOperAndAgentAndMer">
|
||||
|
||||
select t.id merId, t.no merNo, c.id channelId,c.no channelNo,c.level_code levelCode,o.id opId,o.no opNo,
|
||||
select t.name,t.id merId, t.no merNo, c.id channelId,c.no channelNo,c.level_code levelCode,o.id opId,o.no opNo,
|
||||
bmc.is_nothing
|
||||
from bus_merchant t left join bus_channel c on t.agent_no = c.no
|
||||
left join bus_operator o on t.operator_no = o.no
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.payment.worker.mapper.UserWorkerWhiteMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user