|
|
@@ -0,0 +1,535 @@
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alipay.api.domain.CompanyInfo;
|
|
|
+import com.jpsoft.employment.config.OSSConfig;
|
|
|
+import com.jpsoft.employment.modules.base.entity.UserAuthenticationApprove;
|
|
|
+import com.jpsoft.employment.modules.base.service.UserAuthenticationApproveService;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.employment.modules.common.utils.DES3;
|
|
|
+import com.jpsoft.employment.modules.common.utils.JwtUtil;
|
|
|
+import com.jpsoft.employment.modules.common.utils.OSSUtil;
|
|
|
+import com.jpsoft.employment.modules.common.utils.SMSUtil;
|
|
|
+import com.jpsoft.employment.modules.job.entity.JobUser;
|
|
|
+import com.jpsoft.employment.modules.job.entity.Resume;
|
|
|
+import com.jpsoft.employment.modules.job.entity.ResumeDeliver;
|
|
|
+import com.jpsoft.employment.modules.job.entity.UserCollection;
|
|
|
+import com.jpsoft.employment.modules.job.service.JobUserService;
|
|
|
+import com.jpsoft.employment.modules.job.service.ResumeDeliverService;
|
|
|
+import com.jpsoft.employment.modules.job.service.ResumeService;
|
|
|
+import com.jpsoft.employment.modules.job.service.UserCollectionService;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.SysLog;
|
|
|
+import com.jpsoft.employment.modules.sys.service.SysLogService;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.joda.time.DateTime;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+import sun.awt.IconInfo;
|
|
|
+import sun.misc.BASE64Decoder;
|
|
|
+
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mobile/jobUserApi")
|
|
|
+@Slf4j
|
|
|
+public class JobUserApiController {
|
|
|
+ @Value("${jwt.secret}")
|
|
|
+ private String jwtSecret;
|
|
|
+
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private JobUserService jobUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ValueOperations<String, Object> valueOperations;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OSSConfig ossConfig;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysLogService sysLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserAuthenticationApproveService userAuthenticationApproveService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserCollectionService userCollectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverService resumeDeliverService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeService resumeService;
|
|
|
+
|
|
|
+ @PostMapping("findByOpenId")
|
|
|
+ @ApiOperation(value = "通过openId查询人员(公开接口)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "openId", value = "微信openId", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> findByOpenId(String openId) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = null;
|
|
|
+ if (StringUtils.isNotBlank(openId)) {
|
|
|
+ jobUser = jobUserService.findByOpenId(openId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (jobUser == null) {
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
+ String token = JwtUtil.createToken(jwtSecret, jobUser.getId() + "", DateTime.now().plusHours(6).toDate());
|
|
|
+
|
|
|
+ dataMap.put("jobUser", jobUser);
|
|
|
+ dataMap.put("token", token);
|
|
|
+
|
|
|
+ messageResult.setData(dataMap);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("wechatLogin")
|
|
|
+ @ApiOperation(value = "微信登录(公开接口)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "openId", value = "openId", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> wechatLogin(String openId) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.findByOpenId(openId);
|
|
|
+
|
|
|
+ if (jobUser ==null) {
|
|
|
+ DES3 des3 = new DES3();
|
|
|
+ String passwordEnc = des3.encrypt(jwtSecret,"123456");
|
|
|
+
|
|
|
+ jobUser = new JobUser();
|
|
|
+ jobUser.setId(UUID.randomUUID().toString());
|
|
|
+ jobUser.setRealName("未注册用户");
|
|
|
+ jobUser.setPassword(passwordEnc);
|
|
|
+ jobUser.setCreateTime(new Date());
|
|
|
+ jobUser.setDelFlag(false);
|
|
|
+ jobUser.setHeadImageUrl("http://xpgj.oss-cn-shanghai.aliyuncs.com/xpgj/test/default_avatar.jpg");
|
|
|
+ jobUser.setIsAuthentication("0");
|
|
|
+ jobUser.setOpenId(openId);
|
|
|
+
|
|
|
+ jobUserService.insert(jobUser);
|
|
|
+ }else{
|
|
|
+ jobUser.setUpdateTime(new Date());
|
|
|
+ jobUserService.update(jobUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
+ String token = JwtUtil.createToken(jwtSecret, jobUser.getId() + "", DateTime.now().plusHours(6).toDate());
|
|
|
+
|
|
|
+ dataMap.put("jobUser", jobUser);
|
|
|
+ dataMap.put("token", token);
|
|
|
+
|
|
|
+ messageResult.setData(dataMap);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("getVerifyCode")
|
|
|
+ @ApiOperation(value = "获取短信验证码(公开接口)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "telephone", value = "电话", required = true, paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<String> getVerifyCode(String telephone) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ String key = "SMS_" + telephone;
|
|
|
+
|
|
|
+ String verifyCode = (String) valueOperations.get(key);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(verifyCode)) {
|
|
|
+ verifyCode = SMSUtil.generateNumberString(6);
|
|
|
+ JSONObject verifyCodeJSON = new JSONObject();
|
|
|
+ verifyCodeJSON.put("code", verifyCode);
|
|
|
+
|
|
|
+ messageResult = SMSUtil.send(telephone, "SMS_49390047", verifyCodeJSON.toString());
|
|
|
+
|
|
|
+ //设置当前用户的验证码,5分钟内有效
|
|
|
+ valueOperations.set(key, verifyCode, 10, TimeUnit.MINUTES);
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("validateCode")
|
|
|
+ @ApiOperation(value = "验证短信验证码(公开接口)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "openId", value = "微信openId", paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> validateCode(String verifyCode, String openId, String telephone) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ String smsKey = "SMS_" + telephone;
|
|
|
+
|
|
|
+ String beforeVerifyCode = (String) valueOperations.get(smsKey);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(beforeVerifyCode)) {
|
|
|
+ throw new Exception("验证码已过期!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!beforeVerifyCode.equals(verifyCode)) {
|
|
|
+ throw new Exception("验证码错误!");
|
|
|
+ }
|
|
|
+
|
|
|
+ JobUser jobUser = null;
|
|
|
+ String token = null;
|
|
|
+ if (StringUtils.isNotEmpty(openId)) {
|
|
|
+ jobUser = jobUserService.findByOpenId(openId);
|
|
|
+
|
|
|
+ if (jobUser != null) {
|
|
|
+ jobUser.setUpdateTime(new Date());
|
|
|
+ jobUserService.update(jobUser);
|
|
|
+ }else{
|
|
|
+ DES3 des3 = new DES3();
|
|
|
+ String passwordEnc = des3.encrypt(jwtSecret,"123456");
|
|
|
+ jobUser = new JobUser();
|
|
|
+ jobUser.setId(UUID.randomUUID().toString());
|
|
|
+ jobUser.setRealName("未注册用户");
|
|
|
+ jobUser.setPassword(passwordEnc);
|
|
|
+ jobUser.setCreateTime(new Date());
|
|
|
+ jobUser.setDelFlag(false);
|
|
|
+ jobUser.setHeadImageUrl("http://xpgj.oss-cn-shanghai.aliyuncs.com/xpgj/test/default_avatar.jpg");
|
|
|
+ jobUser.setIsAuthentication("0");
|
|
|
+ jobUser.setOpenId(openId);
|
|
|
+
|
|
|
+ jobUserService.insert(jobUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ token = JwtUtil.createToken(jwtSecret, jobUser.getId(), DateTime.now().plusHours(6).toDate());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("token", token);
|
|
|
+ map.put("jobUser", jobUser);
|
|
|
+
|
|
|
+ messageResult.setData(map);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("passwordLogin")
|
|
|
+ @ApiOperation(value = "密码登录(公开接口)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "phone", value = "openId", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "password", value = "openId", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "openId", value = "openId", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> passwordLogin(String phone,String password,String openId) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.findByPhone(phone);
|
|
|
+ if(jobUser == null){
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage("手机号未注册");
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+ DES3 des3 = new DES3();
|
|
|
+ String passwordEnc = des3.encrypt(jwtSecret,password);
|
|
|
+
|
|
|
+ if(passwordEnc.equals(jobUser.getPassword())){
|
|
|
+ jobUser.setOpenId(openId);
|
|
|
+ jobUser.setUpdateTime(new Date());
|
|
|
+ jobUserService.update(jobUser);
|
|
|
+ }else {
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage("密码错误");
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
+ String token = JwtUtil.createToken(jwtSecret, jobUser.getId() + "", DateTime.now().plusHours(6).toDate());
|
|
|
+
|
|
|
+ dataMap.put("jobUser", jobUser);
|
|
|
+ dataMap.put("token", token);
|
|
|
+
|
|
|
+ messageResult.setData(dataMap);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("upload")
|
|
|
+ @ApiOperation(value = "人员照片上传")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "photoName", value = "照片名称", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "photoFile", value = "照片路径", required = true, paramType = "form", dataType = "__file"),
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = false, paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "令牌", required = false, paramType = "query")
|
|
|
+ })
|
|
|
+ public MessageResult<String> upload(
|
|
|
+ String photoName, MultipartFile photoFile, String token, @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.get(subject);
|
|
|
+
|
|
|
+ if (jobUser == null) {
|
|
|
+ throw new Exception("人员信息不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String retFileUrl = OSSUtil.upload(ossConfig, "/jobUser", photoName, photoFile.getInputStream());
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(retFileUrl);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("uploadBase64")
|
|
|
+ @ResponseBody
|
|
|
+ @ApiOperation(value = "员工照片上传")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "photoName", value = "照片名称", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "photoBase64Data", value = "员工照片base64编码", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<String> uploadBase64(String photoName, String photoBase64Data) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ SysLog sysLog = new SysLog();
|
|
|
+ sysLog.setPointcut("人员照片上传");
|
|
|
+
|
|
|
+ try {
|
|
|
+ sysLog.setRemark("base64 照片大小:" + photoBase64Data.length());
|
|
|
+
|
|
|
+ //前50个字符
|
|
|
+ if (StringUtils.isNotEmpty(photoBase64Data)) {
|
|
|
+ sysLog.setData(photoBase64Data.substring(0, Math.min(photoBase64Data.length(), 50)));
|
|
|
+ }
|
|
|
+
|
|
|
+ BASE64Decoder decoder = new BASE64Decoder();
|
|
|
+
|
|
|
+ String[] arr = photoBase64Data.split(",");
|
|
|
+
|
|
|
+ byte[] imgData = decoder.decodeBuffer(arr[1]);
|
|
|
+
|
|
|
+ for (int i = 0; i < imgData.length; ++i) {
|
|
|
+ if (imgData[i] < 0) {// 调整异常数据
|
|
|
+ imgData[i] += 256;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(imgData);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(photoName)) {
|
|
|
+ photoName = "1.jpg";
|
|
|
+ }
|
|
|
+
|
|
|
+ String retFileUrl = OSSUtil.upload(ossConfig, "/jobUser", photoName, inputStream);
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(retFileUrl);
|
|
|
+ messageResult.setCode(200);
|
|
|
+
|
|
|
+ sysLog.setUrl(retFileUrl);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(e.getMessage());
|
|
|
+
|
|
|
+ sysLog.setRemark(sysLog.getRemark() + "," + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ sysLog.setCreateTime(new Date());
|
|
|
+ sysLogService.insert(sysLog);
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("save")
|
|
|
+ @ApiOperation(value = "保存人员信息并将照片上传到终端")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "userId", value = "人员编号", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "openId", value = "微信openId", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "faceImageUrl", value = "照片地址", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<JobUser> save(String userId, String openId, String faceImageUrl, String token) {
|
|
|
+ MessageResult<JobUser> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.get(userId);
|
|
|
+
|
|
|
+ if (jobUser == null) {
|
|
|
+ throw new Exception("人员信息不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 更新人脸照片
|
|
|
+ jobUser.setOpenId(openId);
|
|
|
+ jobUser.setHeadImageUrl(faceImageUrl);
|
|
|
+ jobUser.setUpdateTime(new Date());
|
|
|
+ jobUserService.update(jobUser);
|
|
|
+
|
|
|
+ messageResult.setData(jobUser);
|
|
|
+ messageResult.setResult(true);
|
|
|
+
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("authenticationStatus")
|
|
|
+ @ApiOperation(value = "用户认证状态")
|
|
|
+ public MessageResult<String> authenticationStatus(String token, @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.get(subject);
|
|
|
+ String returnIs = "";
|
|
|
+ if(jobUser != null){
|
|
|
+ returnIs = jobUser.getIsAuthentication();
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setData(returnIs);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("submitAuthentication")
|
|
|
+ @ApiOperation(value = "提交认证信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "name", value = "姓名", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "idCard", value = "身份证", required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "positiveUrl", value = "身份证正面地址", required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "reverseUrl", value = "身份证反面地址", required = true,paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<String> submitAuthentication(
|
|
|
+ String name,
|
|
|
+ String idCard,
|
|
|
+ String positiveUrl,
|
|
|
+ String reverseUrl,
|
|
|
+ String token,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ JobUser jobUser = jobUserService.get(subject);
|
|
|
+
|
|
|
+ if (jobUser == null) {
|
|
|
+ throw new Exception("未登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ jobUser.setUpdateTime(new Date());
|
|
|
+ jobUser.setUpdateBy(subject);
|
|
|
+
|
|
|
+ jobUser.setIdCard(idCard);
|
|
|
+ jobUser.setHeadImageUrl(positiveUrl+","+reverseUrl);
|
|
|
+ jobUser.setRealName(name);
|
|
|
+ jobUser.setIsAuthentication("2");//待审核
|
|
|
+
|
|
|
+ jobUserService.update(jobUser);
|
|
|
+
|
|
|
+ UserAuthenticationApprove uaa = userAuthenticationApproveService.findByUserId(jobUser.getId());
|
|
|
+ if(uaa == null) {
|
|
|
+ //保存认证信息到审批表
|
|
|
+ uaa = new UserAuthenticationApprove();
|
|
|
+ uaa.setId(UUID.randomUUID().toString());
|
|
|
+ uaa.setCreateTime(new Date());
|
|
|
+ uaa.setCreateBy(subject);
|
|
|
+ uaa.setDelFlag(false);
|
|
|
+ uaa.setJobUserId(jobUser.getId());
|
|
|
+
|
|
|
+ userAuthenticationApproveService.insert(uaa);
|
|
|
+ }else{
|
|
|
+ uaa.setUpdateTime(new Date());
|
|
|
+ uaa.setUpdateBy(subject);
|
|
|
+ uaa.setJobUserId(jobUser.getId());
|
|
|
+ userAuthenticationApproveService.update(uaa);
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setData("提交成功,请等待审核!");
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|