zoujiajian 2 years ago
parent
commit
d05db88ce4

+ 9 - 5
netflix-web/src/main/java/com/cyksj/web/controller/mini/UserStudentCertController.java

@@ -23,6 +23,7 @@ import com.ejlchina.searcher.param.Operator;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -73,11 +74,14 @@ public class UserStudentCertController {
 		}
 		miniService.getStudentIdentity(user, code);
 		//大学生认证活动 若有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();
 	}