@ -1,6 +1,5 @@
package weaver.interfaces.aisin.cron ;
package weaver.interfaces.aisin.cron ;
import com.engine.kq.biz.KQLeaveRulesBiz ;
import com.engine.kq.biz.KQReportBiz ;
import com.engine.kq.biz.KQReportBiz ;
import com.engine.kq.util.KQDurationCalculatorUtil ;
import com.engine.kq.util.KQDurationCalculatorUtil ;
import com.engine.kq.util.KQTransMethod ;
import com.engine.kq.util.KQTransMethod ;
@ -37,7 +36,6 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
String currentDate = TimeUtil . getCurrentDateString ( ) ;
String currentDate = TimeUtil . getCurrentDateString ( ) ;
String kqMonth = getKqMonth ( ) ;
String kqMonth = getKqMonth ( ) ;
String jsTableName = bb . getPropValue ( "aisinsecond" , "jsTableName" ) ;
String jsTableName = bb . getPropValue ( "aisinsecond" , "jsTableName" ) ;
String dxRuleId = bb . getPropValue ( "aisinsecond" , "dxRuleId" ) ;
String firstDayOfMonth = firstDayOfMonth ( kqMonth ) ;
String firstDayOfMonth = firstDayOfMonth ( kqMonth ) ;
@ -60,7 +58,7 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
String subcompanyid = bb . getPropValue ( "aisinsecond" , "subcompanyid" ) ;
String subcompanyid = bb . getPropValue ( "aisinsecond" , "subcompanyid" ) ;
//防止多次执行,执行前先判断是否已有考勤月明细数据
//防止多次执行,执行前先判断是否已有考勤月明细数据
rs . executeQuery ( "select count(1) as sums from "+ jsTableName + " _dt1 where mainid = ?", id ) ;
rs . executeQuery ( "select count(1) as sums from uf_atbpkqfz _dt1 where mainid = ?", id ) ;
rs . next ( ) ;
rs . next ( ) ;
int sums = Util . getIntValue ( rs . getString ( "sums" ) ) ;
int sums = Util . getIntValue ( rs . getString ( "sums" ) ) ;
if ( sums > 0 ) {
if ( sums > 0 ) {
@ -113,7 +111,18 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
1.5 * ( workingDayOvertime_4leave + workingDayOvertime_nonleave ) + 2 * ( restDayOvertime_4leave + restDayOvertime_nonleave ) + 3 * ( holidayOvertime_4leave + holidayOvertime_nonleave )
1.5 * ( workingDayOvertime_4leave + workingDayOvertime_nonleave ) + 2 * ( restDayOvertime_4leave + restDayOvertime_nonleave ) + 3 * ( holidayOvertime_4leave + holidayOvertime_nonleave )
) ) ;
) ) ;
e . setSalaryHours ( salaryHours ) ;
e . setSalaryHours ( salaryHours ) ;
String usedAmounts = flowWorkMonth ( e , kqMonth ) ;
e . setUseHours ( usedAmounts ) ;
String salaryRemianHours = subtract ( salaryHours , usedAmounts ) ;
e . setSalaryRemianHours ( salaryRemianHours ) ;
String flowHours = KQDurationCalculatorUtil . getDurationRound ( String . valueOf (
( workingDayOvertime_4leave + workingDayOvertime_nonleave ) + ( restDayOvertime_4leave + restDayOvertime_nonleave ) + ( holidayOvertime_4leave + holidayOvertime_nonleave )
) ) ;
String remainHours = subtract ( flowHours , usedAmounts ) ;
e . setRemainHours ( remainHours ) ;
rs . executeUpdate ( "insert into uf_atbpkqfz_dt1 (mainid,yggh,ygxm,bmmc,dyjbxsspr,dyjbxssxr,dyjbxssjjr,hsgzxsshj,ydxxss," +
" syxssgzjs,dydxsyxs) values(?,?,?,?,?,?,?,?,?,?,?)" , id , e . getWorkcode ( ) , e . getResourceId ( ) , e . getDepetId ( ) , e . getWorkDayHours ( ) ,
e . getRestDayHours ( ) , e . getHolidayHours ( ) , e . getSalaryHours ( ) , e . getUseHours ( ) , e . getSalaryRemianHours ( ) , e . getRemainHours ( ) ) ;
} ) ;
} ) ;
@ -134,7 +143,7 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
csLeaveDetails . forEach ( e - > {
csLeaveDetails . forEach ( e - > {
compensatoryLeave ( e , kqMonth ) ;
compensatoryLeave ( e , kqMonth ) ;
rs . executeUpdate ( "insert into "+ jsTableName + " _dt2 (mainid,ygxm,yggh,zylxss,ysyxss,syxss,bysqjsdylxss) values(?,?,?,?,?,?,?)", id ,
rs . executeUpdate ( "insert into uf_atbpkqfz _dt2 (mainid,ygxm,yggh,zylxss,ysyxss,syxss,bysqjsdylxss) values(?,?,?,?,?,?,?)", id ,
e . getResourceId ( ) , e . getWorkcode ( ) , e . getAllHours ( ) , e . getUseHours ( ) , e . getRemainHours ( ) , e . getWorkflowHours ( ) ) ;
e . getResourceId ( ) , e . getWorkcode ( ) , e . getAllHours ( ) , e . getUseHours ( ) , e . getRemainHours ( ) , e . getWorkflowHours ( ) ) ;
} ) ;
} ) ;
@ -195,21 +204,21 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
/ * *
/ * *
* 倒 休 假
* 倒 休 假
* /
* /
private void flowWorkMonth ( OffLeaveDetail offLeaveDetail , String kqMonth ) {
private String flowWorkMonth ( OffLeaveDetail offLeaveDetail , String kqMonth ) {
RecordSet rs = new RecordSet ( ) ;
RecordSet rs = new RecordSet ( ) ;
BaseBean bb = new BaseBean ( ) ;
BaseBean bb = new BaseBean ( ) ;
String dxRuleId = bb . getPropValue ( "aisinsecond" , "dxRuleId" ) ;
String dxRuleId = bb . getPropValue ( "aisinsecond" , "dxRuleId" ) ;
KQTransMethod kqTransMethod = new KQTransMethod ( ) ;
String year = kqMonth . substring ( 0 , 4 ) ;
String year = kqMonth . substring ( 0 , 4 ) ;
String month = kqMonth . substring ( 5 , 7 ) ;
String month = kqMonth . substring ( 5 , 7 ) ;
/*判断该假期类型是否属于 调休 的类型(暂不支持一个请假类型下既存在"加班时长自动计入余额"的余额发放方式,又存在其他发放方式)*/
String usedAmounts = "0.00" ;
boolean isTiaoXiu = KQLeaveRulesBiz . isTiaoXiu ( dxRuleId ) ;
KQTransMethod kqTransMethod = new KQTransMethod ( ) ;
rs . executeQuery ( "select sum(usedAmount) as usedAmounts from kq_balanceOfLeave where leaveRulesId = " + dxRuleId + " and (isDelete is null or isDelete<>1) \n" +
/*如果属于调休,需求默认是属于调休 此处增加一层判断*/
" and belongYear = '" + year + "' and resourceId = ? and belongMonth = '" + month + "' group by resourceId" , offLeaveDetail . getResourceId ( ) ) ;
if ( isTiaoXiu ) {
if ( rs . next ( ) ) {
usedAmounts = kqTransMethod . getOriginalShow ( Util . null2String ( rs . getString ( "usedAmounts" ) ) ) ;
}
}
return usedAmounts ;
}
}
@ -220,4 +229,11 @@ public class KqCloseAccountUpdateCrob extends BaseCronJob {
remainHours = String . format ( "%.2f" , baseHours - usedHours ) ;
remainHours = String . format ( "%.2f" , baseHours - usedHours ) ;
return remainHours ;
return remainHours ;
}
}
private String subtract ( String operand1 , String operand2 ) {
double num1 = Double . parseDouble ( operand1 ) ;
double num2 = Double . parseDouble ( operand2 ) ;
double result = num1 - num2 ;
return String . valueOf ( result ) ;
}
}
}