diff --git a/src/com/engine/bjcj220907/dao/OverseasAllowanceDAO.java b/src/com/engine/bjcj220907/dao/OverseasAllowanceDAO.java index d4b560d..c9df3aa 100644 --- a/src/com/engine/bjcj220907/dao/OverseasAllowanceDAO.java +++ b/src/com/engine/bjcj220907/dao/OverseasAllowanceDAO.java @@ -1,7 +1,14 @@ package com.engine.bjcj220907.dao; +import weaver.conn.RecordSet; import weaver.general.BaseBean; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * @author Harryxzy * @date 2022/09/26 14:10 @@ -12,6 +19,48 @@ public class OverseasAllowanceDAO { BaseBean baseBean = new BaseBean(); + /** + * @description 计算考勤所属月员工的薪酬等级 + * @return Map + * @author Harryxzy + * @date 2022/9/26 17:43 + */ + public Map getXCDJByUsers(List users,Calendar endAttendanceCal) { + RecordSet rs = new RecordSet(); + StringBuilder sb =new StringBuilder(); + if(users != null && users.size()>0){ + sb = new StringBuilder("select z.xm,z.gj,z.xd,z.sxrq,d.xcdj,jxgz from uf_xczjbd z LEFT JOIN uf_xcdj d on d.gj=z.gj and d.xd=z.xd WHERE xm IN ( "); + for(int i=0;i getCZInfosAndCZDays(List jwCZInfos, Calendar startAttendanceCal, Calendar endAttendanceCal); + List getCZInfosAndCZDays(List jwCZInfos, Calendar startAttendanceCal, Calendar endAttendanceCal); } diff --git a/src/com/engine/bjcj220907/service/impl/OverseasAllowanceCountServiceImpl.java b/src/com/engine/bjcj220907/service/impl/OverseasAllowanceCountServiceImpl.java index 3e7ce46..304824a 100644 --- a/src/com/engine/bjcj220907/service/impl/OverseasAllowanceCountServiceImpl.java +++ b/src/com/engine/bjcj220907/service/impl/OverseasAllowanceCountServiceImpl.java @@ -1,14 +1,18 @@ package com.engine.bjcj220907.service.impl; import com.engine.bjcj220907.dao.MonthBonusDAO; +import com.engine.bjcj220907.dao.OverseasAllowanceDAO; +import com.engine.bjcj220907.entity.JWJT; import com.engine.bjcj220907.entity.JwCZInfo; import com.engine.bjcj220907.entity.JwCZInfoDetail; import com.engine.bjcj220907.service.OverseasAllowanceCountService; import com.engine.bjcj220907.utils.BjcjCommonUtils; import weaver.general.BaseBean; +import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -23,6 +27,10 @@ public class OverseasAllowanceCountServiceImpl implements OverseasAllowanceCount public MonthBonusDAO getMonthBonusDAO(){ return new MonthBonusDAO(); } + + public OverseasAllowanceDAO getOverseasAllowanceDAO(){ + return new OverseasAllowanceDAO(); + } /** * @description 计算境外津贴 * @return void @@ -45,11 +53,11 @@ public class OverseasAllowanceCountServiceImpl implements OverseasAllowanceCount Calendar endAttendanceCal = BjcjCommonUtils.getEndAttendanceCal(countCal.getTime()); baseBean.writeLog("将境外常驻信息格式化"); // 如果用户在考勤周期内存在境外常驻信息则过滤出来,并且计算当月应常驻天数 - jwCZInfos = getCZInfosAndCZDays(jwCZInfos,startAttendanceCal,endAttendanceCal); - // - - - + List results = getCZInfosAndCZDays(jwCZInfos, startAttendanceCal, endAttendanceCal); + baseBean.writeLog("如果用户在考勤周期内存在境外常驻信息则过滤出来,并且计算当月应常驻天数:"+results.size()); + // 计算考勤所属月员工的薪酬等级 + List users = results.stream().map(i -> i.getUser()).collect(Collectors.toList()); + Map usersXSDJ = getOverseasAllowanceDAO().getXCDJByUsers(users,endAttendanceCal); } /** @@ -58,8 +66,9 @@ public class OverseasAllowanceCountServiceImpl implements OverseasAllowanceCount * @author Harryxzy * @date 2022/9/26 16:29 */ - public List getCZInfosAndCZDays(List jwCZInfos,Calendar startAttendanceCal,Calendar endAttendanceCal){ - List collect = jwCZInfos.stream().filter(czInfo -> { + public List getCZInfosAndCZDays(List jwCZInfos,Calendar startAttendanceCal,Calendar endAttendanceCal){ + ArrayList results = new ArrayList<>(); + jwCZInfos.stream().filter(czInfo -> { List czDetails = czInfo.getInfos(); // 用于存储计算到哪一天的日期 Calendar c = Calendar.getInstance(); @@ -82,6 +91,8 @@ public class OverseasAllowanceCountServiceImpl implements OverseasAllowanceCount // 开始常驻日期在 考勤开始日期前(应出勤日期为自然日) int days = BjcjCommonUtils.getDays(startAttendanceCal.getTime(), endAttendanceCal.getTime()); czInfo.setYczDays(days); + JWJT build = JWJT.builder().user(czInfo.getXm()).ycq(days).build(); + results.add(build); return true; } } @@ -107,12 +118,14 @@ public class OverseasAllowanceCountServiceImpl implements OverseasAllowanceCount if (i == czDetails.size() - 1 && flag[0] == true) { // 已计算出应出勤天数 czInfo.setYczDays(ycq[0]); + JWJT build = JWJT.builder().user(czInfo.getXm()).ycq(ycq[0]).build(); + results.add(build); return true; } } return false; - }).collect(Collectors.toList()); - return collect; + }); + return results; } }