|  | @@ -3,6 +3,8 @@ package org.jeecg.modules.viewClockIn.service.impl;
 | 
	
		
			
				|  |  |  import com.baomidou.dynamic.datasource.annotation.DS;
 | 
	
		
			
				|  |  |  import io.netty.util.internal.StringUtil;
 | 
	
		
			
				|  |  |  import org.jeecg.common.api.vo.Result;
 | 
	
		
			
				|  |  | +import org.jeecg.common.util.UUIDGenerator;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.geke.statutoryleave.entity.StatutoryLeave;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.viewClockIn.entity.BdClose;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
 | 
	
	
		
			
				|  | @@ -14,6 +16,7 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.text.DateFormat;
 | 
	
		
			
				|  |  |  import java.text.ParseException;
 | 
	
		
			
				|  |  |  import java.text.SimpleDateFormat;
 | 
	
	
		
			
				|  | @@ -32,6 +35,94 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private bdClockinMonthMapper clockinMonthMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 生成月报表
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public String handleInfo(String nowDate,List<String> userList){
 | 
	
		
			
				|  |  | +        List<bdClockinMonth> list = clockinMonthMapper.selectByMonth(nowDate,userList);
 | 
	
		
			
				|  |  | +        if(list.size() == 0){
 | 
	
		
			
				|  |  | +            throw new RuntimeException("当前月份没有考勤数据,无法生成月报!");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String[] date = nowDate.split("-");
 | 
	
		
			
				|  |  | +        clockinMonthMapper.deleteByMonth(nowDate,userList);//删除之前生成的月报
 | 
	
		
			
				|  |  | +        List<StatutoryLeave>  leaveList = clockinMonthMapper.getStatutoryLeave(nowDate);
 | 
	
		
			
				|  |  | +        for(bdClockinMonth o:list){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(o.getSyU8() != null && (o.getSyU8().equals(1) || o.getSyU8() == 1)){
 | 
	
		
			
				|  |  | +                System.out.println(o.getPersonName());
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(!StringUtil.isNullOrEmpty(o.getDepartId())){
 | 
	
		
			
				|  |  | +                String[] dept = o.getDepartId().split(",");
 | 
	
		
			
				|  |  | +                if(dept.length > 0){
 | 
	
		
			
				|  |  | +                    o.setDepartId(dept[0]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            o.setMonthTime(nowDate);
 | 
	
		
			
				|  |  | +            o.setYears(date[0]);
 | 
	
		
			
				|  |  | +            o.setMonths(date[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            o.setWorkDay("21.75");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//				正式工		101
 | 
	
		
			
				|  |  | +//				实习生		103
 | 
	
		
			
				|  |  | +//			 	劳务工		104
 | 
	
		
			
				|  |  | +//			 	劳务外包5+2	105
 | 
	
		
			
				|  |  | +//			 	劳务外包6+1	106
 | 
	
		
			
				|  |  | +//			 	顾问			102
 | 
	
		
			
				|  |  | +// 				员工为正式,实习,劳务加班付薪时,如果没匹配到工资倍数,则默认两倍;匹配到工资倍数则按照倍数算薪;其他员工除非能匹配到工资倍数,否则不能付薪只能调休
 | 
	
		
			
				|  |  | +//				 String cate = o.getCategory();
 | 
	
		
			
				|  |  | +//				 if(!cate.equals("101") && !cate.equals("103") && !cate.equals("104")){
 | 
	
		
			
				|  |  | +//					 DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  | +//					 String thisDate = null;
 | 
	
		
			
				|  |  | +//					 if(w.equals("1")){
 | 
	
		
			
				|  |  | +//						 thisDate = jsonObject.get("viewDate1").toString();
 | 
	
		
			
				|  |  | +//					 }else{
 | 
	
		
			
				|  |  | +//						 thisDate = jsonObject.get("viewDate").toString();
 | 
	
		
			
				|  |  | +//					 }
 | 
	
		
			
				|  |  | +//					 List<StatutoryLeave> list = statutoryLeaveService.list();
 | 
	
		
			
				|  |  | +//					 for(StatutoryLeave o:list){
 | 
	
		
			
				|  |  | +//						 if(o.getType().equals("1")){//班
 | 
	
		
			
				|  |  | +//							 Date begin = o.getStartDate();
 | 
	
		
			
				|  |  | +//							 Date end = o.getEndDate();
 | 
	
		
			
				|  |  | +//							 if(!isEffectiveDate(sdf.parse(thisDate),begin,end) ){
 | 
	
		
			
				|  |  | +//								 return Result.error("当前用户的加班,只能用于累计调休");
 | 
	
		
			
				|  |  | +//							 }
 | 
	
		
			
				|  |  | +//						 }
 | 
	
		
			
				|  |  | +//					 }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//				 }
 | 
	
		
			
				|  |  | +            // 附加考勤天数(加班数据、节假日上班多倍工资)
 | 
	
		
			
				|  |  | +            BigDecimal addDays = new BigDecimal("0");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //是否免打卡 1免打卡
 | 
	
		
			
				|  |  | +            if(StringUtil.isNullOrEmpty(o.getIsAttendance()) && o.getIsAttendance().equals("1")){
 | 
	
		
			
				|  |  | +                o.setWorkDayReal("21.75");//真实考勤天数
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                BigDecimal workDay = new BigDecimal("21.75").setScale(2,BigDecimal.ROUND_HALF_UP);;
 | 
	
		
			
				|  |  | +                if(!StringUtil.isNullOrEmpty(o.getHolidayTimeBj()) && !o.getHolidayTimeBj().equals("0")){
 | 
	
		
			
				|  |  | +                    workDay = workDay.subtract(new BigDecimal(o.getHolidayTimeBj()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if(!StringUtil.isNullOrEmpty(o.getHolidayTimeSj()) && !o.getHolidayTimeSj().equals("0")){
 | 
	
		
			
				|  |  | +                    workDay = workDay.subtract(new BigDecimal(o.getHolidayTimeSj()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if(!StringUtil.isNullOrEmpty(o.getMissingNum()) && !o.getMissingNum().equals("0")){
 | 
	
		
			
				|  |  | +                    workDay = workDay.subtract(new BigDecimal(o.getMissingNum()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                o.setWorkDayReal(workDay.toString());//真实考勤天数
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            o.setId(UUIDGenerator.generate());
 | 
	
		
			
				|  |  | +            clockinMonthMapper.insert(o);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return "true";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      public List<bdClockinMonth> selectByMonth(String nowDate,List<String> userId){
 | 
	
		
			
				|  |  |          return clockinMonthMapper.selectByMonth(nowDate,userId);
 | 
	
		
			
				|  |  |      }
 |