|
@@ -60,74 +60,95 @@ public class ActionSave extends BaseAction {
|
|
|
AttendanceSelfHoliday attendanceSelfHoliday = null;
|
|
AttendanceSelfHoliday attendanceSelfHoliday = null;
|
|
|
|
|
|
|
|
if( wrapIn != null && StringUtils.isNoneEmpty( wrapIn.getEmployeeName() )
|
|
if( wrapIn != null && StringUtils.isNoneEmpty( wrapIn.getEmployeeName() )
|
|
|
- && StringUtils.isNoneEmpty( wrapIn.getEmployeeNumber() )
|
|
|
|
|
&& StringUtils.isNoneEmpty( wrapIn.getLeaveType() )
|
|
&& StringUtils.isNoneEmpty( wrapIn.getLeaveType() )
|
|
|
&& wrapIn.getStartTime() != null
|
|
&& wrapIn.getStartTime() != null
|
|
|
&& wrapIn.getEndTime() != null
|
|
&& wrapIn.getEndTime() != null
|
|
|
){
|
|
){
|
|
|
- if( wrapIn.getEmployeeName().indexOf("@P") < 0 ){
|
|
|
|
|
- //不是DistinguishedName
|
|
|
|
|
|
|
+ if( wrapIn.getEmployeeName().indexOf("@P") < 0 ){//不是DistinguishedName
|
|
|
if( wrapIn.getEmployeeName().indexOf("@I") > 0 ){
|
|
if( wrapIn.getEmployeeName().indexOf("@I") > 0 ){
|
|
|
- wrapIn.setEmployeeName(userManagerService.getPersonNameByIdentity(wrapIn.getEmployeeName()));
|
|
|
|
|
- }else{
|
|
|
|
|
- Person person = userManagerService.getPersonObjByName(wrapIn.getEmployeeName());
|
|
|
|
|
- if( person != null ){
|
|
|
|
|
- wrapIn.setEmployeeName( person.getDistinguishedName() );
|
|
|
|
|
|
|
+ String personName = userManagerService.getPersonNameByIdentity(wrapIn.getEmployeeName());
|
|
|
|
|
+ if( StringUtils.isNotEmpty( personName ) ){
|
|
|
|
|
+ wrapIn.setEmployeeName(personName);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //补充员工的组织信息
|
|
|
|
|
- Unit unit = userManagerService.getUnitWithPersonName( wrapIn.getEmployeeNumber() );
|
|
|
|
|
- Unit topUnit = null;
|
|
|
|
|
- String unitName = null;
|
|
|
|
|
- String unitOu = null;
|
|
|
|
|
- String topUnitName = null;
|
|
|
|
|
- String topUnitOu = null;
|
|
|
|
|
- if( unit != null ){
|
|
|
|
|
- unitName = unit.getName();
|
|
|
|
|
- unitOu = unit.getDistinguishedName();
|
|
|
|
|
- topUnit = userManagerService.getTopUnitWithUnitName(unitOu);
|
|
|
|
|
- }
|
|
|
|
|
- if( topUnit != null ){
|
|
|
|
|
- topUnitName = topUnit.getName();
|
|
|
|
|
- topUnitOu = topUnit.getDistinguishedName();
|
|
|
|
|
- }
|
|
|
|
|
- emc.beginTransaction( AttendanceSelfHoliday.class );
|
|
|
|
|
- //先根据batchFlag删除原来的数据,然后再进行新数据的保存
|
|
|
|
|
- if(StringUtils.isNotEmpty( wrapIn.getBatchFlag() ) ){
|
|
|
|
|
- holidayList = attendanceSelfHolidayServiceAdv.listWithBatchFlag( wrapIn.getBatchFlag() );
|
|
|
|
|
- if(ListTools.isNotEmpty( holidayList )){
|
|
|
|
|
- logger.info("先根据batchFlag删除原来的数据,然后再进行新数据的保存" );
|
|
|
|
|
- for( AttendanceSelfHoliday holiday : holidayList ){
|
|
|
|
|
- emc.remove( emc.find(holiday.getId(), AttendanceSelfHoliday.class ), CheckRemoveType.all );
|
|
|
|
|
|
|
+ if( StringUtils.isNotEmpty( wrapIn.getEmployeeName() )){
|
|
|
|
|
+ Person person = userManagerService.getPersonObjByName(wrapIn.getEmployeeName());
|
|
|
|
|
+ if( person != null ){
|
|
|
|
|
+ wrapIn.setEmployeeName( person.getDistinguishedName() );
|
|
|
|
|
+ if( StringUtils.isNotEmpty( person.getEmployee() )){
|
|
|
|
|
+ wrapIn.setEmployeeNumber( person.getEmployee() );
|
|
|
|
|
+ }else{
|
|
|
|
|
+ wrapIn.setEmployeeNumber( person.getDistinguishedName() );
|
|
|
}
|
|
}
|
|
|
- logger.info("删除" + holidayList.size() + "条旧请假信息数据。" );
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if( StringUtils.isNotEmpty( wrapIn.getId() ) ){
|
|
|
|
|
- //根据ID查询信息是否存在,如果存在就update,如果不存在就create
|
|
|
|
|
- attendanceSelfHoliday = emc.find( wrapIn.getId(), AttendanceSelfHoliday.class );
|
|
|
|
|
- if( attendanceSelfHoliday != null ){
|
|
|
|
|
- //更新已经存在的信息
|
|
|
|
|
- wrapIn.copyTo( attendanceSelfHoliday );
|
|
|
|
|
- attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
|
|
|
- logger.info("更新:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
|
|
|
|
|
- attendanceSelfHoliday.setUnitName( unitName );
|
|
|
|
|
- attendanceSelfHoliday.setUnitOu( unitOu );
|
|
|
|
|
- attendanceSelfHoliday.setTopUnitName( topUnitName );
|
|
|
|
|
- attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
|
|
|
-
|
|
|
|
|
- emc.check( attendanceSelfHoliday, CheckPersistType.all);
|
|
|
|
|
|
|
+ //补充员工的组织信息
|
|
|
|
|
+ Unit unit = userManagerService.getUnitWithPersonName( wrapIn.getEmployeeNumber() );
|
|
|
|
|
+ Unit topUnit = null;
|
|
|
|
|
+ String unitName = null;
|
|
|
|
|
+ String unitOu = null;
|
|
|
|
|
+ String topUnitName = null;
|
|
|
|
|
+ String topUnitOu = null;
|
|
|
|
|
+ if( unit != null ){
|
|
|
|
|
+ unitName = unit.getName();
|
|
|
|
|
+ unitOu = unit.getDistinguishedName();
|
|
|
|
|
+ topUnit = userManagerService.getTopUnitWithUnitName(unitOu);
|
|
|
|
|
+ }
|
|
|
|
|
+ if( topUnit != null ){
|
|
|
|
|
+ topUnitName = topUnit.getName();
|
|
|
|
|
+ topUnitOu = topUnit.getDistinguishedName();
|
|
|
|
|
+ }
|
|
|
|
|
+ emc.beginTransaction( AttendanceSelfHoliday.class );
|
|
|
|
|
+ //先根据batchFlag删除原来的数据,然后再进行新数据的保存
|
|
|
|
|
+ if(StringUtils.isNotEmpty( wrapIn.getBatchFlag() ) ){
|
|
|
|
|
+ holidayList = attendanceSelfHolidayServiceAdv.listWithBatchFlag( wrapIn.getBatchFlag() );
|
|
|
|
|
+ if(ListTools.isNotEmpty( holidayList )){
|
|
|
|
|
+ logger.info("先根据batchFlag删除原来的数据,然后再进行新数据的保存" );
|
|
|
|
|
+ for( AttendanceSelfHoliday holiday : holidayList ){
|
|
|
|
|
+ emc.remove( emc.find(holiday.getId(), AttendanceSelfHoliday.class ), CheckRemoveType.all );
|
|
|
|
|
+ }
|
|
|
|
|
+ logger.info("删除" + holidayList.size() + "条旧请假信息数据。" );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if( StringUtils.isNotEmpty( wrapIn.getId() ) ){
|
|
|
|
|
+ //根据ID查询信息是否存在,如果存在就update,如果不存在就create
|
|
|
|
|
+ attendanceSelfHoliday = emc.find( wrapIn.getId(), AttendanceSelfHoliday.class );
|
|
|
|
|
+ if( attendanceSelfHoliday != null ){
|
|
|
|
|
+ //更新已经存在的信息
|
|
|
|
|
+ wrapIn.copyTo( attendanceSelfHoliday );
|
|
|
|
|
+ attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
|
|
|
+ logger.info("更新:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
+
|
|
|
|
|
+ attendanceSelfHoliday.setUnitName( unitName );
|
|
|
|
|
+ attendanceSelfHoliday.setUnitOu( unitOu );
|
|
|
|
|
+ attendanceSelfHoliday.setTopUnitName( topUnitName );
|
|
|
|
|
+ attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
|
|
|
+
|
|
|
|
|
+ emc.check( attendanceSelfHoliday, CheckPersistType.all);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ attendanceSelfHoliday = new AttendanceSelfHoliday();
|
|
|
|
|
+ wrapIn.copyTo( attendanceSelfHoliday );
|
|
|
|
|
+ //使用参数传入的ID作为记录的ID
|
|
|
|
|
+ attendanceSelfHoliday.setId( wrapIn.getId() );
|
|
|
|
|
+ attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
|
|
|
+ logger.info("新增:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
+
|
|
|
|
|
+ attendanceSelfHoliday.setUnitName( unitName );
|
|
|
|
|
+ attendanceSelfHoliday.setUnitOu( unitOu );
|
|
|
|
|
+ attendanceSelfHoliday.setTopUnitName( topUnitName );
|
|
|
|
|
+ attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
|
|
|
+
|
|
|
|
|
+ emc.persist( attendanceSelfHoliday, CheckPersistType.all);
|
|
|
|
|
+ }
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ //没有传入指定的ID
|
|
|
attendanceSelfHoliday = new AttendanceSelfHoliday();
|
|
attendanceSelfHoliday = new AttendanceSelfHoliday();
|
|
|
|
|
+
|
|
|
wrapIn.copyTo( attendanceSelfHoliday );
|
|
wrapIn.copyTo( attendanceSelfHoliday );
|
|
|
- //使用参数传入的ID作为记录的ID
|
|
|
|
|
- attendanceSelfHoliday.setId( wrapIn.getId() );
|
|
|
|
|
attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
|
- logger.info("新增:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
|
|
+ logger.debug("新增,无ID:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
|
|
|
attendanceSelfHoliday.setUnitName( unitName );
|
|
attendanceSelfHoliday.setUnitName( unitName );
|
|
|
attendanceSelfHoliday.setUnitOu( unitOu );
|
|
attendanceSelfHoliday.setUnitOu( unitOu );
|
|
@@ -135,42 +156,27 @@ public class ActionSave extends BaseAction {
|
|
|
attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
|
|
|
|
|
|
emc.persist( attendanceSelfHoliday, CheckPersistType.all);
|
|
emc.persist( attendanceSelfHoliday, CheckPersistType.all);
|
|
|
|
|
+ result.setData( new Wo( attendanceSelfHoliday.getId() ) );
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
- //没有传入指定的ID
|
|
|
|
|
- attendanceSelfHoliday = new AttendanceSelfHoliday();
|
|
|
|
|
-
|
|
|
|
|
- wrapIn.copyTo( attendanceSelfHoliday );
|
|
|
|
|
- attendanceSelfHoliday.setBatchFlag(wrapIn.getBatchFlag());
|
|
|
|
|
- logger.debug("新增,无ID:gson.toJson( attendanceSelfHoliday ) = " + gson.toJson( attendanceSelfHoliday ) );
|
|
|
|
|
-
|
|
|
|
|
- attendanceSelfHoliday.setUnitName( unitName );
|
|
|
|
|
- attendanceSelfHoliday.setUnitOu( unitOu );
|
|
|
|
|
- attendanceSelfHoliday.setTopUnitName( topUnitName );
|
|
|
|
|
- attendanceSelfHoliday.setTopUnitOu( topUnitOu );
|
|
|
|
|
-
|
|
|
|
|
- emc.persist( attendanceSelfHoliday, CheckPersistType.all);
|
|
|
|
|
|
|
+ emc.commit();
|
|
|
result.setData( new Wo( attendanceSelfHoliday.getId() ) );
|
|
result.setData( new Wo( attendanceSelfHoliday.getId() ) );
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- emc.commit();
|
|
|
|
|
- result.setData( new Wo( attendanceSelfHoliday.getId() ) );
|
|
|
|
|
-
|
|
|
|
|
- //清除缓存
|
|
|
|
|
- ApplicationCache.notify( AttendanceSelfHoliday.class );
|
|
|
|
|
-
|
|
|
|
|
- //根据员工休假数据来记录与这条数据相关的统计需求记录
|
|
|
|
|
- //new AttendanceDetailAnalyseService().recordStatisticRequireLog( attendanceSelfHoliday );
|
|
|
|
|
- logger.debug("休假数据有变动,对该员工的该请假时间内的所有打卡记录进行分析......" );
|
|
|
|
|
|
|
|
|
|
- //休假数据有更新,对该员工的该请假时间内的所有打卡记录进行分析
|
|
|
|
|
- List<String> ids = attendanceDetailAnalyseServiceAdv.listAnalyseAttendanceDetailIds(attendanceSelfHoliday.getEmployeeName(), attendanceSelfHoliday.getStartTime(), attendanceSelfHoliday.getEndTime(), effectivePerson.getDebugger() );
|
|
|
|
|
- if( ListTools.isNotEmpty( ids ) ){
|
|
|
|
|
- for( String id : ids ){
|
|
|
|
|
- try { //分析保存好的考勤数据
|
|
|
|
|
- ThisApplication.detailAnalyseQueue.send( id );
|
|
|
|
|
- } catch ( Exception e1 ) {
|
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
|
|
+ //清除缓存
|
|
|
|
|
+ ApplicationCache.notify( AttendanceSelfHoliday.class );
|
|
|
|
|
+
|
|
|
|
|
+ //根据员工休假数据来记录与这条数据相关的统计需求记录
|
|
|
|
|
+ //new AttendanceDetailAnalyseService().recordStatisticRequireLog( attendanceSelfHoliday );
|
|
|
|
|
+ logger.debug("休假数据有变动,对该员工的该请假时间内的所有打卡记录进行分析......" );
|
|
|
|
|
+
|
|
|
|
|
+ //休假数据有更新,对该员工的该请假时间内的所有打卡记录进行分析
|
|
|
|
|
+ List<String> ids = attendanceDetailAnalyseServiceAdv.listAnalyseAttendanceDetailIds(attendanceSelfHoliday.getEmployeeName(), attendanceSelfHoliday.getStartTime(), attendanceSelfHoliday.getEndTime(), effectivePerson.getDebugger() );
|
|
|
|
|
+ if( ListTools.isNotEmpty( ids ) ){
|
|
|
|
|
+ for( String id : ids ){
|
|
|
|
|
+ try { //分析保存好的考勤数据
|
|
|
|
|
+ ThisApplication.detailAnalyseQueue.send( id );
|
|
|
|
|
+ } catch ( Exception e1 ) {
|
|
|
|
|
+ e1.printStackTrace();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -203,7 +209,6 @@ public class ActionSave extends BaseAction {
|
|
|
@FieldDescribe("员工姓名:员工的标识,<font color='red'>必填</font>,员工的distinguishedName,如:张三@zhangsan@P")
|
|
@FieldDescribe("员工姓名:员工的标识,<font color='red'>必填</font>,员工的distinguishedName,如:张三@zhangsan@P")
|
|
|
private String employeeName;
|
|
private String employeeName;
|
|
|
|
|
|
|
|
- @FieldDescribe("员工号,如果没有员工号,可以使用员工标识代替,不可为空")
|
|
|
|
|
private String employeeNumber;
|
|
private String employeeNumber;
|
|
|
|
|
|
|
|
@FieldDescribe("请假类型:带薪年休假|带薪病假|带薪福利假|扣薪事假|其他")
|
|
@FieldDescribe("请假类型:带薪年休假|带薪病假|带薪福利假|扣薪事假|其他")
|
|
@@ -215,7 +220,7 @@ public class ActionSave extends BaseAction {
|
|
|
@FieldDescribe("结束时间,<font color='red'>必填</font>: yyyy-mm-dd hh24:mi:ss")
|
|
@FieldDescribe("结束时间,<font color='red'>必填</font>: yyyy-mm-dd hh24:mi:ss")
|
|
|
private Date endTime;
|
|
private Date endTime;
|
|
|
|
|
|
|
|
- @FieldDescribe("请假天数,<font color='red'>必填</font>")
|
|
|
|
|
|
|
+ @FieldDescribe("请假天数,最小粒度,0.5天,<font color='red'>必填</font>")
|
|
|
private Double leaveDayNumber = 0.0;
|
|
private Double leaveDayNumber = 0.0;
|
|
|
|
|
|
|
|
@FieldDescribe("请假说明")
|
|
@FieldDescribe("请假说明")
|