|
@@ -51,7 +51,7 @@ public class SpecialtyService {
|
|
|
specialty.setEnable(true);
|
|
|
ExcelError error = importCheck(specialty);
|
|
|
if (error == null) {
|
|
|
- list.add(specialty);
|
|
|
+ addSpecialty(list,specialty);
|
|
|
}
|
|
|
return error;
|
|
|
}
|
|
@@ -63,14 +63,25 @@ public class SpecialtyService {
|
|
|
return excelErrors;
|
|
|
}
|
|
|
|
|
|
- private ExcelError importCheck(Specialty Specialty) {
|
|
|
- if(StringUtils.isEmpty(Specialty.getCode())){
|
|
|
+ private void addSpecialty(List<Specialty> specialties,Specialty specialty){
|
|
|
+ for(Specialty tempSpecialty:specialties){
|
|
|
+ if(tempSpecialty.getCode().equals(specialty.getCode())){
|
|
|
+ tempSpecialty.setName(specialty.getName());
|
|
|
+ tempSpecialty.setUpdateTime(new Date());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ specialties.add(specialty);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExcelError importCheck(Specialty specialty) {
|
|
|
+ if(StringUtils.isEmpty(specialty.getCode())){
|
|
|
return new ExcelError("代码不能为空");
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(Specialty.getName())){
|
|
|
+ if(StringUtils.isEmpty(specialty.getName())){
|
|
|
return new ExcelError("名称不能为空");
|
|
|
}
|
|
|
- Specialty domain = specialtyRepo.findByOrgIdAndCode(Specialty.getOrgId(),Specialty.getCode());
|
|
|
+ Specialty domain = specialtyRepo.findByOrgIdAndCode(specialty.getOrgId(),specialty.getCode());
|
|
|
if(domain != null){
|
|
|
return new ExcelError("代码已存在");
|
|
|
}
|