Commit c8b53d80 authored by fangxinjiang's avatar fangxinjiang

附属信息附件上传接口调整

parent 5b0d9375
......@@ -70,8 +70,9 @@ public class TEmpEducationController {
* @param tEmpEducation 员工学历信息表
* @return
*/
@Operation(description = "不分页查询")
@Operation(description = "不分页查询hasPermission('archives_tempeducation_export')")
@GetMapping("/noPage" )
@PreAuthorize("@pms.hasPermission('archives_tempeducation_export')" )
public R<List<TEmpEducation>> getTEmpEducationNoPage(TEmpEducation tEmpEducation) {
return R.ok(tEmpEducationService.list( Wrappers.query(tEmpEducation)));
}
......@@ -93,7 +94,7 @@ public class TEmpEducationController {
* @param tEmpEducation 员工学历信息表
* @return R
*/
@Operation( description = "新增员工学历信息表")
@Operation( description = "新增员工学历信息表hasPermission('archives_tempeducation_add')")
@SysLog("新增员工学历信息表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('archives_tempeducation_add')" )
......
package com.yifu.cloud.plus.v1.check.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
* 实名校验限定调用API的条数表
*
* @author hgw
* @date 2022-6-10 11:07:37
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_can_check")
@Tag(name = "可以校验")
public class TCanCheck extends Model<TCanCheck> {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 0不可,1可以校验
*/
@NotNull(message = "0不可,1可以校验不能为空")
@Schema(description = "0不可,1可以校验")
private Integer canCheck;
}
package com.yifu.cloud.plus.v1.check.utils;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.yifu.cloud.plus.v1.check.constant.ChecksConstants;
......@@ -10,7 +11,9 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.HashMap;
import java.util.Map;
......@@ -20,10 +23,9 @@ import java.util.Map;
* @description 测试身份证
* @date 2022/5/7
*/
public class ChecksUtil {
@Value("${canCheck:false}")
private static boolean canCheck;
private static final String APP_ID = "oi0mucL4";
......@@ -33,7 +35,7 @@ public class ChecksUtil {
private static JsonParser jsonParser = new JsonParser();
public static void checkIdCard(TCheckIdCard checkIdCard) {
public static void checkIdCard(TCheckIdCard checkIdCard, boolean canCheck) {
if (canCheck) {
// 1.调用身份信息校验api
......@@ -49,7 +51,7 @@ public class ChecksUtil {
* @Date 17:50 2022/6/20
* @param mobiles 检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码
**/
public static R<Map<String,TCheckMobile>> checkMobile(String mobiles) {
public static R<Map<String,TCheckMobile>> checkMobile(String mobiles, boolean canCheck) {
Map<String,TCheckMobile> checkMobiles = new HashMap<>();
if (canCheck) {
// 1.调用身份信息校验api
......@@ -67,7 +69,7 @@ public class ChecksUtil {
* @param cardNo 银行卡号,限单个 是 [string]
* @param mobile 银行预留手机号,仅支持国内11位号码
**/
public static R<TCheckBankNo> checkBankNo(String name, String idNum, String cardNo, String mobile) {
public static R<TCheckBankNo> checkBankNo(String name, String idNum, String cardNo, String mobile, boolean canCheck) {
TCheckBankNo checkBankNo = new TCheckBankNo();
if (canCheck) {
// 1.调用身份信息校验api
......@@ -93,15 +95,16 @@ public class ChecksUtil {
// 校验状态码 200000:成功,其他失败
JsonObject resJson = jsonObject.get(ChecksConstants.DATA).getAsJsonObject();
String message = jsonObject.get(ChecksConstants.MESSAGE).getAsString();
JsonElement temp;
if (Common.isNotNull(resJson)){
TCheckBankNo bankNo = new TCheckBankNo();
bankNo.setBankNo(resJson.getAsJsonObject().get("bankNo").getAsString());
bankNo.setBankName(resJson.getAsJsonObject().get("bankName").getAsString());
bankNo.setCardCategory(resJson.getAsJsonObject().get("cardCategory").getAsString());
bankNo.setCardType(resJson.getAsJsonObject().get("cardType").getAsString());
bankNo.setResult(resJson.getAsJsonObject().get(ChecksConstants.RESULT).getAsString());
bankNo.setBankNo(getJsonElementValue(resJson.getAsJsonObject().get("bankNo")));
bankNo.setBankName(getJsonElementValue(resJson.getAsJsonObject().get("bankName")));
bankNo.setCardCategory(getJsonElementValue(resJson.getAsJsonObject().get("cardCategory")));
bankNo.setCardType(getJsonElementValue(resJson.getAsJsonObject().get("cardType")));
bankNo.setResult(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.RESULT)));
bankNo.setMessage(message);
bankNo.setRemark(resJson.getAsJsonObject().get(ChecksConstants.REMARK).getAsString());
bankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK)));
bankNo.setType(CommonConstants.ONE_STRING);
}
} else {
......@@ -114,7 +117,9 @@ public class ChecksUtil {
return R.ok(checkBankNo);
}
private static String getJsonElementValue(JsonElement temp){
return Common.isNotNull(temp)?temp.getAsString():CommonConstants.EMPTY_STRING;
}
/**
* @Author fxj
......@@ -139,11 +144,11 @@ public class ChecksUtil {
TCheckMobile mobile = null;
for (int i = 0;i < mobileArray.size(); i++){
mobile = new TCheckMobile();
mobile.setMobile(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.MOBILE).getAsString());
mobile.setArea(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.AREA).getAsString());
mobile.setNumbertype(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.NUMBER_TYPE).getAsString());
mobile.setChargesstatus(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.CHARGES_STATUS).getAsString());
mobile.setStatus(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.STATUS).getAsString());
mobile.setMobile(getJsonElementValue(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.MOBILE)));
mobile.setArea(getJsonElementValue(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.AREA)));
mobile.setNumbertype(getJsonElementValue(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.NUMBER_TYPE)));
mobile.setChargesstatus(getJsonElementValue(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.CHARGES_STATUS)));
mobile.setStatus(getJsonElementValue(mobileArray.get(i).getAsJsonObject().get(ChecksConstants.STATUS)));
mobile.setMessage(message);
mobile.setType(CommonConstants.ONE_STRING);
checkMobileMap.put(mobile.getMobile(),mobile);
......@@ -170,13 +175,14 @@ public class ChecksUtil {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
// 校验状态码 200000:成功,其他失败
String resultStr = jsonObject.get(ChecksConstants.DATA).getAsJsonObject().get(ChecksConstants.RESULT).getAsString();
JsonObject resultJson = jsonObject.get(ChecksConstants.DATA).getAsJsonObject();
String resultStr = getJsonElementValue(resultJson.getAsJsonObject().get(ChecksConstants.RESULT));
if ("01".equals(resultStr)) {
checkIdCard.setIsTrue(1);
checkIdCard.setReason("正确");
} else {
checkIdCard.setIsTrue(0);
String remark = jsonObject.get(ChecksConstants.DATA).getAsJsonObject().get(ChecksConstants.REMARK).getAsString();
String remark = getJsonElementValue(resultJson.get(ChecksConstants.REMARK));
checkIdCard.setReason("调用身份信息校验失败,resultStr:" + resultStr + ",msg:" + remark);
}
} else {
......
package com.yifu.cloud.plus.v1.check.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.check.entity.TCanCheck;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author fxj
* @Description 身份证实名校验自留库
* @Date 17:25 2022/6/21
**/
@Mapper
public interface TCanCheckMapper extends BaseMapper<TCanCheck> {
}
package com.yifu.cloud.plus.v1.check.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCanCheck;
/**
* 校验锁
*
* @author hgw
* @date 2022-01-13 15:08:05
*/
public interface TCanCheckService extends IService<TCanCheck> {
Boolean getCanCheck();
}
package com.yifu.cloud.plus.v1.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCanCheck;
import com.yifu.cloud.plus.v1.check.mapper.TCanCheckMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import org.springframework.stereotype.Service;
/**
* 身份证实名校验自留库
*
* @author hgw
* @date 2022-05-11 16:12:18
*/
@Service("tCanCheckService")
public class TCanCheckServiceImpl extends ServiceImpl<TCanCheckMapper, TCanCheck> implements TCanCheckService {
@Override
public Boolean getCanCheck() {
TCanCheck tCanCheck= baseMapper.selectById(1);
boolean canCheck = false;
if (tCanCheck != null && tCanCheck.getCanCheck() == 1) {
canCheck = true;
}
return canCheck;
}
}
......@@ -19,12 +19,14 @@ package com.yifu.cloud.plus.v1.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.mapper.TCheckBankNoMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckBankNoService;
import com.yifu.cloud.plus.v1.check.utils.ChecksUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
......@@ -33,14 +35,16 @@ import org.springframework.stereotype.Service;
* @author fxj
* @date 2022-06-20 19:56:33
*/
@RequiredArgsConstructor
@Service
public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCheckBankNo> implements TCheckBankNoService {
private final TCanCheckService canCheckService;
@Override
public R<TCheckBankNo> checkBankNo(String name, String idNum, String cardNo, String mobile) {
if (Common.isEmpty(name) || Common.isEmpty(idNum) || Common.isEmpty(cardNo)){
return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_BANK_NO_REQUEST_PARAM_ERROR));
}
return ChecksUtil.checkBankNo(name,idNum,cardNo,mobile);
return ChecksUtil.checkBankNo(name,idNum,cardNo,mobile,canCheckService.getCanCheck());
}
}
......@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckApiNum;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckLock;
import com.yifu.cloud.plus.v1.check.mapper.TCheckIdCardMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckApiNumService;
import com.yifu.cloud.plus.v1.check.service.TCheckIdCardService;
import com.yifu.cloud.plus.v1.check.service.TCheckLockService;
......@@ -40,6 +41,8 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
private final TCheckLockService tCheckLockService;
private final TCheckApiNumService tCheckApiNumService;
private final TCanCheckService canCheckService;
/**
* 身份证实名校验自留库简单分页查询
*
......@@ -144,7 +147,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
// 调用API校验
if (nowApiNum < canApiNum) {
nowApiNum++;
ChecksUtil.checkIdCard(c);
ChecksUtil.checkIdCard(c,canCheckService.getCanCheck());
c.setCreateUser(userId);
c.setCreateTime(LocalDateTime.now());
c.setType(CommonConstants.ONE_INT);
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.check.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckMobileService;
import com.yifu.cloud.plus.v1.check.utils.ChecksUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -26,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -37,9 +39,11 @@ import java.util.Map;
* @author fxj
* @date 2022-06-20 17:29:03
*/
@RequiredArgsConstructor
@Service
public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCheckMobile> implements TCheckMobileService {
private TCanCheckService canCheckService;
/**
* @Author fxj
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
......@@ -54,7 +58,7 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
if (Common.isNotEmpty(mobileList) && mobileList.size() > CommonConstants.INTEGER_HUNDRED){
return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED));
}
mobileMapR = ChecksUtil.checkMobile(mobiles);
mobileMapR = ChecksUtil.checkMobile(mobiles,canCheckService.getCanCheck());
if (Common.isEmpty(mobileMapR) && Common.isEmpty(mobileMapR.getData())){
return R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_MOBILE_REQUEST_ERROR));
}
......
......@@ -28,4 +28,6 @@ security:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
- /checkBankNo/**
\ No newline at end of file
- /checkBankNo/**
# 创蓝云智校验配置
canCheck: true
\ No newline at end of file
<?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="com.yifu.cloud.plus.v1.check.mapper.TCanCheckMapper">
</mapper>
\ No newline at end of file
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