|
@@ -0,0 +1,4887 @@
|
|
|
+package cn.hmsoft.ses.control.std;
|
|
|
+
|
|
|
+import cn.hmsoft.frame.constants.FrameParamConstants;
|
|
|
+import cn.hmsoft.frame.data.model.FrameDict;
|
|
|
+import cn.hmsoft.frame.data.model.FrameParam;
|
|
|
+import cn.hmsoft.frame.exception.web.BusinessException;
|
|
|
+import cn.hmsoft.frame.service.IFrameParamService;
|
|
|
+import cn.hmsoft.frame.util.FrameAssertUtil;
|
|
|
+import cn.hmsoft.frame.util.FrameDictUtil;
|
|
|
+import cn.hmsoft.frame.util.FrameParamUtil;
|
|
|
+import cn.hmsoft.helper.DateHelper;
|
|
|
+import cn.hmsoft.helper.JsonHelper;
|
|
|
+import cn.hmsoft.helper.LogHelper;
|
|
|
+import cn.hmsoft.helper.SecureHelper;
|
|
|
+import cn.hmsoft.helper.StringHelper;
|
|
|
+import cn.hmsoft.ses.constants.EnrolSessionName;
|
|
|
+import cn.hmsoft.ses.constants.StdConst;
|
|
|
+import cn.hmsoft.ses.constants.StdConst.OperType;
|
|
|
+import cn.hmsoft.ses.constants.SysConst;
|
|
|
+import cn.hmsoft.ses.control.util.FrameIdCardUtil;
|
|
|
+import cn.hmsoft.ses.data.dao.std.StdAppLogintokenDao;
|
|
|
+import cn.hmsoft.ses.data.dao.std.StdIdentityCardDao;
|
|
|
+import cn.hmsoft.ses.data.dao.std.StdRegInfoDao;
|
|
|
+import cn.hmsoft.ses.data.model.cf.CfOrganization;
|
|
|
+import cn.hmsoft.ses.data.model.gxzk.CjJigechengjiOld;
|
|
|
+import cn.hmsoft.ses.data.model.pl.PlExamTime;
|
|
|
+import cn.hmsoft.ses.data.model.pl.PlMajor;
|
|
|
+import cn.hmsoft.ses.data.model.pl.PlMajorRecord;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdAppLogintoken;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdEnrol;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdIdentityCard;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdMajor;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdRegInfo;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdReportForm;
|
|
|
+import cn.hmsoft.ses.data.model.std.StdReportFormPlanCity;
|
|
|
+import cn.hmsoft.ses.data.model.sys.SysEmailInfo;
|
|
|
+import cn.hmsoft.ses.data.model.sys.SysOperateFail;
|
|
|
+import cn.hmsoft.ses.data.model.sys.SysSmsInfo;
|
|
|
+import cn.hmsoft.ses.data.model.sys.SysVerificationCode;
|
|
|
+import cn.hmsoft.ses.data.model.sys.SysVerificationEmailCode;
|
|
|
+import cn.hmsoft.ses.helper.YearCodeHelper;
|
|
|
+import cn.hmsoft.ses.service.iface.cf.ICfOrganizationService;
|
|
|
+import cn.hmsoft.ses.service.iface.gxzk.ICjJigechengjiOldService;
|
|
|
+import cn.hmsoft.ses.service.iface.pl.IPlExamTimeService;
|
|
|
+import cn.hmsoft.ses.service.iface.pl.IPlMajorRecordService;
|
|
|
+import cn.hmsoft.ses.service.iface.pl.IPlMajorService;
|
|
|
+import cn.hmsoft.ses.service.iface.std.IStdEnrolService;
|
|
|
+import cn.hmsoft.ses.service.iface.std.IStdMajorService;
|
|
|
+import cn.hmsoft.ses.service.iface.std.IStdRegInfoLogService;
|
|
|
+import cn.hmsoft.ses.service.iface.std.IStdRegInfoService;
|
|
|
+import cn.hmsoft.ses.service.iface.std.IStdReportFormService;
|
|
|
+import cn.hmsoft.ses.service.iface.sys.ISysEmailInfoService;
|
|
|
+import cn.hmsoft.ses.service.iface.sys.ISysOperateFailService;
|
|
|
+import cn.hmsoft.ses.service.iface.sys.ISysSmsInfoService;
|
|
|
+import cn.hmsoft.ses.service.iface.sys.ISysVerificationCodeService;
|
|
|
+import cn.hmsoft.ses.service.iface.sys.ISysVerificationEmailCodeService;
|
|
|
+import cn.hmsoft.ses.util.*;
|
|
|
+import cn.hmsoft.web.control.AjaxControl;
|
|
|
+import cn.hmsoft.web.entity.Ajax;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.xcwlkj.dfs.model.vo.UploadItemVO;
|
|
|
+import com.xcwlkj.dfs.model.vo.UploadVO;
|
|
|
+import com.xcwlkj.dfs.util.XcDfsClient;
|
|
|
+import org.apache.commons.io.FilenameUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.imageio.ImageIO;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.servlet.http.HttpSession;
|
|
|
+import java.awt.*;
|
|
|
+import java.awt.image.BufferedImage;
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneOffset;
|
|
|
+import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 学生注册
|
|
|
+ *
|
|
|
+ * @author: yangwei
|
|
|
+ * @date: 2018-10-16 10:23:05
|
|
|
+ * @version: 1.0
|
|
|
+ * @email: yangwei@qmth.com.cn
|
|
|
+ * @Company: www.hmsoft.cn
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+public class StdRegInfoControl extends AjaxControl {
|
|
|
+
|
|
|
+ private static final String String = null;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStdRegInfoService stdRegInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StdRegInfoDao stdRegInfoDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StdAppLogintokenDao stdAppLogintokenDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStdMajorService stdMajorService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IPlMajorService plMajorService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICfOrganizationService cfOrganizationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IPlMajorRecordService iPlMajorRecordService;
|
|
|
+ @Autowired
|
|
|
+ private IStdRegInfoLogService regLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStdEnrolService stdEnrolService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IPlExamTimeService examTimeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICjJigechengjiOldService cjJigechengjiOldService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StdIdentityCardDao stdIdentityCardDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysSmsInfoService sysSmsInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysVerificationCodeService sysVerificationCodeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysEmailInfoService sysEmailInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysVerificationEmailCodeService sysVerificationEmailCodeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysOperateFailService sysOperateFailService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFrameParamService frameParamService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStdReportFormService stdReportFormService;
|
|
|
+
|
|
|
+ private static int SOCIAL_ID = 99999999;
|
|
|
+
|
|
|
+ private static HashMap<String, Object> cacheMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ static {
|
|
|
+ System.setProperty("java.awt.headless", "true");
|
|
|
+ }
|
|
|
+
|
|
|
+ //@RequestMapping("/std/stdRegInfo/page")
|
|
|
+ public Ajax pageRegInfo(String query, Integer limit, Integer start, String order, String type,
|
|
|
+ StdRegInfo stdRegInfo) {
|
|
|
+ return new Ajax(this.stdRegInfoService.pageStdRegInfo(query, start, limit, order, type));
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/getSocialMajorList")
|
|
|
+ public Ajax getSocialMajorList() {
|
|
|
+ // 社会考生专业
|
|
|
+ List<PlMajorRecord> socialMajorArray = this.iPlMajorRecordService.getSocialMajorList();
|
|
|
+ return new Ajax(socialMajorArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/getStdMajor")
|
|
|
+ public Ajax getStdMajor() {
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ PlMajor stdMajor = this.plMajorService.find(dbStd.getMajor_id());
|
|
|
+ return new Ajax(stdMajor);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询 开考且网报专业
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/stdRegInfo/getNetMajorList")
|
|
|
+ public Ajax getNetMajorList() {
|
|
|
+ // StdRegInfo stdRegInfo =
|
|
|
+ // (StdRegInfo)getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ // StdRegInfo dbStd = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ // PlMajor stdMajor = this.plMajorService.find(dbStd.getMajor_id());
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("is_net_exam", 1);// 网考
|
|
|
+ paraMap.put("status", 1);// 开考
|
|
|
+
|
|
|
+ List<PlMajor> majorList = this.plMajorService.listByMap(paraMap);
|
|
|
+
|
|
|
+ // 考生专业和 可报考专业合并 初始化专业下拉使用
|
|
|
+ /*
|
|
|
+ * boolean notExistStdMajor = true; Integer stdMajorId =
|
|
|
+ * stdMajor.getId(); for (PlMajor plMajor : majorList) { if (stdMajorId
|
|
|
+ * == plMajor.getId()) { notExistStdMajor = false; } }
|
|
|
+ *
|
|
|
+ * if(notExistStdMajor){ majorList.add(0, stdMajor); }
|
|
|
+ */
|
|
|
+
|
|
|
+ return new Ajax(majorList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取数据字典缓存
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ private Map<String, Object> getDictMap() {
|
|
|
+ Map<String, Object> dictMap = null;
|
|
|
+ if (cacheMap.get("dictData") == null) {
|
|
|
+ dictMap = new HashMap<String, Object>();
|
|
|
+ cacheMap.put("dictData", dictMap);
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("is_net_exam", 1);// 网考
|
|
|
+ paraMap.put("status", 1);// 开考
|
|
|
+ List<PlMajor> majorArray = this.plMajorService.listByMap(paraMap);
|
|
|
+
|
|
|
+ HashMap<String, Object> byMajorParaMap = new HashMap<String, Object>();
|
|
|
+ byMajorParaMap.put("is_allow_graduate", 1);// 允许毕业
|
|
|
+ byMajorParaMap.put("status", 1);// 开考
|
|
|
+ List<PlMajor> byMajorArray = this.plMajorService.listByMap(byMajorParaMap);
|
|
|
+ if (null != byMajorArray) {
|
|
|
+ for (PlMajor pm : byMajorArray) {
|
|
|
+ if (null != pm.getMajor_level() && 1 == pm.getMajor_level().intValue()) {
|
|
|
+ pm.setMajor_full_name(pm.getMajor_code() + "|" + pm.getMajor_name() + "-本科");
|
|
|
+ } else {
|
|
|
+ pm.setMajor_full_name(pm.getMajor_code() + "|" + pm.getMajor_name() + "-专科");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 名族
|
|
|
+ List<FrameDict> stdNationArray = FrameDictUtil.getFrameDict("std_nation");
|
|
|
+ // 职业
|
|
|
+ List<FrameDict> stdOccupationArray = FrameDictUtil.getFrameDict("std_occupation");
|
|
|
+ List<FrameDict> stdFamilyRegArray = FrameDictUtil.getFrameDict("std_family_reg");
|
|
|
+ List<FrameDict> stdPoliticalStatusArray = FrameDictUtil.getFrameDict("std_political_status");
|
|
|
+ List<FrameDict> StdSexTypeArray = FrameDictUtil.getFrameDict("StdSexType");
|
|
|
+ List<FrameDict> certTypeArray = FrameDictUtil.getFrameDict("CERT_TYPE");
|
|
|
+ List<FrameDict> StdHealthyArray = FrameDictUtil.getFrameDict("std_healthy");
|
|
|
+ List<FrameDict> StdEduArray = FrameDictUtil.getFrameDict("std_edu");
|
|
|
+ List<FrameDict> majorLevelArray = FrameDictUtil.getFrameDict("MajorLevel");
|
|
|
+
|
|
|
+ List<CfOrganization> orgArray = this.stdRegInfoService.CfOrganizationList("1");
|
|
|
+ CfOrganization org = new CfOrganization();
|
|
|
+ org.setId(SOCIAL_ID);
|
|
|
+ org.setOrg_code("001");
|
|
|
+ org.setOrg_name("社会考生");
|
|
|
+ orgArray.add(0, org);
|
|
|
+ List<CfOrganization> examAreaOrgArray = this.stdRegInfoService.CfOrganizationList("4");
|
|
|
+
|
|
|
+ dictMap.put("majorArray", majorArray);
|
|
|
+ dictMap.put("byMajorArray", byMajorArray);
|
|
|
+ dictMap.put("nationArray", stdNationArray);
|
|
|
+ dictMap.put("occupationArray", stdOccupationArray);
|
|
|
+ dictMap.put("familyRegArray", stdFamilyRegArray);
|
|
|
+ dictMap.put("politicalStatusArray", stdPoliticalStatusArray);
|
|
|
+ dictMap.put("sexArray", StdSexTypeArray);
|
|
|
+ dictMap.put("certTypeArray", certTypeArray);
|
|
|
+ dictMap.put("healthyArray", StdHealthyArray);
|
|
|
+ dictMap.put("eduArray", StdEduArray);
|
|
|
+ dictMap.put("orgArray", orgArray);
|
|
|
+ dictMap.put("examAreaOrgArray", examAreaOrgArray);
|
|
|
+ dictMap.put("majorLevelArray", majorLevelArray);
|
|
|
+ } else {
|
|
|
+ dictMap = (HashMap<String, Object>) cacheMap.get("dictData");
|
|
|
+ }
|
|
|
+ return dictMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping({ "/std/stdRegInfo/freshFrameParamsCache" })
|
|
|
+ public Ajax freshFrameParamsCache() {
|
|
|
+ FrameParamUtil.ReloadFrameParams();
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+ @RequestMapping("/std/stdRegInfo/freshCache")
|
|
|
+ public Ajax freshCache() {
|
|
|
+ // 刷新字典缴存
|
|
|
+ FrameDictUtil.allDict(true);
|
|
|
+ cacheMap.put("dictData", null);
|
|
|
+ cacheMap.put("dictData", getDictMap());
|
|
|
+
|
|
|
+ /*HashMap dictMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ // List<PlMajor> majorArray = plMajorService.all();
|
|
|
+ // List<PlMajorRecord> majorArray =
|
|
|
+ // iPlMajorRecordService.getNSocialMajorList();
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("is_net_exam", 1);// 网考
|
|
|
+ paraMap.put("status", 1);// 开考
|
|
|
+ List<PlMajor> majorArray = this.plMajorService.listByMap(paraMap);
|
|
|
+
|
|
|
+ // 名族
|
|
|
+ List<FrameDict> stdNationArray = FrameDictUtil.getFrameDict("std_nation");
|
|
|
+ // 职业
|
|
|
+ List<FrameDict> stdOccupationArray = FrameDictUtil.getFrameDict("std_occupation");
|
|
|
+ List<FrameDict> stdFamilyRegArray = FrameDictUtil.getFrameDict("std_family_reg");
|
|
|
+ List<FrameDict> stdPoliticalStatusArray = FrameDictUtil.getFrameDict("std_political_status");
|
|
|
+ List<FrameDict> StdSexTypeArray = FrameDictUtil.getFrameDict("StdSexType");
|
|
|
+ List<FrameDict> StdHealthyArray = FrameDictUtil.getFrameDict("std_healthy");
|
|
|
+ List<FrameDict> StdEduArray = FrameDictUtil.getFrameDict("std_edu");
|
|
|
+ List<FrameDict> majorLevelArray = FrameDictUtil.getFrameDict("MajorLevel");
|
|
|
+
|
|
|
+ List<CfOrganization> orgArray = this.stdRegInfoService.CfOrganizationList("1");
|
|
|
+ CfOrganization org = new CfOrganization();
|
|
|
+ org.setId(SOCIAL_ID);
|
|
|
+ org.setOrg_code("001");
|
|
|
+ org.setOrg_name("社会考生");
|
|
|
+ orgArray.add(0, org);
|
|
|
+ List<CfOrganization> examAreaOrgArray = this.stdRegInfoService.CfOrganizationList("4");
|
|
|
+
|
|
|
+ dictMap.put("majorArray", majorArray);
|
|
|
+ dictMap.put("nationArray", stdNationArray);
|
|
|
+ dictMap.put("occupationArray", stdOccupationArray);
|
|
|
+ dictMap.put("familyRegArray", stdFamilyRegArray);
|
|
|
+ dictMap.put("politicalStatusArray", stdPoliticalStatusArray);
|
|
|
+ dictMap.put("sexArray", StdSexTypeArray);
|
|
|
+ dictMap.put("healthyArray", StdHealthyArray);
|
|
|
+ dictMap.put("eduArray", StdEduArray);
|
|
|
+ dictMap.put("orgArray", orgArray);
|
|
|
+ dictMap.put("examAreaOrgArray", examAreaOrgArray);
|
|
|
+ dictMap.put("majorLevelArray", majorLevelArray);
|
|
|
+
|
|
|
+ cacheMap.put("dictData", dictMap);*/
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/initForBindPhone")
|
|
|
+ public Ajax initForBindPhone(Integer std_id) {
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession()
|
|
|
+ .getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if(!sessionStdRegInfo.getId().equals(std_id)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> provinces = this.stdRegInfoService.queryBzmbGbXzqhdm("000000");
|
|
|
+ map.put("provinces", provinces);
|
|
|
+
|
|
|
+ map.put("year_code", YearCodeHelper.getCurrentYearCode());
|
|
|
+
|
|
|
+ return new Ajax(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/initForReportForm")
|
|
|
+ public Ajax initForReportForm(Integer std_id) {
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession()
|
|
|
+ .getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if(!sessionStdRegInfo.getId().equals(std_id)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> provinces = this.stdRegInfoService.queryBzmbGbXzqhdm("000000");
|
|
|
+ map.put("provinces", provinces);
|
|
|
+
|
|
|
+ String year_code = YearCodeHelper.getCurrentYearCode();
|
|
|
+ map.put("year_code", year_code);
|
|
|
+ map.put("exam_year", year_code.substring(0, 4));
|
|
|
+ map.put("exam_month", year_code.substring(4, 6));
|
|
|
+
|
|
|
+ FrameParam param = this.frameParamService.find(FrameParam.class,"param_name", "ticket_promise_one");
|
|
|
+ if(null != param && "Active".equals(param.getProtect_status())){
|
|
|
+ map.put("ticket_promise_one", param.getParam_value());
|
|
|
+ }else{
|
|
|
+ map.put("ticket_promise_one", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ param = this.frameParamService.find(FrameParam.class,"param_name", "std_report_form");
|
|
|
+ if(null != param && "Active".equals(param.getProtect_status())){
|
|
|
+ map.put("days", param.getParam_value());
|
|
|
+ }else{
|
|
|
+ map.put("days", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ StdReportForm stdReportForm = this.stdReportFormService.queryStdReportFormByTicketNo(Integer.valueOf(YearCodeHelper.getCurrentYearCode()), sessionStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ map.put("stdReportForm", stdReportForm);
|
|
|
+
|
|
|
+ if(null != stdReportForm){
|
|
|
+ List<StdReportFormPlanCity> plans = this.stdReportFormService.queryStdReportFormPlanCityByReportFormId(stdReportForm.getId());
|
|
|
+ if(null != plans && !plans.isEmpty()){
|
|
|
+ for(StdReportFormPlanCity plan:plans){
|
|
|
+ List<Map<String, Object>> citys = this.stdRegInfoService.queryBzmbGbXzqhdm(plan.getPlan_province());
|
|
|
+ plan.setCitys(citys);
|
|
|
+
|
|
|
+ List<Map<String, Object>> countys = this.stdRegInfoService.queryBzmbGbXzqhdm(plan.getPlan_city());
|
|
|
+ plan.setCountys(countys);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("plans", plans);
|
|
|
+ }else{
|
|
|
+ map.put("plans", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/queryBzmbGbXzqhdm")
|
|
|
+ public Ajax queryBzmbGbXzqhdm(Integer std_id, String parent_id) {
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession()
|
|
|
+ .getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if (!sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> data = this.stdRegInfoService.queryBzmbGbXzqhdm(parent_id);
|
|
|
+ map.put("data", data);
|
|
|
+
|
|
|
+ return new Ajax(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/init")
|
|
|
+ public Ajax init(StdRegInfo stdRegInfo) {
|
|
|
+
|
|
|
+ Map<String, Object> dictMap = this.getDictMap();
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ map.put("dict", dictMap);
|
|
|
+
|
|
|
+ Map<String, Object> configMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
+
|
|
|
+ String uploadServerUrl = SysConst.getAppConfig().getUploadServerUrl();
|
|
|
+
|
|
|
+
|
|
|
+ configMap.put("uploadServerUrl", uploadServerUrl);
|
|
|
+
|
|
|
+ configMap.put("photoHttp", SysConst.getAppConfig().getPhotoHttp());
|
|
|
+ configMap.put("isRemotePhoto", SysConst.getAppConfig().getIsRemotePhoto());
|
|
|
+
|
|
|
+ map.put("config", configMap);
|
|
|
+
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession()
|
|
|
+ .getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = stdRegInfoService.find(sessionStdRegInfo.getId());
|
|
|
+ if (dbStd != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStd);
|
|
|
+
|
|
|
+ // 漏洞问题处理 4.1.8[中风险]敏感信息(全局)-服务端,只处理密码和邮箱。身份证、手机等要用于办理业务
|
|
|
+ dbStd.setStd_pass(null);
|
|
|
+ dbStd.setBind_email(null);
|
|
|
+ dbStd.setStd_email(null);
|
|
|
+
|
|
|
+ map.put("stdRegInfo", dbStd);
|
|
|
+ map.put("stdMajor", plMajorService.findMajor(dbStd.getMajor_id()));
|
|
|
+
|
|
|
+ // 20220722 信息采集年度码(如果当前批次与该值不一样,则考生第一次登录时需填写批次信息采集)
|
|
|
+ if(null == dbStd.getYear_code()){
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "0");
|
|
|
+ }else{
|
|
|
+ if(!YearCodeHelper.getCurrentYearCode().equals(dbStd.getYear_code()+"")){
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "0");
|
|
|
+ }else{
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String is_std_report_form = "false";
|
|
|
+ // 填写自学考试考生赴考报备表开关
|
|
|
+ FrameParam param = this.frameParamService.find(FrameParam.class,"param_name", "std_report_form");
|
|
|
+ if (null != param && "Active".equals(param.getProtect_status())) {
|
|
|
+ // 根据考生查询是否已经缴费
|
|
|
+ List<StdEnrol> list = this.stdEnrolService.listEnrolByStdId(sessionStdRegInfo.getId(),
|
|
|
+ YearCodeHelper.getCurrentYearCode());
|
|
|
+ // 已缴费,则校验是否在填写报备表时间范围之内
|
|
|
+ if (null != list && !list.isEmpty()) {
|
|
|
+ StdReportForm stdReportForm = this.stdReportFormService.queryStdReportFormByTicketNo(
|
|
|
+ Integer.valueOf(YearCodeHelper.getCurrentYearCode()), sessionStdRegInfo.getTicket_no());
|
|
|
+ // 没有填写报备表,则需要填写
|
|
|
+ if (null == stdReportForm) {
|
|
|
+ LocalDateTime now = null;
|
|
|
+ StdEnrol time = this.stdEnrolService.getDataBaseTime();
|
|
|
+ if (null != time && null != time.getCreate_time()) {
|
|
|
+ now = time.getCreate_time();
|
|
|
+ } else {
|
|
|
+ now = LocalDateTime.now();
|
|
|
+ }
|
|
|
+
|
|
|
+ PlExamTime dbTime = this.examTimeService.queryPlExamTime(YearCodeHelper.getCurrentYearCode());
|
|
|
+
|
|
|
+ LocalDate start_date = dbTime.getExam_first_day();
|
|
|
+ LocalDate end_date = null;
|
|
|
+ if(null != dbTime.getExam_third_day()){
|
|
|
+ end_date = dbTime.getExam_third_day();
|
|
|
+ }else{
|
|
|
+ end_date = dbTime.getExam_second_day();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填写开始时间
|
|
|
+ LocalDateTime start_time = start_date.atTime(0, 0, 0);
|
|
|
+ // 填写结束时间
|
|
|
+ LocalDateTime end_time = end_date.atTime(0, 0, 0);
|
|
|
+
|
|
|
+ // 天数
|
|
|
+ int days = Integer.valueOf(param.getParam_value());
|
|
|
+
|
|
|
+ // 填写开始时间设定在考试开始时间+天数
|
|
|
+ start_time = start_time.plusDays(-days);
|
|
|
+ // 填写结束时间设定在考试结束时间
|
|
|
+ end_time = end_time.plusDays(1);
|
|
|
+
|
|
|
+ //now = start_time.plusDays(1);
|
|
|
+ if (DateHelper.isBetween(now, start_time, end_time)) {
|
|
|
+ is_std_report_form = "true";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("std_report_form", is_std_report_form);
|
|
|
+
|
|
|
+
|
|
|
+ /*// 账号已经绑定手机号,则设置绑定标识
|
|
|
+ if(!StringUtils.isEmpty(dbStd.getBindphone())){
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "1");
|
|
|
+ }else{
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.queryPasswordQuestion(dbStd);
|
|
|
+
|
|
|
+ if(null != stds && !stds.isEmpty()){
|
|
|
+ // 账号已经设置密保,则设置绑定标识
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "1");
|
|
|
+ }else{
|
|
|
+ // 账号没有绑定手机号,也没有设置密保,则设置未绑定标识
|
|
|
+ map.put("isBindPhoneOrSetQuestion", "0");
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String belong_city = dbStd.getBelong_city();
|
|
|
+ String enrol_county_city = dbStd.getEnrol_county_city();
|
|
|
+ Map<String, Object> county_cityMap = stdRegInfoService.getCityCounty(belong_city, enrol_county_city);
|
|
|
+
|
|
|
+ map.put("county_city", county_cityMap);
|
|
|
+
|
|
|
+ List<Map<String,Object>> std_citys = this.stdRegInfoService.queryCity();
|
|
|
+ map.put("std_citys", std_citys);
|
|
|
+
|
|
|
+ if(!StringUtils.isEmpty(dbStd.getStd_city())){
|
|
|
+ List<Map<String,Object>> std_countys = this.stdRegInfoService.queryCityCounty(dbStd.getStd_city());
|
|
|
+ map.put("std_countys", std_countys);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String,Object>> provinces = this.stdRegInfoService.queryBzmbGbXzqhdm("000000");
|
|
|
+ map.put("provinces", provinces);
|
|
|
+
|
|
|
+ if(!StringUtils.isEmpty(dbStd.getProvince())){
|
|
|
+ List<Map<String,Object>> citys = this.stdRegInfoService.queryBzmbGbXzqhdm(dbStd.getProvince());
|
|
|
+ map.put("citys", citys);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!StringUtils.isEmpty(dbStd.getCity())){
|
|
|
+ List<Map<String,Object>> countys = this.stdRegInfoService.queryBzmbGbXzqhdm(dbStd.getCity());
|
|
|
+ map.put("countys", countys);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //map.put("FrameParam", SpringConfig.GobalDao.all(FrameParam.class));
|
|
|
+ map.put("FrameParam", FrameParamConstants.GobalParamMap);
|
|
|
+
|
|
|
+ return new Ajax(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("std/stdRegInfo/checkStdReportForm")
|
|
|
+ public Ajax existFacePic() {
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+
|
|
|
+ // 填写自学考试考生赴考报备表开关
|
|
|
+ FrameParam param = this.frameParamService.find(FrameParam.class,"param_name", "std_report_form");
|
|
|
+ if (null != param && "Active".equals(param.getProtect_status())) {
|
|
|
+ // 根据考生查询是否已经缴费
|
|
|
+ List<StdEnrol> list = this.stdEnrolService.listEnrolByStdId(sessionStdRegInfo.getId(),
|
|
|
+ YearCodeHelper.getCurrentYearCode());
|
|
|
+ // 已缴费,则校验是否在填写报备表时间范围之内
|
|
|
+ if (null != list && !list.isEmpty()) {
|
|
|
+ StdReportForm stdReportForm = this.stdReportFormService.queryStdReportFormByTicketNo(
|
|
|
+ Integer.valueOf(YearCodeHelper.getCurrentYearCode()), sessionStdRegInfo.getTicket_no());
|
|
|
+ // 没有填写报备表,则需要填写
|
|
|
+ if (null == stdReportForm) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/queryCity")
|
|
|
+ public Ajax queryCity() {
|
|
|
+ return new Ajax(this.stdRegInfoService.queryCity());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/queryCityCounty")
|
|
|
+ public Ajax queryCityCounty(String std_city) {
|
|
|
+ return new Ajax(this.stdRegInfoService.queryCityCounty(std_city));
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/assistListAll")
|
|
|
+ public Ajax listAll(CfOrganization cfOrg) {
|
|
|
+ return new Ajax(this.cfOrganizationService.assistlistAll(cfOrg));
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/validateIdCardForPhotoReview")
|
|
|
+ public Ajax validateIdCardForPhotoReview() {
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (stdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no = stdRegInfo.getCert_no();
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ if (StringUtils.isEmpty(cert_no)) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("证件号为空,无法完成照片合规检查!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cert_no.length() != 18) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("证件号不是18位身份证号,无法完成照片合规检查!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!cert_no.startsWith("45")) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-2);
|
|
|
+ ajax.setErrorMsg("非区内身份证号,无法完成照片合规检查,请进入考生信息变更申请,提交变更考生照片!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/reg")
|
|
|
+ public Ajax reg(StdRegInfo stdRegInfo) {
|
|
|
+ if(null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getCert_no())){
|
|
|
+ throw new BusinessException("请填写证件号。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getStd_name())){
|
|
|
+ throw new BusinessException("请填写姓名。");
|
|
|
+ }else if(!StringUtils.isEmpty(stdRegInfo.getStd_name())){
|
|
|
+ if (!PatternUtil.checkStdName(stdRegInfo.getStd_name().trim())) {
|
|
|
+ throw new BusinessException("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 证件号验证
|
|
|
+ String cert_no = stdRegInfo.getCert_no();
|
|
|
+
|
|
|
+ if (null == stdRegInfo.getCert_type()) {
|
|
|
+ throw new BusinessException("请选择证件类型。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != stdRegInfo.getCert_type() && stdRegInfo.getCert_type().intValue() != 1) {
|
|
|
+ throw new BusinessException("请使用身份证号注册;使用非身份证件号注册,请到自考办现场进行注册。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stdRegInfo.getCert_type() == 1 && !FrameIdCardUtil.validateIdCard18(cert_no)) {
|
|
|
+ throw new BusinessException("身份证[" + cert_no + "]不合法,请重新填写!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canRegTime", 30);
|
|
|
+ if(null != error){
|
|
|
+ throw new BusinessException(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.stdRegInfoService.existStdRegInfoByCertNo(cert_no)) {
|
|
|
+ // 设置注册失败次数
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canRegTime", 5, 30, "注册失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ throw new BusinessException("证件号[" + cert_no + "]已经存在,请使用该证件号登录!");
|
|
|
+ }else{
|
|
|
+ // 校验18位身份证对应的15位身份证号是否已经存在
|
|
|
+ String temp_cert_no = cert_no.substring(0, 6)+cert_no.substring(8, 17);
|
|
|
+ if (this.stdRegInfoService.existStdRegInfoByCertNo(temp_cert_no)) {
|
|
|
+ // 设置注册失败次数
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canRegTime", 5, 30, "注册失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ throw new BusinessException("证件号[" + cert_no + "]对应的15位身份证号已经存在,请使用15位身份证号进入忘记密码页面找回密码!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(null != stdRegInfo.getStd_name()){
|
|
|
+ stdRegInfo.setStd_name(stdRegInfo.getStd_name().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 调用身份证件认证接口校验身份证合法性(校验不通过,业务继续,校验结果记录到考生信息表中)
|
|
|
+ //checkIdentifyCard(stdRegInfo);
|
|
|
+
|
|
|
+ // 考生来源
|
|
|
+ // int std_source = stdRegInfo.getSchool_id().intValue() == SOCIAL_ID?
|
|
|
+ // StdConst.StudentType.SOCIAL.ordinal():StdConst.StudentType.ASSIST.ordinal();
|
|
|
+ // stdRegInfo.setStd_source(std_source);
|
|
|
+ stdRegInfo.setStatus(StdConst.Status.NEW.ordinal());
|
|
|
+
|
|
|
+ LocalDateTime now = null;
|
|
|
+ StdEnrol time = this.stdEnrolService.getDataBaseTime();
|
|
|
+ if (null != time && null != time.getCreate_time()) {
|
|
|
+ now = time.getCreate_time();
|
|
|
+ } else {
|
|
|
+ now = LocalDateTime.now();
|
|
|
+ }
|
|
|
+ stdRegInfo.setReg_time(DateHelper.format(now));
|
|
|
+ stdRegInfo.setIs_new_stu(1);
|
|
|
+ stdRegInfo.setStd_source(1);
|
|
|
+
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMapTime = new HashMap<String, Object>();
|
|
|
+ paraMapTime.put("year_code", YearCodeHelper.getCurrentYearCodeForTicketNo());
|
|
|
+ List<PlExamTime> dbTime = this.examTimeService.listByMap(paraMapTime);
|
|
|
+ PlExamTime currentTime = null;
|
|
|
+ if (dbTime.size() > 0) {
|
|
|
+ currentTime = dbTime.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("无当前批次信息,请联系系统管理员");
|
|
|
+ }
|
|
|
+ String exam_time_id = currentTime.getId().toString();
|
|
|
+ stdRegInfo.setExam_time_id(exam_time_id);
|
|
|
+ // 密码截取
|
|
|
+ stdRegInfo.setStd_pass(cutPasssword(stdRegInfo.getStd_pass()));
|
|
|
+
|
|
|
+ // 注册时清空准考证号,防止攻击直接生成准考证号
|
|
|
+ stdRegInfo.setTicket_no(null);
|
|
|
+ stdRegInfo.setPhoto_path(null);
|
|
|
+ stdRegInfo.setMajor_id(null);
|
|
|
+
|
|
|
+ // 保存考生信息
|
|
|
+ this.stdRegInfoService.save(stdRegInfo);
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验身份证件合法性
|
|
|
+ * @param stdRegInfo
|
|
|
+ */
|
|
|
+ private String checkIdentifyCard(StdRegInfo stdRegInfo) {
|
|
|
+ try {
|
|
|
+ // 调用身份证接口
|
|
|
+ JsonObject identfiy = IdentifyCardOrcUtil.identifyCard(stdRegInfo.getCert_no(), stdRegInfo.getStd_name());
|
|
|
+
|
|
|
+ if (null == identfiy) {
|
|
|
+ return "身份证认证失败,返回报文为空。";
|
|
|
+ }
|
|
|
+
|
|
|
+ int code = identfiy.get("code").getAsInt();
|
|
|
+
|
|
|
+ if (code == 1) {
|
|
|
+ if(identfiy.get("data").isJsonArray()){
|
|
|
+ // 读取返回的数组
|
|
|
+ JsonArray identifyCards = identfiy.get("data").getAsJsonArray();
|
|
|
+
|
|
|
+ // 遍历返回的数组
|
|
|
+ if (null != identifyCards && identifyCards.size() > 0) {
|
|
|
+ JsonElement identifyCard = null;
|
|
|
+ JsonObject data = null;
|
|
|
+ for (int i = 0; i < identifyCards.size(); i++) {
|
|
|
+ identifyCard = identifyCards.get(i);
|
|
|
+ if (null != identifyCard) {
|
|
|
+ data = identifyCard.getAsJsonObject();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != data) {
|
|
|
+ // 姓名
|
|
|
+ String xm = data.get("xm").getAsString();
|
|
|
+ // 身份证号
|
|
|
+ String sfzh = data.get("sfzh").getAsString();
|
|
|
+
|
|
|
+ // 校验身份证件号与姓名一致
|
|
|
+ if (stdRegInfo.getCert_no().equals(sfzh) && stdRegInfo.getStd_name().equals(xm)) {
|
|
|
+ // 校验身份证件号与姓名一致 则返回
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return "身份证认证失败,身份证号在公安系统不存在,请进入个人中心变更身份信息。";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ JsonObject data = identfiy.get("data").getAsJsonObject();
|
|
|
+ // 姓名
|
|
|
+ String xm = data.get("XM").getAsString();
|
|
|
+ // 身份证号
|
|
|
+ String sfzh = data.get("GMSFHM").getAsString();
|
|
|
+
|
|
|
+ // 校验身份证件号与姓名一致
|
|
|
+ if (stdRegInfo.getCert_no().equals(sfzh) && stdRegInfo.getStd_name().equals(xm)) {
|
|
|
+ // 校验身份证件号与姓名一致 则返回
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (code == 2) {
|
|
|
+ return "身份证认证失败,身份证号在公安系统不存在。";
|
|
|
+ } else if (code == 3) {
|
|
|
+ return "身份证认证失败,查询超时。";
|
|
|
+ } else if (code == 4) {
|
|
|
+ return "身份证认证失败,查询出错。";
|
|
|
+ } else if (code == 5) {
|
|
|
+ return "身份证认证失败,解释出错(报文格式不对)。";
|
|
|
+ } else if (code == 6) {
|
|
|
+ return "身份证认证失败,禁止访问(无权限)。";
|
|
|
+ } else if (code == 7) {
|
|
|
+ return "身份证认证失败,查询条件匹配为误(无法构造查询条件)。";
|
|
|
+ } else if (code == 8) {
|
|
|
+ return "身份证认证失败,禁止访问(服务已停用)。";
|
|
|
+ } else if (code == 9) {
|
|
|
+ return "身份证认证失败,禁止访问(服务已过期)。";
|
|
|
+ } else if (code == 10) {
|
|
|
+ return "身份证认证失败,禁止访问(服务不在开放时段内)。";
|
|
|
+ } else if (code == 11) {
|
|
|
+ return "身份证认证失败,禁止访问(访问人信息为空或不全)。";
|
|
|
+ } else if (code == -49) {
|
|
|
+ return "身份证认证失败,查询出错:非工作时间,服务器被拒绝。";
|
|
|
+ } else if (code == -50) {
|
|
|
+ return "身份证认证失败,查询出错:公民身份号码或姓名为空。";
|
|
|
+ } else if (code == -51) {
|
|
|
+ return "身份证认证失败,查询出错:公民身份号码或姓名超长。";
|
|
|
+ } else if (code == 201) {
|
|
|
+ return "身份证认证失败,查询出错:参数提交方式有误,或有参数为空。";
|
|
|
+ } else if (code == 0) {
|
|
|
+ return "身份证认证失败,查询出错:接口连接异常,请稍后再试。";
|
|
|
+ } else {
|
|
|
+ return "身份证认证失败,错误码:"+code;
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ return "身份证认证接口异常,请联系系统管理员";
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String verifyCertificate(StdRegInfo stdRegInfo) {
|
|
|
+ try {
|
|
|
+ // 调用身份证接口
|
|
|
+ JsonObject identfiy = IdentifyCardOrcUtil.verifyCertificate(stdRegInfo.getCert_no(),
|
|
|
+ stdRegInfo.getStd_name(), stdRegInfo.getCert_type());
|
|
|
+
|
|
|
+ if (null == identfiy) {
|
|
|
+ return "港澳台身份认证失败,返回报文为空。";
|
|
|
+ }
|
|
|
+
|
|
|
+ int code = identfiy.get("code").getAsInt();
|
|
|
+
|
|
|
+ if (code == 1) {
|
|
|
+
|
|
|
+ JsonObject data = identfiy.get("data").getAsJsonObject();
|
|
|
+ // 响应码
|
|
|
+ String data_code = data.get("code").getAsString();
|
|
|
+ // 响应信息
|
|
|
+ String msg = data.get("msg").getAsString();
|
|
|
+
|
|
|
+ // 验证通过
|
|
|
+ if ("70000".equals(data_code)) {
|
|
|
+ return "success";
|
|
|
+ } else {
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return "港澳台身份认证失败,错误码:" + code;
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ return "港澳台身份证认证接口异常,请联系系统管理员";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/setQuestion")
|
|
|
+ public Ajax setQuestion(StdRegInfo stdRegInfo, String validateCode) {
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (StringUtils.isEmpty(validateCode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写校验码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码不正确,请重新填写校验码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdRegInfo.getQuestion())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写问题!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdRegInfo.getAnswer())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写答案!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo seStd = (StdRegInfo)getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ stdRegInfo.setId(seStd.getId());
|
|
|
+ List<StdRegInfo> stdList = this.stdRegInfoService.queryPasswordQuestion(stdRegInfo);
|
|
|
+
|
|
|
+ if (null != stdList && !stdList.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您的账号已经设置密保问题,无法再重新设置!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ // 设置密保问题
|
|
|
+ this.stdRegInfoService.setPasswordQuestion(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/login")
|
|
|
+ public Ajax login(StdRegInfo stdRegInfo, String validateCode) {
|
|
|
+ boolean is_remove = true;
|
|
|
+
|
|
|
+ try {
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (StringUtils.isEmpty(validateCode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写校验码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码不正确,请重新填写校验码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canLoginTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // StdRegInfo dbStdRegInfo =
|
|
|
+ // this.stdRegInfoService.login(stdRegInfo);
|
|
|
+ List<StdRegInfo> stdList = this.stdRegInfoService.loginByCertNo(stdRegInfo);
|
|
|
+
|
|
|
+ if (stdList.size() == 0) {
|
|
|
+ // 记录登录失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canLoginTime", 5, 5, "登录失败累计超过5次,请5分钟之后再登录!");
|
|
|
+ } else {
|
|
|
+ StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ for (Iterator iterator = stdList.iterator(); iterator.hasNext();) {
|
|
|
+ StdRegInfo std = (StdRegInfo) iterator.next();
|
|
|
+ if (seStd != null && !seStd.getId().equals(std.getId())) {
|
|
|
+ throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stdList.size() == 0) {
|
|
|
+ throw new BusinessException("登录失败,账号或密码错误!(注意证件号字母x大小写)");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stdList.size() == 1) {
|
|
|
+ StdRegInfo dbStdRegInfo = stdList.get(0);
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+ std.setQuestion(dbStdRegInfo.getQuestion());
|
|
|
+ std.setYear_code(dbStdRegInfo.getYear_code());
|
|
|
+ std.setStd_mobile(dbStdRegInfo.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(dbStdRegInfo.getStd_name());
|
|
|
+ std.setProvince(dbStdRegInfo.getProvince());
|
|
|
+ //std.setCity(dbStdRegInfo.getCity());
|
|
|
+ //std.setCounty(dbStdRegInfo.getCounty());
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ //return new Ajax(dbStdRegInfo);
|
|
|
+ } else {
|
|
|
+ boolean is_one = true;
|
|
|
+
|
|
|
+ // 账号有多个且都没有准考证号
|
|
|
+ for (StdRegInfo std : stdList) {
|
|
|
+ if (null != std && null != std.getTicket_no()) {
|
|
|
+ is_one = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (is_one) {
|
|
|
+ StdRegInfo dbStdRegInfo = stdList.get(0);
|
|
|
+
|
|
|
+ // 如果账号有多个且都没有准考证号,取第一个账号登陆
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ //return new Ajax(dbStdRegInfo);
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+ std.setQuestion(dbStdRegInfo.getQuestion());
|
|
|
+ std.setYear_code(dbStdRegInfo.getYear_code());
|
|
|
+ std.setStd_mobile(dbStdRegInfo.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(dbStdRegInfo.getStd_name());
|
|
|
+ std.setProvince(dbStdRegInfo.getProvince());
|
|
|
+ //std.setCity(dbStdRegInfo.getCity());
|
|
|
+ //std.setCounty(dbStdRegInfo.getCounty());
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ } else {
|
|
|
+ is_remove = false;
|
|
|
+
|
|
|
+ List<StdRegInfo> tepm_list = new ArrayList<StdRegInfo>();
|
|
|
+ for (StdRegInfo temp_std : stdList) {
|
|
|
+ if (null != temp_std ) {
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(temp_std.getId());
|
|
|
+ std.setTicket_no(temp_std.getTicket_no());
|
|
|
+ std.setYear_code(temp_std.getYear_code());
|
|
|
+ std.setStd_mobile(temp_std.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(temp_std.getStd_name());
|
|
|
+ std.setProvince(temp_std.getProvince());
|
|
|
+ //std.setCity(temp_std.getCity());
|
|
|
+ //std.setCounty(temp_std.getCounty());
|
|
|
+
|
|
|
+ tepm_list.add(std);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(tepm_list);
|
|
|
+ //return new Ajax(stdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ if(is_remove){
|
|
|
+ // 防止校验码重复使用,被人攻击
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/loginForPhone")
|
|
|
+ public Ajax loginForPhone(StdRegInfo stdRegInfo, String code, String validateCode) {
|
|
|
+ boolean is_remove = true;
|
|
|
+
|
|
|
+ try {
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (StringUtils.isEmpty(validateCode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写校验码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(validateCode) && !validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码错误,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(code)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写短信验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getCert_no())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写手机号码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canLoginTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StdRegInfo> stdList = this.stdRegInfoService.findStdByStdPhone(stdRegInfo.getCert_no(),
|
|
|
+ stdRegInfo.getId());
|
|
|
+
|
|
|
+ if (stdList.size() == 0) {
|
|
|
+ // 记录登录失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canLoginTime", 5, 5, "登录失败累计超过5次,请5分钟之后再登录!");
|
|
|
+ } else {
|
|
|
+ StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ for (Iterator iterator = stdList.iterator(); iterator.hasNext();) {
|
|
|
+ StdRegInfo std = (StdRegInfo) iterator.next();
|
|
|
+ if (seStd != null && !seStd.getId().equals(std.getId())) {
|
|
|
+ throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationCode> codes = this.sysVerificationCodeService
|
|
|
+ .querySysVerificationCodeByCode(stdRegInfo.getCert_no(), code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送验证码!");
|
|
|
+
|
|
|
+ // 记录验证失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canLoginTime", 5, 5, "登录失败累计超过5次,请5分钟之后再登录!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stdList.size() == 1) {
|
|
|
+ // 如果手机号码对应的账号只有一个,则更新验证码,如果有多个账号,选择账号后第二次进入再更新验证码
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationCode sysVerificationCode = codes.get(0);
|
|
|
+ sysVerificationCode.setStatus(1);
|
|
|
+ this.sysVerificationCodeService.edit(sysVerificationCode);
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = stdList.get(0);
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+
|
|
|
+ std.setYear_code(dbStdRegInfo.getYear_code());
|
|
|
+ std.setStd_mobile(dbStdRegInfo.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(dbStdRegInfo.getStd_name());
|
|
|
+ std.setProvince(dbStdRegInfo.getProvince());
|
|
|
+
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ } else {
|
|
|
+ boolean is_one = true;
|
|
|
+
|
|
|
+ // 账号有多个且都没有准考证号
|
|
|
+ for (StdRegInfo std : stdList) {
|
|
|
+ if (null != std && null != std.getTicket_no()) {
|
|
|
+ is_one = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (is_one) {
|
|
|
+ StdRegInfo dbStdRegInfo = stdList.get(0);
|
|
|
+
|
|
|
+ // 如果账号有多个且都没有准考证号,取第一个账号登陆
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+
|
|
|
+ std.setYear_code(dbStdRegInfo.getYear_code());
|
|
|
+ std.setStd_mobile(dbStdRegInfo.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(dbStdRegInfo.getStd_name());
|
|
|
+ std.setProvince(dbStdRegInfo.getProvince());
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ } else {
|
|
|
+ is_remove = false;
|
|
|
+
|
|
|
+ List<StdRegInfo> tepm_list = new ArrayList<StdRegInfo>();
|
|
|
+ for (StdRegInfo temp_std : stdList) {
|
|
|
+ if (null != temp_std ) {
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(temp_std.getId());
|
|
|
+ std.setTicket_no(temp_std.getTicket_no());
|
|
|
+
|
|
|
+ std.setYear_code(temp_std.getYear_code());
|
|
|
+ std.setStd_mobile(temp_std.getStd_mobile());
|
|
|
+ std.setCurrent_year_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ std.setStd_name(temp_std.getStd_name());
|
|
|
+ std.setProvince(temp_std.getProvince());
|
|
|
+
|
|
|
+
|
|
|
+ tepm_list.add(std);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(tepm_list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ if(is_remove){
|
|
|
+ // 防止校验码重复使用,被人攻击
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private boolean isSendSmsExt(){
|
|
|
+ HttpSession session = getSession();
|
|
|
+ Object sessionCanLoginTime = session.getAttribute("canSendTime");
|
|
|
+ if(sessionCanLoginTime !=null){
|
|
|
+ long canLoginTime = (long)sessionCanLoginTime;
|
|
|
+ if(new Date().getTime() <canLoginTime){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ session.removeAttribute("canSendTime");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ long currentTime = new Date().getTime();
|
|
|
+ long canBindTime = currentTime + 1000*60*1;
|
|
|
+ session.setAttribute("canSendTime", canBindTime);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void removeSendSmsExt(){
|
|
|
+ HttpSession session = getSession();
|
|
|
+ Object sessionCanLoginTime = session.getAttribute("canSendTime");
|
|
|
+ if(sessionCanLoginTime !=null){
|
|
|
+ session.removeAttribute("canSendTime");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private boolean isIdentifyCardFialExt(){
|
|
|
+ HttpSession session = getSession();
|
|
|
+ Object sessionCanLoginTime = session.getAttribute("canIdentifyCardTime");
|
|
|
+ if(sessionCanLoginTime !=null){
|
|
|
+ long canLoginTime = (long)sessionCanLoginTime;
|
|
|
+ if(new Date().getTime() <canLoginTime){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ session.removeAttribute("canIdentifyCardTime");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ long currentTime = new Date().getTime();
|
|
|
+ long canBindTime = currentTime + 1000*60*1;
|
|
|
+ session.setAttribute("canIdentifyCardTime", canBindTime);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/logout")
|
|
|
+ public Ajax logout(String token) {
|
|
|
+ //[高风险]安全退出无效-服务端 退出如APP传token,更新数据库中获取token失效,
|
|
|
+ if(!StringUtils.isEmpty(token)){
|
|
|
+ StdAppLogintoken stdAppLogintoken = this.stdAppLogintokenDao.find("token", token);
|
|
|
+ if(null != stdAppLogintoken && "1".equals(stdAppLogintoken.getStatus())){
|
|
|
+ stdAppLogintoken.setStatus("0");
|
|
|
+ this.stdAppLogintokenDao.updateStdAppLogintokenStatus(stdAppLogintoken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/password")
|
|
|
+ public Ajax password(String std_pass_old, String std_pass_new) {
|
|
|
+ std_pass_old = cutPasssword(std_pass_old);
|
|
|
+ std_pass_new = cutPasssword(std_pass_new);
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ if (dbStdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!dbStdRegInfo.getStd_pass().equals(std_pass_old)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("旧密码不正确,请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ dbStdRegInfo.setStd_pass(std_pass_new);
|
|
|
+ this.stdRegInfoService.update(dbStdRegInfo);
|
|
|
+ getRequest().getSession().removeAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendSmsForLogin")
|
|
|
+ public Ajax sendSmsForLogin(String std_mobile, String validateCode) {
|
|
|
+ try {
|
|
|
+ if(!StringUtils.isEmpty(validateCode)){
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码错误,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (null == std_mobile) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(std_mobile, "sendSmsForLogin", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ error = this.isSysOperateFail(std_mobile, "canLoginTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByStdPhone(std_mobile, null);
|
|
|
+
|
|
|
+ if (null == stds || stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("手机号未绑定!");
|
|
|
+
|
|
|
+ removeSendSmsExt();
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(std_mobile, "canLoginTime", 5, 5, "登录失败累计超过5次,请5分钟之后再登录!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ int code = (int) ((Math.random() * 9 + 1) * 100000);
|
|
|
+
|
|
|
+ String smstext = "您正在登陆广西自学考试网上系统,验证码:" + code + ",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(std_mobile, smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg")?"验证码发送失败,请稍后重试!":reslut.get("msg").getAsString());
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ removeSendSmsExt();
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(std_mobile);
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(std_mobile);
|
|
|
+ sysCode.setCode(code + "");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_mobile, "sendSmsForLogin", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendSmsForPay")
|
|
|
+ public Ajax sendSmsForPay(String orderNum) {
|
|
|
+
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ if (dbStdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(dbStdRegInfo.getBindphone())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您的账号未绑定手机号码,请先完成手机号码绑定。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(dbStdRegInfo.getBindphone(), "sendSmsForPay", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int) ((Math.random() * 9 + 1) * 100000);
|
|
|
+
|
|
|
+ String smstext = "您正在广西自学考试网上系统报考缴费,验证码:" + code + ",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(dbStdRegInfo.getBindphone(), smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg") ? "验证码发送失败,请稍后重试!" : reslut.get("msg").getAsString());
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(dbStdRegInfo.getBindphone());
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(dbStdRegInfo.getBindphone());
|
|
|
+ sysCode.setCode(code + "");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(dbStdRegInfo.getBindphone(), "sendSmsForPay", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendSmsForFindPassword")
|
|
|
+ public Ajax sendSmsForFindPassword(String std_name,String cert_no, String std_mobile) {
|
|
|
+ if (null == std_name) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入姓名!");
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ if (!PatternUtil.checkStdName(std_name.trim())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == cert_no){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入证件号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == std_mobile){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(std_mobile, "sendSmsForFindPassword", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByCertNoAndStdPhone(std_name,cert_no,null);
|
|
|
+ StdRegInfo dbStdRegInfo = null;
|
|
|
+
|
|
|
+ if (null == stds || stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份信息输入有误,请重新输入!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ boolean isbindphone = false;
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getBindphone()){
|
|
|
+ isbindphone = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!isbindphone){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定手机,请使用其他方式修改密码!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ isbindphone = false;
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getBindphone()&&std_mobile.equals(std.getBindphone())){
|
|
|
+ isbindphone = true;
|
|
|
+ dbStdRegInfo = std;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!isbindphone){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定该手机号!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int)((Math.random()*9+1)*100000);
|
|
|
+
|
|
|
+ String smstext = "您正在广西自学考试网上系统修改密码,验证码:"+code+",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(std_mobile, smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg")?"验证码发送失败,请稍后重试!":reslut.get("msg").getAsString());
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ //插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(std_mobile);
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ //插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(std_mobile);
|
|
|
+ sysCode.setCode(code+"");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 设置验证通过的考生信息到临时会话中,在修改密码时校验
|
|
|
+ HttpSession session = getSession();
|
|
|
+ session.setAttribute("temp_std", dbStdRegInfo);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_mobile, "sendSmsForFindPassword", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkSms")
|
|
|
+ public Ajax checkSms(String std_name,String cert_no, String std_mobile,String code) {
|
|
|
+ if (StringUtils.isEmpty(std_name)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入姓名!");
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ if (!PatternUtil.checkStdName(std_name.trim())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(cert_no)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入证件号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(code)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByCertNoAndStdPhone(std_name,cert_no,std_mobile);
|
|
|
+
|
|
|
+ // 如果手机号为空,检查 账号是否绑定手机
|
|
|
+ if (StringUtils.isEmpty(std_mobile)) {
|
|
|
+ boolean isbindphone = false;
|
|
|
+ for (StdRegInfo std : stds) {
|
|
|
+ if (null != std.getBindphone()) {
|
|
|
+ isbindphone = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isbindphone) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定手机!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = null;
|
|
|
+
|
|
|
+ if (null == stds || stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份或手机号输入有误,请重新输入!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ boolean isbindphone = false;
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getBindphone()){
|
|
|
+ isbindphone = true;
|
|
|
+ dbStdRegInfo = std;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(!isbindphone){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定该手机号!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationCode> codes = this.sysVerificationCodeService.querySysVerificationCodeByCode(std_mobile, code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送验证码!");
|
|
|
+
|
|
|
+ //记录验证失败信息
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationCode sysVerificationCode = codes.get(0);
|
|
|
+ sysVerificationCode.setStatus(1);
|
|
|
+ this.sysVerificationCodeService.edit(sysVerificationCode);
|
|
|
+
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = null;
|
|
|
+ if(null != dbStdRegInfo){
|
|
|
+ std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendMailForFindPassword")
|
|
|
+ public Ajax sendMailForFindPassword(String std_name,String cert_no, String std_email) {
|
|
|
+ if(null == std_name){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入姓名!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ if (!PatternUtil.checkStdName(std_name.trim())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == cert_no){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入证件号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == std_email){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入电子邮箱!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ String regex_email = "^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)$";
|
|
|
+ if(!Pattern.matches(regex_email, std_email)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入正确的电子邮箱!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送
|
|
|
+ String error = this.isSysOperateFail(cert_no, "sendMailForFindPassword", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByCertNoAndStdMail(std_name,cert_no,std_email);
|
|
|
+ StdRegInfo dbStdRegInfo = null;
|
|
|
+
|
|
|
+ if (null == stds || stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份或电子邮件输入有误,请重新输入!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ boolean isbindmail = false;
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getBind_email()){
|
|
|
+ isbindmail = true;
|
|
|
+ dbStdRegInfo = std;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!isbindmail){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定该电子邮箱!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int code = (int)((Math.random()*9+1)*100000);
|
|
|
+
|
|
|
+ String subject = "广西自学考试网上系统邮件验证码";
|
|
|
+ String text = "您正在广西自学考试网上系统修改密码,验证码:"+code+",如非本人操作,请忽略本邮件。(广西自学考试)";
|
|
|
+
|
|
|
+ // 线程发送邮件
|
|
|
+ MailThread mail = new MailThread();
|
|
|
+ mail.setEmail(std_email);
|
|
|
+ mail.setSubject(subject);
|
|
|
+ mail.setText(text);
|
|
|
+ mail.start();
|
|
|
+
|
|
|
+ /*try {
|
|
|
+
|
|
|
+ SendEmailUtil.sendEmail(std_email, subject, text);
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("邮件发送失败,请稍后重试!");
|
|
|
+
|
|
|
+ //清空1分钟内不允许再次发送短信
|
|
|
+ removeSendSmsExt();
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //插入邮件验证码表
|
|
|
+ SysEmailInfo email = new SysEmailInfo();
|
|
|
+ email.setEmail(std_email);
|
|
|
+ email.setContent(text);
|
|
|
+ this.sysEmailInfoService.insert(email);
|
|
|
+
|
|
|
+ //插入短信验证码表
|
|
|
+ SysVerificationEmailCode sysCode = new SysVerificationEmailCode();
|
|
|
+ sysCode.setEmail(std_email);
|
|
|
+ sysCode.setCode(code+"");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationEmailCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 设置验证通过的考生信息到临时会话中,在修改密码时校验
|
|
|
+ HttpSession session = getSession();
|
|
|
+ session.setAttribute("temp_std", dbStdRegInfo);
|
|
|
+
|
|
|
+ // 记录发次数
|
|
|
+ this.setSysOperateFail(cert_no, "sendMailForFindPassword", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkMail")
|
|
|
+ public Ajax checkMail(String std_name,String cert_no, String std_email,String code) {
|
|
|
+ if(StringUtils.isEmpty(std_name)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入姓名!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ if (!PatternUtil.checkStdName(std_name.trim())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(cert_no)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入证件号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(code)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByCertNoAndStdMail(std_name,cert_no,std_email);
|
|
|
+
|
|
|
+ // 如果电子 邮件为空,检查 账号是否绑定邮箱
|
|
|
+ if (StringUtils.isEmpty(std_email)) {
|
|
|
+ boolean isbindmail = false;
|
|
|
+ for (StdRegInfo std : stds) {
|
|
|
+ if (null != std.getBind_email()) {
|
|
|
+ isbindmail = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isbindmail) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定电子邮箱!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入电子邮箱!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = null;
|
|
|
+
|
|
|
+ if (null == stds || stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份或电子邮箱输入有误!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ boolean isbindmail = false;
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getBind_email()){
|
|
|
+ isbindmail = true;
|
|
|
+ dbStdRegInfo = std;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(!isbindmail){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("账号未绑定该电子邮箱!");
|
|
|
+
|
|
|
+ // 记录校验失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationEmailCode> codes = this.sysVerificationEmailCodeService.querySysVerificationEmailCodeByCode(std_email, code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送邮件!");
|
|
|
+
|
|
|
+ //记录验证失败信息
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationEmailCode sysVerificationCode = codes.get(0);
|
|
|
+ sysVerificationCode.setStatus(1);
|
|
|
+ this.sysVerificationEmailCodeService.edit(sysVerificationCode);
|
|
|
+
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = null;
|
|
|
+ if(null != dbStdRegInfo){
|
|
|
+ std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private String isSysOperateFail(String account,String operate_type,Integer second){
|
|
|
+ SysOperateFail fail = this.sysOperateFailService.querySysOperateFailByAccount(account, operate_type, second);
|
|
|
+ if(null != fail){
|
|
|
+ if(fail.getFail_count()>=fail.getMax_count()){
|
|
|
+ return fail.getFail_remark();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setSysOperateFail(String account,String operate_type,Integer max_count,Integer second,String fail_remark){
|
|
|
+ SysOperateFail fail = this.sysOperateFailService.querySysOperateFailByAccount(account, operate_type, second);
|
|
|
+ if(null == fail){
|
|
|
+ fail = new SysOperateFail();
|
|
|
+ fail.setAccount(account);
|
|
|
+ fail.setFail_count(1);
|
|
|
+ fail.setMax_count(max_count);
|
|
|
+ fail.setFail_remark(fail_remark);
|
|
|
+ fail.setOperate_type(operate_type);
|
|
|
+
|
|
|
+ this.sysOperateFailService.insert(fail);
|
|
|
+ }else{
|
|
|
+ fail.setFail_count(fail.getFail_count()+1);
|
|
|
+
|
|
|
+ LocalDateTime now = this.sysOperateFailService.getDataBaseTime().getOperate_time();
|
|
|
+ fail.setOperate_time(now);
|
|
|
+
|
|
|
+ this.sysOperateFailService.edit(fail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendSms")
|
|
|
+ public Ajax sendSms(String std_pass, String std_mobile) {
|
|
|
+ if(null == std_mobile){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ std_pass = cutPasssword(std_pass);
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo std = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+
|
|
|
+ if (std != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!std.getStd_pass().equals(std_pass)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("密码不正确请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(std_mobile, "sendSms", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 当前账号已经绑定该手机号,不允许重复绑定
|
|
|
+ if(std_mobile.equals(std.getBindphone())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您的账号已经绑定该手机号码,不需要重复绑定!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int)((Math.random()*9+1)*100000);
|
|
|
+
|
|
|
+ String smstext = "您正在广西自学考试网上系统绑定手机,验证码:"+code+",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(std_mobile, smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg")?"验证码发送失败,请稍后重试!":reslut.get("msg").getAsString());
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ //插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(std_mobile);
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ //插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(std_mobile);
|
|
|
+ sysCode.setCode(code+"");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_mobile, "sendSms", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendEmail")
|
|
|
+ public Ajax sendEmail(String std_pass, String std_email) {
|
|
|
+ if(null == std_email){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入电子邮箱!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送
|
|
|
+ String error = this.isSysOperateFail(std_email, "sendEmail", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ std_pass = cutPasssword(std_pass);
|
|
|
+
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo std = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ if (std != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!std.getStd_pass().equals(std_pass)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("密码不正确请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ // 当前账号已经绑定该手机号,不允许重复绑定
|
|
|
+ if(std_email.equals(std.getBind_email())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您的账号已经绑定该电子邮箱,不需要重复绑定!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int)((Math.random()*9+1)*100000);
|
|
|
+
|
|
|
+ String subject = "广西自学考试网上系统邮件验证码";
|
|
|
+ String text = "您正在广西自学考试网上系统绑定电子邮箱,验证码:"+code+",如非本人操作,请忽略本邮件。(广西自学考试)";
|
|
|
+
|
|
|
+ // 线程发送邮件
|
|
|
+ MailThread mail = new MailThread();
|
|
|
+ mail.setEmail(std_email);
|
|
|
+ mail.setSubject(subject);
|
|
|
+ mail.setText(text);
|
|
|
+ mail.start();
|
|
|
+
|
|
|
+ //插入邮件验证码表
|
|
|
+ SysEmailInfo sms = new SysEmailInfo();
|
|
|
+ sms.setEmail(std_email);
|
|
|
+ sms.setContent(text);
|
|
|
+ this.sysEmailInfoService.insert(sms);
|
|
|
+
|
|
|
+ //插入邮件验证码表
|
|
|
+ SysVerificationEmailCode sysCode = new SysVerificationEmailCode();
|
|
|
+ sysCode.setEmail(std_email);
|
|
|
+ sysCode.setCode(code+"");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationEmailCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_email, "sendEmail", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/sendSmsForLoginBindPhone")
|
|
|
+ public Ajax sendSmsForLoginBindPhone(String std_mobile, String validateCode) {
|
|
|
+ try {
|
|
|
+ if(!StringUtils.isEmpty(validateCode)){
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码错误,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (null == std_mobile) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo std = this.stdRegInfoService.find(stdRegInfo.getId());
|
|
|
+ if (std != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 当前账号已经绑定该手机号,不允许重复绑定
|
|
|
+ if (std_mobile.equals(std.getBindphone())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您的账号已经绑定该手机号码,不需要重复绑定!");
|
|
|
+ return ajax;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(std_mobile, "sendSmsForLoginBindPhone", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int) ((Math.random() * 9 + 1) * 100000);
|
|
|
+
|
|
|
+ String smstext = "您正在广西自学考试网上系统绑定手机,验证码:" + code + ",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(std_mobile, smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg")?"验证码发送失败,请稍后重试!":reslut.get("msg").getAsString());
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ // 清空1分钟内不允许再次发送短信
|
|
|
+ removeSendSmsExt();
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(std_mobile);
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(std_mobile);
|
|
|
+ sysCode.setCode(code + "");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_mobile, "sendSmsForLoginBindPhone", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/bindPhone")
|
|
|
+ public Ajax bindPhone(String std_pass, String std_mobile,String code) {
|
|
|
+ if(null == std_mobile){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == std_pass){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入密码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == code){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ std_pass = cutPasssword(std_pass);
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if(!stdRegInfo.getStd_pass().equals(std_pass)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("密码不正确请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canBindPhoneTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String year_code = YearCodeHelper.getCurrentYearCode();
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByStdPhone(std_mobile, null);
|
|
|
+ if(null != stds && !stds.isEmpty()){
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if (stdRegInfo.getId().intValue() != std.getId().intValue() && null != std.getYear_code()
|
|
|
+ && year_code.equals(std.getYear_code().toString())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("手机号" + std_mobile + "已绑定,不允许重复绑定!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationCode> codes = this.sysVerificationCodeService.querySysVerificationCodeByCode(std_mobile, code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送验证码!");
|
|
|
+
|
|
|
+ //记录验证失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canBindPhoneTime", 5, 5, "绑定手机失败累计超过5次,请5分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationCode sysVerificationCode = codes.get(0);
|
|
|
+ sysVerificationCode.setStatus(1);
|
|
|
+ this.sysVerificationCodeService.edit(sysVerificationCode);
|
|
|
+
|
|
|
+ // 验证通过,更新绑定手机号码到考生表
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(stdRegInfo.getId());
|
|
|
+ std.setBindphone(std_mobile);
|
|
|
+ std.setStd_mobile(std_mobile);
|
|
|
+
|
|
|
+ // 加密考生敏感信息
|
|
|
+ this.stdRegInfoService.EncryptStd(std);
|
|
|
+
|
|
|
+ this.stdRegInfoService.edit(std);
|
|
|
+
|
|
|
+ // 更新到缓存中
|
|
|
+ stdRegInfo.setBindphone(std_mobile);
|
|
|
+ stdRegInfo.setStd_mobile(std_mobile);
|
|
|
+
|
|
|
+ stdRegInfo.setBindphone_en(std.getBindphone_en());
|
|
|
+ stdRegInfo.setStd_mobile_en(std.getStd_mobile_en());
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, stdRegInfo);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(stdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/bindEmail")
|
|
|
+ public Ajax bindEmail(String std_pass, String std_email,String code) {
|
|
|
+ if(null == std_email){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入电子邮箱!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == std_pass){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入密码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == code){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ std_pass = cutPasssword(std_pass);
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if(!stdRegInfo.getStd_pass().equals(std_pass)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("密码不正确请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canBindEmailTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据邮箱和邮件验证码获取短信信息
|
|
|
+ List<SysVerificationEmailCode> codes = this.sysVerificationEmailCodeService.querySysVerificationEmailCodeByCode(std_email, code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送验证码!");
|
|
|
+
|
|
|
+ //记录验证失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canBindEmailTime", 5, 5, "绑定邮箱失败累计超过5次,请5分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationEmailCode sysVerificationEmailCode = codes.get(0);
|
|
|
+ sysVerificationEmailCode.setStatus(1);
|
|
|
+ this.sysVerificationEmailCodeService.edit(sysVerificationEmailCode);
|
|
|
+
|
|
|
+ // 验证通过,更新绑定手机号码到考生表
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(stdRegInfo.getId());
|
|
|
+ std.setBind_email(std_email);
|
|
|
+ //std.setStd_email(std_email);
|
|
|
+
|
|
|
+ // 加密考生敏感信息
|
|
|
+ this.stdRegInfoService.EncryptStd(std);
|
|
|
+
|
|
|
+ this.stdRegInfoService.edit(std);
|
|
|
+
|
|
|
+ // 更新到缓存中
|
|
|
+ stdRegInfo.setBind_email(std_email);
|
|
|
+ //stdRegInfo.setStd_email(std_email);
|
|
|
+
|
|
|
+ stdRegInfo.setBind_email_en(std.getBind_email_en());
|
|
|
+ //stdRegInfo.setStd_email_en(std.getStd_email_en());
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, stdRegInfo);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(stdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/bindPhoneForLogin")
|
|
|
+ public Ajax bindPhoneForLogin(StdRegInfo regInfo,String validateCode, String code) {
|
|
|
+ try {
|
|
|
+ if (null == code) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入验证码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(sessionVcode)){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请刷新校验码并重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码不正确,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ if (null == regInfo.getStd_mobile()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canBindTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String year_code = YearCodeHelper.getCurrentYearCode();
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByStdPhone(regInfo.getStd_mobile(), null);
|
|
|
+ if(null != stds && !stds.isEmpty()){
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ if(null != std.getYear_code() && year_code.equals(std.getYear_code().toString())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("手机号"+regInfo.getStd_mobile()+"已登记,不允许重复登记!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationCode> codes = this.sysVerificationCodeService.querySysVerificationCodeByCode(regInfo.getStd_mobile(),
|
|
|
+ code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证码错误或验证码已失效,请重新发送验证码!");
|
|
|
+
|
|
|
+ // 记录验证失败信息
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canBindTime", 5, 5, "绑定手机失败累计超过5次,请5分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证通过,更新验证码表
|
|
|
+ SysVerificationCode sysVerificationCode = codes.get(0);
|
|
|
+ sysVerificationCode.setStatus(1);
|
|
|
+ this.sysVerificationCodeService.edit(sysVerificationCode);
|
|
|
+
|
|
|
+ // 验证通过,更新绑定手机号码到考生表
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+
|
|
|
+ std.setId(stdRegInfo.getId());
|
|
|
+ std.setBindphone(regInfo.getStd_mobile());
|
|
|
+ std.setStd_mobile(regInfo.getStd_mobile());
|
|
|
+ std.setProvince(regInfo.getProvince());
|
|
|
+ std.setCity(regInfo.getCity());
|
|
|
+ std.setCounty(regInfo.getCounty());
|
|
|
+ std.setStd_address(regInfo.getStd_address());
|
|
|
+ std.setYear_code(Integer.valueOf(year_code));
|
|
|
+
|
|
|
+ // 加密考生敏感信息
|
|
|
+ this.stdRegInfoService.EncryptStd(std);
|
|
|
+
|
|
|
+ this.stdRegInfoService.edit(std);
|
|
|
+
|
|
|
+ // 更新到缓存中
|
|
|
+ stdRegInfo.setBindphone(regInfo.getStd_mobile());
|
|
|
+ stdRegInfo.setStd_mobile(regInfo.getStd_mobile());
|
|
|
+
|
|
|
+ stdRegInfo.setBindphone_en(std.getBindphone_en());
|
|
|
+ stdRegInfo.setStd_mobile_en(std.getStd_mobile_en());
|
|
|
+
|
|
|
+ stdRegInfo.setProvince(std.getProvince());
|
|
|
+ stdRegInfo.setCity(std.getCity());
|
|
|
+ stdRegInfo.setCounty(std.getCounty());
|
|
|
+ stdRegInfo.setStd_address(std.getStd_address());
|
|
|
+ stdRegInfo.setStd_address_en(std.getStd_address_en());
|
|
|
+
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, stdRegInfo);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(stdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/addStdeRportForm")
|
|
|
+ public Ajax addStdeRportForm(StdReportForm stdReportForm, String validateCode, Integer std_id) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请刷新校验码并重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码不正确,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession()
|
|
|
+ .getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (!StringUtils.isEmpty(std_id) && sessionStdRegInfo != null & !sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生登录异常,请不要在同一个浏览器登录多个用户,请务必退出后重新登录!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo stdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if (!sessionStdRegInfo.getId().equals(stdRegInfo.getId())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填写自学考试考生赴考报备表开关
|
|
|
+ FrameParam param = this.frameParamService.find(FrameParam.class, "param_name", "std_report_form");
|
|
|
+ if (null != param && "Active".equals(param.getProtect_status())) {
|
|
|
+ // 根据考生查询是否已经缴费
|
|
|
+ List<StdEnrol> list = this.stdEnrolService.listEnrolByStdId(sessionStdRegInfo.getId(),
|
|
|
+ YearCodeHelper.getCurrentYearCode());
|
|
|
+ // 已缴费,则校验是否在填写报备表时间范围之内
|
|
|
+ if (null != list && !list.isEmpty()) {
|
|
|
+
|
|
|
+ LocalDateTime now = null;
|
|
|
+ StdEnrol time = this.stdEnrolService.getDataBaseTime();
|
|
|
+ if (null != time && null != time.getCreate_time()) {
|
|
|
+ now = time.getCreate_time();
|
|
|
+ } else {
|
|
|
+ now = LocalDateTime.now();
|
|
|
+ }
|
|
|
+
|
|
|
+ PlExamTime dbTime = this.examTimeService.queryPlExamTime(YearCodeHelper.getCurrentYearCode());
|
|
|
+
|
|
|
+ LocalDate start_date = dbTime.getExam_first_day();
|
|
|
+ LocalDate end_date = null;
|
|
|
+ if(null != dbTime.getExam_third_day()){
|
|
|
+ end_date = dbTime.getExam_third_day();
|
|
|
+ }else{
|
|
|
+ end_date = dbTime.getExam_second_day();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填写开始时间
|
|
|
+ LocalDateTime start_time = start_date.atTime(0, 0, 0);
|
|
|
+ // 填写结束时间
|
|
|
+ LocalDateTime end_time = end_date.atTime(0, 0, 0);
|
|
|
+
|
|
|
+ // 天数
|
|
|
+ int days = Integer.valueOf(param.getParam_value());
|
|
|
+
|
|
|
+ // 填写开始时间设定在考试开始时间+天数
|
|
|
+ start_time = start_time.plusDays(-days);
|
|
|
+ // 填写结束时间设定在考试结束时间
|
|
|
+ end_time = end_time.plusDays(1);
|
|
|
+
|
|
|
+ //now = start_time.plusDays(1);
|
|
|
+ if (!DateHelper.isBetween(now, start_time, end_time)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("未在"+YearCodeHelper.getCurrentYearCode().substring(0, 4)+"年"+YearCodeHelper.getCurrentYearCode().substring(4, 6)+"月报备表填写时间范围之内,暂不允许提交!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("您本批次没有报考缴费,不允许提交!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("本批次报备表填写时间未开放,不允许提交!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getStd_name())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入姓名!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getTicket_no())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入准考证号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getStd_mobile())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getAlready_in_city())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择您当前是否已在考点所在城市!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getCurrent_province())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择当前所在地区省(市、自治区)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getCurrent_city())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择当前所在地区市!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getCurrent_county())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择当前所在地区区(县)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getCurrent_address())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写当前所在地区详细地址!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("否".equals(stdReportForm.getAlready_in_city())) {
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getTravel_date())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写预计出行至报考考区的时间!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getArrive_province())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择抵达考区后入住地区省(市、自治区)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getArrive_city())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择抵达考区后入住地区市!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getArrive_county())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择抵达考区后入住地区区(县)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getArrive_address())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写抵达考区后入住地区详细地址!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (!StringUtils.isEmpty(stdReportForm.getTravel_date())) {
|
|
|
+ stdReportForm.setTravel_date(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(stdReportForm.getArrive_province())) {
|
|
|
+ stdReportForm.setArrive_province(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(stdReportForm.getArrive_city())) {
|
|
|
+ stdReportForm.setArrive_city(null);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(stdReportForm.getArrive_county())) {
|
|
|
+ stdReportForm.setArrive_county(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(stdReportForm.getArrive_address())) {
|
|
|
+ stdReportForm.setArrive_address(null);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getIs_plan_city())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择考前14天期间,是否计划去或去过除当前所在地及考区所在地外的市!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StdReportFormPlanCity> citys = null;
|
|
|
+
|
|
|
+ if ("是".equals(stdReportForm.getIs_plan_city())) {
|
|
|
+ if (StringHelper.isEmpty(stdReportForm.getPlanJson())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写计划或去过的地区!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ citys = JsonHelper.fromJson(stdReportForm.getPlanJson(), StdReportFormPlanCity.class);
|
|
|
+ int i = 0;
|
|
|
+ for (StdReportFormPlanCity city : citys) {
|
|
|
+ if (StringUtils.isEmpty(city.getPlan_province())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择第" + (i + 1) + "行的省(市、自治区)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(city.getPlan_city())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择第" + (i + 1) + "行的市!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(city.getPlan_county())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择第" + (i + 1) + "行的区(县)!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getIs_high_risk())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择是否有中高风险地区所在市(县、区)旅居史!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(stdReportForm.getIs_quarantine())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请选择是否处于隔离或居家观察中!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(stdRegInfo.getCert_no(), "canBindTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(stdReportForm.getYear_code())){
|
|
|
+ stdReportForm.setYear_code(Integer.valueOf(YearCodeHelper.getCurrentYearCode()));
|
|
|
+ }
|
|
|
+
|
|
|
+ StdReportForm reportForm = this.stdReportFormService
|
|
|
+ .queryStdReportFormByTicketNo(stdReportForm.getYear_code(), stdReportForm.getTicket_no());
|
|
|
+ if (null != reportForm) {
|
|
|
+ this.stdReportFormService.delete(reportForm.getId());
|
|
|
+ this.stdReportFormService.deleteStdReportFormPlanCityByReportFormId(reportForm.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ stdReportForm.setId(null);
|
|
|
+ Integer report_form_id = this.stdReportFormService.addStdReportForm(stdReportForm);
|
|
|
+
|
|
|
+
|
|
|
+ if (null != citys) {
|
|
|
+ for (StdReportFormPlanCity city : citys) {
|
|
|
+ city.setId(null);
|
|
|
+ city.setReport_form_id(report_form_id);
|
|
|
+ this.stdReportFormService.addStdReportFormPlanCity(city);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 无登录修改密码
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/passwordNoLogin")
|
|
|
+ public Ajax passwordNoLogin(String id, String validate_code, String std_pass1, String std_pass2) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+
|
|
|
+ StdRegInfo temp_std = (StdRegInfo) getRequest().getSession().getAttribute("temp_std");
|
|
|
+
|
|
|
+ // 校验验证通过的考生是否与修改密码的考生一致
|
|
|
+ if(null == temp_std || !java.lang.String.valueOf(temp_std.getId()).equals(id)){
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("考生ID非法,请重新验证考生信息!");
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ if (!std_pass1.equalsIgnoreCase(std_pass2)) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("两次输入密码不一致,请重新输入!");
|
|
|
+ } else {
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(id);
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = stdRegInfoService.queryStdByNameAndCertno(dbStdRegInfo.getStd_name(),
|
|
|
+ dbStdRegInfo.getCert_no());
|
|
|
+
|
|
|
+ if (null != stds) {
|
|
|
+ for (StdRegInfo std : stds) {
|
|
|
+ std.setStd_pass(this.cutPasssword(std_pass1));
|
|
|
+ this.stdRegInfoService.update(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ getRequest().getSession().removeAttribute("temp_std");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送手机验证码
|
|
|
+ *
|
|
|
+ * @param std_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/sendPhoneVcode")
|
|
|
+ public Ajax sendPhoneVcode(String std_id) {
|
|
|
+ //StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(std_id);
|
|
|
+ //String std_mobile = dbStdRegInfo.getStd_mobile();
|
|
|
+ String phoneVcode = this.genPhoneVcode();
|
|
|
+ // System.out.println("验证码:"+phoneVcode);
|
|
|
+
|
|
|
+ this.setSessionPhoneVcode(phoneVcode);
|
|
|
+
|
|
|
+ return new Ajax(phoneVcode);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setSessionPhoneVcode(String phoneVcode) {
|
|
|
+ HttpSession session = this.getRequest().getSession();
|
|
|
+ List<String> vcodeList = (ArrayList<String>) session.getAttribute("phoneVCode");
|
|
|
+ if (vcodeList == null || vcodeList.size() == 0) {
|
|
|
+ vcodeList = new ArrayList<String>();
|
|
|
+ }
|
|
|
+ vcodeList.add(phoneVcode);
|
|
|
+ session.setAttribute("phoneVCode", vcodeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成手机验证码 5位数
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String genPhoneVcode() {
|
|
|
+ String code = String.valueOf((int) ((Math.random() * 9 + 1) * 10000));
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/findStdByCertNo")
|
|
|
+ public Ajax findStdByCertNo(String cert_no,String std_name,String ticket_no) {
|
|
|
+ String error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.findStdByCertNo(cert_no,std_name,ticket_no);
|
|
|
+
|
|
|
+ // 记录二次校验失败次数
|
|
|
+ if(null == dbStdRegInfo || null == dbStdRegInfo.getId()){
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置验证通过的考生信息到临时会话中,在修改密码时校验
|
|
|
+ HttpSession session = getSession();
|
|
|
+
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = null;
|
|
|
+ if(null != dbStdRegInfo){
|
|
|
+ std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+ if(null != dbStdRegInfo.getQuestion()){
|
|
|
+ std.setQuestion("Question");
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份验证失败,请重新输入!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ session.setAttribute("temp_std", dbStdRegInfo);
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkQuestion")
|
|
|
+ public Ajax checkQuestion(String cert_no,String std_name,String question,String answer) {
|
|
|
+ String error = this.isSysOperateFail(cert_no, "canResetTime", 30);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("二次验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.checkQuestion(cert_no,std_name,question,answer);
|
|
|
+
|
|
|
+ // 记录二次校验失败次数
|
|
|
+ if(null == dbStdRegInfo || null == dbStdRegInfo.getId()){
|
|
|
+ this.setSysOperateFail(cert_no, "canResetTime", 5, 30, "身份验证失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("验证失败!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置验证通过的考生信息到临时会话中,在修改密码时校验
|
|
|
+ HttpSession session = getSession();
|
|
|
+
|
|
|
+ // 只返回考生必须的字段给前台,避免考生信息暴露
|
|
|
+ StdRegInfo std = null;
|
|
|
+ if(null != dbStdRegInfo){
|
|
|
+ std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+ }
|
|
|
+
|
|
|
+ session.setAttribute("temp_std", dbStdRegInfo);
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 密码截取
|
|
|
+ private String cutPasssword(String password) {
|
|
|
+ if (StringHelper.isNotEmpty(password) && password.length() >= 8) {
|
|
|
+ return password.toUpperCase().substring(0, 8);
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("密码不能为空!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考生信息保存 (不包括图片)
|
|
|
+ *
|
|
|
+ * @param stdRegInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/stdRegInfo/edit")
|
|
|
+ public Ajax editStdRegInfo(StdRegInfo stdRegInfo,Integer std_id) {
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (!StringUtils.isEmpty(std_id) && sessionStdRegInfo != null &!sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生登录异常,请不要在同一个浏览器登录多个用户,请务必退出后重新登录!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if(!sessionStdRegInfo.getId().equals(stdRegInfo.getId())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoService.find(sessionStdRegInfo.getId());
|
|
|
+ if(null != dbStd){
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStd);
|
|
|
+ }
|
|
|
+
|
|
|
+ //20220424 蓝剑 考生不允许选择助学考生,主考学校网络助学、专本衔接考生备案审核通过时才更新
|
|
|
+ // 更新考生来源时,如果旧考生来源不是助学考生,要更新成助学考生,不允许。
|
|
|
+ if (!(null != dbStd.getStd_source() && dbStd.getStd_source().intValue() == 3)
|
|
|
+ && null != stdRegInfo.getStd_source() && stdRegInfo.getStd_source().intValue() == 3) {
|
|
|
+ throw new BusinessException("考生来源不允许选择助学考生,助学考生由主考院校考生备案后统一修改。");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关键信息有修改时,校验是否允许修改
|
|
|
+ if (!dbStd.getStd_name().equals(stdRegInfo.getStd_name()) || !dbStd.getCert_no().equals(stdRegInfo.getCert_no())
|
|
|
+ || (null !=stdRegInfo.getCert_type() && !stdRegInfo.getCert_type().equals(dbStd.getCert_type()))) {
|
|
|
+
|
|
|
+ boolean existScore = this.cjJigechengjiOldService.existScore(dbStd.getId());
|
|
|
+ if(existScore){
|
|
|
+ throw new BusinessException("存在历史成绩,不允许直接修改姓名、证件号以及证件类型!请进入个人中心->考生信息变更,提交申请单。");
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMapTime = new HashMap<String, Object>();
|
|
|
+ paraMapTime.put("year_code", YearCodeHelper.getCurrentYearCode());
|
|
|
+ List<PlExamTime> dbTime = this.examTimeService.listByMap(paraMapTime);
|
|
|
+ PlExamTime currentTime = null;
|
|
|
+ if (dbTime.size() > 0) {
|
|
|
+ currentTime = dbTime.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("无当前批次信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("std_reg_id", dbStd.getId());
|
|
|
+ paraMap.put("exam_time_id", currentTime.getId());
|
|
|
+ paraMap.put("fee_status", "1");
|
|
|
+ List<StdEnrol> enrolList = this.stdEnrolService.listByMap(paraMap);
|
|
|
+ for (StdEnrol enrol : enrolList) {
|
|
|
+ if (enrol.getStatus() >=4) {
|
|
|
+ throw new BusinessException("当前批次内存在报考信息,不允许直接修改姓名、证件号以及证件类型!请进入个人中心->考生信息变更,提交申请单。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null != stdRegInfo.getStd_name()){
|
|
|
+ stdRegInfo.setStd_name(stdRegInfo.getStd_name().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null != stdRegInfo.getCert_no()){
|
|
|
+ stdRegInfo.setCert_no(stdRegInfo.getCert_no().trim());
|
|
|
+ String std_birth = !StringUtils.isEmpty(stdRegInfo.getCert_no())&&stdRegInfo.getCert_no().length() == 18?
|
|
|
+ stdRegInfo.getCert_no().substring(6,10) + "" + stdRegInfo.getCert_no().substring(10,12) + "" + stdRegInfo.getCert_no().substring(12,14):"";
|
|
|
+ dbStd.setStd_birth(std_birth);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //身份证号变更
|
|
|
+ if(!StringUtils.isEmpty(stdRegInfo.getCert_no()) &&
|
|
|
+ !stdRegInfo.getCert_no().trim().equals(dbStd.getCert_no())){
|
|
|
+ //验证合法
|
|
|
+ if ((stdRegInfo.getCert_type() == null || stdRegInfo.getCert_type() == 1) && !StringUtils.isEmpty(stdRegInfo.getCert_no()) && !FrameIdCardUtil.validateIdCard18(stdRegInfo.getCert_no().trim())) {
|
|
|
+ throw new BusinessException("身份证[" + stdRegInfo.getCert_no() + "]不合法,请重新填写!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no_en = AesUtil.Encrypt(stdRegInfo.getCert_no().trim());
|
|
|
+ //验证重复
|
|
|
+ List<StdRegInfo> list = this.stdRegInfoService.list("cert_no_en", cert_no_en);
|
|
|
+ for (StdRegInfo vo : list) {
|
|
|
+ if (!vo.getId().equals(sessionStdRegInfo.getId())) {
|
|
|
+ throw new BusinessException("证件号:"+stdRegInfo.getCert_no()+"已有其他用户注册,无法更新");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //准考证号变更
|
|
|
+ if(!StringUtils.isEmpty(stdRegInfo.getTicket_no()) &&
|
|
|
+ !stdRegInfo.getTicket_no().trim().equals(dbStd.getTicket_no())){
|
|
|
+ throw new BusinessException("准考证号已经生成,不允许修改。");
|
|
|
+ }
|
|
|
+
|
|
|
+ String photo_url = dbStd.getPhoto_url();
|
|
|
+ if (!StringUtils.isEmpty(photo_url)) {
|
|
|
+ stdRegInfo.setStatus(StdConst.Status.IMGDONE.ordinal());
|
|
|
+ } else {
|
|
|
+ stdRegInfo.setStatus(StdConst.Status.INFODONE.ordinal());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果是社会考生 置空 主考院校和助学班
|
|
|
+ if (null != stdRegInfo.getStd_source() && stdRegInfo.getStd_source() == StdConst.StudentType.SOCIAL.ordinal()) {
|
|
|
+ stdRegInfo.setSchool_id(null);
|
|
|
+ stdRegInfo.setAssist_id(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ stdRegInfo.setPhoto_url(dbStd.getPhoto_url());
|
|
|
+ stdRegInfo.setPhoto_path(dbStd.getPhoto_path());
|
|
|
+ stdRegInfo.setPhoto_id(dbStd.getPhoto_id());
|
|
|
+ stdRegInfo.setCert_no_must_update(0);
|
|
|
+
|
|
|
+ // 绑定手机号不允许更新
|
|
|
+ stdRegInfo.setBindphone(null);
|
|
|
+
|
|
|
+ // 绑定邮箱不允许更新
|
|
|
+ stdRegInfo.setBind_email(null);
|
|
|
+
|
|
|
+ // 身份认证不允许更新
|
|
|
+ stdRegInfo.setIs_identfiy(null);
|
|
|
+
|
|
|
+ // 加密考生敏感信息
|
|
|
+ this.stdRegInfoService.EncryptStd(stdRegInfo);
|
|
|
+ String std_name = stdRegInfo.getStd_name();
|
|
|
+
|
|
|
+ if (!std_name.equals(dbStd.getStd_name())) {
|
|
|
+ if (!PatternUtil.checkStdName(std_name.trim())) {
|
|
|
+ throw new BusinessException("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.stdRegInfoService.update(stdRegInfo);
|
|
|
+
|
|
|
+ stdRegInfo.setBindphone(dbStd.getBindphone());
|
|
|
+ stdRegInfo.setBind_email(dbStd.getBind_email());
|
|
|
+ stdRegInfo.setIs_identfiy(dbStd.getIs_identfiy());
|
|
|
+
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, stdRegInfo);
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(stdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/editMajor")
|
|
|
+ public Ajax editMajor(StdRegInfo stdRegInfo,Integer std_id) {
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (!StringUtils.isEmpty(std_id) && sessionStdRegInfo != null &!sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生登录异常,请不要在同一个浏览器登录多个用户,请务必退出后重新登录!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if(!sessionStdRegInfo.getId().equals(stdRegInfo.getId())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(sessionStdRegInfo.getId());
|
|
|
+ if (dbStdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ PlMajor dbMajor = this.plMajorService.find(stdRegInfo.getMajor_id());
|
|
|
+ if(null != dbMajor){
|
|
|
+ // 专业I信息
|
|
|
+ dbStdRegInfo.setMajor_id(dbMajor.getId());
|
|
|
+ dbStdRegInfo.setMajor_code(dbMajor.getMajor_code());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 社会考生
|
|
|
+ // if (dbStdRegInfo.getStd_source() ==
|
|
|
+ // StdConst.StudentType.SOCIAL.ordinal()) {
|
|
|
+ // dbStdRegInfo.setSchool_id(stdRegInfo.getSchool_id());
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 考点信息
|
|
|
+ dbStdRegInfo.setExam_area_id(stdRegInfo.getExam_area_id());
|
|
|
+
|
|
|
+ // 生成准考证号
|
|
|
+// if (StringUtils.isEmpty(dbStdRegInfo.getTicket_no()) && !StringUtils.isEmpty(dbStdRegInfo.getPhoto_url())) {
|
|
|
+// dbStdRegInfo.setTicket_no(this.stdRegInfoService.genTicketNo(dbStdRegInfo));
|
|
|
+// }
|
|
|
+ dbStdRegInfo.setStatus(StdConst.Status.ALLDONE.ordinal());
|
|
|
+
|
|
|
+ this.editStdMajor(dbStdRegInfo, dbMajor);
|
|
|
+
|
|
|
+ this.stdRegInfoService.update(dbStdRegInfo);
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ HashMap<String, Object> rtnMap = new HashMap<String, Object>();
|
|
|
+ rtnMap.put("stdMajor", dbMajor);
|
|
|
+ rtnMap.put("stdReg", dbStdRegInfo);
|
|
|
+ return new Ajax(rtnMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**准考证 生成确定
|
|
|
+ * @param std_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/stdRegInfo/handleGenTicketNo")
|
|
|
+ public Ajax handleGenTicketNo(Integer std_id,boolean handleConfirm) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (!StringUtils.isEmpty(std_id) && sessionStdRegInfo != null &!sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生登录异常,请不要在同一个浏览器登录多个用户,请务必退出后重新登录!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ synchronized (std_id) {
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(sessionStdRegInfo.getId());
|
|
|
+ if (dbStdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+ // 使用新的准考证生成规则
|
|
|
+ // 具备生成准考证号条件
|
|
|
+ if (StringUtils.isEmpty(dbStdRegInfo.getTicket_no()) &&
|
|
|
+ !StringUtils.isEmpty(dbStdRegInfo.getPhoto_path()) &&
|
|
|
+ !StringUtils.isEmpty(dbStdRegInfo.getStd_city())&&
|
|
|
+ !StringUtils.isEmpty(dbStdRegInfo.getStd_county())) {
|
|
|
+ if(handleConfirm){
|
|
|
+ dbStdRegInfo.setTicket_no(this.stdRegInfoService.getTicketNoByCity(dbStdRegInfo));
|
|
|
+ this.stdRegInfoService.update(dbStdRegInfo);
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(dbStdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ //更新准考证到会话
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, std);
|
|
|
+
|
|
|
+
|
|
|
+ ajax.setEntity(dbStdRegInfo.getTicket_no());
|
|
|
+ }
|
|
|
+ ajax.setSuccess(true);
|
|
|
+ }else{
|
|
|
+ if (!StringUtils.isEmpty(dbStdRegInfo.getTicket_no())) {
|
|
|
+ ajax.setErrorMsg("准考证已生成!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(dbStdRegInfo.getPhoto_path())) {
|
|
|
+ ajax.setErrorMsg("未上传考生照片!");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(dbStdRegInfo.getStd_city()) ||
|
|
|
+ StringUtils.isEmpty(dbStdRegInfo.getStd_county())) {
|
|
|
+ ajax.setErrorMsg("请选择报考地市!");
|
|
|
+ }
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 具备生成准考证号条件
|
|
|
+ /*if (StringUtils.isEmpty(dbStdRegInfo.getTicket_no()) &&
|
|
|
+ !StringUtils.isEmpty(dbStdRegInfo.getPhoto_url()) &&
|
|
|
+ !StringUtils.isEmpty(dbStdRegInfo.getStd_source())) {
|
|
|
+ if(handleConfirm){
|
|
|
+ dbStdRegInfo.setTicket_no(this.stdRegInfoService.genTicketNo(dbStdRegInfo));
|
|
|
+ this.stdRegInfoService.edit(dbStdRegInfo);
|
|
|
+ ajax.setEntity(dbStdRegInfo.getTicket_no());
|
|
|
+ }
|
|
|
+ ajax.setSuccess(true);
|
|
|
+ }else{
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新std_major关系表数据
|
|
|
+ *
|
|
|
+ * @param dbStdRegInfo
|
|
|
+ * @param dbMajor
|
|
|
+ */
|
|
|
+ private void editStdMajor(StdRegInfo dbStdRegInfo, PlMajor dbMajor) {
|
|
|
+ List<StdMajor> dbStdMajorList = stdMajorService.list("std_reg_id", dbStdRegInfo.getId());
|
|
|
+ for (StdMajor dbStdMajor : dbStdMajorList) {
|
|
|
+ stdMajorService.delete(dbStdMajor.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ StdMajor stdMajor = new StdMajor();
|
|
|
+ stdMajor.setStd_reg_id(dbStdRegInfo.getId());
|
|
|
+ stdMajor.setCert_no(dbStdRegInfo.getCert_no());
|
|
|
+ stdMajor.setFull_name(dbMajor.getMajor_full_name());
|
|
|
+ stdMajor.setMajor_code(dbMajor.getMajor_code());
|
|
|
+ stdMajor.setMajor_id(dbMajor.getId());
|
|
|
+ stdMajor.setMajor_name(dbMajor.getMajor_name());
|
|
|
+ stdMajor.setStd_name(dbStdRegInfo.getStd_name());
|
|
|
+ stdMajor.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ stdMajorService.insert(stdMajor);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 身份证认证
|
|
|
+ * @param stdRegInfo
|
|
|
+ * @param std_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/stdRegInfo/identifyCard")
|
|
|
+ public Ajax identifyCard(StdRegInfo stdRegInfo,Integer std_id) {
|
|
|
+ StdRegInfo sessionStdRegInfo = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (!StringUtils.isEmpty(std_id) && sessionStdRegInfo != null &!sessionStdRegInfo.getId().equals(std_id)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生登录异常,请不要在同一个浏览器登录多个用户,请务必退出后重新登录!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验会话的ID与修改的ID一致性
|
|
|
+ if(!sessionStdRegInfo.getId().equals(stdRegInfo.getId())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(246);
|
|
|
+ ajax.setErrorMsg("检测到考生与会话考生不一致,请重新登陆!");
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoService.find(sessionStdRegInfo.getId());
|
|
|
+ if (dbStd != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStd);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null != dbStd && null != dbStd.getIs_identfiy() && dbStd.getIs_identfiy().intValue() == 1){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份证已认证,不允许重复认证。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == dbStd || StringUtils.isEmpty(dbStd.getCert_no())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("证件号为空,无法进行身份证认证。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == dbStd || StringUtils.isEmpty(dbStd.getStd_name())){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("姓名为空,无法进行身份证认证。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 证件号验证
|
|
|
+ String cert_no = dbStd.getCert_no();
|
|
|
+
|
|
|
+ if (null != cert_no && cert_no.length() == 15) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("15位证件号,请到达各市考办进行身份证升位和身份认证!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != cert_no && cert_no.length() == 18 && !FrameIdCardUtil.validateIdCard18(cert_no)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份证[" + cert_no + "]不合法,无法进行身份证认证,请进入个人中心申请变更身份信息。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ //List<StdRegInfo> stds = this.stdRegInfoService.queryStdByCertno(cert_no);
|
|
|
+
|
|
|
+ /* if(null != stds && !stds.isEmpty()){
|
|
|
+ for(StdRegInfo std:stds){
|
|
|
+ // 系统已经存在其他的账号的证件类型是身份证,认证失败
|
|
|
+ if(null != std && null != std.getCert_type() && std.getCert_type().intValue() == 1 && dbStd.getId().intValue() != std.getId().intValue()){
|
|
|
+ throw new BusinessException("身份证[" + cert_no + "],系统已经存在证件类型是身份证的其他账号,身份证认证失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 1分钟内不允许再次验证
|
|
|
+ if (!isIdentifyCardFialExt()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请1分钟之后再重新进行身份认证!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo temp_std = new StdRegInfo();
|
|
|
+ temp_std.setCert_no(cert_no);
|
|
|
+ temp_std.setStd_name(dbStd.getStd_name());
|
|
|
+
|
|
|
+ if (null != cert_no && cert_no.length() == 18) {
|
|
|
+ // 身份证认证
|
|
|
+ String result = this.checkIdentifyCard(temp_std);
|
|
|
+
|
|
|
+ if(null == result){
|
|
|
+ //身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份证认证不通过,请进入个人中心申请变更身份信息。");
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }else if(!"success".equals(result)){
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(result);
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ // 身份认证成功
|
|
|
+ // 设置身份认证成功标识
|
|
|
+ dbStd.setIs_identfiy(1);
|
|
|
+
|
|
|
+ // 设置证件类型为身份证
|
|
|
+ dbStd.setCert_type(1);
|
|
|
+
|
|
|
+ // 保存认证信息
|
|
|
+ this.stdRegInfoService.update(dbStd);
|
|
|
+
|
|
|
+ // 更新考生会话信息
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStd);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(dbStd, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax(dbStd);
|
|
|
+ }
|
|
|
+ }else if(null != cert_no && (cert_no.toUpperCase().startsWith("H")||cert_no.toUpperCase().startsWith("M") || (null != dbStd.getCert_type() && dbStd.getCert_type().intValue() == 8))){
|
|
|
+ // 港澳台考生身份认证
|
|
|
+ String result = this.verifyCertificate(dbStd);
|
|
|
+
|
|
|
+ if (null == result) {
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("港澳台身身份认证不通过。");
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ } else if (!"success".equals(result)) {
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(result);
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ // 港澳台身份认证成功
|
|
|
+ // 设置身份认证成功标识
|
|
|
+ dbStd.setIs_identfiy(1);
|
|
|
+
|
|
|
+ // 保存认证信息
|
|
|
+ this.stdRegInfoService.update(dbStd);
|
|
|
+
|
|
|
+ // 更新考生会话信息
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStd);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(dbStd, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax(dbStd);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("证件号不是身份证或港澳居民往来内地通行证或台湾居民往来内地通行证,无法进行身份认证!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*@RequestMapping("/std/stdRegInfo/delete")
|
|
|
+ public Ajax deleteStdRegInfo(Integer id) {
|
|
|
+ this.stdRegInfoService.delete(id);
|
|
|
+ return new Ajax();
|
|
|
+ }*/
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/get")
|
|
|
+ public Ajax getStdRegInfo() {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+
|
|
|
+ StdRegInfo stdRegInfo = this.stdRegInfoService.find(std.getId());
|
|
|
+ if(null != stdRegInfo){
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param file
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/stdRegInfo/uploadImgForPhotoReview")
|
|
|
+ public Ajax uploadImguploadImgForPhotoReview(MultipartFile file) {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(std.getId());
|
|
|
+ if (dbStdRegInfo != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileSeq = this.stdRegInfoService.getFileSeq();
|
|
|
+ String feature1 = null;
|
|
|
+ String feature2 = null;
|
|
|
+ String pass_score = null;
|
|
|
+
|
|
|
+ FrameParam loginParam = this.stdRegInfoDao.find(FrameParam.class, "param_name", "featureScore");
|
|
|
+ if (null == loginParam || "InActive".equals(loginParam.getProtect_status())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("照片合规检查功能未开放,不允许进行照片合规检查操作。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ pass_score = loginParam.getParam_value();
|
|
|
+
|
|
|
+ String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
|
|
+ // 转换小写
|
|
|
+ extension = extension.toLowerCase();
|
|
|
+
|
|
|
+ // 校验文件类型
|
|
|
+ if (!"jpg".equals(extension) && !"jpeg".equals(extension) && !"png".equals(extension)
|
|
|
+ && !"gif".equals(extension) && !"bmp".equals(extension)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("上传图片必须是JPG/JPEG/PNG/格式!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no = dbStdRegInfo.getCert_no();
|
|
|
+
|
|
|
+ String rootPath = SysConst.getAppConfig().getUploadBase();
|
|
|
+ // 创建文件夹
|
|
|
+ makeDir(rootPath);
|
|
|
+
|
|
|
+ long time = new Date().getTime();
|
|
|
+
|
|
|
+ String fullFileName = rootPath + SysConst.IMG_FACE_PREFIX + cert_no + "_" + time + "_" + fileSeq + "."
|
|
|
+ + extension;
|
|
|
+ File desfile = new File(fullFileName);
|
|
|
+ try {
|
|
|
+ file.transferTo(desfile);
|
|
|
+ } catch (IOException e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("保存上传文件失败。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------照片水印校验开始-------------------------
|
|
|
+ String response = PhotoUtil.verifyWatermark(fullFileName);
|
|
|
+
|
|
|
+ // 校验成功
|
|
|
+ if ("0".equals(response)) {
|
|
|
+ dbStdRegInfo.setPhoto_compliance("1");
|
|
|
+ } else {
|
|
|
+ // 校验失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(response);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------照片水印校验结束-------------------------
|
|
|
+
|
|
|
+ // ----------------------------特征值获取开始-------------------------
|
|
|
+ Map<String, String> result = PhotoUtil.getExtractFeature(fullFileName);
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ if ("0".equals(result.get("code").toString())) {
|
|
|
+ feature1 = result.get("msg");
|
|
|
+ //dbStdRegInfo.setFeature(feature1);
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(result.get("msg"));
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------特征值获取结束-------------------------
|
|
|
+
|
|
|
+ // ----------------------------获取 广西区内身份证照片获取开始-------------------------
|
|
|
+ // 获取 广西区内身份证照片
|
|
|
+ JsonObject identfiy = IdentifyCardOrcUtil.identifyCardImage(dbStdRegInfo.getCert_no().toUpperCase(),
|
|
|
+ dbStdRegInfo.getStd_name());
|
|
|
+
|
|
|
+ if (identfiy.get("code").getAsInt() == 1) {
|
|
|
+
|
|
|
+ JsonObject data = identfiy.get("data").getAsJsonObject();
|
|
|
+ String photoData = data.get("photoData").getAsString();
|
|
|
+
|
|
|
+ if (null != photoData) {
|
|
|
+ time = new Date().getTime();
|
|
|
+ fileSeq = this.stdRegInfoService.getFileSeq();
|
|
|
+ String fileName = SysConst.getAppConfig().getDownloadTemp()
|
|
|
+ + dbStdRegInfo.getCert_no() + "_" + time + "_" + fileSeq + ".jpg";
|
|
|
+
|
|
|
+ // 不存在则创建文件夹
|
|
|
+ makeDir(SysConst.getAppConfig().getDownloadTemp());
|
|
|
+
|
|
|
+ // base64 to image
|
|
|
+ File tempFile = IdentifyCardOrcUtil.base64StringToImage(photoData, fileName);
|
|
|
+
|
|
|
+ // ----------------------------特征值获取开始-------------------------
|
|
|
+ result = PhotoUtil.getExtractFeature(fileName);
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ if ("0".equals(result.get("code").toString())) {
|
|
|
+ feature2 = result.get("msg");
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(result.get("msg"));
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------特征值获取结束-------------------------
|
|
|
+
|
|
|
+ // ----------------------------特征值对比开始-------------------------
|
|
|
+ Map<String, String> map = PhotoUtil.compareFeature(feature1, feature2);
|
|
|
+ String score = null;
|
|
|
+ // 成功
|
|
|
+ if ("0".equals(map.get("code"))) {
|
|
|
+ score = map.get("msg");
|
|
|
+
|
|
|
+ BigDecimal pass_scoreDecimal = new BigDecimal(pass_score);
|
|
|
+ BigDecimal scoreDecimal = new BigDecimal(score);
|
|
|
+
|
|
|
+ // 特征值比较得分小于设置的分数,对比不通过
|
|
|
+ if (scoreDecimal.compareTo(pass_scoreDecimal) < 0) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("上传的照片与身份证照片不匹配,请考生提交考生信息变更申请,变更考生照片,并到达现场审核。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(map.get("msg"));
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------特征值对比结束-------------------------
|
|
|
+
|
|
|
+ // 删除临时照片
|
|
|
+ if (null != tempFile && tempFile.exists()) {
|
|
|
+ tempFile.delete();
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("身份证照片为空,照片合规检查失败。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg("获取身份证照片失败,错误码:" + identfiy.get("code").getAsInt() + ",照片合规检查失败。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------获取 广西区内身份证照片获取结束-------------------------
|
|
|
+
|
|
|
+ // ----------------------------考生照片上传恒生文件服务器开始-------------------------
|
|
|
+ UploadVO uploadVO = XcDfsClient.uploadStream(desfile.getPath());
|
|
|
+ List<UploadItemVO> uploadItems = uploadVO.getList();
|
|
|
+ if (null != uploadItems && !uploadItems.isEmpty()) {
|
|
|
+ UploadItemVO vo = uploadItems.get(0);
|
|
|
+ dbStdRegInfo.setPhoto_path(vo.getFilePath());
|
|
|
+ dbStdRegInfo.setPhoto_id(vo.getId());
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("考生照片上传文件服务器失败,请联系系统管理员!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ // ----------------------------考生照片上传恒生文件服务器结束-------------------------
|
|
|
+
|
|
|
+ dbStdRegInfo.setPhoto_url(SysConst.IMG_FACE_PREFIX + cert_no + "_" + time + "_" + fileSeq + "." + extension);
|
|
|
+ if (dbStdRegInfo.getMajor_id() != null) {
|
|
|
+ dbStdRegInfo.setStatus(StdConst.Status.ALLDONE.ordinal());
|
|
|
+ }
|
|
|
+
|
|
|
+ this.stdRegInfoService.update(dbStdRegInfo);
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(dbStdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+
|
|
|
+ return new Ajax(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/uploadImg")
|
|
|
+ public Ajax upload(MultipartFile file) {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoService.find(std.getId());
|
|
|
+
|
|
|
+ if(null != dbStdRegInfo){
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileSeq = this.stdRegInfoService.getFileSeq();
|
|
|
+ try {
|
|
|
+ String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
|
|
+ // 转换小写
|
|
|
+ extension = extension.toLowerCase();
|
|
|
+
|
|
|
+ // 校验文件类型
|
|
|
+ if (!"jpg".equals(extension) && !"jpeg".equals(extension) && !"png".equals(extension)&& !"gif".equals(extension)&& !"bmp".equals(extension)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("上传图片必须是JPG/JPEG/PNG/格式!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("std_reg_id", std.getId());
|
|
|
+ paraMap.put("fee_status", "1");
|
|
|
+ paraMap.put("year_code", YearCodeHelper.getCurrentYearCode());
|
|
|
+
|
|
|
+ List<StdEnrol> enrolList = this.stdEnrolService.listByMap(paraMap);
|
|
|
+ boolean exist4enrol = false;
|
|
|
+ for (StdEnrol enrol : enrolList) {
|
|
|
+ if (enrol.getStatus() >=4) {
|
|
|
+ exist4enrol = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 存在报考缴费数据,判断是否在不允许变更的时间范围之内
|
|
|
+ if(exist4enrol){
|
|
|
+ // 获取考生信息变更申请开关
|
|
|
+ FrameParam loginParam = this.stdRegInfoDao.find(FrameParam.class, "param_name", "stdInfoModifyApplyControl");
|
|
|
+
|
|
|
+ // 开关打开,则不允许新增申请考生信息变更,提醒内容为Param_value
|
|
|
+ if (null != loginParam && "Active".equals(loginParam.getProtect_status())) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(loginParam.getParam_value());
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean existScore = this.cjJigechengjiOldService.existScore(std.getId());
|
|
|
+ if(existScore){
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("存在历史成绩,无法上传图片,请提交考生信息变更申请。");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no = dbStdRegInfo.getCert_no();
|
|
|
+ // String rootPath = getRootPath();
|
|
|
+ String rootPath = SysConst.getAppConfig().getUploadBase();
|
|
|
+ // 创建文件夹
|
|
|
+ makeDir(rootPath);
|
|
|
+
|
|
|
+ long time = new Date().getTime();
|
|
|
+
|
|
|
+ String fullFileName = rootPath + SysConst.IMG_FACE_PREFIX + cert_no + "_" + time + "_" + fileSeq + "."
|
|
|
+ + extension;
|
|
|
+ File desfile = new File(fullFileName);
|
|
|
+ file.transferTo(desfile);
|
|
|
+
|
|
|
+ // 获取照片合规检查开关
|
|
|
+ FrameParam loginParam = this.stdRegInfoDao.find(FrameParam.class, "param_name", "photoCompliance");
|
|
|
+
|
|
|
+ // 照片合规检查开关 开启时校验照片合规性
|
|
|
+ if (null != loginParam && "Active".equals(loginParam.getProtect_status())) {
|
|
|
+ // ----------------------------照片水印校验开始-------------------------
|
|
|
+ String response = PhotoUtil.verifyWatermark(fullFileName);
|
|
|
+
|
|
|
+ // 校验成功
|
|
|
+ if ("0".equals(response)) {
|
|
|
+ dbStdRegInfo.setPhoto_compliance("1");
|
|
|
+ } else {
|
|
|
+ // 校验失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(response);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------照片水印校验结束-------------------------
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------------------特征值获取开始-------------------------
|
|
|
+ /*Map<String, String> result = PhotoUtil.getExtractFeature(fullFileName);
|
|
|
+
|
|
|
+ // 成功
|
|
|
+ if ("0".equals(result.get("code").toString())) {
|
|
|
+ dbStdRegInfo.setFeature(result.get("msg"));
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorCode(-1);
|
|
|
+ ajax.setErrorMsg(result.get("msg"));
|
|
|
+ return ajax;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // ----------------------------特征值获取结束-------------------------
|
|
|
+
|
|
|
+
|
|
|
+ // ----------------------------考生照片上传恒生文件服务器开始-------------------------
|
|
|
+ UploadVO uploadVO = XcDfsClient.uploadStream(desfile.getPath());
|
|
|
+ List<UploadItemVO> uploadItems = uploadVO.getList();
|
|
|
+ if (null != uploadItems && !uploadItems.isEmpty()) {
|
|
|
+ UploadItemVO vo = uploadItems.get(0);
|
|
|
+ dbStdRegInfo.setPhoto_path(vo.getFilePath());
|
|
|
+ dbStdRegInfo.setPhoto_id(vo.getId());
|
|
|
+ } else {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("考生照片上传文件服务器失败,请联系系统管理员!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ // ----------------------------考生照片上传恒生文件服务器结束-------------------------
|
|
|
+
|
|
|
+ dbStdRegInfo
|
|
|
+ .setPhoto_url(SysConst.IMG_FACE_PREFIX + cert_no + "_" + time + "_" + fileSeq + "." + extension);
|
|
|
+ if (dbStdRegInfo.getMajor_id() != null) {
|
|
|
+ dbStdRegInfo.setStatus(StdConst.Status.ALLDONE.ordinal());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成准考证号
|
|
|
+// if (StringUtils.isEmpty(dbStdRegInfo.getTicket_no()) && dbStdRegInfo.getStd_source() != null) {
|
|
|
+// dbStdRegInfo.setTicket_no(this.stdRegInfoService.genTicketNo(dbStdRegInfo));
|
|
|
+// }
|
|
|
+
|
|
|
+ this.stdRegInfoService.update(dbStdRegInfo);
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ // 添加日志
|
|
|
+ this.regLogService.insertStdRegLog(dbStdRegInfo, OperType.UPDATE.ordinal());
|
|
|
+ } catch (IllegalStateException | IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return new Ajax(dbStdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/getOrgBySocialMajor")
|
|
|
+ public Ajax getOrgBySocialMajor(String major_id) {
|
|
|
+ List<CfOrganization> orgList = this.cfOrganizationService.getOrgBySocialMajor(major_id);
|
|
|
+ return new Ajax(orgList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // private String getRootPath(){
|
|
|
+ // boolean isWindowSystem = CommonToolUtil.isWindowSystem();
|
|
|
+ // String rootPath = "";
|
|
|
+ // if(isWindowSystem){
|
|
|
+ // rootPath = "d:\\img\\";
|
|
|
+ // }else{
|
|
|
+ // rootPath = SysConst.UPLOAD_BASE + File.separator;
|
|
|
+ // }
|
|
|
+ // return rootPath;
|
|
|
+ // }
|
|
|
+
|
|
|
+ private boolean makeDir(String rootPath) {
|
|
|
+ // 创建目录
|
|
|
+ boolean suc = false;
|
|
|
+ File dir = new File(rootPath + SysConst.IMG_FACE_PREFIX);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ suc = dir.mkdir();
|
|
|
+ }
|
|
|
+ return suc;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成验证码图片
|
|
|
+ *
|
|
|
+ * @param major_id
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/validateCode")
|
|
|
+ public void validateCode(String major_id) throws IOException {
|
|
|
+ HttpServletResponse response = this.getResponse();
|
|
|
+ HttpServletRequest request = this.getRequest();
|
|
|
+
|
|
|
+ // 响应头信息
|
|
|
+ response.setHeader("Pragma", "No-Cache");
|
|
|
+ response.setHeader("Cache-Control", "no-cache");
|
|
|
+ response.setDateHeader("Expries", 0);
|
|
|
+
|
|
|
+ // 随机数生成类
|
|
|
+ Random random = new Random();
|
|
|
+
|
|
|
+ // 定义验证码的位数
|
|
|
+ int size = 4;
|
|
|
+
|
|
|
+ // 定义变量保存生成的验证码
|
|
|
+ String vCode = "";
|
|
|
+ char c;
|
|
|
+ // 产生验证码
|
|
|
+ /*
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+ // 产生一个26以内的随机整数
|
|
|
+ int number = random.nextInt(26);
|
|
|
+ // 如果生成的是偶数,则随机生成一个数字
|
|
|
+ if (number % 2 == 0) {
|
|
|
+ c = (char) ('0' + (char) ((int) (Math.random() * 10)));
|
|
|
+ // 如果生成的是奇数,则随机生成一个字母
|
|
|
+ } else {
|
|
|
+ c = (char) ((char) ((int) (Math.random() * 26)) + 'A');
|
|
|
+ }
|
|
|
+ vCode = vCode + c;
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ // 转换小写
|
|
|
+// vCode = vCode.toLowerCase();
|
|
|
+
|
|
|
+ //四位随机数字
|
|
|
+ vCode = String.valueOf((int)((Math.random()*9+1)*1000));
|
|
|
+
|
|
|
+ // 压力测试使用
|
|
|
+ //vCode = "1234";
|
|
|
+
|
|
|
+ // 保存生成的5位验证码
|
|
|
+ request.getSession().setAttribute("vCode", vCode);
|
|
|
+
|
|
|
+ // 验证码图片的生成
|
|
|
+ // 定义图片的宽度和高度
|
|
|
+ int width = (int) Math.ceil(size * 20);
|
|
|
+ int height = 30;
|
|
|
+ BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
|
|
+ // 获取图片的上下文
|
|
|
+ Graphics gr = image.getGraphics();
|
|
|
+ // 设定图片背景颜色
|
|
|
+ gr.setColor(Color.WHITE);
|
|
|
+ gr.fillRect(0, 0, width, height);
|
|
|
+ // 设定图片边框
|
|
|
+ gr.setColor(Color.GRAY);
|
|
|
+ gr.drawRect(0, 0, width - 1, height - 1);
|
|
|
+ // 画十条干扰线
|
|
|
+ for (int i = 0; i < 5; i++) {
|
|
|
+ int x1 = random.nextInt(width);
|
|
|
+ int y1 = random.nextInt(height);
|
|
|
+ int x2 = random.nextInt(width);
|
|
|
+ int y2 = random.nextInt(height);
|
|
|
+ gr.setColor(randomColor());
|
|
|
+ gr.drawLine(x1, y1, x2, y2);
|
|
|
+ }
|
|
|
+ // 设置字体,画验证码
|
|
|
+ gr.setColor(randomColor());
|
|
|
+ gr.setFont(randomFont());
|
|
|
+ gr.drawString(vCode, 10, 22);
|
|
|
+ // 图像生效
|
|
|
+ gr.dispose();
|
|
|
+ // 输出到页面
|
|
|
+ ImageIO.write(image, "JPEG", response.getOutputStream());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/checkValidateCode")
|
|
|
+ public Ajax checkValidateCode(String validateCode) throws IOException {
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ if (!StringUtils.isEmpty(validateCode) && validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ ajax.setSuccess(true);
|
|
|
+ } else {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/queryPubKey")
|
|
|
+ public Ajax queryPubKey() {
|
|
|
+ String pubKey = SysConst.getAppConfig().getPubKey();
|
|
|
+ return new Ajax(pubKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String[] fontNames = { "宋体", "华文楷体", "黑体", "微软雅黑", "楷体_GB2312" };
|
|
|
+ private Random r = new Random();
|
|
|
+
|
|
|
+ // 生成随机的颜色
|
|
|
+ private Color randomColor() {
|
|
|
+ int red = r.nextInt(150);
|
|
|
+ int green = r.nextInt(150);
|
|
|
+ int blue = r.nextInt(150);
|
|
|
+ return new Color(red, green, blue);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成随机的字体
|
|
|
+ private Font randomFont() {
|
|
|
+ int index = r.nextInt(fontNames.length);
|
|
|
+ String fontName = fontNames[index];// 生成随机的字体名称
|
|
|
+ int style = r.nextInt(4);
|
|
|
+ int size = r.nextInt(3) + 24; // 生成随机字号, 24 ~ 28
|
|
|
+ return new Font(fontName, style, size);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/xuexin/login")
|
|
|
+ public Ajax xuexinLogin() throws IOException {
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/xuexin/queryXL")
|
|
|
+ public Ajax queryXL(String xm, String zjhm) throws IOException {
|
|
|
+ XueXinUtil.queryXL(xm, zjhm);
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/getWyUrl")
|
|
|
+ public Ajax getWyUrl() {
|
|
|
+ return new Ajax(SysConst.getAppConfig().getPay_union_unionPay_url());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/queryMajorByLevel")
|
|
|
+ public Ajax queryMajorByLevel(Integer major_level) {
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("is_net_exam", 1);// 网考
|
|
|
+ paraMap.put("status", 1);// 开考
|
|
|
+ paraMap.put("major_level", major_level);// 开考
|
|
|
+ List<PlMajor> majorArray = this.plMajorService.listByMap(paraMap);
|
|
|
+ return new Ajax(majorArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/validateUploadPhtooUrl")
|
|
|
+ public Ajax validateUploadPhtooUrl() {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ HashMap<String, Object> paraMapTime = new HashMap<String, Object>();
|
|
|
+ paraMapTime.put("year_code", YearCodeHelper.getCurrentYearCode());
|
|
|
+ List<PlExamTime> dbTime = this.examTimeService.listByMap(paraMapTime);
|
|
|
+ PlExamTime currentTime = null;
|
|
|
+ if (dbTime.size() > 0) {
|
|
|
+ currentTime = dbTime.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("无当前批次信息");
|
|
|
+ }
|
|
|
+ //检查考生上传图片登记表里面是否有记录
|
|
|
+ /*List<Map<java.lang.String, Object>> std_can_upload_face = this.stdRegInfoDao.listMapBySql(" select * from std_can_upload_face where status = 1 and ( ticket_no = ? or cert_no = ? or std_id = ?)",
|
|
|
+ std.getTicket_no(),std.getCert_no(),std.getId());
|
|
|
+ if (std_can_upload_face.size() > 0 ) {
|
|
|
+ HashMap<String, Object> rtnMap = new HashMap<String, Object>();
|
|
|
+ rtnMap.put("existEnrol", false);
|
|
|
+ rtnMap.put("existCjold", false);
|
|
|
+ return new Ajax(rtnMap);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMap = new HashMap<String, Object>();
|
|
|
+ paraMap.put("std_reg_id", std.getId());
|
|
|
+ paraMap.put("fee_status", "1");
|
|
|
+ paraMap.put("exam_time_id", currentTime.getId());
|
|
|
+
|
|
|
+ List<StdEnrol> enrolList = this.stdEnrolService.listByMap(paraMap);
|
|
|
+ boolean existScore = this.cjJigechengjiOldService.existScore(std.getId());
|
|
|
+//
|
|
|
+// List<CjJigechengjiOld> dbCjOldList1 = StringUtils.isEmpty(std.getOld_ticket_no1()) ? new ArrayList()
|
|
|
+// : this.cjJigechengjiOldService.listByStd(std.getOld_ticket_no1());
|
|
|
+//
|
|
|
+// List<CjJigechengjiOld> dbCjOldList2 = StringUtils.isEmpty(std.getOld_ticket_no2()) ? new ArrayList()
|
|
|
+// : this.cjJigechengjiOldService.listByStd(std.getOld_ticket_no2());
|
|
|
+//
|
|
|
+// dbCjOldList.addAll(dbCjOldList1);
|
|
|
+// dbCjOldList.addAll(dbCjOldList2);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ HashMap<String, Object> rtnMap = new HashMap<String, Object>();
|
|
|
+ boolean exist4enrol = false;
|
|
|
+ for (StdEnrol enrol : enrolList) {
|
|
|
+ if (enrol.getStatus() >=4) {
|
|
|
+ exist4enrol = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (exist4enrol) {
|
|
|
+ rtnMap.put("existEnrol", true);
|
|
|
+ } else {
|
|
|
+ rtnMap.put("existEnrol", false);
|
|
|
+ }
|
|
|
+
|
|
|
+ rtnMap.put("existCjold", existScore);
|
|
|
+
|
|
|
+ return new Ajax(rtnMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkOldTicketNo")
|
|
|
+ public Ajax checkOldTicketNo(String ticket_no_old) {
|
|
|
+ // 1分钟内不允许再次请求
|
|
|
+ String error = this.isSysOperateFail(ticket_no_old, "checkOldTicketNo", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ CjJigechengjiOld JigechengjiOld = this.cjJigechengjiOldService.checkOldTicketNo(ticket_no_old);
|
|
|
+ if (JigechengjiOld == null) {
|
|
|
+ return new Ajax(JigechengjiOld);
|
|
|
+ }else{
|
|
|
+ List<StdRegInfo> list = this.stdRegInfoService.list("old_ticket_no1", ticket_no_old);
|
|
|
+ List<StdRegInfo> list2 = this.stdRegInfoService.list("old_ticket_no2", ticket_no_old);
|
|
|
+
|
|
|
+ if (null != list && !list.isEmpty()) {
|
|
|
+ for (StdRegInfo std : list) {
|
|
|
+ if (std != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(std);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != list2 && !list2.isEmpty()) {
|
|
|
+ for (StdRegInfo std : list2) {
|
|
|
+ if (std != null) {
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(std);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ list.addAll(list2);
|
|
|
+
|
|
|
+ // 记录次数
|
|
|
+ this.setSysOperateFail(ticket_no_old, "checkOldTicketNo", 1, 1, "请1分钟之后再重新验证!");
|
|
|
+
|
|
|
+ if (list.size()>0) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("该老准考证号已经存在考生无需新注册,准考证号:"+list.get(0).getTicket_no()+" 身份证号"+list.get(0).getCert_no());
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ return new Ajax(JigechengjiOld);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkCertNo18")
|
|
|
+ public Ajax checkCertNo18() {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoDao.find(std.getId());
|
|
|
+ if(null != dbStd){
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStd);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no = dbStd.getCert_no();
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ if ((std.getCert_type() ==null || dbStd.getCert_type() == 1) && !FrameIdCardUtil.validateIdCard18(cert_no)) {
|
|
|
+ return ajax;
|
|
|
+ }else{
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkPhotoCompliance")
|
|
|
+ public Ajax checkPhotoCompliance() {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ FrameParam loginParam = this.stdRegInfoDao.find(FrameParam.class, "param_name", "photoComplianceForEnrol");
|
|
|
+ if (null != loginParam && "Active".equals(loginParam.getProtect_status())) {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoDao.find(std.getId());
|
|
|
+
|
|
|
+ if (null != dbStd.getPhoto_compliance() && dbStd.getPhoto_compliance().equals("1")) {
|
|
|
+ ajax.setSuccess(true);
|
|
|
+ } else {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/checkIsIdentfiy")
|
|
|
+ public Ajax checkIsIdentfiy() {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ FrameParam loginParam = this.stdRegInfoDao.find(FrameParam.class, "param_name", "photoComplianceForEnrol");
|
|
|
+ if (null != loginParam && "Active".equals(loginParam.getProtect_status())) {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoDao.find(std.getId());
|
|
|
+
|
|
|
+ if (null != dbStd.getIs_identfiy() && dbStd.getIs_identfiy().intValue() == 1) {
|
|
|
+ ajax.setSuccess(true);
|
|
|
+ } else {
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ajax;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/updateMustUpdeCertNo")
|
|
|
+ public Ajax updateMustUpdeCertNo() {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ StdRegInfo dbStd = this.stdRegInfoDao.find(std.getId());
|
|
|
+ if(null != dbStd){
|
|
|
+ // 解密考生敏感信息
|
|
|
+ this.stdRegInfoService.DecryptStd(dbStd);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cert_no = dbStd.getCert_no();
|
|
|
+ if ((std.getCert_type() ==null || dbStd.getCert_type() == 1) && !FrameIdCardUtil.validateIdCard18(cert_no)) {
|
|
|
+ dbStd.setCert_no_must_update(1);
|
|
|
+ this.stdRegInfoDao.update(dbStd);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/identifyOrc")
|
|
|
+ public Ajax identifyOrc(String file, String validateCode) {
|
|
|
+ try {
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (StringUtils.isEmpty(validateCode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请填写校验码!");
|
|
|
+ getSession().removeAttribute("vCode");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码不正确,请重新填写!");
|
|
|
+ getSession().removeAttribute("vCode");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*JsonObject inte = IdentifyCardOrcUtil.interfaceAuth();
|
|
|
+ if (inte.get("code").getAsInt() != 200) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("接口鉴权错误!");
|
|
|
+ return ajax;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ JsonObject identfiy = IdentifyCardOrcUtil.identifyCardRec(file, 2, 1);
|
|
|
+ if (identfiy.get("code").getAsInt() != 200) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("图像识别错误,错误码:" + identfiy.get("code"));
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ JsonObject data = identfiy.get("data").getAsJsonObject();
|
|
|
+ if (data.get("imageConfig").getAsInt() != 1) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请上传身份证正面!");
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ HashMap<String, Object> rtnMap = new HashMap<String, Object>();
|
|
|
+ StdIdentityCard card = new StdIdentityCard();
|
|
|
+
|
|
|
+ rtnMap.put("cert_no", data.get("number").getAsString());
|
|
|
+ card.setId_number(data.get("number").getAsString());
|
|
|
+
|
|
|
+ rtnMap.put("std_sex", data.get("sex").getAsString().equals("女") ? 2 : 1);
|
|
|
+ card.setSex(data.get("sex").getAsString());
|
|
|
+
|
|
|
+ rtnMap.put("std_nation", data.get("nationality").getAsString());
|
|
|
+ card.setNationality(data.get("nationality").getAsString());
|
|
|
+
|
|
|
+ for (FrameDict frameDict : FrameDictUtil.getFrameDict("std_nation")) {
|
|
|
+ if (frameDict.getDict_text().equals(data.get("nationality").getAsString())) {
|
|
|
+ rtnMap.put("std_nation", frameDict.getDict_value());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rtnMap.put("std_birth", data.get("birth").getAsString());
|
|
|
+ card.setBirth(data.get("birth").getAsString());
|
|
|
+
|
|
|
+ rtnMap.put("std_name", data.get("name").getAsString());
|
|
|
+ card.setName(data.get("name").getAsString());
|
|
|
+
|
|
|
+ rtnMap.put("std_address", data.get("address").getAsString());
|
|
|
+ card.setAddress(data.get("address").getAsString());
|
|
|
+
|
|
|
+ // 记录图像识别成功
|
|
|
+ this.stdIdentityCardDao.insert(card);
|
|
|
+
|
|
|
+ return new Ajax(rtnMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ APP 注册
|
|
|
+ */
|
|
|
+ @RequestMapping("/std/sendSmsForReg")
|
|
|
+ public Ajax sendSmsForReg(String std_mobile, String validateCode) {
|
|
|
+ try {
|
|
|
+ if(!StringUtils.isEmpty(validateCode)){
|
|
|
+ String sessionVcode = (String) getSession().getAttribute("vCode");
|
|
|
+ if (!validateCode.equalsIgnoreCase(sessionVcode)) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("校验码错误,请重新填写!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == std_mobile) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请输入手机号!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1分钟内不允许再次发送短信
|
|
|
+ String error = this.isSysOperateFail(std_mobile, "sendSmsForReg", 1);
|
|
|
+ if (null != error) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(error);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<StdRegInfo> stds = this.stdRegInfoService.findStdByStdPhone(std_mobile, null);
|
|
|
+
|
|
|
+ if (null != stds && !stds.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("手机号已注册绑定,请通过身份信息和手机号找回密码!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int code = (int) ((Math.random() * 9 + 1) * 100000);
|
|
|
+
|
|
|
+ String smstext = "您正在注册广西自学考试网上系统账号,验证码:" + code + ",如非本人操作,请忽略本短信。(广西自学考试)";
|
|
|
+ JsonObject reslut = SmsSendUtil.sendSms(std_mobile, smstext);
|
|
|
+ if (null == reslut || null == reslut.get("flag") || !"succeed".equals(reslut.get("flag").getAsString())) {
|
|
|
+ String info = (null == reslut.get("msg")?"验证码发送失败,请稍后重试!":reslut.get("msg").getAsString());
|
|
|
+
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(info);
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysSmsInfo sms = new SysSmsInfo();
|
|
|
+ sms.setPhone(std_mobile);
|
|
|
+ sms.setContent(smstext);
|
|
|
+ this.sysSmsInfoService.insert(sms);
|
|
|
+
|
|
|
+ // 插入短信验证码表
|
|
|
+ SysVerificationCode sysCode = new SysVerificationCode();
|
|
|
+ sysCode.setPhone(std_mobile);
|
|
|
+ sysCode.setCode(code + "");
|
|
|
+ sysCode.setStatus(0);
|
|
|
+ this.sysVerificationCodeService.insert(sysCode);
|
|
|
+
|
|
|
+ // 记录发短信次数
|
|
|
+ this.setSysOperateFail(std_mobile, "sendSmsForReg", 1, 1, "请1分钟之后再重新发送验证码!");
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+ } finally {
|
|
|
+ this.getSession().removeAttribute("vCode");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/stdRegInfo/regForApp")
|
|
|
+ public Ajax regApp(StdRegInfo stdRegInfo,String code) {
|
|
|
+ if(null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getCert_no())){
|
|
|
+ throw new BusinessException("请填写证件号。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getStd_name())) {
|
|
|
+ throw new BusinessException("请填写姓名。");
|
|
|
+ } else if (!StringUtils.isEmpty(stdRegInfo.getStd_name())) {
|
|
|
+ if (!PatternUtil.checkStdName(stdRegInfo.getStd_name().trim())) {
|
|
|
+ throw new BusinessException("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == stdRegInfo.getCert_type()){
|
|
|
+ stdRegInfo.setCert_type(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 证件号验证
|
|
|
+ String cert_no = stdRegInfo.getCert_no();
|
|
|
+
|
|
|
+ if (null == stdRegInfo.getCert_type()) {
|
|
|
+ throw new BusinessException("请选择证件类型。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != stdRegInfo.getCert_type() && stdRegInfo.getCert_type().intValue() != 1) {
|
|
|
+ throw new BusinessException("请使用身份证号注册;使用非身份证件号注册,请到自考办现场进行注册。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stdRegInfo.getCert_type() == 1 && !FrameIdCardUtil.validateIdCard18(cert_no)) {
|
|
|
+ throw new BusinessException("身份证[" + cert_no + "]不合法,请重新填写。非身份证号,请到自考办现场注册。");
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(cert_no, "canRegTime", 30);
|
|
|
+ if(null != error){
|
|
|
+ throw new BusinessException(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.stdRegInfoService.existStdRegInfoByCertNo(cert_no)) {
|
|
|
+ // 设置注册失败次数
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canRegTime", 5, 30, "注册失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ throw new BusinessException("证件号[" + cert_no + "]已经存在,请使用该证件号登录!");
|
|
|
+ }else{
|
|
|
+ // 校验18位身份证对应的15位身份证号是否已经存在
|
|
|
+ String temp_cert_no = cert_no.substring(0, 6)+cert_no.substring(8, 17);
|
|
|
+ if (this.stdRegInfoService.existStdRegInfoByCertNo(temp_cert_no)) {
|
|
|
+ // 设置注册失败次数
|
|
|
+ this.setSysOperateFail(stdRegInfo.getCert_no(), "canRegTime", 5, 30, "注册失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ throw new BusinessException("证件号[" + cert_no + "]对应的15位身份证号已经存在,请使用15位身份证号进入忘记密码页面找回密码!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据手机号码和短信验证码获取短信信息
|
|
|
+ List<SysVerificationCode> codes = this.sysVerificationCodeService
|
|
|
+ .querySysVerificationCodeByCode(stdRegInfo.getStd_mobile(), code);
|
|
|
+
|
|
|
+ // 验证验证码有效性
|
|
|
+ if (null == codes || codes.isEmpty()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("短信验证码错误或已失效,请重新发送短信验证码!");
|
|
|
+
|
|
|
+ // 设置注册失败次数
|
|
|
+ this.setSysOperateFail(cert_no, "canRegTime", 5, 30, "注册失败累计超过5次,请30分钟之后再尝试!");
|
|
|
+
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(null != stdRegInfo.getStd_name()){
|
|
|
+ stdRegInfo.setStd_name(stdRegInfo.getStd_name().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 调用身份证件认证接口校验身份证合法性(校验不通过,业务继续,校验结果记录到考生信息表中)
|
|
|
+ //checkIdentifyCard(stdRegInfo);
|
|
|
+
|
|
|
+ // 生日
|
|
|
+ String std_birth = (null != cert_no && cert_no.length() == 18
|
|
|
+ ? cert_no.substring(6, 10) + "" + cert_no.substring(10, 12) + "" + cert_no.substring(12, 14) : "");
|
|
|
+ stdRegInfo.setStd_birth(std_birth);
|
|
|
+
|
|
|
+ // 性别
|
|
|
+ String std_sex = (null != cert_no && cert_no.length() == 18
|
|
|
+ ? ((Integer.parseInt(cert_no.substring(16, 17)) % 2) == 1 ? "1" : "2") : "");
|
|
|
+ stdRegInfo.setStd_sex(std_sex);
|
|
|
+
|
|
|
+
|
|
|
+ stdRegInfo.setStatus(StdConst.Status.NEW.ordinal());
|
|
|
+
|
|
|
+ LocalDateTime now = null;
|
|
|
+ StdEnrol time = this.stdEnrolService.getDataBaseTime();
|
|
|
+ if (null != time && null != time.getCreate_time()) {
|
|
|
+ now = time.getCreate_time();
|
|
|
+ } else {
|
|
|
+ now = LocalDateTime.now();
|
|
|
+ }
|
|
|
+
|
|
|
+ stdRegInfo.setReg_time(DateHelper.format(now));
|
|
|
+ stdRegInfo.setIs_new_stu(1);
|
|
|
+ stdRegInfo.setStd_source(1);
|
|
|
+
|
|
|
+ HashMap<String, Object> paraMapTime = new HashMap<String, Object>();
|
|
|
+ paraMapTime.put("year_code", YearCodeHelper.getCurrentYearCodeForTicketNo());
|
|
|
+ List<PlExamTime> dbTime = this.examTimeService.listByMap(paraMapTime);
|
|
|
+ PlExamTime currentTime = null;
|
|
|
+ if (dbTime.size() > 0) {
|
|
|
+ currentTime = dbTime.get(0);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("无当前批次信息,请联系系统管理员");
|
|
|
+ }
|
|
|
+ String exam_time_id = currentTime.getId().toString();
|
|
|
+ stdRegInfo.setExam_time_id(exam_time_id);
|
|
|
+ // 密码截取
|
|
|
+ stdRegInfo.setStd_pass(cutPasssword(stdRegInfo.getStd_pass()));
|
|
|
+
|
|
|
+ //APP登录同时绑定手要号码
|
|
|
+ stdRegInfo.setBindphone(stdRegInfo.getStd_mobile());
|
|
|
+ stdRegInfo.setStd_dh(stdRegInfo.getStd_mobile());
|
|
|
+
|
|
|
+ // 注册时清空准考证号,防止攻击直接生成准考证号
|
|
|
+ stdRegInfo.setTicket_no(null);
|
|
|
+ stdRegInfo.setPhoto_path(null);
|
|
|
+ stdRegInfo.setMajor_id(null);
|
|
|
+
|
|
|
+ // 保存考生信息
|
|
|
+ this.stdRegInfoService.save(stdRegInfo);
|
|
|
+
|
|
|
+ return new Ajax();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 身份证认证
|
|
|
+ * @param stdRegInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Ajax identifyCardApp(StdRegInfo stdRegInfo) {
|
|
|
+
|
|
|
+ // 证件号验证
|
|
|
+ String cert_no = stdRegInfo.getCert_no();
|
|
|
+
|
|
|
+ // 1分钟内不允许再次验证
|
|
|
+ if (!isIdentifyCardFialExt()) {
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("请1分钟之后再重新进行身份认证!");
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo temp_std = new StdRegInfo();
|
|
|
+ temp_std.setCert_no(cert_no);
|
|
|
+ temp_std.setStd_name(stdRegInfo.getStd_name());
|
|
|
+
|
|
|
+ if (null != cert_no && cert_no.length() == 18) {
|
|
|
+ // 身份证认证
|
|
|
+ String result = this.checkIdentifyCard(temp_std);
|
|
|
+
|
|
|
+ if(null == result){
|
|
|
+ //身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("身份证认证不通过,请进入个人中心申请变更身份信息。");
|
|
|
+ //return ajax;
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+
|
|
|
+ }else if(!"success".equals(result)){
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(result);
|
|
|
+ //return ajax;
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }else{
|
|
|
+ // 身份认证成功
|
|
|
+ // 设置身份认证成功标识
|
|
|
+ stdRegInfo.setIs_identfiy(1);
|
|
|
+
|
|
|
+ // 设置证件类型为身份证
|
|
|
+ stdRegInfo.setCert_type(1);
|
|
|
+
|
|
|
+ // 保存认证信息
|
|
|
+ //this.stdRegInfoService.edit(dbStd);
|
|
|
+
|
|
|
+ // 更新考生会话信息
|
|
|
+ //getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStd);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ //this.regLogService.insertStdRegLog(stdRegInfo, OperType.ADD.ordinal());
|
|
|
+
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }
|
|
|
+ }else if(null != cert_no && (cert_no.toUpperCase().startsWith("H")||cert_no.toUpperCase().startsWith("M") )){
|
|
|
+ // 港澳台考生身份认证
|
|
|
+ String result = this.verifyCertificate(stdRegInfo);
|
|
|
+
|
|
|
+ if (null == result) {
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("港澳台身身份认证不通过。");
|
|
|
+ //return ajax;
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+
|
|
|
+ } else if (!"success".equals(result)) {
|
|
|
+ // 身份认证失败
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg(result);
|
|
|
+ return ajax;
|
|
|
+ } else {
|
|
|
+ // 港澳台身份认证成功
|
|
|
+ // 设置身份认证成功标识
|
|
|
+ stdRegInfo.setIs_identfiy(1);
|
|
|
+ // 设置证件类型为身份证
|
|
|
+ stdRegInfo.setCert_type(8);
|
|
|
+
|
|
|
+ // 保存认证信息
|
|
|
+ //this.stdRegInfoService.edit(stdRegInfo);
|
|
|
+
|
|
|
+ // 更新考生会话信息
|
|
|
+ //getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, stdRegInfo);
|
|
|
+
|
|
|
+ // 添加日志
|
|
|
+ //this.regLogService.insertStdRegLog(stdRegInfo, OperType.ADD.ordinal());
|
|
|
+
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ Ajax ajax = new Ajax();
|
|
|
+ ajax.setSuccess(false);
|
|
|
+ ajax.setErrorMsg("证件号不是身份证或港澳居民往来内地通行证或台湾居民往来内地通行证,无法进行身份认证!");
|
|
|
+ //return ajax;
|
|
|
+ return new Ajax(stdRegInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/getLoginToken")
|
|
|
+ public Ajax getLoginToken(String uuid) {
|
|
|
+ StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ String token=SecureHelper.des3Encrypt(std.getId().toString()+ "@"+uuid+ "@"+ LocalDateTime.now().plusDays(7).toInstant(ZoneOffset.of("+8")).toEpochMilli(), SecureHelper.getSecureKey(uuid));
|
|
|
+
|
|
|
+ //[高风险]安全退出无效-服务端 将token保存数据库中
|
|
|
+ StdAppLogintoken temp = this.stdAppLogintokenDao.find("token", token);
|
|
|
+ if(null == temp){
|
|
|
+ StdAppLogintoken stdAppLogintoken = new StdAppLogintoken();
|
|
|
+ stdAppLogintoken.setToken(token);
|
|
|
+ stdAppLogintoken.setStatus("1");
|
|
|
+
|
|
|
+ this.stdAppLogintokenDao.insert(stdAppLogintoken);
|
|
|
+ }else{
|
|
|
+ temp.setStatus("1");
|
|
|
+ this.stdAppLogintokenDao.updateStdAppLogintokenStatus(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return new Ajax(token);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/std/loginForAuthentication")
|
|
|
+ public Ajax loginForAuthentication(String uuid, String token) {
|
|
|
+ if (uuid == null || token == null) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+// String std_id = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+// if (StringUtils.isEmpty(std_id) ) {
|
|
|
+// throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+// }
|
|
|
+ String source = null;
|
|
|
+ try {
|
|
|
+ source = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ if (StringHelper.isEmpty(source))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if (source.split("@").length != 3)
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if (!source.split("@")[1].equals(uuid))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if(System.currentTimeMillis()>Long.parseLong(source.split("@")[2]))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+
|
|
|
+ // [高风险]安全退出无效-服务端 从数据库中获取token,判断token是否已经安全退出,如果已经安全退出,则需要重新登录
|
|
|
+ StdAppLogintoken temp = this.stdAppLogintokenDao.find("token", token);
|
|
|
+ if (null != temp && !"1".equals(temp.getStatus())) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoDao.queryStdById(Integer.valueOf(source.split("@")[0]));
|
|
|
+ if (dbStdRegInfo == null ) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (seStd != null && !seStd.getId().equals(dbStdRegInfo.getId())) {
|
|
|
+ throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
+ }
|
|
|
+ stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|