ysh 3 роки тому
батько
коміт
d5e7eb1cba
15 змінених файлів з 387 додано та 77 видалено
  1. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java
  3. 51 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java
  4. 118 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/controller/viewClockInController.java
  5. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/NumEntity.java
  6. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/ViewClockIn.java
  7. 23 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/entity/bdClockinMonth.java
  8. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/bdClockinMonthMapper.java
  9. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/viewClockInMapper.java
  10. 75 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/bdClockinMonthMapper.xml
  11. 65 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/mapper/xml/viewClockInMapper.xml
  12. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IbdClockinMonthService.java
  13. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/IviewClockInService.java
  14. 12 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/bdClockinMonthServiceImpl.java
  15. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/viewClockIn/service/impl/viewClockInServiceImpl.java

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -120,13 +120,14 @@ public class SysDepartController {
 	 * @return
 	 */
 	@RequestMapping(value = "/queryTreeList2", method = RequestMethod.GET)
-	public Result<List<SysDepartTreeModel>> queryTreeList2() {
+	public Result<List<SysDepartTreeModel>> queryTreeList2(@RequestParam(name="viewDate", defaultValue="1") String viewDate) {
+		System.out.println(viewDate);
 		Result<List<SysDepartTreeModel>> result = new Result<>();
 		try {
 			LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 
 			if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
-				List<SysDepartTreeModel> list = sysDepartService.queryTreeList2();
+				List<SysDepartTreeModel> list = sysDepartService.queryTreeList2(viewDate);
 				result.setResult(list);
 				result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
 				result.setSuccess(true);

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java

@@ -34,7 +34,7 @@ public interface ISysDepartService extends IService<SysDepart>{
      * 勤信息使用(部门下增加人员)
      * @return
      */
-    List<SysDepartTreeModel> queryTreeList2();
+    List<SysDepartTreeModel> queryTreeList2(String viewDate);
 
     /**
      * 查询所有部门DepartId信息,并分节点进行显示

+ 51 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -7,6 +7,7 @@ import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.FillRuleConstant;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.FillRuleUtil;
 import org.jeecg.common.util.YouBianCodeUtil;
 import org.jeecg.common.util.oConvertUtils;
@@ -15,7 +16,9 @@ import org.jeecg.modules.system.mapper.*;
 import org.jeecg.modules.system.model.DepartIdModel;
 import org.jeecg.modules.system.model.SysDepartTreeModel;
 import org.jeecg.modules.system.service.ISysDepartService;
+import org.jeecg.modules.system.util.DateUtils2;
 import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
+import org.jeecg.modules.viewClockIn.mapper.viewClockInMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
@@ -49,13 +52,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
 	private SysDepartRoleUserMapper departRoleUserMapper;
 	@Autowired
 	private SysUserMapper sysUserMapper;
-
 	@Autowired
 	private  SysDepartMapper sysDepartMapper;
 	@Autowired
 	private  SysUserServiceImpl sysUserServiceImpl;
 	@Autowired
 	private  SysDictItemMapper sysDictItemMapper;
+	@Autowired
+	private viewClockInMapper viewClockInMapper1;
 
 	@Override
 	public List<SysDepartTreeModel> queryMyDeptTreeList(String departIds) {
@@ -101,37 +105,70 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
 	 * @return
 	 */
 	@Override
-	public List<SysDepartTreeModel> queryTreeList2() {
+	public List<SysDepartTreeModel> queryTreeList2(String viewDate) {
 		LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
 		query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
 		query.orderByAsc(SysDepart::getDepartOrder);
 		List<SysDepart> list = this.list(query);
-		int aa = 1;
+		if(StringUtil.isNullOrEmpty(viewDate)){
+			viewDate = DateUtils.getNYTime();
+		}else if(viewDate.equals("1")){
+			viewDate = DateUtils.getNYTime();
+		}
+
+		List<Map<String ,Object>> map = viewClockInMapper1.selectErrorNum(viewDate);
+
 		for(SysDepart o:list){
-			aa++;
-			o.setDepartName(o.getDepartName()+" ("+aa+"/81)");
+
+			for(Map<String ,Object> m:map){
+				if(m.get("departname")!=null && o.getDepartName().equals(m.get("departname").toString())){
+					String errornum = "";
+					String usernum = "";
+					if(m.get("usernum") != null){
+						usernum = m.get("usernum").toString();
+					}else{
+						usernum = "0";
+					}
+					if(m.get("errornum") != null){
+						errornum = m.get("errornum").toString();
+					}else{
+						errornum = "0";
+					}
+					o.setDepartName(o.getDepartName()+"("+errornum+"/"+usernum+")");
+				}
+			}
+
+
+
 		}
 		//获取人员类型
 		List<SysDictItem> dictList = sysDictItemMapper.selectItemsByMainCode("category");
+		List<Map<String ,Object>> userMap = viewClockInMapper1.selectUserError(viewDate);
 
-		LambdaQueryWrapper<SysUser> query1 = new LambdaQueryWrapper<SysUser>();
-		query1.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
-		List<SysUser> list1 = sysUserServiceImpl.list(query1);
+//		LambdaQueryWrapper<SysUser> query1 = new LambdaQueryWrapper<SysUser>();
+//		query1.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
+//		List<SysUser> list1 = sysUserServiceImpl.list(query1);
 		List<SysDepart> list3 = new ArrayList<SysDepart>();
 
-		for(SysUser o:list1){
-			if(o.getDepartIds() != null){
-				String[] dep = o.getDepartIds().split(",");
+		for(Map<String ,Object> o:userMap){
+			String err = "";
+			if(o.get("errornum")!=null){
+				err = o.get("errornum").toString();
+			}else{
+				err = "0";
+			}
+			if(o.get("departids") != null){
+				String[] dep = o.get("departids").toString().split(",");
 				for(String a:dep){
 
 					SysDepart sysDepart = new SysDepart();
-					sysDepart.setId(o.getId());
+					sysDepart.setId(o.get("username").toString());
 					sysDepart.setParentId(a);
-					sysDepart.setDepartName(o.getRealname());
+					sysDepart.setDepartName(o.get("realname").toString()+"("+err+")");
 
 					for(SysDictItem i:dictList){
 
-						if(o.getCategory() != null && i.getItemValue().equals(o.getCategory().toString())){
+						if(o.get("category") != null && i.getItemValue().equals(o.get("category").toString())){
 							sysDepart.setOrgCode(i.getItemValue());
 							sysDepart.setOrgType(i.getItemText());
 						}

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

@@ -1,20 +1,22 @@
 package org.jeecg.modules.viewClockIn.controller;
 
+import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import io.netty.util.internal.StringUtil;
+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.DateUtils;
 import org.jeecg.modules.geke.attendance.entity.Attendance;
 import org.jeecg.modules.geke.attendance.service.IAttendanceService;
@@ -85,60 +87,151 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 	 }
 
 	 @RequestMapping(value = "/jiaozhun", method = RequestMethod.PUT)
-	 public String jiaozhun(@RequestBody JSONObject jsonObject) throws ParseException {
+	 public Result<?> jiaozhun(@RequestBody JSONObject jsonObject) throws ParseException {
 
 	 	if(jsonObject.get("shiftTimeS") == null || jsonObject.get("shiftTimeX") == null){
-			return "没有排班,无需校准打卡时间";
+//			return "没有排班,无需校准打卡时间";
+			return Result.error("没有排班,无需校准打卡时间!");
 		}
-		 DateFormat sdf = new SimpleDateFormat("YYYY-DD-MM mm:dd:ss");
+		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		 DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		 Attendance attendance = new Attendance();
 		 String shiftTimeS = jsonObject.get("shiftTimeS").toString();
+		 String shiftTimeX = jsonObject.get("shiftTimeX").toString();
 		 String username = jsonObject.get("username").toString();
 		 attendance.setUserId(username);
+		 attendance.setNotes("手工校准"+user.getRealname());
 		 attendance.setUserDate(sdf.parse(shiftTimeS));
 		 attendance.setCheckinType("上班打卡");
 		 attendance.setExceptionType("正常");
+//		 if(jsonObject.get("setInfo") != null){
+//			 attendance.setSetInfo(jsonObject.get("setInfo").toString());
+//		 }
+
 		 attendanceService.save(attendance);
 		 Attendance attendance2 = new Attendance();
+//		 if(jsonObject.get("setInfo") != null){
+//		 	attendance2.setSetInfo(jsonObject.get("setInfo").toString());
+//		 }
+		 attendance2.setNotes("手工校准"+user.getRealname());
 		 attendance2.setUserId(username);
-		 attendance2.setUserDate(sdf.parse(shiftTimeS));
+		 attendance2.setUserDate(sdf.parse(shiftTimeX));
 		 attendance2.setCheckinType("下班打卡");
 		 attendance2.setExceptionType("正常");
 		 attendanceService.save(attendance2);
-		 return "校准成功";
+		 return Result.OK("校准成功!");
+//		 return "校准成功";
 
 	 }
 
 	 public static void main(String[] args) throws ParseException {
-		 DateFormat sdf = new SimpleDateFormat("YYYY-DD-MM mm:dd:ss");
-		 System.out.println(sdf.parse("2021-12-12 20:12:12"));
+
+	 	String st = "sdfsdfsddf";
+	 	String[] s = st.split("(");
+		 System.out.println(DateUtils.getNYTime());
+//		 DateFormat sdf = new SimpleDateFormat("YYYY-DD-MM HH:dd:ss");
+//		 System.out.println(sdf.parse("2021-12-12 20:12:12"));
+	 }
+
+	 @RequestMapping(value = "/syMonthReport", method = RequestMethod.PUT)
+	 public Result<?> syMonthReport(@RequestBody JSONObject jsonObject) {
+
+		 String viewDate = jsonObject.getString("viewDate");
+		 String ids = jsonObject.getString("ids");
+		 String[] userId = ids.split(",");
+
+//		 List<bdClockinMonth> list = bdClockinMonthService.selectAllByMonth(viewDate,userId);
+		 	try {
+				String err = bdClockinMonthService.reportIntoU8Job(viewDate,userId);
+				if(StringUtil.isNullOrEmpty(err)){
+					return Result.error(err);
+				}
+			}catch (Exception e){
+				return Result.error(e.getMessage());
+			}
+
+		 return Result.OK("true");
 	 }
 
 	 @RequestMapping(value = "/monthReport", method = RequestMethod.PUT)
-	 public String monthReport(@RequestBody JSONObject jsonObject) {
+	 public Result<?> monthReport(@RequestBody JSONObject jsonObject) {
 
 		 try {
-
+		 	 Map<String,String> map = new HashMap<>();
 			 String nowDate = jsonObject.getString("nowDate");
+			 String[] date = nowDate.split("-");
+			 String userIds = jsonObject.getString("userIds");
+			 List<String> userList = new ArrayList<>();
+			 if(!StringUtil.isNullOrEmpty(userIds)){
+				 String[] userId = userIds.split(",");
+				 for(String o:userId){
+					String[] arr = o.split("&");
+					if(arr.length > 0){
+						if(map.containsKey(arr[0])){
+							continue;
+						}
+						userList.add(arr[0]);
+						map.put(arr[0],"");
+					}
+				 }
+			 }
 
-			 List<bdClockinMonth> list = bdClockinMonthService.selectByMonth(nowDate);
+			 List<bdClockinMonth> list = bdClockinMonthService.selectByMonth(nowDate,userList);
 
 			 if(list.size() == 0){
-				 return "当前月份没有考勤数据,无法生成月报";
+				 return Result.error("当前月份没有考勤数据,无法生成月报!");
 			 }
 
-			 bdClockinMonthService.deleteByMonth(nowDate);
+			 bdClockinMonthService.deleteByMonth(nowDate,userList);
 			 for(bdClockinMonth o:list){
+			 	o.setMonthTime(nowDate);
+			 	o.setYears(date[0]);
+			 	o.setMonths(date[1]);
+
+				o.setWorkDay("21.75");
+				//是否免打卡 1免打卡
+				if(StringUtil.isNullOrEmpty(o.getIsAttendance()) && o.getIsAttendance().equals("1")){
+					 o.setWorkDayReal("21.75");//真实考勤天数
+				}else{
+					BigDecimal workDay = new BigDecimal("21.75");
+					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()));
+					}
+					o.setWorkDayReal(workDay.toString());//真实考勤天数
+
+				}
+
 				 bdClockinMonthService.save(o);
 			 }
 
 		 } catch (Exception e) {
 			 log.error(e.getMessage(), e);
-			 return "月报生成失败,请稍后再试";
+			 return Result.error("月报生成失败,请稍后再试!");
 		 }
-
-	 	return "true";
+		 return Result.OK("true");
 	 }
+
+
+//	 @RequestMapping(value = "/list1111111", method = RequestMethod.GET)
+//	 public Result<Page<ViewClockIn>> queryPageList(ViewClockIn sysAnnouncement,
+//														@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+//														@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+//														HttpServletRequest req) {
+//		 Result<Page<ViewClockIn>> result = new Result<Page<ViewClockIn>>();
+//		 Page<ViewClockIn> pageList = new Page<ViewClockIn>(pageNo,pageSize);
+//		 pageList = viewClockInService.selectPage(pageList);//
+//		 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;
+//	 }
+
 	/**
 	 * 分页列表查询
 	 *
@@ -162,7 +255,8 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 		LambdaQueryWrapper<ViewClockIn> query = new LambdaQueryWrapper<ViewClockIn>();
 
 		if(userName != null && userName != ""){
-			query.eq(ViewClockIn::getRealname,userName);//姓名
+			String[] s = userName.split("(");
+			query.eq(ViewClockIn::getRealname,s[0]);//姓名
 		}
 		if(mDate != null && mDate != ""){
 			query.eq(ViewClockIn::getHeadMonth,mDate);//月份
@@ -186,7 +280,10 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 		if(beginViewDate != null && beginViewDate != "" && !beginViewDate.equals("1")){
 			query.between(ViewClockIn::getViewDate,beginViewDate,endViewDate);
 		}
-		query.orderByDesc(ViewClockIn::getViewDate);
+		if(beginViewDate.equals("1") && mDate == null && viewClockIn.getViewDate() == null){
+			query.eq(ViewClockIn::getHeadMonth,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);

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

@@ -0,0 +1,9 @@
+package org.jeecg.modules.viewClockIn.entity;
+
+public class NumEntity {
+
+    private String departname;//年度
+    private String usernum;//年度
+    private String errornum;//年度
+
+}

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

@@ -27,7 +27,10 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @Accessors(chain = true)
 @ApiModel(value="view_clock_in_1对象", description="员工考勤日报")
 public class ViewClockIn {
+	@TableField(exist = false)
+	private String allDate;//当月所有日期
 
+	private String pkId;//临时主键 (例:100131&2021-12-01)
 	/**真实姓名*/
 	@Excel(name = "真实姓名", width = 15)
     @ApiModelProperty(value = "真实姓名")
@@ -149,5 +152,9 @@ public class ViewClockIn {
 	 * 1付薪,2累计调休,3忽略
 	 */
 	private String setInfo;
+	/**
+	 * 当日打卡次数
+	 */
+	private String attendanceCount;
 
 }

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

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import lombok.NonNull;
 import lombok.experimental.Accessors;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -28,6 +29,28 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @ApiModel(value="bd_clockin_month对象", description="考勤月报")
 public class bdClockinMonth {
 
+//	@TableField(exist = false)
+	private String basePay;//基本工资1
+	private String basePay_2;//
+	private String wagesBase;//缴交基数1
+	private String wagesBase_2;//
+	private String security;//社保基数1
+	private String security_2;//
+	private String workDay;//考勤天数1
+	private String workDay_2;//
+	private String workDayReal;//实际考勤天数1
+	private String workDayReal_2;//
+	private String duration;//本月加班时长(小时)1
+	private String duration_2;//
+	private String holidayTimeBj;//本月请假时长(病假天数)1
+	private String holidayTimeBj_2;//
+	private String holidayTimeSj;//本月请假时长(事假小时)1
+	private String holidayTimeSj_2;//
+
+	private String isAttendance;//免打卡 (0打卡,1免打卡)
+	private String isSalary;//是否算薪(0是,1否)
+	private String syFund;//公积金账号
+
 	private String years;//年度
 
 	private String months;//月份
@@ -69,22 +92,6 @@ public class bdClockinMonth {
 	@Excel(name = "本月早退分钟数", width = 15)
     @ApiModelProperty(value = "本月早退分钟数")
 	private Integer latetimeX;
-	/**本月加班时长*/
-	@Excel(name = "本月加班时长", width = 15)
-    @ApiModelProperty(value = "本月加班时长")
-	private Integer duration;
-	/**本月请假时长(默认小时)*/
-	@Excel(name = "本月请假时长(默认小时)", width = 15)
-    @ApiModelProperty(value = "本月请假时长(默认小时)")
-	private String holidayTime;
-	/**请假类型*/
-	@Excel(name = "请假类型", width = 15)
-    @ApiModelProperty(value = "请假类型")
-	private String holidayType;
-	/**应到天数*/
-	@Excel(name = "应到天数", width = 15)
-    @ApiModelProperty(value = "应到天数")
-	private Integer shouldDays;
 
 	/**创建人*/
 	@Excel(name = "创建人", width = 15)

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

@@ -21,16 +21,16 @@ public interface bdClockinMonthMapper extends BaseMapper<bdClockinMonth> {
      * @param nowDate
      * @return
      */
-    public List<bdClockinMonth> selectByMonth(String nowDate);
+    public List<bdClockinMonth> selectByMonth(@Param("nowDate") String nowDate,@Param("userId")List<String> userId);
 
     /**
      * 查询所有未同步到u8的数据
      * @param nowDate
      * @return
      */
-    public List<bdClockinMonth> selectAllByMonth(String nowDate);
+    public List<bdClockinMonth> selectAllByMonth(@Param("nowDate") String nowDate,@Param("userId") String[] userId);
 
-    int deleteByMonth(String nowDate);
+    int deleteByMonth(@Param("nowDate") String nowDate,@Param("userId")List<String> userId);
 
     @DS("multi-datasource1")
     List<Map<String,Object>> selectTest();

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

@@ -1,9 +1,12 @@
 package org.jeecg.modules.viewClockIn.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.viewClockIn.entity.NumEntity;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 员工考勤日报
@@ -15,4 +18,9 @@ public interface viewClockInMapper extends BaseMapper<ViewClockIn> {
 
     int fuXinInfo(String st,String userId,String viewDate);
 
+    List<Map<String,Object>> selectErrorNum(String viewDate);
+
+    List<Map<String,Object>> selectUserError(String viewDate);
+
+    List<ViewClockIn> selectPage(Page<ViewClockIn> page);
 }

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

@@ -2,9 +2,57 @@
 <!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="selectByMonth"  resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
+    <select id="selectByMonth" parameterType="java.util.List" resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
 
+        select c.sy_fund,c.is_salary,c.is_attendance,c.id personId,c.work_no personCode,c.realname personName,c.depart_ids,c.wages_one basePay,
+               c.wages_two,c.security,c.wages_base,B.duration
+             ,sj.holiday_time_sj,bj.holiday_time_bj
+        from sys_user C left join  (
         select a.view_date monthTime,a.years,a.months,a.realname personName,a.user_id personId,a.username personCode,
+        sum(a.lateTime_s) latetimeS,sum(a.lateTime_x) latetimeX ,sum(a.duration) duration,sum(a.sj_time) holidayTime
+        from (
+        select realname,user_id,username,DATE_FORMAT(view_date,'%Y-%m') view_date,
+        DATE_FORMAT(view_date,'%Y') years,
+        DATE_FORMAT(view_date,'%m') months,
+        case
+        when lateTime_s &lt; 0 then 0
+        else lateTime_s
+        end lateTime_s,
+        case
+        when lateTime_x &lt; 0 then 0
+        else lateTime_x
+        end lateTime_x,
+        case when set_info ='付薪' then duration else 0 end
+        duration,
+        TIMESTAMPDIFF(hour,holiday_start_date,holiday_end_date)/24 sj_time,
+        holiday_type,holiday_start_date,holiday_end_date from view_clock_in_1
+        where DATE_FORMAT(view_date,'%Y-%m') = #{nowDate}
+        ) as a
+        group by a.realname,a.user_id,a.username,a.view_date,a.years,a.months
+        ) B on C.ID = B.personId
+
+        left join (
+        select sum(TIMESTAMPDIFF(hour,start_date,end_date)) holiday_time_sj,user_id
+        from geke_vacation_body where holiday_type='事假' and DATE_FORMAT(start_date,'%Y-%m') = #{nowDate}
+        group by user_id
+        ) sj on sj.user_id = C.id
+        left join (
+        select TIMESTAMPDIFF(hour,start_date,end_date)/24 holiday_time_bj,user_id
+        from geke_vacation_body where holiday_type='病假' and DATE_FORMAT(start_date,'%Y-%m') = #{nowDate}
+        group by user_id
+        ) bj on bj.user_id = C.id
+
+        where C.del_flag='0' and C.info_sy in(2,3)
+        and c.employment_status = '10'
+          <if test="userId != null and userId != '' and userId.size >0">
+              and C.id in(
+              <foreach collection="userId" item="item" index="index" separator=",">
+                  #{item}
+              </foreach>
+              )
+          </if>
+
+<!--        select a.view_date monthTime,a.years,a.months,a.realname personName,a.user_id personId,a.username personCode,
             sum(a.lateTime_s) latetimeS,sum(a.lateTime_x) latetimeX ,sum(a.duration) duration,sum(a.sj_time) holidayTime
             from (
                 select realname,user_id,username,DATE_FORMAT(view_date,'%Y-%m') view_date,
@@ -19,22 +67,36 @@
                     else lateTime_x
                 end lateTime_x,
                 duration,
-                <!-- MAX(CASE `holiday_type` WHEN '事假' THEN TIMESTAMPDIFF(day,holiday_start_date,holiday_end_date) ELSE 0 END) as 'sj_time',-->
                 TIMESTAMPDIFF(day,holiday_start_date,holiday_end_date) sj_time,
                 holiday_type,holiday_start_date,holiday_end_date from view_clock_in_1
                 where DATE_FORMAT(view_date,'%Y-%m') = #{nowDate}
             ) as a
         group by a.realname,a.user_id,a.username,a.view_date,a.years,a.months
-
+-->
     </select>
 
     <select id="selectAllByMonth"  resultType="org.jeecg.modules.viewClockIn.entity.bdClockinMonth">
         select * from
-               bd_clockin_month where sy_u8 = 0 and month_time = #{nowDate}
+               bd_clockin_month where sy_u8 = 0 and is_salary ='0' and month_time = #{nowDate}
+        <if test="userId != null and userId != '' and userId.length >0">
+            and id in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
     </select>
 
     <delete id="deleteByMonth">
         delete from bd_clockin_month where month_time = #{nowDate}
+        <if test="userId != null and userId != '' and userId.size >0">
+            and person_id in(
+            <foreach collection="userId" item="item" index="index" separator=",">
+                #{item}
+            </foreach>
+            )
+        </if>
+
     </delete>
 
     <select id="selectTest" resultType="Map">
@@ -42,11 +104,18 @@
     </select>
     
     <insert id="insertU8WaGZData" parameterType="java.util.List" useGeneratedKeys="false">
-        insert into WA_GZData (cGZGradeNum,cPsn_Num ,cPsn_Name ,iYear,iMonth,cDept_Num )
+        insert into WA_GZData
+            (cGZGradeNum,<!--工资类别号-->
+             cPsn_Num ,<!--人员编码 -->
+             cPsn_Name ,<!--人员姓名-->
+             iYear,<!--工资年份 -->
+             iMonth,<!--工资月份 -->
+             cDept_Num<!--部门编码 -->
+            )
         values
         <foreach collection="list" item="item" index="index" separator=",">
             (
-               '1',
+               '001',
                #{item.personCode},
                #{item.personName},
                #{item.years},

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

@@ -2,9 +2,72 @@
 <!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.viewClockInMapper">
 
+  <!--  <select id="selectPage" resultType = "org.jeecg.modules.viewClockIn.entity.ViewClockIn">
+
+        select * from
+
+            (SELECT
+                 all_date
+             FROM
+                 (
+                     SELECT
+                         DATE_FORMAT( DATE_SUB( last_day('2022-01-1'), INTERVAL xc - 1 DAY ), '%Y-%m-%d' ) AS all_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.all_date >= (SELECT date_add('2022-01-1', INTERVAL - DAY ( '2022-01-1')+ 1 DAY ))
+            ) a
+
+                left join  view_clock_in_1 b on a.all_date = b.view_date
+        order by  a.all_date
+    </select>
+-->
     <update id="fuXinInfo">
-        update geke_attendance set set_info = #{st}
-        where user_id =#{userId} and date_format( user_date, '%Y-%m-%d' ) = #{viewDate}
+       <!-- 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}
+        where person =#{userId} and date_format( begin_date, '%Y-%m-%d' ) = #{viewDate}
     </update>
+
+    <select id="selectErrorNum"  resultType="Map">
+
+        select a.depart_name departname,a.usernum,c.errornum from view_user_num A
+        left join (
+        select A.depart_name,count(b.username) errornum from sys_depart A left join (
+        select b.username,b.depart_names from view_clock_in_1 b
+        where DATE_FORMAT(b.view_date,'%Y-%m') = #{viewDate}
+        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '')
+        and (b.set_info is null or b.set_info = '')
+        group by b.username,b.depart_names
+
+        ) B on find_in_set(A.depart_name , B.depart_names)
+        group by A.depart_name
+        ) C on A.depart_name = C.depart_name
+
+
+    </select>
+
+
+    <select id="selectUserError" resultType="Map">
+
+        select a.username,a.realname,a.depart_ids departids,a.category,b.errornum from sys_user A left join (
+        select b.username,count(1) as errornum from view_clock_in_1 b
+        where DATE_FORMAT(b.view_date,'%Y-%m') = #{viewDate}
+        and (b.lateTime_s &lt; 0 or b.lateTime_x > 0 || b.shift_real_time_s is null || b.shift_real_time_s = '')
+        and (b.set_info is null or b.set_info = '')
+        group by b.username
+        ) B
+        on a.username = b.username
+
+
+    </select>
 </mapper>

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

@@ -16,11 +16,11 @@ import java.util.Map;
  */
 public interface IbdClockinMonthService extends IService<bdClockinMonth> {
 
-    List<bdClockinMonth> selectByMonth(String nowDate);
+    List<bdClockinMonth> selectByMonth(String nowDate,List<String> userId);
 
-    List<bdClockinMonth> selectAllByMonth(String nowDate);
+    List<bdClockinMonth> selectAllByMonth(String nowDate,String[] userId);
 
-    int deleteByMonth(String nowDate);
+    int deleteByMonth(String nowDate,List<String> userId);
 
     List<Map<String,Object>> selectTest();
 
@@ -28,5 +28,5 @@ public interface IbdClockinMonthService extends IService<bdClockinMonth> {
 
     int updateSy(List<bdClockinMonth> list);
 
-    void reportIntoU8Job(String nowDate);
+    String reportIntoU8Job(String nowDate,String[] ids);
 }

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.viewClockIn.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -12,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IviewClockInService extends IService<ViewClockIn> {
 
     public int fuXinInfo(String st, String userId, String viewDate);
+
+    public Page<ViewClockIn> selectPage(Page<ViewClockIn> page);
 }

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

@@ -25,16 +25,16 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
     @Autowired
     private bdClockinMonthMapper clockinMonthMapper;
 
-    public List<bdClockinMonth> selectByMonth(String nowDate){
-        return clockinMonthMapper.selectByMonth(nowDate);
+    public List<bdClockinMonth> selectByMonth(String nowDate,List<String> userId){
+        return clockinMonthMapper.selectByMonth(nowDate,userId);
     }
 
-    public List<bdClockinMonth> selectAllByMonth(String nowDate){
-        return clockinMonthMapper.selectAllByMonth(nowDate);
+    public List<bdClockinMonth> selectAllByMonth(String nowDate,String[] userId){
+        return clockinMonthMapper.selectAllByMonth(nowDate,userId);
     }
 
-    public int deleteByMonth(String nowDate){
-        return clockinMonthMapper.deleteByMonth(nowDate);
+    public int deleteByMonth(String nowDate,List<String> userId){
+        return clockinMonthMapper.deleteByMonth(nowDate,userId);
     }
 
     public List<Map<String,Object>> selectTest(){
@@ -53,14 +53,18 @@ public class bdClockinMonthServiceImpl extends ServiceImpl<bdClockinMonthMapper,
      * 定时任务,同步月报至u8
      * @param nowDate
      */
-    public void reportIntoU8Job(String nowDate){
-        List<bdClockinMonth> list = clockinMonthMapper.selectAllByMonth(nowDate);//获取当月要同步的数据
+    public String reportIntoU8Job(String nowDate,String[] arr){
+        List<bdClockinMonth> list = clockinMonthMapper.selectAllByMonth(nowDate,arr);//获取当月要同步的数据
         if(list.size() > 0){
             int st = clockinMonthMapper.insertU8WaGZData(list);//插入u8数据库表WA_GZData
             if(st != 0){
                 clockinMonthMapper.updateSy(list);//更新月报同步状态
             }
+        }else{
+            return "所选条件,无匹配数据上传";
         }
+
+        return "";
     }
 
 }

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.viewClockIn.service.impl;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.viewClockIn.entity.ViewClockIn;
 import org.jeecg.modules.viewClockIn.mapper.viewClockInMapper;
 import org.jeecg.modules.viewClockIn.service.IviewClockInService;
@@ -24,4 +25,8 @@ public class viewClockInServiceImpl extends ServiceImpl<viewClockInMapper, ViewC
         return viewClockInMapper1.fuXinInfo(st,userId,viewDate);
     }
 
+//    @Override
+    public Page<ViewClockIn> selectPage(Page<ViewClockIn> page) {
+        return page.setRecords(viewClockInMapper1.selectPage(page));
+    }
 }