Просмотр исходного кода

[考勤管理]修复了在某些情况下通过接口接入完成的打卡数据后不实时分析的问题

o2lee 5 лет назад
Родитель
Сommit
3520a30842

+ 31 - 0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendancedetail/ActionReciveAttendance.java

@@ -24,6 +24,8 @@ import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.organization.Person;
+import org.apache.commons.lang3.StringUtils;
 
 public class ActionReciveAttendance extends BaseAction {
 	
@@ -107,6 +109,35 @@ public class ActionReciveAttendance extends BaseAction {
 				}
 			}
 		}
+
+		if( check ){
+			String distinguishedName = wrapIn.getEmpName();
+			if( StringUtils.isEmpty( distinguishedName )){
+				distinguishedName = effectivePerson.getDistinguishedName();
+			}
+
+			Person person = userManagerService.getPersonObjByName( distinguishedName );
+
+			if( person != null ){
+				attendanceDetail.setEmpName( person.getDistinguishedName() );
+				if( StringUtils.isEmpty( wrapIn.getEmpNo() )){
+					if( person != null ){
+						if( StringUtils.isNotEmpty( person.getEmployee() )){
+							attendanceDetail.setEmpNo(person.getEmployee());
+						}else{
+							attendanceDetail.setEmpNo( distinguishedName );
+						}
+					}
+				}
+			}else{
+				//人员不存在
+				check = false;
+				Exception exception = new ExceptionAttendanceDetailProcess(
+						"考勤人员不存在.DistinguishedName:" + distinguishedName );
+				result.error(exception);
+			}
+		}
+
 		if (check) {
 			try {
 				attendanceDetail = attendanceDetailServiceAdv.save(attendanceDetail);

+ 1 - 0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceDetailService.java

@@ -211,6 +211,7 @@ public class AttendanceDetailService {
 			emc.beginTransaction( AttendanceSetting.class );
 			emc.check( attendanceDetail_old, CheckPersistType.all);	
 			emc.commit();
+			attendanceDetail = attendanceDetail_old;
 		}else{
 			//需要新增打卡信息数据
 			if( attendanceDetail.getId() == null ) {