@ -11,14 +11,18 @@ import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property ;
import weaver.soa.workflow.request.RequestInfo ;
import java.util.* ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
public class OutSignSyncAction implements Action {
BaseBean bb = new BaseBean ( ) ;
@Override
public String execute ( RequestInfo requestInfo ) {
bb . writeLog ( "OutSignSyncAction-start" ) ;
String startDate = "" ;
String endDate = "" ;
String resourceid = "" ;
@ -49,7 +53,7 @@ public class OutSignSyncAction implements Action {
if ( StringUtils . isNotBlank ( sjjsrq ) ) {
endDate = sjjsrq ;
}
bb . writeLog ( "start to handle data." ) ;
if ( StringUtils . isNotBlank ( startDate ) & & StringUtils . isNotBlank ( endDate ) & & StringUtils . isNotBlank ( resourceid ) ) {
// 内部同行人也要考虑
if ( StringUtils . isNotBlank ( nbtxr ) ) {
@ -67,9 +71,9 @@ public class OutSignSyncAction implements Action {
String signinfo = Util . null2String ( rs . getString ( "signinfo" ) ) ;
infos . add ( signinfo ) ;
}
bb . writeLog ( "infos is:" + infos ) ;
for ( String inf : infos ) {
if ( inf ! = null ) {
if ( StringUtils. isNotEmpty ( inf ) ) {
Map < String , Object > in = mapStringToMap ( inf ) ;
String userId = Util . null2String ( in . get ( "userId" ) ) ;
String userType = Util . null2String ( in . get ( "userType" ) ) ;
@ -87,41 +91,41 @@ public class OutSignSyncAction implements Action {
String deviceInfo = Util . null2String ( in . get ( "deviceInfo" ) ) ;
String belongdateIsNull = Util . null2String ( in . get ( "belongdateIsNull" ) ) ;
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ;
boolean isok = rs . executeUpdate ( punchSql , resourceid , userType , signType , signDate , signTime , clientAddress , isInCom ,
timeZone , belongdate , signfrom , longitude , latitude , address , deviceInfo , "1" ) ;
boolean isok = rs . executeUpdate ( punchSql , resourceid , userType , signType , signDate , signTime , clientAddress , isInCom ,
timeZone , belongdate , signfrom , longitude , latitude , address , deviceInfo , "1" ) ;
bb . writeLog ( "isok: " + isok ) ;
//同步更新考勤数据到考勤报表
if ( "true" . equals ( belongdateIsNull ) ) {
if ( "true" . equals ( belongdateIsNull ) ) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
bb . writeLog ( "PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil . getYesterday ( ) ) ;
new KQFormatBiz ( ) . formatDate ( "" + userId , DateUtil . getYesterday ( ) ) ;
bb . writeLog ( "PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil . getYesterday ( ) ) ;
new KQFormatBiz ( ) . formatDate ( "" + userId , DateUtil . getYesterday ( ) ) ;
}
bb . writeLog ( "PunchOutButtonCmd:userId:" + userId + ":belongdate:" + ( belongdate . length ( ) = = 0 ? DateUtil . getCurrentDate ( ) : belongdate ) ) ;
if ( belongdate . length ( ) = = 0 ) {
bb . writeLog ( "PunchOutButtonCmd:userId:" + userId + ":belongdate:" + ( belongdate . length ( ) = = 0 ? DateUtil . getCurrentDate ( ) : belongdate ) ) ;
if ( belongdate . length ( ) = = 0 ) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
new KQFormatBiz ( ) . formatDate ( "" + userId , DateUtil . getYesterday ( ) ) ;
new KQFormatBiz ( ) . formatDate ( "" + userId , DateUtil . getYesterday ( ) ) ;
}
new KQFormatBiz ( ) . formatDate ( "" + userId , ( belongdate . length ( ) = = 0 ? DateUtil . getCurrentDate ( ) : belongdate ) ) ;
new KQFormatBiz ( ) . formatDate ( "" + userId , ( belongdate . length ( ) = = 0 ? DateUtil . getCurrentDate ( ) : belongdate ) ) ;
//外勤签到转的考勤 处理加班规则
SplitActionUtil . pushOverTimeTasksAll ( belongdate , belongdate , "" + userId ) ;
SplitActionUtil . pushOverTimeTasksAll ( belongdate , belongdate , "" + userId ) ;
}
}
}
} catch ( Exception e ) {
bb . writeLog ( "OutSignSyncAction Exception: " + e );
bb . writeLog ( "OutSignSyncAction Exception: " + e .getMessage ( ) );
return Action . FAILURE_AND_CONTINUE ;
}
return Action . SUCCESS ;
}
public static Map < String , Object > mapStringToMap ( String str ) {
str = str . substring ( 1 , str . length ( ) - 1 ) ;
public static Map < String , Object > mapStringToMap ( String str ) {
str = str . substring ( 1 , str . length ( ) - 1 ) ;
String [ ] strs = str . split ( "," ) ;
Map < String , Object > map = new HashMap < > ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
for ( String string : strs ) {
String key = string . split ( "=" ) [ 0 ] ;
String value = string . split ( "=" ) [ 1 ] ;