|
@@ -6,11 +6,9 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
-import com.cyksj.mapper.UserCertRecordMapper;
|
|
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.mapper.UserStudentCertRecordMapper;
|
|
import com.cyksj.mapper.UserStudentCertRecordMapper;
|
|
|
import com.cyksj.model.entity.User;
|
|
import com.cyksj.model.entity.User;
|
|
|
-import com.cyksj.model.entity.UserCertRecord;
|
|
|
|
|
import com.cyksj.model.entity.UserStudentCertRecord;
|
|
import com.cyksj.model.entity.UserStudentCertRecord;
|
|
|
import com.cyksj.model.views.CouponView;
|
|
import com.cyksj.model.views.CouponView;
|
|
|
import com.cyksj.model.views.UserActivityView;
|
|
import com.cyksj.model.views.UserActivityView;
|
|
@@ -23,6 +21,7 @@ import com.ejlchina.searcher.param.Operator;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -48,8 +47,6 @@ public class UserStudentCertController {
|
|
|
|
|
|
|
|
private final UserBindRelationService userBindRelationService;
|
|
private final UserBindRelationService userBindRelationService;
|
|
|
|
|
|
|
|
- private final UserCertRecordMapper UserCertRecordMapper;
|
|
|
|
|
-
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
|
|
private final UserStudentCertRecordMapper userStudentCertRecordMapper;
|
|
private final UserStudentCertRecordMapper userStudentCertRecordMapper;
|
|
@@ -66,18 +63,21 @@ public class UserStudentCertController {
|
|
|
}
|
|
}
|
|
|
//是否认证过
|
|
//是否认证过
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, user);
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, user);
|
|
|
- Integer selectCount = UserCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserCertRecord.class)
|
|
|
|
|
- .in(UserCertRecord::getUserId, userIdList));
|
|
|
|
|
|
|
+ Integer selectCount = userStudentCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserStudentCertRecord.class)
|
|
|
|
|
+ .in(UserStudentCertRecord::getUserId, userIdList));
|
|
|
if (selectCount > 0) {
|
|
if (selectCount > 0) {
|
|
|
throw BusinessRuntimeException.getInstance("已认证大学生身份");
|
|
throw BusinessRuntimeException.getInstance("已认证大学生身份");
|
|
|
}
|
|
}
|
|
|
miniService.getStudentIdentity(user, code);
|
|
miniService.getStudentIdentity(user, code);
|
|
|
//大学生认证活动 若有sid则发送对应用户
|
|
//大学生认证活动 若有sid则发送对应用户
|
|
|
- userActivityService.sendStudentCertActivity(user, dsCode);
|
|
|
|
|
- UserStudentCertRecord record = new UserStudentCertRecord();
|
|
|
|
|
- record.setUserId(userId);
|
|
|
|
|
- record.setSchool(school);
|
|
|
|
|
- userStudentCertRecordMapper.insert(record);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ UserStudentCertRecord record = new UserStudentCertRecord();
|
|
|
|
|
+ record.setUserId(userId);
|
|
|
|
|
+ record.setSchool(school);
|
|
|
|
|
+ userStudentCertRecordMapper.insert(record);
|
|
|
|
|
+ userActivityService.sendStudentCertActivity(user, dsCode);
|
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
|
+ }
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|