ysh 3 gadi atpakaļ
vecāks
revīzija
027db14166

+ 40 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/controller/bdClockinMonthController.java

@@ -11,12 +11,15 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.viewClockIn.entity.BdClose;
 import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
 import org.jeecg.modules.viewClockIn.service.IbdClockinMonthService;
@@ -118,7 +121,7 @@ public class bdClockinMonthController extends JeecgController<bdClockinMonth, Ib
 	 */
 	@AutoLog(value = "考勤月报-分页列表查询")
 	@ApiOperation(value="考勤月报-分页列表查询", notes="考勤月报-分页列表查询")
-	@GetMapping(value = "/list")
+	@GetMapping(value = "/list111111")
 	public Result<?> queryPageList(bdClockinMonth bdClockinMonth,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@@ -130,7 +133,42 @@ public class bdClockinMonthController extends JeecgController<bdClockinMonth, Ib
 		IPage<bdClockinMonth> pageList = bdClockinMonthService.page(page, queryWrapper);
 		return Result.OK(pageList);
 	}
-	
+
+
+
+	 @RequestMapping(value = "/list", method = RequestMethod.GET)
+	 public Result<Page<bdClockinMonth>> queryPageList1(bdClockinMonth clockinMonth,
+														@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														HttpServletRequest req) {
+		 Result<Page<bdClockinMonth>> result = new Result<Page<bdClockinMonth>>();
+		 Page<bdClockinMonth> page = new Page<bdClockinMonth>(pageNo,pageSize);
+		 Map<String,String> map = new HashMap<>();
+		 if(clockinMonth.getMonthTime() == null || clockinMonth.getMonthTime() == ""){
+			 DateFormat sdf = new SimpleDateFormat("yyyy-MM");
+			 map.put("months",sdf.format(new Date()));
+		 }else{
+			 map.put("months",clockinMonth.getMonthTime());
+		 }
+		 if(clockinMonth.getPersonName() != null && clockinMonth.getPersonName() != ""){
+			 map.put("personName", StringUtils.deleteWhitespace(clockinMonth.getPersonName()));
+		 }
+		 if(clockinMonth.getPersonId() != null && clockinMonth.getPersonId() != ""){
+			 map.put("personId", StringUtils.deleteWhitespace(clockinMonth.getPersonId()));
+		 }
+		 if(clockinMonth.getSyU8() != null){
+			 map.put("syU8", clockinMonth.getSyU8().toString());
+		 }
+
+		 Page<bdClockinMonth> pageList = bdClockinMonthService.selectByPage(page,map);
+		 log.info("查询当前页:"+pageList.getCurrent());
+		 log.info("查询当前页数量:"+pageList.getSize());
+		 log.info("查询结果数量:"+pageList.getRecords().size());
+		 log.info("数据总数:"+pageList.getTotal());
+		 result.setSuccess(true);
+		 result.setResult(pageList);
+		 return result;
+	 }
 	/**
 	 * 添加
 	 *

+ 109 - 32
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/controller/viewClockInController.java

@@ -25,6 +25,7 @@ import org.jeecg.modules.geke.shift.entity.Shift;
 import org.jeecg.modules.geke.shift.service.IShiftService;
 import org.jeecg.modules.geke.statutoryleave.entity.StatutoryLeave;
 import org.jeecg.modules.geke.statutoryleave.service.IStatutoryLeaveService;
+import org.jeecg.modules.quartz.entity.QuartzJob;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
@@ -88,6 +89,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	  */
 	 @RequestMapping(value = "/handleInfo", method = RequestMethod.PUT)
 	 public Result<?> handleInfo(@RequestBody JSONObject jsonObject) throws ParseException {
+		String multiple = jsonObject.getString("multiple");
 		String viewDates = jsonObject.getString("viewDate");
 		String username = jsonObject.getString("username");
 		String st = jsonObject.getString("st");
@@ -135,9 +137,10 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 				 }else{
 					 st = "忽略";
 				 }
+				 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 				 for(String a:viewDateArr){
 
-					 viewClockInService.fuXinInfo(st,username,a,sysUser.getUsername());
+					 viewClockInService.fuXinInfo(multiple,st,username,a,user.getUsername());
 
 				 }
 
@@ -158,36 +161,37 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	 @RequestMapping(value = "/fuXinInfo", method = RequestMethod.PUT)
 	 public Result<?> fuXinInfo(@RequestBody JSONObject jsonObject) throws ParseException {
 		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		 String multiple = jsonObject.get("multiple").toString();
 		 String st = jsonObject.get("st").toString();
 		 String w = jsonObject.get("w").toString();
 		 String userId = jsonObject.get("userId").toString();
-		 SysUser sysUser = iSysUserService.getUserByName(userId);
-		 if(sysUser != null){
-			//正式工 101 实习生 103 劳务工	104 劳务外包5+2 105  劳务外包6+1 106  顾问 102
-			 //员工为正式,实习,劳务加班付薪时,如果没匹配到工资倍数,则默认两倍;匹配到工资倍数则按照倍数算薪;其他员工除非能匹配到工资倍数,否则不能付薪只能调休
-		 	int userType = sysUser.getCategory();
-		 	if(userType != 101 && userType != 103 && userType != 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("当前用户的加班,只能用于累计调休");
-						}
-					}
-				}
-
-			}
-
-		 }
+//		 SysUser sysUser = iSysUserService.getUserByName(userId);
+//		 if(sysUser != null){
+//			//正式工 101 实习生 103 劳务工	104 劳务外包5+2 105  劳务外包6+1 106  顾问 102
+//			 //员工为正式,实习,劳务加班付薪时,如果没匹配到工资倍数,则默认两倍;匹配到工资倍数则按照倍数算薪;其他员工除非能匹配到工资倍数,否则不能付薪只能调休
+//		 	int userType = sysUser.getCategory();
+//		 	if(userType != 101 && userType != 103 && userType != 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("当前用户的加班,只能用于累计调休");
+//						}
+//					}
+//				}
+//
+//			}
+//
+//		 }
 		 if(st.equals("1")){
 			 st = "付薪";
 		 }else if(st.equals("2")){
@@ -204,7 +208,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 			 if(!bdClockinMonthService.ifClose(viewDate1)){
 				 return Result.error("当前月份已关账,无法此操作");
 			 }
-			 viewClockInService.updateOvertime(st,pkId,user.getUsername());
+			 viewClockInService.updateOvertime(multiple,st,pkId,user.getUsername());
 		 }else{
 
 			 String viewDate = jsonObject.get("viewDate").toString();
@@ -213,7 +217,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 			 if(!bdClockinMonthService.ifClose(viewDate)){
 				 return Result.error("当前月份已关账,无法此操作");
 			 }
-			 viewClockInService.fuXinInfo(st,userId,viewDate,user.getUsername());
+			 viewClockInService.fuXinInfo(multiple,st,userId,viewDate,user.getUsername());
 		 }
 
 		 return Result.OK("true");
@@ -456,7 +460,7 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	 * @param req
 	 * @return
 	 */
-	@AutoLog(value = "员工考勤日报-分页列表查询")
+//	@AutoLog(value = "员工考勤信息,点击左侧树形菜单时调用")
 	@ApiOperation(value="员工考勤日报-分页列表查询", notes="员工考勤日报-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<?> queryPageList(ViewClockIn viewClockIn,
@@ -513,7 +517,80 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 		IPage<ViewClockIn> pageList = viewClockInService.page(page, query);
 		return Result.OK(pageList);
 	}
-	
+
+		/**
+	 * 分页列表查询
+	 *
+	 * @param viewClockIn
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "员工考勤日报-分页列表查询")
+	@ApiOperation(value="员工考勤日报-分页列表查询", notes="员工考勤日报-分页列表查询")
+	@GetMapping(value = "/list1")
+	public Result<?> queryPageList1(ViewClockIn viewClockIn,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   @RequestParam(name="beginViewDate", defaultValue="1") String beginViewDate,
+								   @RequestParam(name="endViewDate", defaultValue="1") String endViewDate,
+								   String userName,String mDate,
+								   HttpServletRequest req) {
+
+//		LambdaQueryWrapper<ViewClockIn> query = new LambdaQueryWrapper<ViewClockIn>();
+		String dpet = viewClockIn.getDepartIds();
+		viewClockIn.setDepartIds(null);
+		QueryWrapper<ViewClockIn> query = QueryGenerator.initQueryWrapper(viewClockIn, req.getParameterMap());
+//		if(userName != null && userName != ""){
+//			String[] s = userName.split("(");
+//			query.eq(ViewClockIn::getRealname,s[0]);//姓名
+//		}
+//		if(mDate != null && mDate != ""){
+//			query.eq(ViewClockIn::getHeadMonth,mDate);//月份
+//		}
+
+//		if(viewClockIn.getDuration() != null && viewClockIn.getDuration() != ""){
+//			query.isNotNull(ViewClockIn::getDuration);//加班信息
+//		}
+//		if(viewClockIn.getShowState() != null && viewClockIn.getShowState() != ""){
+//			query.like(ViewClockIn::getShowState,viewClockIn.getShowState());//异常状态
+//		}
+//		if(viewClockIn.getRealname() != null && viewClockIn.getRealname() != ""){
+//			query.like(ViewClockIn::getRealname,viewClockIn.getRealname());//姓名
+//		}
+//		if(viewClockIn.getDepartNames() != null && viewClockIn.getDepartNames() != ""){
+//			query.like(ViewClockIn::getDepartNames,viewClockIn.getDepartNames());//部门
+//		}
+//		if(viewClockIn.getDepartIds() != null && viewClockIn.getDepartIds() != ""){
+////			query.apply("org_code"+" like {0}", viewClockIn.getDepartIds()+"%");
+//			query.apply("FIND_IN_SET({0},depart_ids)", viewClockIn.getDepartIds());
+//		}
+//		if(viewClockIn.getWorkNo() != null && viewClockIn.getWorkNo() != ""){
+//			query.eq(ViewClockIn::getWorkNo,viewClockIn.getWorkNo());//工号
+//		}
+//		if(viewClockIn.getName() != null && viewClockIn.getName() != ""){
+//			query.eq(ViewClockIn::getName,viewClockIn.getName());//班次
+//		}
+//		if(viewClockIn.getViewDate() != null && viewClockIn.getViewDate() != ""){
+//			query.eq(ViewClockIn::getViewDate,viewClockIn.getViewDate());//日期
+//		}
+		if(dpet != null && dpet != ""){
+//			query.apply("org_code"+" like {0}", viewClockIn.getDepartIds()+"%");
+			query.apply("FIND_IN_SET({0},depart_ids)",dpet);
+		}
+		if(beginViewDate != null && beginViewDate != "" && !beginViewDate.equals("1")){
+			query.between("view_Date",beginViewDate,endViewDate);
+		}
+		if(beginViewDate.equals("1") && mDate == null && viewClockIn.getViewDate() == null){
+			query.eq("head_Month",DateUtils.getNYTime());//月份
+		}
+//		query.orderByAsc(ViewClockIn::getViewDate);
+		Page<ViewClockIn> page = new Page<ViewClockIn>(pageNo, pageSize);
+		IPage<ViewClockIn> pageList = viewClockInService.page(page, query);
+		return Result.OK(pageList);
+	}
+
 	/**
 	 * 添加
 	 *

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/bdClockinMonth.java

@@ -30,6 +30,10 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 public class bdClockinMonth {
 
 //	@TableField(exist = false)
+	private String monthdate;//前台传入月份
+	private String realname;//人员档案中的姓名
+	private String username;//人员档案中工号
+
 	private String basePay;//基本工资1
 	private String basePay_2;//
 	private String wagesBase;//缴交基数1
@@ -51,6 +55,8 @@ public class bdClockinMonth {
 	private String isSalary;//是否算薪(0是,1否)
 	private String syFund;//公积金账号
 	private String category;//人员类别
+	@TableField(exist = false)
+	private String type;//打卡类型 上班类型(1,固定时间上下班,2,按班次上下班,3,自由上下班)
 
 	private String years;//年度
 

+ 43 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/bdClockinMonthMapper.java

@@ -4,9 +4,13 @@ import java.util.List;
 import java.util.Map;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.geke.statutoryleave.entity.StatutoryLeave;
+import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.viewClockIn.entity.BdClose;
+import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -18,6 +22,45 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface bdClockinMonthMapper extends BaseMapper<bdClockinMonth> {
 
+    public List<bdClockinMonth> selectByPage(Page<bdClockinMonth> page,@Param("map")Map<String,String> map);
+
+    /**
+     * 生成月报使用(查询用户信息)
+     * @param userId
+     * @return
+     */
+    public List<bdClockinMonth> selectUserBy(@Param("userId")List<String> userId,@Param("nowDate") String nowDate);
+
+    /**
+     * 生成月报使用(查询请假信息)
+     * @param nowDate
+     * @return
+     */
+    public List<Map<String,Object>> selectVacation(@Param("nowDate") String nowDate,@Param("userId")List<String> userId);
+
+    /**
+     * 生成月报使用(查询加班信息)
+     * @param nowDate
+     * @return
+     */
+    public List<Map<String,Object>> selectOvertime(@Param("nowDate") String nowDate,@Param("userId")List<String> userId);
+
+    /**
+     * 生成月报使用(获取非固定班打卡人员考勤缺卡天数)
+     * @param nowDate '2022-06'
+     * @param userId '100009'
+     * @return
+     */
+    public Integer selectNotFixedInfo(@Param("nowDate") String nowDate,@Param("userId")String userId);
+
+    /**
+     * 生成月报使用(获取固定班打卡人员当月考勤缺卡天数)
+     * @param nowDate '2022-06'
+     * @param userId '100009'
+     * @return
+     */
+    public Integer selectFixedInfo(@Param("nowDate") String nowDate,@Param("userId")String userId);
+
     /**
      * 生成月报使用
      * @param nowDate

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/viewClockInMapper.java

@@ -23,9 +23,10 @@ import java.util.Map;
  */
 public interface viewClockInMapper extends BaseMapper<ViewClockIn> {
 
-    int fuXinInfo(String st,String userId,String viewDate,String username);
+    int fuXinInfo(@Param("multiple")String multiple,@Param("st")String st,@Param("userId")String userId,
+                  @Param("viewDate")String viewDate,@Param("username")String username);
 
-    int updateOvertime(String st,String id,String username);
+    int updateOvertime(@Param("multiple")String multiple,@Param("st")String st,@Param("id")String id,@Param("username")String username);
 
     List<Map<String,Object>> selectByOvertime(@Param("monthTime") String monthTime,@Param("userList")List<String> userList);
 

+ 115 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/bdClockinMonthMapper.xml

@@ -2,6 +2,121 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.viewClockIn.mapper.bdClockinMonthMapper">
 
+    <select id="selectByPage" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
+
+        select #{map.months} monthdate, b.realname realname,b.username username,a.*
+        from bd_clockin_month a
+        right join sys_user b on b.id = a.person_id
+        where b.del_flag='0'
+        <if test="map.personName != null and map.personName != ''">
+            and b.realname like concat('%',#{map.personName},'%')
+        </if>
+        <if test="map.personId != null and map.personId != ''">
+            and b.username = #{map.personId}
+        </if>
+        <if test="map.syU8 != null and map.syU8 != ''">
+            and a.sy_u8 = #{map.syU8}
+        </if>
+    </select>
+
+    <select id="selectVacation" parameterType="java.util.List" resultType="Map">
+
+        select concat(user_id,holiday_type) userType,sum(holiday_count)/24 holiday_count
+        from geke_vacation_body where DATE_FORMAT(start_date,'%Y-%m') = #{nowDate}
+
+        <if test="userId != null and userId != '' and userId.size >0">
+            and user_id in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        GROUP BY user_id,holiday_type
+        </if>
+    </select>
+
+    <select id="selectOvertime" parameterType="java.util.List" resultType="Map">
+        select person, sum(duration*multiple) duration
+        from bd_work_overtime where set_info='付薪' and DATE_FORMAT(begin_date,'%Y-%m') = #{nowDate}
+
+        <if test="userId != null and userId != '' and userId.size >0">
+            and person in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
+        GROUP BY person
+    </select>
+
+    <select id="selectUserBy" parameterType="java.util.List" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
+        select b.type,a.id personId,a.username person_code,a.realname person_name,
+            a.category, -- 人员类别 101正式工 102 合同工 103 实习生 104 劳务工
+            a.is_attendance,-- 是否考勤(0是 ,1否)
+            a.is_salary, -- 是否算薪
+            a.wages_one, -- 基本工资
+            a.wages_base,-- 缴交基数
+            a.sy_fund, -- 公积金账号
+            a.share_dept depart_id, -- 分摊部门
+            m.sy_u8 -- 月报是否已同步到u8(0否,1是)
+        from sys_user a
+        left join geke_attendance_rule b on a.id = b.user_id
+        left join bd_clockin_month m on a.id = m.person_id and m.month_time = #{nowDate}
+        where a.del_flag = 0 and date_format(IFNULL(a.term_date,NOW()),'%Y-%m') >= #{nowDate}
+        <if test="userId != null and userId != '' and userId.size >0">
+            and a.id in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
+    </select>
+
+    <select id="selectNotFixedInfo" resultType="int">
+        select count(user_id) missingNum from geke_user_shift where user_id = #{userId}
+            and DATE_FORMAT(shift_date,'%Y-%m') = #{nowDate} and shift_id !='0' and shift_id != '1'
+            and DATE_FORMAT(shift_date,'%Y-%m-%d') not in(
+                select DATE_FORMAT(user_date,'%Y-%m-%d')  from
+                    geke_attendance b
+                where b.exception_type !='未打卡' and b.user_id = #{userId} and DATE_FORMAT(b.user_date,'%Y-%m') = #{nowDate} -- 打卡信息
+            )
+            and DATE_FORMAT(shift_date,'%Y-%m-%d') not in( -- 过滤请假日期信息
+                select adddate(DATE_FORMAT(a.start_date,'%Y-%m-%d'), numlist.id) as 'date' from geke_vacation_body a left join
+                (SELECT n1.i + n10.i*10 + n100.i*100 AS id FROM num n1 cross join num as n10 cross join num as n100) as numlist
+                on adddate(DATE_FORMAT(a.start_date,'%Y-%m-%d'), numlist.id) &lt;= DATE_FORMAT(a.end_date,'%Y-%m-%d')
+                where  DATE_FORMAT(a.start_date,'%Y-%m') = #{nowDate} and a.user_id= #{userId}
+            )
+        group by user_id
+    </select>
+
+    <select id="selectFixedInfo" resultType="int">
+        select count(1) missingNum
+        from (
+                 select date,DAYOFWEEK(date)-1 weekDay from (
+                     SELECT DATE_FORMAT(DATE_SUB(last_day(concat(#{nowDate},'-01')), INTERVAL xc-1 day), '%Y-%m-%d') as date
+                     FROM (
+                     SELECT @xi:=@xi+1 as xc from
+                     (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) xc1,
+                     (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) xc2,
+                     (SELECT @xi:=0) xc0
+                     ) xcxc) x0 where x0.date >= (select date_add(concat(#{nowDate},'-01'),interval-day(concat(#{nowDate},'-01'))+1 day))
+        ) a
+        left join geke_statutory_leave b on DATE_FORMAT(b.start_date,'%Y-%m-%d') = DATE_FORMAT(a.date,'%Y-%m-%d')
+
+        where (a.weekDay in('1','2','3','4','5') and (b.type = '1' or b.type is null))
+
+        and a.date not in(
+            select DATE_FORMAT(user_date,'%Y-%m-%d') from
+                geke_attendance b
+            where b.exception_type !='未打卡' and b.user_id = #{userId} and DATE_FORMAT(b.user_date,'%Y-%m') = #{nowDate} -- 打卡信息
+        )
+        and a.date not in( -- 过滤请假日期信息
+            select adddate(DATE_FORMAT(a.start_date,'%Y-%m-%d'), numlist.id) as 'date' from geke_vacation_body a left join
+            (SELECT n1.i + n10.i*10 + n100.i*100 AS id FROM num n1 cross join num as n10 cross join num as n100) as numlist
+            on adddate(DATE_FORMAT(a.start_date,'%Y-%m-%d'), numlist.id) &lt;= DATE_FORMAT(a.end_date,'%Y-%m-%d')
+            where  DATE_FORMAT(a.start_date,'%Y-%m') = #{nowDate} and a.user_id=#{userId}
+        )
+    </select>
+
     <select id="selectByMonth" parameterType="java.util.List" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
 
         select m.sy_u8, c.depart_ids departId,c.category,c.sy_fund,c.is_salary,c.is_attendance,c.id personId,c.work_no personCode,

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/viewClockInMapper.xml

@@ -71,12 +71,12 @@
        <!-- update geke_attendance set set_info = #{st}
         where user_id =#{userId} and date_format( user_date, '%Y-%m-%d' ) = #{viewDate} -->
 
-        update bd_work_overtime set set_info = #{st},update_name = #{username},update_date = NOW()
+        update bd_work_overtime set multiple = #{multiple},set_info = #{st},update_name = #{username},update_date = NOW()
         where person =#{userId} and date_format( begin_date, '%Y-%m-%d' ) = #{viewDate}
     </update>
 
     <update id="updateOvertime">
-        update bd_work_overtime set set_info = #{st},update_name = #{username},update_date = NOW()
+        update bd_work_overtime set multiple = #{multiple}, set_info = #{st},update_name = #{username},update_date = NOW()
         where id =#{id}
     </update>
 

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IbdClockinMonthService.java

@@ -1,6 +1,9 @@
 package org.jeecg.modules.viewClockIn.service;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.viewClockIn.entity.BdClose;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
@@ -17,6 +20,8 @@ import java.util.Map;
  */
 public interface IbdClockinMonthService extends IService<bdClockinMonth> {
 
+    Page<bdClockinMonth> selectByPage(Page<bdClockinMonth> page, Map<String,String> map);
+
     /**
      * 生成月报表
      * @return

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IviewClockInService.java

@@ -19,8 +19,8 @@ import java.util.Map;
  */
 public interface IviewClockInService extends IService<ViewClockIn> {
 
-    public int fuXinInfo(String st, String userId, String viewDate,String username);
-    public int updateOvertime(String st,String id,String username);
+    public int fuXinInfo(String multiple, String st, String userId, String viewDate,String username);
+    public int updateOvertime(String multiple,String st,String id,String username);
     public Page<ViewClockIn> selectPage(Page<ViewClockIn> page);
     public List<ExportClockInfo> exportErrotInfo(String realname , String headMonth, String userType);
     public List<ExportClockDay> exportXlsDay(ExportClockDay viewClockIn);

+ 113 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/bdClockinMonthServiceImpl.java

@@ -1,10 +1,14 @@
 package org.jeecg.modules.viewClockIn.service.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.netty.util.internal.StringUtil;
+import org.apache.ibatis.annotations.Param;
 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.system.entity.SysUser;
 import org.jeecg.modules.viewClockIn.entity.BdClose;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
@@ -15,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.text.DateFormat;
@@ -36,10 +41,117 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
     private bdClockinMonthMapper clockinMonthMapper;
 
     /**
-     * 生成月报表
+     * 月报分页查询
+     * @param page
+     * @param map
      * @return
      */
+    @Override
+    public Page<bdClockinMonth> selectByPage(Page<bdClockinMonth> page, Map<String,String> map) {
+        return page.setRecords(clockinMonthMapper.selectByPage(page,map));
+    }
+
+    /**
+     * 生成月报表(在用)
+     * @param nowDate
+     * @param userList
+     * @return
+     */
+    @Transactional
     public String handleInfo(String nowDate,List<String> userList){
+        userList.add("100089");
+        //获取要生成月报用户信息
+        List<bdClockinMonth> selectUserBy = clockinMonthMapper.selectUserBy(userList,nowDate);
+        //请假信息(事假,病假)天
+        List<Map<String,Object>> selectVacation = clockinMonthMapper.selectVacation(nowDate,userList);
+        //加班信息(单人合计付薪)小时
+        List<Map<String,Object>> selectOvertime = clockinMonthMapper.selectOvertime(nowDate,userList);
+        //删除之前生成的月报
+        clockinMonthMapper.deleteByMonth(nowDate,userList);
+
+        //循环处理每条用户的考勤信息
+        for(bdClockinMonth o:selectUserBy){
+            //是否同步至u8(0否,1是) 已同步至u8的月报不予放行
+            if(o.getSyU8() != null && o.getSyU8().equals(1)){
+                continue;
+            }
+            //用户id
+            String userId = o.getPersonId();
+            //获取当前员工的病假、事假时长
+            if(selectVacation.size() > 0){
+                for(Map<String,Object> jq:selectVacation){
+                    if(jq.get("userType").toString().equals(userId+"事假")){
+                        String holiday_count = jq.get("holiday_count").toString();
+                        o.setHolidayTimeSj(holiday_count);
+                    }
+                    if(jq.get("userType").toString().equals(userId+"病假")){
+                        String holiday_count = jq.get("holiday_count").toString();
+                        o.setHolidayTimeBj(holiday_count);
+                    }
+                }
+            }
+            //获取当前员工的加班信息(仅统计付薪)
+            if(selectOvertime.size() > 0){
+                for(Map<String,Object> jb:selectOvertime){
+                    if(jb.get("person").toString().equals(userId)) {
+                        o.setDuration(jb.get("duration").toString());
+                    }
+                }
+            }
+
+            int allNum = 0;//统计缺卡天数
+            //获取旷工天数
+            //免打卡 (0打卡,1免打卡)
+            if(!StringUtil.isNullOrEmpty(o.getIsAttendance()) && o.getIsAttendance().equals("1")){
+
+            }else{
+                //上班类型(1,固定时间上下班,2,按班次上下班,3,自由上下班)
+                if(StringUtil.isNullOrEmpty(o.getType())){
+                    continue;
+                }
+                if(o.getType().equals("1")){
+                    //获取固定班打卡人员当月考勤缺卡天数
+                    Integer num = clockinMonthMapper.selectFixedInfo(nowDate,userId);
+                    if(num != null){
+                        allNum = allNum + num;
+                        o.setMissingNum(String.valueOf(num));
+                    }
+
+                }else if(o.getType().equals("2")){
+                    //获取非固定班打卡人员考勤缺卡天数
+                    Integer num = clockinMonthMapper.selectNotFixedInfo(nowDate,userId);
+                    if(num != null){
+                        allNum = allNum + num;
+                        o.setMissingNum(String.valueOf(num));
+                    }
+
+                }else{
+                    continue;
+                }
+
+            }
+            BigDecimal b = new BigDecimal("21.75").subtract(new BigDecimal(String.valueOf(allNum)));
+            o.setWorkDayReal(b.toString());
+            String[] date = nowDate.split("-");
+            o.setMonthTime(nowDate);
+            o.setYears(date[0]);
+            o.setMonths(date[1]);
+
+            o.setWorkDay("21.75");
+            o.setId(UUIDGenerator.generate());
+            clockinMonthMapper.insert(o);
+
+        }
+
+
+        return "true";
+    }
+
+    /**
+     * 生成月报表(未使用)
+     * @return
+     */
+    public String handleInfo1(String nowDate,List<String> userList){
         List<bdClockinMonth> list = clockinMonthMapper.selectByMonth(nowDate,userList);
         if(list.size() == 0){
             throw new RuntimeException("当前月份没有考勤数据,无法生成月报!");

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/viewClockInServiceImpl.java

@@ -34,12 +34,12 @@ public class viewClockInServiceImpl extends ServiceImpl<viewClockInMapper, ViewC
         return viewClockInMapper1.selectByOvertime(monthTime,userList);
     }
 
-    public int fuXinInfo(String st,String userId,String viewDate,String username) {
-        return viewClockInMapper1.fuXinInfo(st,userId,viewDate,username);
+    public int fuXinInfo(String multiple,String st,String userId,String viewDate,String username) {
+        return viewClockInMapper1.fuXinInfo(multiple,st,userId,viewDate,username);
     }
 
-    public int updateOvertime(String st,String id,String username) {
-        return viewClockInMapper1.updateOvertime(st,id,username);
+    public int updateOvertime(String multiple,String st,String id,String username) {
+        return viewClockInMapper1.updateOvertime(multiple,st,id,username);
     }
 
 //    @Override