|
@@ -85,6 +85,14 @@ public class StudentServiceImpl implements StudentService {
|
|
|
throw new StatusException("160001", "顶级机构错误");
|
|
|
}
|
|
|
|
|
|
+ String identityNumber = studentInfo.getIdentityNumber();
|
|
|
+ if (StringUtils.isBlank(identityNumber)) {
|
|
|
+ throw new StatusException("160012", "身份证号不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
|
|
|
+ rootOrgId);
|
|
|
+
|
|
|
OrgEntity org = null;
|
|
|
if (null != studentInfo.getOrgId()) {
|
|
|
org = GlobalHelper.getEntity(orgRepo, studentInfo.getOrgId(), OrgEntity.class);
|
|
@@ -116,17 +124,22 @@ public class StudentServiceImpl implements StudentService {
|
|
|
org = orgRepo.save(org);
|
|
|
}
|
|
|
} else {
|
|
|
- throw new StatusException("160082", "orgId,orgCode can not be all null");
|
|
|
- }
|
|
|
-
|
|
|
- String identityNumber = studentInfo.getIdentityNumber();
|
|
|
- if (StringUtils.isBlank(identityNumber)) {
|
|
|
- throw new StatusException("160012", "身份证号不能为空");
|
|
|
+ if (null != student) {
|
|
|
+ org = GlobalHelper.getEntity(orgRepo, student.getOrgId(), OrgEntity.class);
|
|
|
+ } else {
|
|
|
+ org = orgRepo.findByRootIdAndCode(rootOrgId, BasicConsts.DEFAULT_ORG_COEE);
|
|
|
+ if (null == org) {
|
|
|
+ org = new OrgEntity();
|
|
|
+ org.setParentId(rootOrgId);
|
|
|
+ org.setCode(BasicConsts.DEFAULT_ORG_COEE);
|
|
|
+ org.setName(BasicConsts.DEFAULT_ORG_NAME);
|
|
|
+ org.setEnable(true);
|
|
|
+ org.setRootId(rootOrgId);
|
|
|
+ org = orgRepo.save(org);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
|
|
|
- rootOrgId);
|
|
|
-
|
|
|
long updateTime = 0L;
|
|
|
if (null != student) {
|
|
|
if (null != student.getUpdateTime()) {
|