|
@@ -10,6 +10,7 @@ import java.lang.reflect.Method;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.util.Map;
|
|
@@ -63,9 +64,11 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
for (WorkStaffEducation info : list) {
|
|
|
if(StringUtils.isNotBlank(info.getDegreePhoto())){
|
|
|
info.setDegreePhotoStr( WorkattachmentService.fileUrlManage(info.getDegreePhoto()));
|
|
|
+ info.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getDegreePhoto()));
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(info.getEduPhoto())){
|
|
|
info.setEduPhotoStr( WorkattachmentService.fileUrlManage(info.getEduPhoto()));
|
|
|
+ info.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getEduPhoto()));
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
@@ -163,6 +166,7 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
EDU_MAP.put("endDate", "毕业日期");
|
|
|
EDU_MAP.put("eduPhoto", "学历证书");
|
|
|
EDU_MAP.put("degreePhoto", "学位证书");
|
|
|
+ EDU_MAP.put("heightEdu", "最高学历");
|
|
|
}
|
|
|
public boolean saveApply(WorkStaffBasicInfo workStaffBasicInfo,boolean first) {
|
|
|
if(workStaffBasicInfo==null|| StringUtils.isBlank(workStaffBasicInfo.getId())){
|
|
@@ -264,17 +268,21 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(workStaffEducation.getDegreePhoto())){
|
|
|
workStaffEducation.setDegreePhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ workStaffEducation.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getDegreePhoto()));
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(workStaffEducation.getEduPhoto())){
|
|
|
workStaffEducation.setEduPhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getEduPhoto()));
|
|
|
+ workStaffEducation.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getEduPhoto()));
|
|
|
}
|
|
|
newList.add(workStaffEducation);
|
|
|
for (WorkStaffEducation info : newList) {
|
|
|
if(StringUtils.isNotBlank(info.getDegreePhoto())){
|
|
|
info.setDegreePhotoStr( WorkattachmentService.fileUrlManage(info.getDegreePhoto()));
|
|
|
+ info.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getDegreePhoto()));
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(info.getEduPhoto())){
|
|
|
info.setEduPhotoStr( WorkattachmentService.fileUrlManage(info.getEduPhoto()));
|
|
|
+ info.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getEduPhoto()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -329,9 +337,11 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(workStaffEducation.getDegreePhoto())){
|
|
|
workStaffEducation.setDegreePhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ workStaffEducation.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getDegreePhoto()));
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(workStaffEducation.getEduPhoto())){
|
|
|
workStaffEducation.setEduPhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getEduPhoto()));
|
|
|
+ workStaffEducation.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getEduPhoto()));
|
|
|
}
|
|
|
newList.add(workStaffEducation);
|
|
|
}
|
|
@@ -350,6 +360,176 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
}
|
|
|
workStaffBasicInfo.setEducationList(newList);
|
|
|
}
|
|
|
+ public void storeQuerys(WorkStaffBasicInfo workStaffBasicInfo) {
|
|
|
+ SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if(workStaffBasicInfo==null|| StringUtils.isBlank(workStaffBasicInfo.getId())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ WorkStaffEducation entity = new WorkStaffEducation();
|
|
|
+ entity.setStaff(workStaffBasicInfo.getId());
|
|
|
+ List<WorkStaffEducation> list=this.findList(entity);
|
|
|
+ List<WorkStaffEducation> newList=Lists.newArrayList();
|
|
|
+ if(list!=null&&list.size()>0){//修改
|
|
|
+ for(WorkStaffEducation workStaffEducation:list){
|
|
|
+ Class<? extends WorkStaffEducation> newClass = workStaffEducation.getClass();
|
|
|
+ Field[] declaredFields = newClass.getDeclaredFields();
|
|
|
+ for (Field field : declaredFields) {
|
|
|
+ String name = field.getName();
|
|
|
+ if("school".equals(name)||"major".equals(name)||"edu".equals(name)||"degree".equals(name)||"eduType".equals(name) || "heightEdu".equals(name)
|
|
|
+ || "startDate".equals(name)||"endDate".equals(name)||"eduPhoto".equals(name)||"degreePhoto".equals(name)){
|
|
|
+ String setMethod = "set"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ String getMethod = "get"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setSonId(workStaffEducation.getId());
|
|
|
+ workStaffAchivesLog.setFields(name);
|
|
|
+ workStaffAchivesLog.setType("修改");
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ List<WorkStaffAchivesLog> logs=workStaffAchivesLogService.findList(workStaffAchivesLog);
|
|
|
+ try {
|
|
|
+ Object newInvoke = newClass.getMethod(getMethod).invoke(workStaffEducation);//修改后
|
|
|
+ if(newInvoke instanceof String){
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, String.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ setReadOnly.invoke(workStaffEducation,logs.get(0).getNewKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newInvoke instanceof Date){//日期
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, Date.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ Date myDate = dateFormat1.parse(logs.get(0).getNewKey());
|
|
|
+ setReadOnly.invoke(workStaffEducation,myDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(null == newInvoke){
|
|
|
+ try {
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, String.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ setReadOnly.invoke(workStaffEducation,logs.get(0).getNewKey());
|
|
|
+ }
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, Date.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ Date myDate = dateFormat1.parse(logs.get(0).getNewKey());
|
|
|
+ setReadOnly.invoke(workStaffEducation,myDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(workStaffEducation.getDegreePhoto())){
|
|
|
+ workStaffEducation.setDegreePhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ workStaffEducation.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(workStaffEducation.getEduPhoto())){
|
|
|
+ workStaffEducation.setEduPhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getEduPhoto()));
|
|
|
+ workStaffEducation.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getEduPhoto()));
|
|
|
+ }
|
|
|
+ newList.add(workStaffEducation);
|
|
|
+ for (WorkStaffEducation info : newList) {
|
|
|
+ if(StringUtils.isNotBlank(info.getDegreePhoto())){
|
|
|
+ info.setDegreePhotoStr( WorkattachmentService.fileUrlManage(info.getDegreePhoto()));
|
|
|
+ info.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(info.getEduPhoto())){
|
|
|
+ info.setEduPhotoStr( WorkattachmentService.fileUrlManage(info.getEduPhoto()));
|
|
|
+ info.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(info.getEduPhoto()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setType("新增");
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ List<WorkStaffAchivesLog> sonIds=workStaffAchivesLogService.findSonId(workStaffAchivesLog);
|
|
|
+ if(sonIds!=null&&sonIds.size()>0){
|
|
|
+ for(WorkStaffAchivesLog w:sonIds){
|
|
|
+ workStaffAchivesLog.setSonId(w.getSonId());
|
|
|
+ WorkStaffEducation workStaffEducation = new WorkStaffEducation();
|
|
|
+ workStaffEducation.setId(w.getSonId());
|
|
|
+ workStaffEducation.setDelFlag("0");
|
|
|
+ workStaffEducation.setStaff(workStaffBasicInfo.getId());
|
|
|
+ Class<? extends WorkStaffEducation> newClass = workStaffEducation.getClass();
|
|
|
+ Field[] declaredFields = newClass.getDeclaredFields();
|
|
|
+ for (Field field : declaredFields) {
|
|
|
+ String name = field.getName();
|
|
|
+ if("school".equals(name)||"major".equals(name)||"edu".equals(name)||"degree".equals(name)||"eduType".equals(name) || "heightEdu".equals(name)
|
|
|
+ || "startDate".equals(name)||"endDate".equals(name)||"eduPhoto".equals(name)||"degreePhoto".equals(name)){
|
|
|
+ String setMethod = "set"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ String getMethod = "get"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ workStaffAchivesLog.setFields(name);
|
|
|
+ List<WorkStaffAchivesLog> logs=workStaffAchivesLogService.findList(workStaffAchivesLog);
|
|
|
+ try {
|
|
|
+ if("startDate".equals(name)||"endDate".equals(name)){//日期
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, Date.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ Date myDate = dateFormat1.parse(logs.get(0).getNewKey());
|
|
|
+ setReadOnly.invoke(workStaffEducation,myDate);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ Method setReadOnly = workStaffEducation.getClass().getMethod(setMethod, String.class);
|
|
|
+ if(logs!=null&&logs.size()>0){
|
|
|
+ setReadOnly.invoke(workStaffEducation,logs.get(0).getNewKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(workStaffEducation.getDegreePhoto())){
|
|
|
+ workStaffEducation.setDegreePhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ workStaffEducation.setDegreePhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(workStaffEducation.getEduPhoto())){
|
|
|
+ workStaffEducation.setEduPhotoStr( WorkattachmentService.fileUrlManage(workStaffEducation.getEduPhoto()));
|
|
|
+ workStaffEducation.setEduPhotoThumbnailStr( WorkattachmentService.fileUrlThumbnailManage(workStaffEducation.getEduPhoto()));
|
|
|
+ }
|
|
|
+ newList.add(workStaffEducation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //删除
|
|
|
+ WorkStaffAchivesLog delLog=new WorkStaffAchivesLog();
|
|
|
+ delLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ delLog.setModule("教育经历");
|
|
|
+ delLog.setType("删除");
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ List<WorkStaffAchivesLog> dellogs=workStaffAchivesLogService.findList(delLog);
|
|
|
+ if (dellogs != null && !dellogs.isEmpty()) {
|
|
|
+ List<String> sonIdLists = Lists.newArrayList();
|
|
|
+ for (WorkStaffAchivesLog log : dellogs) {
|
|
|
+ sonIdLists.add(log.getSonId());
|
|
|
+ }
|
|
|
+
|
|
|
+ Iterator<WorkStaffEducation> iterator = newList.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ WorkStaffEducation staff = iterator.next();
|
|
|
+ if (sonIdLists.contains(staff.getId())) {
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workStaffBasicInfo.setEducationList(newList);
|
|
|
+ }
|
|
|
|
|
|
@Transactional(readOnly = false)
|
|
|
public void saveEdu(WorkStaffBasicInfo workStaffBasicInfo) {
|
|
@@ -389,7 +569,12 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
String describes=EDU_MAP.get(name);
|
|
|
if(newInvoke instanceof String){
|
|
|
String newValue=newInvoke.toString();
|
|
|
- String oldValue=oldInvoke.toString();
|
|
|
+ String oldValue = null;
|
|
|
+ if(null == oldInvoke){
|
|
|
+ oldValue = "";
|
|
|
+ }else{
|
|
|
+ oldValue=oldInvoke.toString();
|
|
|
+ }
|
|
|
if(!newValue.equals(oldValue)){
|
|
|
if("edu".equals(name)){
|
|
|
workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
@@ -448,6 +633,82 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ }else{
|
|
|
+ ////判定审核状态。审核状态为1(暂存),则对暂存的数据进行删除
|
|
|
+ if("1".equals(workStaffBasicInfo.getAuditStatus())){
|
|
|
+ if(newEducation.getDegreePhotoFile()!=null&&!newEducation.getDegreePhotoFile().isEmpty()&&newEducation.getDegreePhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getDegreePhotoFile();
|
|
|
+ newEducation.setDegreePhoto(this.uploadFile(file,newEducation.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(newEducation.getEduPhotoFile()!=null&&!newEducation.getEduPhotoFile().isEmpty()&&newEducation.getEduPhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getEduPhotoFile();
|
|
|
+ newEducation.setEduPhoto(this.uploadFile(file,newEducation.getEduPhoto()));
|
|
|
+ }
|
|
|
+ String newId=IdGen.uuid();
|
|
|
+ for (Field field : declaredFields) {
|
|
|
+ String name = field.getName();
|
|
|
+ if("school".equals(name)||"major".equals(name)||"edu".equals(name)||"degree".equals(name)||"eduType".equals(name)
|
|
|
+ || "startDate".equals(name)||"endDate".equals(name)||"eduPhoto".equals(name)||"degreePhoto".equals(name) || "heightEdu".equals(name)
|
|
|
+ ||"degreePhotoFile".equals(name)||"eduPhotoFile".equals(name)){
|
|
|
+ String methodName = "get"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setSonId(newId);
|
|
|
+ workStaffAchivesLog.setFields(name);
|
|
|
+ workStaffAchivesLog.setState("1");
|
|
|
+ try {
|
|
|
+ Object newInvoke = newClass.getMethod(methodName).invoke(newEducation);//修改后
|
|
|
+ String describes=EDU_MAP.get(name);
|
|
|
+ if(newInvoke instanceof String){
|
|
|
+ String newValue=newInvoke.toString();
|
|
|
+ if("edu".equals(name)){
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"education_level",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("degree".equals(name)){
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"degree_level",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("eduType".equals(name)){
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"edu_type",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("heightEdu".equals(name)){
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"yes_no",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else{
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",newInvoke.toString(),
|
|
|
+ "",newInvoke.toString(),newId,"新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newInvoke instanceof Date){//日期
|
|
|
+ String newDate=sdf.format(newInvoke);
|
|
|
+ workStaffAchivesLogService.saveStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",newDate,"",newDate,newId,"新增");
|
|
|
+ };
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}else if((newEducation.getId()==null||"".equals(newEducation.getId()))&&"0".equals(newEducation.getDelFlag())){//新增
|
|
|
if(newEducation.getDegreePhotoFile()!=null&&!newEducation.getDegreePhotoFile().isEmpty()&&newEducation.getDegreePhotoFile().getSize()>0){
|
|
@@ -537,4 +798,196 @@ public class WorkStaffEducationService extends CrudService<WorkStaffEducationDao
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void storeEdu(WorkStaffBasicInfo workStaffBasicInfo) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ List<WorkStaffEducation> educationList =workStaffBasicInfo.getEducationList();
|
|
|
+ if(educationList!=null&&educationList.size()>0){
|
|
|
+ for(WorkStaffEducation newEducation:educationList){
|
|
|
+ Class<? extends WorkStaffEducation> newClass = newEducation.getClass();
|
|
|
+ Field[] declaredFields = newClass.getDeclaredFields();
|
|
|
+ if(newEducation.getId()!=null&&!"1".equals(newEducation.getDelFlag())&&!"".equals(newEducation.getId())){
|
|
|
+ if(newEducation.getDegreePhotoFile()!=null&&!newEducation.getDegreePhotoFile().isEmpty()&&newEducation.getDegreePhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getDegreePhotoFile();
|
|
|
+ newEducation.setDegreePhoto(this.uploadFile(file,newEducation.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(newEducation.getEduPhotoFile()!=null&&!newEducation.getEduPhotoFile().isEmpty()&&newEducation.getEduPhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getEduPhotoFile();
|
|
|
+ newEducation.setEduPhoto(this.uploadFile(file,newEducation.getEduPhoto()));
|
|
|
+ }
|
|
|
+ WorkStaffEducation oldEducation=this.get(newEducation.getId());
|
|
|
+ if(oldEducation!=null){
|
|
|
+ Class<? extends WorkStaffEducation> oldClass = oldEducation.getClass();
|
|
|
+ for (Field field : declaredFields) {
|
|
|
+ String name = field.getName();
|
|
|
+ if("school".equals(name)||"major".equals(name)||"edu".equals(name)||"degree".equals(name)||"eduType".equals(name)
|
|
|
+ || "startDate".equals(name)||"endDate".equals(name)||"eduPhoto".equals(name)||"degreePhoto".equals(name) || "heightEdu".equals(name)
|
|
|
+ ||"degreePhotoFile".equals(name)||"eduPhotoFile".equals(name)){
|
|
|
+ String methodName = "get"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setSonId(newEducation.getId());
|
|
|
+ workStaffAchivesLog.setFields(name);
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ try {
|
|
|
+ Object newInvoke = newClass.getMethod(methodName).invoke(newEducation);//修改后
|
|
|
+ Object oldInvoke = oldClass.getMethod(methodName).invoke(oldEducation);//修改前
|
|
|
+ String describes=EDU_MAP.get(name);
|
|
|
+ if(newInvoke instanceof String){
|
|
|
+ String newValue=newInvoke.toString();
|
|
|
+ String oldValue = null;
|
|
|
+ if(null == oldInvoke){
|
|
|
+ oldValue = "";
|
|
|
+ }else{
|
|
|
+ oldValue=oldInvoke.toString();
|
|
|
+ }
|
|
|
+ if(!newValue.equals(oldValue)){
|
|
|
+ if("edu".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ DictUtils.getDictLabel(oldValue,"education_level",""),
|
|
|
+ DictUtils.getDictLabel(newValue,"education_level",""),
|
|
|
+ oldValue,newValue,newEducation.getId(),"修改");
|
|
|
+ }else if("degree".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ DictUtils.getDictLabel(oldValue,"degree_level",""),
|
|
|
+ DictUtils.getDictLabel(newValue,"degree_level",""),
|
|
|
+ oldValue,newValue,newEducation.getId(),"修改");
|
|
|
+ }else if("eduType".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ DictUtils.getDictLabel(oldValue,"edu_type",""),
|
|
|
+ DictUtils.getDictLabel(newValue,"edu_type",""),
|
|
|
+ oldValue,newValue,newEducation.getId(),"修改");
|
|
|
+ }else if("heightEdu".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ DictUtils.getDictLabel(oldValue,"yes_no",""),
|
|
|
+ DictUtils.getDictLabel(newValue,"yes_no",""),
|
|
|
+ oldValue,newValue,newEducation.getId(),"修改");
|
|
|
+ }else{
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ oldInvoke.toString(),newInvoke.toString(),
|
|
|
+ oldInvoke.toString(),newInvoke.toString(),newEducation.getId(),"修改");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newInvoke instanceof Date){//日期
|
|
|
+ String newDate="";
|
|
|
+ String oldDate="";
|
|
|
+ if(newInvoke!=null){
|
|
|
+ newDate=sdf.format(newInvoke);
|
|
|
+ }
|
|
|
+ if (oldInvoke!=null){
|
|
|
+ oldDate=sdf.format(oldInvoke);
|
|
|
+ }
|
|
|
+ if(!newDate.equals(oldDate)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ oldDate,newDate,oldDate,newDate,newEducation.getId(),"修改");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if((newEducation.getId()==null||"".equals(newEducation.getId()))&&"0".equals(newEducation.getDelFlag())){//新增
|
|
|
+ if(newEducation.getDegreePhotoFile()!=null&&!newEducation.getDegreePhotoFile().isEmpty()&&newEducation.getDegreePhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getDegreePhotoFile();
|
|
|
+ newEducation.setDegreePhoto(this.uploadFile(file,newEducation.getDegreePhoto()));
|
|
|
+ }
|
|
|
+ if(newEducation.getEduPhotoFile()!=null&&!newEducation.getEduPhotoFile().isEmpty()&&newEducation.getEduPhotoFile().getSize()>0){
|
|
|
+ MultipartFile file = newEducation.getEduPhotoFile();
|
|
|
+ newEducation.setEduPhoto(this.uploadFile(file,newEducation.getEduPhoto()));
|
|
|
+ }
|
|
|
+ String newId=IdGen.uuid();
|
|
|
+ for (Field field : declaredFields) {
|
|
|
+ String name = field.getName();
|
|
|
+ if("school".equals(name)||"major".equals(name)||"edu".equals(name)||"degree".equals(name)||"eduType".equals(name)
|
|
|
+ || "startDate".equals(name)||"endDate".equals(name)||"eduPhoto".equals(name)||"degreePhoto".equals(name) || "heightEdu".equals(name)
|
|
|
+ ||"degreePhotoFile".equals(name)||"eduPhotoFile".equals(name)){
|
|
|
+ String methodName = "get"+name.substring(0,1).toUpperCase()+name.substring(1);
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setSonId(newId);
|
|
|
+ workStaffAchivesLog.setFields(name);
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ try {
|
|
|
+ Object newInvoke = newClass.getMethod(methodName).invoke(newEducation);//修改后
|
|
|
+ String describes=EDU_MAP.get(name);
|
|
|
+ if(newInvoke instanceof String){
|
|
|
+ String newValue=newInvoke.toString();
|
|
|
+ if("edu".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"education_level",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("degree".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"degree_level",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("eduType".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"edu_type",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else if("heightEdu".equals(name)){
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",
|
|
|
+ DictUtils.getDictLabel(newValue,"yes_no",""),
|
|
|
+ "",newValue,newId,"新增");
|
|
|
+ }else{
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",newInvoke.toString(),
|
|
|
+ "",newInvoke.toString(),newId,"新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newInvoke instanceof Date){//日期
|
|
|
+ String newDate=sdf.format(newInvoke);
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历",describes,name,
|
|
|
+ "",newDate,"",newDate,newId,"新增");
|
|
|
+ };
|
|
|
+ } catch (NoSuchMethodException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(newEducation.getId()!=null&&"1".equals(newEducation.getDelFlag())&&!"".equals(newEducation.getId())){//删除
|
|
|
+ WorkStaffAchivesLog workStaffAchivesLog=new WorkStaffAchivesLog();
|
|
|
+ workStaffAchivesLog.setStaffId(workStaffBasicInfo.getId());
|
|
|
+ workStaffAchivesLog.setModule("教育经历");
|
|
|
+ workStaffAchivesLog.setSonId(newEducation.getId());
|
|
|
+ workStaffAchivesLog.setType("删除");
|
|
|
+ workStaffAchivesLog.setState("3");
|
|
|
+ workStaffAchivesLogService.storeStaffLog(workStaffAchivesLog,workStaffBasicInfo.getId(),
|
|
|
+ "教育经历","","",
|
|
|
+ "","",
|
|
|
+ "","",newEducation.getId(),"删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|