|
@@ -5,6 +5,10 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.Header;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.kxs.common.core.constant.CommonConstants;
|
|
@@ -42,7 +46,9 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -117,6 +123,9 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
if(isvInfo == null){
|
|
|
throw new GlobalCustomerException("服务商不存在");
|
|
|
}
|
|
|
+ if(!verifyIdName(order.getIdCard(), order.getCustName())){
|
|
|
+ throw new GlobalCustomerException("身份证和姓名不一致");
|
|
|
+ }
|
|
|
//订单号
|
|
|
String orderSn = CommonConstants.ORDER_SN_PREFIX + IdUtil.getSnowflakeNextIdStr();
|
|
|
order.setOrderSn(orderSn);
|
|
@@ -139,6 +148,32 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
return order.getId();
|
|
|
}
|
|
|
+ private Boolean verifyIdName(String idCard, String name) {
|
|
|
+ String url = "https://dfidveri.market.alicloudapi.com/verify_id_name";
|
|
|
+ //调用二要素认证
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("id_number", idCard);
|
|
|
+ param.put("name", name);
|
|
|
+ String result = HttpRequest.post(url)
|
|
|
+ .header(Header.AUTHORIZATION, "APPCODE " + "8e5704921ca3422f80f0deb935a7ddc6")
|
|
|
+ .header(Header.CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8")
|
|
|
+ .timeout(20000)
|
|
|
+ .form(param)
|
|
|
+ .execute().body();
|
|
|
+ if (StrUtil.isEmpty(result) || !JSONUtil.isTypeJSON(result)) {
|
|
|
+ log.error("实名认证:{},响应异常: {}", name, result);
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(result);
|
|
|
+ if (!"OK".equals(jsonObject.getStr("status"))) {
|
|
|
+ throw new GlobalCustomerException(jsonObject.getStr("reason"));
|
|
|
+ }
|
|
|
+ int state = jsonObject.getInt("state");
|
|
|
+ if(state != 1){
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|