Commit 0a0c8235 authored by zhangzhenbang's avatar zhangzhenbang

单独实名认证

parent 76ec7b63
...@@ -12,6 +12,7 @@ import com.yingxin.beijingvehicleflow.service.IdentityInformationService; ...@@ -12,6 +12,7 @@ import com.yingxin.beijingvehicleflow.service.IdentityInformationService;
import com.yingxin.beijingvehicleflow.service.ReservationService; import com.yingxin.beijingvehicleflow.service.ReservationService;
import com.yingxin.beijingvehicleflow.util.AESUtil; import com.yingxin.beijingvehicleflow.util.AESUtil;
import com.yingxin.beijingvehicleflow.util.DesUtil; import com.yingxin.beijingvehicleflow.util.DesUtil;
import com.yingxin.beijingvehicleflow.util.IdCardUtil;
import com.yingxin.beijingvehicleflow.util.PicUtils; import com.yingxin.beijingvehicleflow.util.PicUtils;
import net.sf.json.JSONException; import net.sf.json.JSONException;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
...@@ -179,4 +180,34 @@ public class IdentityInfoController { ...@@ -179,4 +180,34 @@ public class IdentityInfoController {
return new Response<JSONObject>(true, "", "",datafterDecryptJson); return new Response<JSONObject>(true, "", "",datafterDecryptJson);
} }
@PostMapping("/identity/verification")
public Response verifyIdentity(@RequestBody IdentityInformation info) {
if (!IdCardUtil.isValidatedAllIdcard(info.getIdCardNumber())) {
return Response.fail("ERROR-ID-NUMBER", "身份证格式有误,请重新输入。");
}
/*图片压缩*/
info.setFaceImage(
PicUtils.compressImage(info.getFaceImage(),
Const.FACE_IMG_SIZE));
try {
if (!authService.is0x42AuthSucc(info)) {
return Response.fail("AUTH-FAILED","实名认证失败。");
}
} catch (Exception e) {
LOGGER.error("身份认证异常:", e);
return Response.fail("AUTH-FAILED","实名认证失败。");
}
try {
info.setIsAuthed(1);
return identityInformationService.updateIdentityVerificationById(info)>0?Response.succ():Response.fail();
} catch (Exception e) {
LOGGER.error("身份认证数据update异常:", e);
return Response.fail("UNKNOWN-ERROR", "系统繁忙,请稍后重试。");
}
}
} }
...@@ -21,5 +21,6 @@ public class IdentityInformation { ...@@ -21,5 +21,6 @@ public class IdentityInformation {
private String wechatPhone; private String wechatPhone;
private String wechatOpenid; private String wechatOpenid;
private boolean isWorker; private boolean isWorker;
private int isAuthed;
} }
...@@ -47,4 +47,8 @@ public interface IdentityInformationMapper { ...@@ -47,4 +47,8 @@ public interface IdentityInformationMapper {
@Select("select r.id as reservationId,info.name,info.id_card_number,info.toBeijing_date,r.submit_coordinate,r.identity_id,r.car_number,r.verify_state " + @Select("select r.id as reservationId,info.name,info.id_card_number,info.toBeijing_date,r.submit_coordinate,r.identity_id,r.car_number,r.verify_state " +
"from identity_information AS info LEFT JOIN reservation AS r ON info.id=r.identity_id WHERE info.id = #{id} ") "from identity_information AS info LEFT JOIN reservation AS r ON info.id=r.identity_id WHERE info.id = #{id} ")
List<ReservationsDisplayDTO> selectReservatinsByIdentityId(IdentityInformation info); List<ReservationsDisplayDTO> selectReservatinsByIdentityId(IdentityInformation info);
@Update("update identity_information set name=#{name}, id_card_number=#{idCardNumber}," +
"face_image=#{faceImage},is_authed=#{isAuthed} where id = #{id}")
int updateIdentityVerificationById(IdentityInformation info);
} }
...@@ -41,4 +41,6 @@ public interface IdentityInformationService { ...@@ -41,4 +41,6 @@ public interface IdentityInformationService {
boolean isIdentityInfoValid(String authTime); boolean isIdentityInfoValid(String authTime);
int updateIdentityVerificationById(IdentityInformation info);
} }
...@@ -121,4 +121,9 @@ public class IdentityInformationServiceImpl implements IdentityInformationServic ...@@ -121,4 +121,9 @@ public class IdentityInformationServiceImpl implements IdentityInformationServic
return (milliSeconds/60.0/1000.0) < validTime; return (milliSeconds/60.0/1000.0) < validTime;
} }
@Override
public int updateIdentityVerificationById(IdentityInformation info) {
return identityInformationMapper.updateIdentityVerificationById(info);
}
} }
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