|
@@ -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;
|
|
@@ -12,6 +13,7 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -59,6 +61,7 @@ import com.qunzhixinxi.hnqz.admin.entity.WmUserSignDetail;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmWkAlbum;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmWkArticle;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmWkArticleShare;
|
|
|
+import com.qunzhixinxi.hnqz.admin.entity.dto.SignAgreementDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.NoticeApiInput;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiInput;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput;
|
|
@@ -137,6 +140,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -880,6 +884,29 @@ public class ApiController {
|
|
|
mapOne.put("existEidResult", false);
|
|
|
}
|
|
|
|
|
|
+ // 签署协议信息
|
|
|
+ mapOne.put("signHonestAgreement", false);
|
|
|
+ if (StrUtil.isNotBlank(sysU.getSignAgreement())) {
|
|
|
+ JSONArray agreements = JSONUtil.parseArray(sysU.getSignAgreement());
|
|
|
+ for (Object agreement : agreements) {
|
|
|
+ SignAgreementDTO signAgreementDTO = BeanUtil.toBean(agreement, SignAgreementDTO.class);
|
|
|
+ if (SignAgreementDTO.SignAgreementType.HONEST_AGREEMENT.equals(signAgreementDTO.getAgreementType())) {
|
|
|
+ // 廉洁协议是否签署
|
|
|
+ mapOne.put("signHonestAgreement", true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 超60周岁是否提醒
|
|
|
+ Map<String, String> checkResult = sysUserService.checkSixtyYearsOld(sysU);
|
|
|
+ mapOne.put("ageReminder", Boolean.TRUE.equals(sysU.getAgeReminder()) && CollUtil.isNotEmpty(checkResult));
|
|
|
+ if (CollUtil.isNotEmpty(checkResult)) {
|
|
|
+ mapOne.put("ageReminderInfo", CollUtil.get(checkResult.values(), 0));
|
|
|
+ } else {
|
|
|
+ mapOne.put("ageReminderInfo", null);
|
|
|
+ }
|
|
|
+
|
|
|
// 获取发起认证的令牌
|
|
|
String randomStr;
|
|
|
|
|
@@ -2503,6 +2530,12 @@ public class ApiController {
|
|
|
return R.failed("全职学术推广员不能领取积分包");
|
|
|
}
|
|
|
|
|
|
+ // 校验超过60周岁,不能做任务
|
|
|
+ Map<String, String> checkResult = sysUserService.checkSixtyYearsOld(userVO);
|
|
|
+ if (CollUtil.isNotEmpty(checkResult) && checkResult.containsKey("OVER")) {
|
|
|
+ throw new RuntimeException(checkResult.get("OVER"));
|
|
|
+ }
|
|
|
+
|
|
|
WmScorePackageStatus wmScorePackageStatus = new WmScorePackageStatus();
|
|
|
wmScorePackageStatus.setPackageId(packageId);
|
|
|
wmScorePackageStatus.setUserId(userVO.getUserId() + "");
|
|
@@ -3788,6 +3821,12 @@ public class ApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 校验超过60周岁,不能做任务
|
|
|
+ Map<String, String> checkResult = sysUserService.checkSixtyYearsOld(BeanUtil.copyProperties(sysUser, UserVO.class));
|
|
|
+ if (CollUtil.isNotEmpty(checkResult) && checkResult.containsKey("OVER")) {
|
|
|
+ throw new RuntimeException(checkResult.get("OVER"));
|
|
|
+ }
|
|
|
+
|
|
|
// 查询任务类型启用状态
|
|
|
List<WmTaskSubmissionPercentRule> rules = wmTaskSubmissionPercentRuleService.list(Wrappers.<WmTaskSubmissionPercentRule>lambdaQuery()
|
|
|
.eq(WmTaskSubmissionPercentRule::getDeptId, sysUser.getDeptId())
|
|
@@ -4597,4 +4636,61 @@ public class ApiController {
|
|
|
return R.ok(Collections.emptyList());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 小程序签署协议
|
|
|
+ *
|
|
|
+ * @param signAgreementDTO 请求参数
|
|
|
+ * @return {@link R}<{@link ?}> 结果
|
|
|
+ */
|
|
|
+ @SysLog("小程序签署协议")
|
|
|
+ @PostMapping("/sign-agreement")
|
|
|
+ public R<Boolean> signAgreement(@Validated @RequestBody SignAgreementDTO signAgreementDTO) {
|
|
|
+ log.info("小程序签署协议请求:{}", signAgreementDTO);
|
|
|
+
|
|
|
+ Integer userId = SecurityUtils.getUser().getId();
|
|
|
+ SysUser queryUser = sysUserService.getById(userId);
|
|
|
+
|
|
|
+ List<Object> signAgreementDTOList = new ArrayList<>();
|
|
|
+ if (StrUtil.isBlank(queryUser.getSignAgreement())) {
|
|
|
+ signAgreementDTOList.add(signAgreementDTO);
|
|
|
+ } else {
|
|
|
+ JSONArray agreements = JSONUtil.parseArray(queryUser.getSignAgreement());
|
|
|
+ signAgreementDTOList.addAll(agreements);
|
|
|
+ // 如果已存在该协议,则不再重复保存
|
|
|
+ boolean anyMatch = agreements.stream()
|
|
|
+ .map(o -> BeanUtil.toBean(o, SignAgreementDTO.class))
|
|
|
+ .anyMatch(dto -> SignAgreementDTO.SignAgreementType.HONEST_AGREEMENT.equals(dto.getAgreementType()));
|
|
|
+ if (anyMatch) {
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ signAgreementDTOList.add(signAgreementDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ boolean update = sysUserService.update(Wrappers.<SysUser>lambdaUpdate()
|
|
|
+ .eq(SysUser::getIdCardNumber, queryUser.getIdCardNumber())
|
|
|
+ .set(SysUser::getSignAgreement, JSONUtil.toJsonStr(signAgreementDTOList))
|
|
|
+ .set(SysUser::getUpdateTime, LocalDateTime.now()));
|
|
|
+
|
|
|
+ return R.ok(update);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关闭年满60周岁提醒
|
|
|
+ *
|
|
|
+ * @return {@link R}<{@link Boolean}>
|
|
|
+ */
|
|
|
+ @PostMapping("/stop-sixtyyearsold-reminder")
|
|
|
+ public R<Boolean> stopSixtyYearsOldReminder() {
|
|
|
+ Integer userId = SecurityUtils.getUser().getId();
|
|
|
+ SysUser queryUser = sysUserService.getById(userId);
|
|
|
+ log.info("关闭年满60周岁提醒:userId={},idCardNumber={}", userId, queryUser.getIdCardNumber());
|
|
|
+
|
|
|
+ boolean update = sysUserService.update(Wrappers.<SysUser>lambdaUpdate()
|
|
|
+ .eq(SysUser::getIdCardNumber, queryUser.getIdCardNumber())
|
|
|
+ .set(SysUser::getAgeReminder, Boolean.FALSE)
|
|
|
+ .set(SysUser::getUpdateTime, LocalDateTime.now()));
|
|
|
+
|
|
|
+ return R.ok(update);
|
|
|
+ }
|
|
|
}
|