|
@@ -33,10 +33,13 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysRole;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmAdRecord;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmPkgQuizRelation;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.entity.WmPlatformQuizTestResult;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.entity.WmQuiz;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskSubmissionPercentRule;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmTaskSubmissionRule;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.PersonalScoreRecordVO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.vo.WmQuizVO;
|
|
|
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.MedicalEquipment;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.SysDeptSub;
|
|
@@ -98,6 +101,8 @@ import com.qunzhixinxi.hnqz.admin.service.WmDaPharmacyService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDeptTaskTypeTemplateService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmFeedbackService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmPkgQuizRelationService;
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.WmPlatformQuizTestResultService;
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.WmQuizService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageStatusService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScoreTaskTypeService;
|
|
@@ -121,6 +126,7 @@ import com.qunzhixinxi.hnqz.admin.view.user.UserUpdateInput;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.enums.CommonFlag;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.enums.LoginTypeEnum;
|
|
|
+import com.qunzhixinxi.hnqz.common.core.constant.enums.UpmsState;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
@@ -167,6 +173,7 @@ 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;
|
|
@@ -228,6 +235,8 @@ public class ApiController {
|
|
|
private final Sequence taskSequence;
|
|
|
private final WmPkgQuizRelationService quizRelationService;
|
|
|
private final WmDaHospitalService wmDaHospitalService;
|
|
|
+ private final WmQuizService quizService;
|
|
|
+ private final WmPlatformQuizTestResultService platformQuizTestResultService;
|
|
|
|
|
|
@SysLog("通过任务类型获取表单配置")
|
|
|
@GetMapping("/getTaskContentConfigByTaskTypeId/{taskTypeId}")
|
|
@@ -1656,7 +1665,6 @@ public class ApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取药企列表
|
|
|
*
|
|
@@ -2450,8 +2458,7 @@ public class ApiController {
|
|
|
|
|
|
// 获取更新操作的用户角色
|
|
|
List<Integer> roles = SecurityUtils.getRoles();
|
|
|
-
|
|
|
- Integer ageByIdCard = null;
|
|
|
+ Integer ageByIdCard;
|
|
|
// 如果角色中包含全职和兼职就需要校验身份证年龄
|
|
|
if (roles.contains(5) || roles.contains(6)) {
|
|
|
// 校验身份证上的年龄
|
|
@@ -2463,238 +2470,11 @@ public class ApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
- // * 小程序的认证
|
|
|
- // * @Modify: start
|
|
|
- // * @Version: v2021.4.16
|
|
|
- // * @Author: ryz
|
|
|
- // * @Date: 2021/4/28
|
|
|
- // */
|
|
|
- // boolean updateFlag = true;
|
|
|
- // if (null != sysUser.getCertStatus()) {
|
|
|
- // if (sysUser.getCertStatus() != 10) {
|
|
|
- // updateFlag = false;
|
|
|
- // }
|
|
|
- //
|
|
|
- // }
|
|
|
- // if (null != sysUser.getRljCertStatus()) {
|
|
|
- // if (sysUser.getRljCertStatus() == 1 || sysUser.getRljCertStatus() == 3) {
|
|
|
- // updateFlag = false;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (!updateFlag) {
|
|
|
- // if (!userUpdateInput.getRealname().equals(sysUser.getRealname())) {
|
|
|
- // return R.failed("用户认证通过或正在认证,暂不能修改姓名");
|
|
|
- // }
|
|
|
- // if (!userUpdateInput.getIdCardNumber().equals(sysUser.getIdCardNumber())) {
|
|
|
- // return R.failed("用户认证通过或正在认证,暂不能修改身份证号");
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
- //
|
|
|
- // Map<SubjectTypeEnum, String> errorMap = new HashMap<>(2);
|
|
|
- //
|
|
|
- // // 开启认证
|
|
|
- // if (CollectionUtils.isNotEmpty(userUpdateInput.getSubList())) {
|
|
|
- // for (String subType : userUpdateInput.getSubList()) {
|
|
|
- //
|
|
|
- // 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());
|
|
|
- // subCondition.setSubjectType(SubjectTypeEnum.TYPE_RENLIJIA.getCode());
|
|
|
- // SysDeptSub deptSub = sysDeptSubService.getOne(Wrappers.query(subCondition));
|
|
|
- // if (null == deptSub || StringUtils.isBlank(deptSub.getAppId())) {
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_RENLIJIA, "人员所在机构未配置结算信息");
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //
|
|
|
- // DingConfig config = new DingConfig();
|
|
|
- // config.setAppId(deptSub.getAppId());
|
|
|
- // config.setAppSecret(deptSub.getAppSecret());
|
|
|
- // config.setQueryUrl(deptSub.getQueryUrl());
|
|
|
- //
|
|
|
- // Map map = new HashMap();
|
|
|
- // map.put("name", userUpdateInput.getRealname());
|
|
|
- // map.put("mobile", sysUser.getPhone());
|
|
|
- // map.put("idCard", userUpdateInput.getIdCardNumber());
|
|
|
- // map.put("idType", "1");
|
|
|
- // List certList = new ArrayList();
|
|
|
- // certList.add(map);
|
|
|
- //
|
|
|
- // EmployCheckResponse response = dingService.check(config, certList);
|
|
|
- // if (!response.isSuccess()) {
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_RENLIJIA, "人力家接口调用异常");
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // //接口请求成功,但是接口返回的状态还需区分checkStatus,1:验证通过,状态改成已提交,2:验证不通过,状态改成认证失败
|
|
|
- // List<EmployCheckResultItem> freelancesResult = response.getData().getFreelancesResult();
|
|
|
- // if (CollectionUtils.isNotEmpty(freelancesResult)) {
|
|
|
- // for (EmployCheckResultItem employCheckResultItem : freelancesResult) {
|
|
|
- // if (employCheckResultItem.getIdCard().equals(userUpdateInput.getIdCardNumber())) {
|
|
|
- // if (employCheckResultItem.getCheckStatus() == 1) {//验证通过
|
|
|
- // sysUser.setRljCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
- // continue;
|
|
|
- // } else {//验证不通过
|
|
|
- // if ("1014".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
- // log.info("认证返回1014按成功处理:{},{}", sysUser.getRealname(), sysUser.getUsername());
|
|
|
- // sysUser.setRljCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // if ("1018".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
- // log.info("认证返回1018按处理中处理:{},{}", sysUser.getRealname(), sysUser.getUsername());
|
|
|
- // sysUser.setRljCertStatus(DingEnum.CER_STATUS_3.getType());
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // if ("1019".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
- // log.info("认证返回1019按成功处理:{},{}", sysUser.getRealname(), sysUser.getUsername());
|
|
|
- // sysUser.setRljCertStatus(DingEnum.CER_STATUS_1.getType());
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // if ("1020".equals(employCheckResultItem.getCheckRemark())) {
|
|
|
- // log.info("认证返回1020按认证失败处理:{},{}", sysUser.getRealname(), sysUser.getUsername());
|
|
|
- // sysUser.setRljCertStatus(DingEnum.CER_STATUS_2.getType());
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // log.info("认证失败:" + employCheckResultItem.getCheckRemark());
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_RENLIJIA, "认证失败:人力家认证失败");
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_RENLIJIA, "人力家接口调用异常");
|
|
|
- // }
|
|
|
- //
|
|
|
- // } 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());
|
|
|
- // subCondition.setSubjectType(SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode());
|
|
|
- // SysDeptSub deptSub = sysDeptSubService.getOne(Wrappers.query(subCondition));
|
|
|
- // if (null == deptSub || StringUtils.isBlank(deptSub.getAppId())) {
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_SHUIBANGYUN, "人员所在机构未配置结算信息");
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //
|
|
|
- // TaxHelperConfig config = new TaxHelperConfig();
|
|
|
- // config.setAppId(deptSub.getAppId());
|
|
|
- // config.setAppSecrete(deptSub.getAppSecret());
|
|
|
- // config.setQueryUrl(deptSub.getQueryUrl());
|
|
|
- //
|
|
|
- //
|
|
|
- // TaxHelperAddMemberModel model = new TaxHelperAddMemberModel(config);
|
|
|
- // model.setIdCard(userUpdateInput.getIdCardNumber());
|
|
|
- // model.setPhone(sysUser.getUsername());
|
|
|
- // model.setType(Integer.parseInt(deptSub.getSubjectUserType()));
|
|
|
- // model.setName(sysUser.getRealname());
|
|
|
- // model.setNotifyUrl("http://localhost:8808");
|
|
|
- // boolean isPingAnBank = StrUtil.isNotEmpty(userUpdateInput.getBankCardNumber());
|
|
|
- // if (isPingAnBank) {
|
|
|
- // model.setPayAccount(userUpdateInput.getBankCardNumber());
|
|
|
- // }
|
|
|
- // model.setEnterpriseCode(sysDept.getTaxCode());
|
|
|
- // if (StringUtils.isEmpty(model.getEnterpriseCode())) {
|
|
|
- //
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_SHUIBANGYUN, "未配置企业的统一社会信用代码");
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //
|
|
|
- // TaxHelperAddMemberRequest request = new TaxHelperAddMemberRequest(model);
|
|
|
- // TaxHelperResponse response = taxHelperService.addMembers(request);
|
|
|
- //
|
|
|
- // // 记录认证结果
|
|
|
- // SysCertResultRecord record = new SysCertResultRecord();
|
|
|
- // record.setCode(response.getCode());
|
|
|
- // record.setCreateTime(LocalDateTime.now());
|
|
|
- // record.setDeptId(sysDept.getDeptId());
|
|
|
- // record.setMessage(StringUtils.isNotEmpty(response.getMessage()) ? response.getMessage() : "无");
|
|
|
- // record.setStatus(null);
|
|
|
- // record.setSubjectType(1);
|
|
|
- // record.setMethod(isPingAnBank ? "增员(平安银行)" : "增员");
|
|
|
- // record.setUserId(sysUser.getUserId());
|
|
|
- // sysCertResultRecordMapper.insert(record);
|
|
|
- //
|
|
|
- // if (response.success()) {
|
|
|
- // sysUser.setCertStatus(isPingAnBank ? TaxHelperCertStatus.UNCHECKED_BIND.getCode() : TaxHelperCertStatus.ADD_MEMBER.getCode());
|
|
|
- // } else {
|
|
|
- // log.info("税邦云增员失败:{},{},原因是:{}", sysUser.getRealname(), sysUser.getUsername(), response.getMessage());
|
|
|
- // userUpdateInput.setIdCardNumber(null);
|
|
|
- // userUpdateInput.setBankCardNumber(null);
|
|
|
- // errorMap.put(SubjectTypeEnum.TYPE_SHUIBANGYUN, "税邦云增员失败");
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // 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,msg);
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
sysUser.setAvatar(userUpdateInput.getAvatar());
|
|
|
- // if (StringUtils.isNotEmpty(userUpdateInput.getIdCardNumber())) {
|
|
|
- // sysUser.setIdCardNumber(userUpdateInput.getIdCardNumber());
|
|
|
- //
|
|
|
- // }
|
|
|
+
|
|
|
// 姓名去除空格(包括字符之间的所有空格都会去除)
|
|
|
sysUser.setRealname(StrUtil.cleanBlank(userUpdateInput.getRealname()));
|
|
|
sysUser.setUserSign(userUpdateInput.getUserSign());
|
|
|
- // sysUser.setBankCardNumber(userUpdateInput.getBankCardNumber());
|
|
|
- // if (StringUtils.isNotEmpty(userUpdateInput.getTaxHelperAgreementSignature())) {
|
|
|
- // sysUser.setTaxHelperAgreementSignature(StringUtils.equals(SignatureStatusEnum.SIGNED.name(), userUpdateInput
|
|
|
- // .getTaxHelperAgreementSignature()) ? 1 : 0);
|
|
|
- // }
|
|
|
sysUserService.updateById(sysUser);
|
|
|
|
|
|
|
|
@@ -4199,4 +3979,61 @@ public class ApiController {
|
|
|
|
|
|
return R.ok(update);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前用户的平台试题测试结果
|
|
|
+ *
|
|
|
+ * @return 平台测试结果信息
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/quiz/plt/test/result")
|
|
|
+ public R<WmQuizVO.ToPltQuizTestVO> checkPlatQuizTestResult() {
|
|
|
+
|
|
|
+ // 获取用户信息
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+
|
|
|
+ // 判断当前企业的的合规权限
|
|
|
+ SysDept ent = sysDeptService.getById(user.getDeptId());
|
|
|
+ String[] deptPermissions = ent.getDeptPermissions();
|
|
|
+ boolean required = ArrayUtil.isNotEmpty(deptPermissions) && Stream.of(deptPermissions).collect(Collectors.toSet()).contains(3);
|
|
|
+
|
|
|
+ // 获取平台的问卷 和 答题的情况
|
|
|
+ List<WmQuiz> quizzes = quizService.listEntQuizzes(upmsConfig.getPltEntId(), UpmsState.QuizState.RELEASE);
|
|
|
+ List<Map<String, Object>> histories = new LinkedList<>();
|
|
|
+ if (CollUtil.isNotEmpty(quizzes)){
|
|
|
+ List<Integer> quizIds = quizzes.stream().mapToInt(WmQuiz::getQuizId).boxed().distinct().collect(Collectors.toList());
|
|
|
+ Map<Integer, List<WmPlatformQuizTestResult>> collect =
|
|
|
+ platformQuizTestResultService.listPltQuizResults(user.getId(), quizIds).stream()
|
|
|
+ .collect(Collectors.groupingBy(WmPlatformQuizTestResult::getQuizId));
|
|
|
+ LocalDate today = LocalDate.now();
|
|
|
+ for (WmQuiz quiz : quizzes){
|
|
|
+ Map<String, Object> history = new HashMap<>(3);
|
|
|
+ history.put("quiz", quiz);
|
|
|
+ List<WmPlatformQuizTestResult> quizTestResults = collect.get(quiz.getQuizId());
|
|
|
+ // 存在历史答题记录
|
|
|
+ if (CollUtil.isNotEmpty(quizTestResults)){
|
|
|
+ // 已经倒序排了, 所以一定是最后的答题结果
|
|
|
+ WmPlatformQuizTestResult historyResult = quizTestResults.get(0);
|
|
|
+ history.put("expiryDate", historyResult.getExpiry());
|
|
|
+ history.put("valid", today.isAfter(historyResult.getExpiry()));
|
|
|
+ }
|
|
|
+ // 不存在答题记录
|
|
|
+ else {
|
|
|
+ history.put("expiryDate", "");
|
|
|
+ history.put("valid", false);
|
|
|
+ }
|
|
|
+
|
|
|
+ histories.add(history);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WmQuizVO.ToPltQuizTestVO vo = new WmQuizVO.ToPltQuizTestVO();
|
|
|
+ vo.setRequired(required);
|
|
|
+ vo.setTestResults(histories);
|
|
|
+
|
|
|
+ return R.ok(vo);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|