|
@@ -744,35 +744,82 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
return yearCount;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public int getYearToWorkMoth(String workMoth){
|
|
|
+ int yearCount=0;
|
|
|
+ int i = Integer.parseInt(workMoth);
|
|
|
+ if (i>=12&&i<120){
|
|
|
+ yearCount=5;
|
|
|
+ }else if (i>=120&&i<240){
|
|
|
+ yearCount=10;
|
|
|
+ }else if (i>=240){
|
|
|
+ yearCount=15;
|
|
|
+ }
|
|
|
+ return yearCount;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
- public Map<String, Object> U8Vacation(String id) {
|
|
|
+ public Map<String, Object> U8Vacation(String id) throws ParseException {
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//日期格式化
|
|
|
+ SimpleDateFormat sdt = new SimpleDateFormat("yyyy");
|
|
|
SysUser userByid = sysUserService.getUserByid(id);
|
|
|
List<Vacation> vacationsBody=new ArrayList<>();
|
|
|
Date newDate = new Date();
|
|
|
int yearCount=0;
|
|
|
int yearCounts=0;
|
|
|
+ int lyearCount=0;
|
|
|
List<BdAnnualLeave> years = bdAnnualLeaveMapper.getYear(simpleDateFormat.format(newDate));
|
|
|
if (years!=null&&years.size()>0&&userByid.getEntryDate()!=null){
|
|
|
for (BdAnnualLeave ls:years){
|
|
|
if (userByid.getWorkMoth().equals("0")&&DateUtils.getDate().getTime()>userByid.getTrialEndDate().getTime()){
|
|
|
yearCount=5;
|
|
|
}else {
|
|
|
- yearCount += getYear(userByid.getEntryDate(), ls.getBeginDate(), userByid);
|
|
|
+ if(oConvertUtils.isNotEmpty(userByid.getEntryDate())&&Integer.parseInt(sdt.format(userByid.getEntryDate()))<Integer.parseInt(ls.getYearName())) {
|
|
|
+ yearCount += getYear(userByid.getEntryDate(), ls.getBeginDate(), userByid);
|
|
|
+ } if(oConvertUtils.isNotEmpty(userByid.getEntryDate())&&Integer.parseInt(sdt.format(userByid.getEntryDate()))==Integer.parseInt(ls.getYearName())) {
|
|
|
+ int i = daysBetween(userByid.getEntryDate(), DateUtils.parseDate(ls.getYearName() + "-12-31", "yyyy-MM-dd"));
|
|
|
+ int yearToWorkMoth = getYearToWorkMoth(userByid.getWorkMoth());
|
|
|
+ BigDecimal multiply = new BigDecimal(yearToWorkMoth).multiply(new BigDecimal(i));
|
|
|
+ BigDecimal bigDecimal = multiply.divide(new BigDecimal("365"),0, BigDecimal.ROUND_DOWN);
|
|
|
+ yearCount+=Integer.parseInt(bigDecimal.toString());
|
|
|
+ yearCounts+=yearToWorkMoth;
|
|
|
+ } if(oConvertUtils.isNotEmpty(userByid.getEntryDate())&&Integer.parseInt(sdt.format(newDate))-1==Integer.parseInt(ls.getYearName())) {
|
|
|
+ lyearCount+=yearCount;
|
|
|
+ }
|
|
|
}
|
|
|
- vacationsBody.addAll(vacationMapper.queryListBody(id,ls.getYearName()));
|
|
|
}
|
|
|
+ for (int is=years.size()-1;is>=0;is--){
|
|
|
+ vacationsBody.addAll(vacationMapper.queryListBody(id,years.get(is).getYearName()));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
int moths=3;
|
|
|
String syYearCount="0";
|
|
|
+ String lsyYearCount="0";
|
|
|
String txCount="0";
|
|
|
- if (vacationsBody!=null&&vacationsBody.size()>0){
|
|
|
- for (Vacation vs:vacationsBody){
|
|
|
- syYearCount=new BigDecimal(syYearCount).add(new BigDecimal(vs.getHolidayCount())).toString();
|
|
|
+ if (vacationsBody!=null&&vacationsBody.size()>0) {
|
|
|
+ for (int i = vacationsBody.size() - 1; i >= 0; i--) {
|
|
|
+ if (Integer.parseInt(sdt.format(vacationsBody.get(i).getYear())) < Integer.parseInt(sdt.format(newDate))) {
|
|
|
+ lsyYearCount = new BigDecimal(lsyYearCount).add(new BigDecimal(vacationsBody.get(i).getHolidayCount())).toString();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ for (int it = vacationsBody.size() - 1; it >= 0; it--) {
|
|
|
+ syYearCount = new BigDecimal(syYearCount).add(new BigDecimal(vacationsBody.get(it).getHolidayCount())).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ vacationsBody=vacationMapper.queryListBody(id,sdt.format(newDate));
|
|
|
+
|
|
|
syYearCount=new BigDecimal(syYearCount).divide(new BigDecimal("24"),1,BigDecimal.ROUND_DOWN).toString();
|
|
|
syYearCount=new BigDecimal(yearCount).subtract(new BigDecimal(syYearCount)).toString();
|
|
|
+ if (!lsyYearCount.equals("0")) {
|
|
|
+ lsyYearCount = new BigDecimal(lsyYearCount).divide(new BigDecimal("24"), 1, BigDecimal.ROUND_DOWN).toString();
|
|
|
+ lsyYearCount = new BigDecimal(lyearCount).subtract(new BigDecimal(lsyYearCount)).toString();
|
|
|
+ }else {
|
|
|
+ lsyYearCount=String.valueOf(lyearCount);
|
|
|
+ }
|
|
|
} else {
|
|
|
syYearCount=String.valueOf(yearCount);
|
|
|
}
|
|
@@ -792,7 +839,8 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
txCount=new BigDecimal(stringObjectMap.get("count").toString()).subtract(new BigDecimal(stringObjectMap.get("sycount").toString())).toString();
|
|
|
|
|
|
}
|
|
|
- map.put("yearCount",yearCount);
|
|
|
+ map.put("yearCount",yearCounts);
|
|
|
+ map.put("lsyYearCount",lsyYearCount);
|
|
|
map.put("syYearCount",syYearCount);
|
|
|
map.put("txCount",txCount);
|
|
|
map.put("vacationsBody",vacationsBody);
|
|
@@ -1997,5 +2045,28 @@ public class WeixinUserImpl implements IWeixinUserService{
|
|
|
}
|
|
|
return listGroup;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算两个日期之间相差的天数
|
|
|
+ * @param smdate 较小的时间
|
|
|
+ * @param bdate 较大的时间
|
|
|
+ * @return 相差天数
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ public static int daysBetween(Date smdate,Date bdate) throws ParseException
|
|
|
+ {
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ smdate=sdf.parse(sdf.format(smdate));
|
|
|
+ bdate=sdf.parse(sdf.format(bdate));
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(smdate);
|
|
|
+ long time1 = cal.getTimeInMillis();
|
|
|
+ cal.setTime(bdate);
|
|
|
+ long time2 = cal.getTimeInMillis();
|
|
|
+ long between_days=(time2-time1)/(1000*3600*24);
|
|
|
+
|
|
|
+ return Integer.parseInt(String.valueOf(between_days));
|
|
|
+ }
|
|
|
}
|
|
|
|