|
|
@@ -11,6 +11,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.oss.OSSClientUtil;
|
|
|
import org.jeecg.common.oss.OSSConfig;
|
|
|
@@ -35,6 +36,7 @@ import org.jeecg.modules.saasmanager.entity.HwCompanyUser;
|
|
|
import org.jeecg.modules.saasmanager.entity.HwPlatformCompany;
|
|
|
import org.jeecg.modules.saasmanager.service.IHwCompanyUserService;
|
|
|
import org.jeecg.modules.saasmanager.service.IHwPlatformCompanyService;
|
|
|
+import org.jeecg.modules.util.BirthUtils;
|
|
|
import org.jeecg.modules.util.Constants;
|
|
|
import org.jeecg.modules.util.ExcelUtils;
|
|
|
import org.jeecg.modules.util.TokenUtil;
|
|
|
@@ -869,4 +871,148 @@ public class HwUserServiceImpl extends ServiceImpl<HwUserMapper, HwUser> impleme
|
|
|
public List<HwUser> findHwuserByIdcard(String idcardNumber) {
|
|
|
return baseMapper.findHwuserByIdcard(idcardNumber);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传图片
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> imgUpload(Map<String, String> requestMap, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ Map<String, Object> resultImg = new HashMap<String, Object>();
|
|
|
+ String type = request.getParameter("upType");
|
|
|
+ String userId = request.getParameter("userId");
|
|
|
+ HwUser hwmUser = this.getById(userId);
|
|
|
+ String path = "/hwuser/index";
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(type)) {
|
|
|
+ switch (type) {
|
|
|
+ case "0":
|
|
|
+ //基本资料
|
|
|
+ path = "/hwuser/resume";
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ //身份证正面
|
|
|
+ path = "/hwuser/idcard/front";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ //身份证反面
|
|
|
+ path = "/hwuser/idcard/back";
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ //手持身份证
|
|
|
+ path = "/hwuser/idcard/hold";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ path = "/hwuser/index";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //上传调用
|
|
|
+ try {
|
|
|
+ if (request instanceof MultipartHttpServletRequest) {
|
|
|
+ Result<?> result = this.webupload(request, "file", hwmUser, path);
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ resultImg.put("imgUrl", result.getResult().toString());
|
|
|
+ } else {
|
|
|
+ log.info("imgUpload========{}", result.getMessage());
|
|
|
+ resultImg.put("success","1004");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("imgUpload========没有文件上传");
|
|
|
+ resultImg.put("success","1004");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resultImg.put("success","1004");
|
|
|
+ }
|
|
|
+ return resultImg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 实名认证
|
|
|
+ *
|
|
|
+ * @param requestMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Map<String, Object> authenticate(Map<String, String> requestMap, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ Map<String, Object> resultImg = new HashMap<String, Object>();
|
|
|
+ String idcardNumber = request.getParameter("idcardNumber");
|
|
|
+ String id = request.getParameter("id");
|
|
|
+ String name = request.getParameter("name");
|
|
|
+ String setIdcardFront = request.getParameter("setIdcardFront");
|
|
|
+ String setIdcardBack = request.getParameter("setIdcardBack");
|
|
|
+ try {
|
|
|
+ // 身份证号是否已存在
|
|
|
+ QueryWrapper<HwUser> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("idcard_number", idcardNumber);
|
|
|
+ queryWrapper.ne("id", id);
|
|
|
+ int count =count(queryWrapper);
|
|
|
+ if (count > 0) {
|
|
|
+ resultImg.put("success","2010");
|
|
|
+ return resultImg;
|
|
|
+ }
|
|
|
+ // 验证实名信息
|
|
|
+// boolean ok = txIdentityUtils.IdCardVerification(name, idcardNumber);
|
|
|
+// if (!ok) {
|
|
|
+// resultImg.put("success","2010");
|
|
|
+// return resultImg;
|
|
|
+// }
|
|
|
+ HwUser hwmUser = this.getById(id);
|
|
|
+ hwmUser.setName(name);
|
|
|
+ hwmUser.setIdcardNumber(idcardNumber);
|
|
|
+ hwmUser.setGender(BirthUtils.getSex(idcardNumber));
|
|
|
+ hwmUser.setIdcardFront(setIdcardFront);
|
|
|
+ hwmUser.setIdcardBack(setIdcardBack);
|
|
|
+ hwmUser.setAuthenticationTime(new Date());
|
|
|
+ hwmUser.setAuthenticationStatus(1);
|
|
|
+ this.updateById(hwmUser);
|
|
|
+ // 同步慧盈
|
|
|
+ String requestUrl = OauthApi.USER_EDIT;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("name", hwmUser.getName());
|
|
|
+ parameters.put("idcardNumber", hwmUser.getIdcardNumber());
|
|
|
+ parameters.put("userCode", hwmUser.getUserCode());
|
|
|
+ parameters.put("updateBy", hwmUser.getName());
|
|
|
+ String idcardPicture = "";
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(hwmUser.getIdcardFront())) {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(hwmUser.getIdcardBack())) {
|
|
|
+ idcardPicture = hwmUser.getIdcardFront() + "," + hwmUser.getIdcardBack();
|
|
|
+ } else {
|
|
|
+ idcardPicture = hwmUser.getIdcardFront();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(hwmUser.getIdcardBack())) {
|
|
|
+ idcardPicture = hwmUser.getIdcardBack();
|
|
|
+ } else {
|
|
|
+ idcardPicture = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ parameters.put("idcardPicture", idcardPicture);
|
|
|
+ log.info("param============{}", JSONObject.toJSONString(parameters));
|
|
|
+ //数据加密
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, "");
|
|
|
+ log.info("用户-编辑===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean("success")) {
|
|
|
+ log.info("用户-编辑成功===={}", jsonObject);
|
|
|
+ } else {
|
|
|
+ log.info("用户-编辑失败===={}", jsonObject);
|
|
|
+ //抛出异常,事务回滚
|
|
|
+ throw new JeecgBootException("认证失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("用户-编辑失败===={}", jsonObject);
|
|
|
+ throw new JeecgBootException("认证失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ resultImg.put("success","1004");
|
|
|
+ }
|
|
|
+ return resultImg;
|
|
|
+ }
|
|
|
}
|