|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
@@ -897,6 +898,11 @@ public class ApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 超60周岁是否提醒
|
|
|
+ String ageReminderInfo = this.sixtyYearsOldReminder(sysU);
|
|
|
+ mapOne.put("ageReminder", Boolean.TRUE.equals(sysU.getAgeReminder()) && StrUtil.isNotBlank(ageReminderInfo));
|
|
|
+ mapOne.put("ageReminderInfo", ageReminderInfo);
|
|
|
+
|
|
|
// 获取发起认证的令牌
|
|
|
String randomStr;
|
|
|
|
|
@@ -4644,4 +4650,55 @@ public class ApiController {
|
|
|
|
|
|
return R.ok(sysUserService.updateById(user));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭年满60周岁提醒
|
|
|
+ *
|
|
|
+ * @return {@link R}<{@link Boolean}>
|
|
|
+ */
|
|
|
+ @PostMapping("/stop-sixtyyearsold-reminder")
|
|
|
+ public R<Boolean> stopSixtyYearsOldReminder() {
|
|
|
+ Integer userId = SecurityUtils.getUser().getId();
|
|
|
+ log.info("关闭年满60周岁提醒:userId={}", userId);
|
|
|
+
|
|
|
+ SysUser user = new SysUser();
|
|
|
+ user.setUserId(userId);
|
|
|
+ user.setAgeReminder(Boolean.FALSE);
|
|
|
+ user.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ return R.ok(sysUserService.updateById(user));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 年龄超60周岁提醒
|
|
|
+ *
|
|
|
+ * @param userVO
|
|
|
+ * @return {@link String}
|
|
|
+ */
|
|
|
+ private String sixtyYearsOldReminder(UserVO userVO) {
|
|
|
+ String idCardNumber = userVO.getIdCardNumber();
|
|
|
+ if (IdcardUtil.isValidCard(idCardNumber)) {
|
|
|
+ // 当前日期
|
|
|
+ Calendar nowCal = Calendar.getInstance();
|
|
|
+ // 基于生日的日期,60周岁提前半年的时间
|
|
|
+ Calendar halfYearCal = IdcardUtil.getBirthDate(idCardNumber).toCalendar();
|
|
|
+ halfYearCal.add(Calendar.YEAR, 59);
|
|
|
+ halfYearCal.add(Calendar.MONTH, 6);
|
|
|
+ // 基于生日的日期,60周岁的时间
|
|
|
+ Calendar sixtyYearsOldYearCal = IdcardUtil.getBirthDate(idCardNumber).toCalendar();
|
|
|
+ sixtyYearsOldYearCal.add(Calendar.YEAR, 60);
|
|
|
+
|
|
|
+ if (sixtyYearsOldYearCal.compareTo(nowCal) > 0 && halfYearCal.compareTo(nowCal) <= 0) {
|
|
|
+ // 提前半年提醒,不满60周岁,但距离60周岁在半年内
|
|
|
+ return String.format("平台要求人员年龄在年满18岁未满60岁之间,您的账号将于%s年%s月%s日被停用,停用后将无法做任务或者资金结算,请知悉!",
|
|
|
+ sixtyYearsOldYearCal.get(Calendar.YEAR), sixtyYearsOldYearCal.get(Calendar.MONTH) + 1, sixtyYearsOldYearCal.get(Calendar.DAY_OF_MONTH));
|
|
|
+ } else if (sixtyYearsOldYearCal.compareTo(nowCal) <= 0) {
|
|
|
+ // 已超过60周岁
|
|
|
+ return String.format("您的账号已于%s年%s月%s日因年龄超限被停用,请知悉",
|
|
|
+ sixtyYearsOldYearCal.get(Calendar.YEAR), sixtyYearsOldYearCal.get(Calendar.MONTH) + 1, sixtyYearsOldYearCal.get(Calendar.DAY_OF_MONTH));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|