|
@@ -2,6 +2,7 @@ package com.qunzhixinxi.hnqz.admin.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
@@ -143,9 +144,11 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.Duration;
|
|
|
import java.time.Instant;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -903,7 +906,7 @@ public class ApiController {
|
|
|
try {
|
|
|
String fieldVal = (String) field.get(wmTaskContent);
|
|
|
|
|
|
- all = duplicateImage(fieldVal, id, errorHash, ducImgUrl,all);
|
|
|
+ all = duplicateImage(fieldVal, id, errorHash, ducImgUrl, all);
|
|
|
} catch (Exception ignored) {
|
|
|
}
|
|
|
|
|
@@ -911,10 +914,10 @@ public class ApiController {
|
|
|
|
|
|
if (CollUtil.isNotEmpty(ducImgUrl)) {
|
|
|
// 保存图片
|
|
|
- log.info("all size:{}",all.size());
|
|
|
- if (CollUtil.isNotEmpty(all)){
|
|
|
+ log.info("all size:{}", all.size());
|
|
|
+ if (CollUtil.isNotEmpty(all)) {
|
|
|
all.forEach(hash -> {
|
|
|
- String key = String.format("%s:%s", id, hash);
|
|
|
+ String key = String.format("%s:%s", id, hash);
|
|
|
log.info("key: {}", key);
|
|
|
redisTemplate.delete(key);
|
|
|
});
|
|
@@ -932,20 +935,20 @@ public class ApiController {
|
|
|
redisTemplate.delete(key);
|
|
|
}
|
|
|
|
|
|
- if (r.getCode() == CommonConstants.FAIL && CollUtil.isNotEmpty(all)){
|
|
|
+ if (r.getCode() == CommonConstants.FAIL && CollUtil.isNotEmpty(all)) {
|
|
|
// 保存图片
|
|
|
- log.info("all size:{}",all.size());
|
|
|
- all.forEach(hash -> {
|
|
|
- String key = String.format("%s:%s", id, hash);
|
|
|
- log.info("key: {}", key);
|
|
|
- redisTemplate.delete(key);
|
|
|
- });
|
|
|
+ log.info("all size:{}", all.size());
|
|
|
+ all.forEach(hash -> {
|
|
|
+ String key = String.format("%s:%s", id, hash);
|
|
|
+ log.info("key: {}", key);
|
|
|
+ redisTemplate.delete(key);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
- private List<String> duplicateImage(String contentValue, Integer userId, Set<String> errorHash, List<String> duplicateImageUrl,List<String> all) {
|
|
|
+ private List<String> duplicateImage(String contentValue, Integer userId, Set<String> errorHash, List<String> duplicateImageUrl, List<String> all) {
|
|
|
|
|
|
|
|
|
if (contentValue.startsWith("/admin/sys-file/wmkj")) {
|
|
@@ -2460,7 +2463,9 @@ public class ApiController {
|
|
|
.eq(WmUserSignDetail::getSignId, userSign.getId()));
|
|
|
if (userSignDetail != null) {
|
|
|
if (ArrayUtil.isNotEmpty(userSignDetail.getPurpose())) {
|
|
|
- String[] purposeNameArr = Stream.of(userSignDetail.getPurpose()).map(s -> UserSignPurposeEnum.resolve(s).getName()).toArray(String[]::new);
|
|
|
+ String[] purposeNameArr = Stream.of(userSignDetail.getPurpose())
|
|
|
+ .map(s -> UserSignPurposeEnum.resolve(s).getName())
|
|
|
+ .toArray(String[]::new);
|
|
|
userSignDetail.setPurposeName(purposeNameArr);
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(userSignDetail.getResult())) {
|
|
@@ -2532,21 +2537,20 @@ public class ApiController {
|
|
|
// 获取更新操作的用户角色
|
|
|
List<Integer> roles = SecurityUtils.getRoles();
|
|
|
|
|
|
+ Integer ageByIdCard = null;
|
|
|
// 如果角色中包含全职和兼职就需要校验身份证年龄
|
|
|
if (roles.contains(5) || roles.contains(6)) {
|
|
|
// 校验身份证上的年龄
|
|
|
if (StringUtils.isNotEmpty(userUpdateInput.getIdCardNumber())) {
|
|
|
- int ageByIdCard = IdcardUtil.getAgeByIdCard(userUpdateInput.getIdCardNumber());
|
|
|
+ ageByIdCard = IdcardUtil.getAgeByIdCard(userUpdateInput.getIdCardNumber());
|
|
|
if (ageByIdCard < 18) {
|
|
|
return R.failed("年龄未满十八");
|
|
|
- } else if (ageByIdCard > 65) {
|
|
|
- return R.failed("年龄已超过六十五");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * TODO 小程序的认证
|
|
|
+ * 小程序的认证
|
|
|
* @Modify: start
|
|
|
* @Version: v2021.4.16
|
|
|
* @Author: ryz
|
|
@@ -2583,6 +2587,35 @@ public class ApiController {
|
|
|
|
|
|
if (SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(subType)) {
|
|
|
|
|
|
+ // 校验身份证上的年龄 60周岁前15天
|
|
|
+ if (ageByIdCard != null && StringUtils.isNotEmpty(userUpdateInput.getIdCardNumber())) {
|
|
|
+
|
|
|
+ boolean over60 = false;
|
|
|
+ log.warn("ageByIdCard:{}", ageByIdCard);
|
|
|
+ if (ageByIdCard == 59) {
|
|
|
+ String birth = IdcardUtil.getBirth(userUpdateInput.getIdCardNumber());
|
|
|
+ log.warn("birth string:{}", birth);
|
|
|
+ LocalDate birthday = LocalDate.parse(birth, DatePattern.PURE_DATE_FORMATTER);
|
|
|
+
|
|
|
+ // 获取今年的生日
|
|
|
+ LocalDate thisBirthday = LocalDate.of(LocalDate.now().getYear(), birthday.getMonthValue(), birthday.getDayOfMonth());
|
|
|
+ LocalDate limit = thisBirthday.minus(15, ChronoUnit.DAYS);
|
|
|
+ log.warn("this year birthday:{}, before 15 days: {}", thisBirthday, limit);
|
|
|
+
|
|
|
+ if (LocalDate.now().isAfter(limit)) {
|
|
|
+ over60 = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (ageByIdCard >= 60) {
|
|
|
+ over60 = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (over60) {
|
|
|
+ errorMap.put(SubjectTypeEnum.TYPE_RENLIJIA, "年龄已超过六十");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SysDeptSub subCondition = new SysDeptSub();
|
|
|
subCondition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
subCondition.setDeptId(sysDept.getDeptId());
|
|
@@ -2651,6 +2684,14 @@ public class ApiController {
|
|
|
|
|
|
} else if (SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode().equals(subType)) {
|
|
|
|
|
|
+ // 校验身份证上的年龄 60周岁前15天
|
|
|
+ if (ageByIdCard != null && StringUtils.isNotEmpty(userUpdateInput.getIdCardNumber())) {
|
|
|
+ if (ageByIdCard > 65) {
|
|
|
+ errorMap.put(SubjectTypeEnum.TYPE_SHUIBANGYUN, "年龄已超过六十五");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SysDeptSub subCondition = new SysDeptSub();
|
|
|
subCondition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
subCondition.setDeptId(sysDept.getDeptId());
|
|
@@ -2674,7 +2715,7 @@ public class ApiController {
|
|
|
model.setName(sysUser.getRealname());
|
|
|
model.setNotifyUrl("http://localhost:8808");
|
|
|
boolean isPingAnBank = StrUtil.isNotEmpty(userUpdateInput.getBankCardNumber());
|
|
|
- if (isPingAnBank){
|
|
|
+ if (isPingAnBank) {
|
|
|
model.setPayAccount(userUpdateInput.getBankCardNumber());
|
|
|
}
|
|
|
model.setEnterpriseCode(sysDept.getTaxCode());
|
|
@@ -2700,7 +2741,7 @@ public class ApiController {
|
|
|
sysCertResultRecordMapper.insert(record);
|
|
|
|
|
|
if (response.success()) {
|
|
|
- sysUser.setCertStatus(isPingAnBank? TaxHelperCertStatus.UNCHECKED_BIND.getCode() : TaxHelperCertStatus.ADD_MEMBER.getCode());
|
|
|
+ sysUser.setCertStatus(isPingAnBank ? TaxHelperCertStatus.UNCHECKED_BIND.getCode() : TaxHelperCertStatus.ADD_MEMBER.getCode());
|
|
|
} else {
|
|
|
log.info("税邦云增员失败:{},{},原因是:{}", sysUser.getRealname(), sysUser.getUsername(), response.getMessage());
|
|
|
userUpdateInput.setIdCardNumber(null);
|
|
@@ -2711,9 +2752,19 @@ public class ApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ String msg = "";
|
|
|
+ for (Map.Entry<SubjectTypeEnum, String> entry : errorMap.entrySet()) {
|
|
|
+ if (SubjectTypeEnum.TYPE_RENLIJIA.equals(entry.getKey())) {
|
|
|
+ msg += SubjectTypeEnum.TYPE_RENLIJIA.getDesc() + "认证结果:" + entry.getValue() + ";";
|
|
|
+ }
|
|
|
+ if (SubjectTypeEnum.TYPE_SHUIBANGYUN.equals(entry.getKey())) {
|
|
|
+ msg += SubjectTypeEnum.TYPE_SHUIBANGYUN.getDesc() + "认证结果:" + entry.getValue() + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 两家都失败了,就中止
|
|
|
if (errorMap.size() == 2) {
|
|
|
- return R.failed(errorMap);
|
|
|
+ return R.failed(errorMap,msg);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2732,7 +2783,9 @@ public class ApiController {
|
|
|
}
|
|
|
sysUserService.updateById(sysUser);
|
|
|
|
|
|
- return R.ok(errorMap);
|
|
|
+
|
|
|
+
|
|
|
+ return R.ok(errorMap, msg);
|
|
|
}
|
|
|
|
|
|
|