Commit d642eadc by 罗承锋

添加年龄限制

parent 332c855c
......@@ -184,6 +184,17 @@ public class PackageNewClothes {
if(!IDCardUtil.IDCardValidate(idCard)){
return ResponseData.error("您的身份证输入有误,请重新输入!");
}
/**
* 黑牛卡年龄判断
*/
if(kapin.indexOf("黑牛") > -1) {
ResponseData<String> stringResponseData = heiNiuIdCardVerification(idCard, customerName);
if (!stringResponseData.isSuccess()) {
return stringResponseData;
};
}
/**
* 办理中+94天内订单判断
*/
......@@ -568,6 +579,37 @@ public class PackageNewClothes {
}
/**
* 黑牛卡身份证验证
* @param idCard 黑牛卡身份证
* @param customerName 姓名
* @return
*/
public static ResponseData<String> heiNiuIdCardVerification(String idCard,String customerName){
JSONObject jsonObject1 = null;
try {
jsonObject1 = XbkUtil.idCardCheckJT0005(idCard, customerName);
} catch (Exception e) {
log.error("身份证验证接口调用异常", e.getMessage());
}
if (jsonObject1 == null) {
log.info("身份证验证接口调用异常");
return ResponseData.error("身份证验证失败。");
}
if (!"0".equals(jsonObject1.getString("code"))) {
return ResponseData.error(jsonObject1.getString("msg"));
}
Integer i = Integer.parseInt(idCard.substring(6, 10));
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date timeDate = new Date();
Integer age = Integer.parseInt(dateFormat.format(timeDate.getTime()));
Integer time25 = Integer.parseInt(String.valueOf(i + 25) + idCard.substring(10, 14));
if (age > time25) {
return ResponseData.error("您已满25周岁,不符合办理条件,如有疑问请联系客服,谢谢。");
}
return ResponseData.success("OK");
}
/**
* 身份证验证
* @param idCard 身份证
* @param customerName 姓名
......@@ -592,13 +634,13 @@ public class PackageNewClothes {
Date timeDate = new Date();
Integer age = Integer.parseInt(dateFormat.format(timeDate.getTime()));
Integer time16 = Integer.parseInt(String.valueOf(i + 16) + idCard.substring(10, 14));
Integer time25 = Integer.parseInt(String.valueOf(i + 25) + idCard.substring(10, 14));
Integer time27 = Integer.parseInt(String.valueOf(i + 27) + idCard.substring(10, 14));
if (age < time16) {
return ResponseData.error("根据工信部要求,未满16周岁的用户,应由法定代理人代为办理线上入网,如有疑问请联系客服,谢谢。");
}
// if (age > time25) {
// return ResponseData.error("您已满25周岁,不符合办理条件,如有疑问请联系客服,谢谢。");
// }
if (age > time27) {
return ResponseData.error("您已满27周岁,不符合办理条件,如有疑问请联系客服,谢谢。");
}
return ResponseData.success("OK");
}
......
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