|
|
@@ -1,7 +1,7 @@
|
|
|
package com.ruoyi.web.service;
|
|
|
|
|
|
-import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
-import com.ruoyi.common.core.domain.model.LoginCard;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
import com.ruoyi.common.enums.UserRegStatus;
|
|
|
import com.ruoyi.common.exception.base.BaseException;
|
|
|
@@ -13,6 +13,9 @@ import com.ruoyi.enums.UserTypeEnum;
|
|
|
import com.ruoyi.framework.web.service.TokenService;
|
|
|
import com.ruoyi.learn.domain.LearnStudent;
|
|
|
import com.ruoyi.learn.mapper.LearnStudentMapper;
|
|
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
+import com.ruoyi.web.domain.CardUserBody;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import com.ruoyi.common.constant.CacheConstants;
|
|
|
@@ -29,7 +32,9 @@ import com.ruoyi.system.service.ISysConfigService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.validation.ValidationException;
|
|
|
import java.text.ParseException;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 注册校验方法
|
|
|
@@ -55,6 +60,10 @@ public class SysRegisterService
|
|
|
private TokenService tokenService;
|
|
|
@Autowired
|
|
|
private LearnStudentMapper learnStudentMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private LearnTeacherService learnTeacherService;
|
|
|
|
|
|
/**
|
|
|
* 注册
|
|
|
@@ -140,6 +149,45 @@ public class SysRegisterService
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void improve(CardUserBody cardUserBody) {
|
|
|
+ DzCards card = cardsService.selectDzCardsByCardId(cardUserBody.getCardId());
|
|
|
+ if(null == card) {
|
|
|
+ throw new ValidationException("卡用户不存在");
|
|
|
+ }
|
|
|
+ List<SysUser> sysUserList = sysUserMapper.selectUserByCardIds(Lists.newArrayList(card.getCardId()));
|
|
|
+ if(CollectionUtils.isEmpty(sysUserList)) {
|
|
|
+ throw new ValidationException("卡用户不存在");
|
|
|
+ }
|
|
|
+ Long userId = sysUserList.get(0).getUserId();
|
|
|
+
|
|
|
+ SysUser upUser = new SysUser();
|
|
|
+ upUser.setUserId(userId);
|
|
|
+ upUser.setNickName(cardUserBody.getNickName());
|
|
|
+ upUser.setLocation(cardUserBody.getLocation());
|
|
|
+ upUser.setExamType(cardUserBody.getExamType());
|
|
|
+ upUser.setEndYear(cardUserBody.getEndYear());
|
|
|
+ upUser.setScores(cardUserBody.getScores());
|
|
|
+ upUser.setSchoolId(cardUserBody.getSchoolId());
|
|
|
+ upUser.setClassId(cardUserBody.getClassId());
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject directed = cardUserBody.getDirectionStudy().getJSONObject(0);
|
|
|
+ Long planId = directed.getLongValue("majorId");
|
|
|
+ Long universityId = directed.getLongValue("universityId");
|
|
|
+ directed.put("notice", learnTeacherService.updateDirected(userId, universityId, planId));
|
|
|
+ cardUserBody.getDirectionStudy().set(0, directed);
|
|
|
+ upUser.setDirectedStudy(cardUserBody.getDirectionStudy().toJSONString());
|
|
|
+
|
|
|
+ DzCards upCard = new DzCards();
|
|
|
+ upCard.setCardId(card.getCardId());
|
|
|
+ upCard.setSchoolId(cardUserBody.getSchoolId());
|
|
|
+ upCard.setClassId(cardUserBody.getClassId());
|
|
|
+ upCard.setCampusId(cardUserBody.getCampusSchoolId());
|
|
|
+ upCard.setCampusClassId(cardUserBody.getCampusClassId());
|
|
|
+ cardsService.updateDzCards(upCard);
|
|
|
+ }
|
|
|
+
|
|
|
private void saveInfo(SysUser user, DzCards card, RegisterBody register) {
|
|
|
user.setNickName(register.getNickName());
|
|
|
user.setLocation(register.getLocation());
|
|
|
@@ -159,7 +207,7 @@ public class SysRegisterService
|
|
|
card.setClassId(register.getClassId());
|
|
|
|
|
|
if(null == user.getCardId() || !user.getCardId().equals(card.getCardId())) { // 未绑定或换绑时激活卡
|
|
|
- if(!CardStatus.Paid.getVal().equals(card.getStatus())) {
|
|
|
+ if(!CardStatus.Paid.getVal().equals(card.getStatus()) && !CardStatus.Open.getVal().equals(card.getStatus())) {
|
|
|
throw new RuntimeException("无效卡");
|
|
|
}
|
|
|
user.setEvalCounts("{\"1\":1,\"2\":1,\"3\":1,\"11\":1,\"0\":0}");
|