|
@@ -0,0 +1,96 @@
|
|
|
|
|
+package org.dromara.backstage.controller.self;
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.codec.Base64;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.dromara.backstage.business.accouunt.UserAccountBusiness;
|
|
|
|
|
+import org.dromara.backstage.business.payments.PayOrderBusiness;
|
|
|
|
|
+import org.dromara.backstage.business.self.SelfBusiness;
|
|
|
|
|
+import org.dromara.backstage.domain.bo.yc.YcTraineeBo;
|
|
|
|
|
+import org.dromara.backstage.domain.convert.YcVoConvert;
|
|
|
|
|
+import org.dromara.backstage.domain.vo.account.AccountInfoVo;
|
|
|
|
|
+import org.dromara.backstage.payment.domain.bo.PtUserAccountBo;
|
|
|
|
|
+import org.dromara.common.core.api.ResponseResult;
|
|
|
|
|
+import org.dromara.common.core.api.ReturnResult;
|
|
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
|
|
+import org.dromara.common.core.enums.ResultCodeEnum;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.text.MessageFormat;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @ClassName TraineeController
|
|
|
|
|
+ * @Description 学员自助控制器
|
|
|
|
|
+ * @Author luoyibo
|
|
|
|
|
+ * @Date 2024-11-08 21:05
|
|
|
|
|
+ * @Version 1.0
|
|
|
|
|
+ * @since jdk17
|
|
|
|
|
+ */
|
|
|
|
|
+@RestController("TraineeController")
|
|
|
|
|
+@ResponseResult
|
|
|
|
|
+@RequestMapping("/trainee")
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+public class TraineeController {
|
|
|
|
|
+ private final UserAccountBusiness userAccountBusiness;
|
|
|
|
|
+ private final SelfBusiness selfBusiness;
|
|
|
|
|
+ private final PayOrderBusiness payOrderBusiness;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据手机号获取教职工信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param mobile 手机号
|
|
|
|
|
+ * @return 教职工信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/api/v1/mobile/{mobile}/{checkinDate}")
|
|
|
|
|
+ public ReturnResult getUserByMobile(@PathVariable("mobile") String mobile, @PathVariable("checkinDate") String checkinDate) {
|
|
|
|
|
+ if (StrUtil.isEmpty(mobile)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "手机号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isEmpty(checkinDate)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "报到日期不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ String dePhone = Base64.decodeStr(mobile);
|
|
|
|
|
+ PtUserAccountBo bo = new PtUserAccountBo().setPhone(dePhone).setCategory("2");
|
|
|
|
|
+ R<AccountInfoVo> result = userAccountBusiness.getAccountInfo(bo);
|
|
|
|
|
+ if (R.isError(result)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.DATA_NOT_FOUND, MessageFormat.format("没有手机号[{0}]对应的人员信息", dePhone));
|
|
|
|
|
+ }
|
|
|
|
|
+ return ReturnResult.success(YcVoConvert.ycUserAccountConvert(result.getData()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据身份证号获取学员信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param identity 身份证号
|
|
|
|
|
+ * @return 学员信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/api/v1/identity/{identity}/{checkinDate}")
|
|
|
|
|
+ public ReturnResult getUserByIdentity(@PathVariable("identity") String identity, @PathVariable("checkinDate") String checkinDate) {
|
|
|
|
|
+ if (StrUtil.isEmpty(identity)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "身份证号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isEmpty(checkinDate)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.PARAM_IS_BLANK, "报到日期不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ String deIdentity = Base64.decodeStr(identity);
|
|
|
|
|
+ PtUserAccountBo bo = new PtUserAccountBo().setIdNumber(deIdentity).setCategory("2");
|
|
|
|
|
+ R<AccountInfoVo> result = userAccountBusiness.getAccountInfo(bo);
|
|
|
|
|
+ if (R.isError(result)) {
|
|
|
|
|
+ return ReturnResult.failure(ResultCodeEnum.DATA_NOT_FOUND, MessageFormat.format("没有身份号[{0}]对应的人员信息", deIdentity));
|
|
|
|
|
+ }
|
|
|
|
|
+ return ReturnResult.success(YcVoConvert.ycUserAccountConvert(result.getData()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 学员报到
|
|
|
|
|
+ * @param bo 学员报到业务对象
|
|
|
|
|
+ * @return 报到结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/api/v1/register")
|
|
|
|
|
+ public ReturnResult checkinTrainee(@RequestBody YcTraineeBo bo){
|
|
|
|
|
+
|
|
|
|
|
+ return ReturnResult.success();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|