v9:增加考勤模块
This commit is contained in:
parent
7ae14cac37
commit
1830be2b65
|
@ -98,6 +98,12 @@ public class Constant {
|
|||
public static final String DEVICE_FLAG_2D = "0";
|
||||
public static final String DEVICE_FLAG_3D = "1";
|
||||
|
||||
//上班状态0缺卡1正常2迟到 下班状态0缺卡1正常3早退
|
||||
public static final int CHECK_QUEKA =0;
|
||||
public static final int CHECK_OK =1;
|
||||
public static final int CHECK_CHIDAO =2;
|
||||
public static final int CHECK_ZAOTUI =3;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.shapelight.common.utils;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -71,4 +72,9 @@ public class MyDateUtils {
|
|||
calendar2.set(Calendar.DAY_OF_MONTH, calendar2.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
return sdf.format(calendar2.getTime())+" 23:59:59";
|
||||
}
|
||||
|
||||
public static int getSeconds(Time time){
|
||||
int sec = time.getHours() * 3600 + time.getMinutes()*60 + time.getSeconds();
|
||||
return sec;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ public class HttpApiController {
|
|||
private TenCellDeptService tenCellDeptService;
|
||||
@Autowired
|
||||
private TenLabelService tenLabelService;
|
||||
@Autowired
|
||||
private TenCheckService tenCheckService;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -744,6 +746,14 @@ public class HttpApiController {
|
|||
|
||||
// log.info("保存记录:----------------------"+record.getRecordTime()+"-"+record.getMemberId().intValue());
|
||||
tenRecordService.saveForFace(record);
|
||||
|
||||
// 考勤记录,没有删除的人记录考勤
|
||||
TenPersonEntity memberEntity = tenPersonService.getById(personId,deviceEntity.getCellId());
|
||||
if(memberEntity!=null){
|
||||
if(memberEntity.getDeleteFlag().intValue() == 0){
|
||||
tenCheckService.saveCheck(memberEntity,record);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ public class DeviceApiServiceImpl implements DeviceApiService {
|
|||
private MinioConfig minioConfig;
|
||||
@Autowired
|
||||
private MinioClient minioClient;
|
||||
@Autowired
|
||||
private TenCheckService tenCheckService;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -575,6 +577,14 @@ public class DeviceApiServiceImpl implements DeviceApiService {
|
|||
// log.info("保存记录:----------------------"+record.getRecordTime()+"-"+record.getMemberId().intValue());
|
||||
tenRecordService.saveForFace(record);
|
||||
|
||||
// 考勤记录,没有删除的人记录考勤
|
||||
TenPersonEntity memberEntity = tenPersonService.getById(personId,cellEntity.getCellId());
|
||||
if(memberEntity!=null){
|
||||
if(memberEntity.getDeleteFlag().intValue() == 0){
|
||||
tenCheckService.saveCheck(memberEntity,record);
|
||||
}
|
||||
}
|
||||
|
||||
Result res = new Result();
|
||||
String resContent = JSONObject.toJSONString(res);
|
||||
MyMessage message = new MyMessage(CmdConstant.CMD_UPRECORD,resContent.getBytes().length,resContent.getBytes());
|
||||
|
|
|
@ -0,0 +1,539 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.config.GlobalValue;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.ten.entity.TenCheckEntity;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRecordEntity;
|
||||
import net.shapelight.modules.ten.service.TenCheckScheduleService;
|
||||
import net.shapelight.modules.ten.service.TenCheckService;
|
||||
import net.shapelight.modules.ten.service.TenRecordService;
|
||||
import net.shapelight.modules.ten.vo.AttendanceDayVo;
|
||||
import net.shapelight.modules.ten.vo.TenCheckMemberCountVo;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("ten/check")
|
||||
@Api(value="考勤记录",tags={"考勤记录"})
|
||||
@Slf4j
|
||||
public class TenCheckController extends AbstractController {
|
||||
@Autowired
|
||||
private TenCheckService tenCheckService;
|
||||
@Autowired
|
||||
private TenRecordService tenRecordService;
|
||||
@Autowired
|
||||
private TenCheckScheduleService tenCheckScheduleService;
|
||||
@Autowired
|
||||
private HttpServletResponse response;
|
||||
@Autowired
|
||||
private GlobalValue globalValue;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "考勤记录列表",response = TenCheckEntity.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="memberName",value = "姓名",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="memberId",value = "姓名id",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="checkDay",value = "星期",paramType = "query",dataType = "String",required = true),
|
||||
|
||||
})
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
params.put("tenantId",getUser().getTenantId());
|
||||
PageUtils page = tenCheckService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 考勤详细信息,所有考勤识别记录
|
||||
*/
|
||||
@GetMapping("/checkDetail/{checkId}")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "考勤详细信息,所有考勤识别记录",response = TenRecordEntity.class)
|
||||
public R checkDetail(@PathVariable("checkId") Long checkId){
|
||||
Long tenantId = getUser().getTenantId();
|
||||
TenCheckEntity tenCheck = tenCheckService.getById(checkId);
|
||||
// List<Long> recordIds = new ArrayList<>();
|
||||
List<TenCheckScheduleEntity> csList = tenCheckScheduleService.list(
|
||||
new QueryWrapper<TenCheckScheduleEntity>()
|
||||
.eq("check_id",tenCheck.getCheckId())
|
||||
);
|
||||
List<TenRecordEntity> records = new ArrayList<>();
|
||||
for(TenCheckScheduleEntity ss: csList){
|
||||
// recordIds.add(ss.getDutyOnRecordId());
|
||||
// recordIds.add(ss.getDutyOffRecordId());
|
||||
if (ss.getDutyOnRecordId()!=null) {
|
||||
TenRecordEntity recordEntityOn = tenRecordService.getById(ss.getDutyOnRecordId(),tenantId);
|
||||
if (recordEntityOn!=null) {
|
||||
records.add(recordEntityOn);
|
||||
}
|
||||
}
|
||||
if(ss.getDutyOffRecordId()!=null){
|
||||
TenRecordEntity recordEntityOff = tenRecordService.getById(ss.getDutyOffRecordId(),tenantId);
|
||||
if(recordEntityOff!=null){
|
||||
records.add(recordEntityOff);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// for(TenRecordEntity recordEntity: records){
|
||||
// recordEntity.setRgb(recordEntity.getRgb());
|
||||
// }
|
||||
// List<TenRecordEntity> records = new ArrayList<>();
|
||||
return R.ok().put("data", records);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 日考勤统计
|
||||
*/
|
||||
@GetMapping("/attendanceDayList")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "日考勤统计",response = AttendanceDayVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnt",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R attendanceDayList(@RequestParam Map<String, Object> params){
|
||||
params.put("tenantId",getUser().getTenantId());
|
||||
PageUtils page = tenCheckService.attendanceDayPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 考勤人员统计
|
||||
*/
|
||||
@GetMapping("/checkMemberCount")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "考勤人员统计",response = TenCheckMemberCountVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="memberName",value = "姓名",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnt",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
|
||||
})
|
||||
public R checkMemberCount(@RequestParam Map<String, Object> params){
|
||||
params.put("tenantId",getUser().getTenantId());
|
||||
PageUtils page = tenCheckService.findCheckMemberCount(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询正常签到
|
||||
*/
|
||||
@GetMapping("/detailDutyOnOk")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "查询正常签到",response = TenCheckScheduleEntity.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="memberId",value = "姓名Id",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
// @ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R detailDutyOnOk(@RequestParam Map<String, Object> params){
|
||||
|
||||
params.put("status", Constant.CHECK_OK);
|
||||
List<TenCheckScheduleEntity> onOK = tenCheckService.findDutyOnInfo(params);
|
||||
for(TenCheckScheduleEntity schedule: onOK){
|
||||
TenCheckEntity check = tenCheckService.getById(schedule.getCheckId());
|
||||
check.setRgb(check.getRgb());
|
||||
schedule.setCheckEntity(check);
|
||||
schedule.setCheckTime(schedule.getDutyOnTime());
|
||||
schedule.setStatusInfo(schedule.getDutyOnStatusInfo());
|
||||
}
|
||||
return R.ok().put("data",onOK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询正常签退
|
||||
*/
|
||||
@GetMapping("/detailDutyOffOk")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "查询正常签退",response = TenCheckMemberCountVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="memberId",value = "姓名Id",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
// @ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R detailDutyOffOk(@RequestParam Map<String, Object> params){
|
||||
|
||||
params.put("status", Constant.CHECK_OK);
|
||||
List<TenCheckScheduleEntity> offOk = tenCheckService.findDutyOffInfo(params);
|
||||
for(TenCheckScheduleEntity schedule: offOk){
|
||||
TenCheckEntity check = tenCheckService.getById(schedule.getCheckId());
|
||||
check.setRgb(check.getRgb());
|
||||
schedule.setCheckEntity(check);
|
||||
schedule.setCheckTime(schedule.getDutyOffTime());
|
||||
schedule.setStatusInfo(schedule.getDutyOffStatusInfo());
|
||||
}
|
||||
return R.ok().put("data",offOk);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询迟到
|
||||
*/
|
||||
@GetMapping("/detailDutyLate")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "查询迟到",response = TenCheckMemberCountVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="memberId",value = "姓名Id",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
// @ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R detailDutyLate(@RequestParam Map<String, Object> params){
|
||||
|
||||
params.put("status", Constant.CHECK_CHIDAO);
|
||||
List<TenCheckScheduleEntity> onLate = tenCheckService.findDutyOnInfo(params);
|
||||
for(TenCheckScheduleEntity schedule: onLate){
|
||||
TenCheckEntity check = tenCheckService.getById(schedule.getCheckId());
|
||||
check.setRgb(check.getRgb());
|
||||
schedule.setCheckEntity(check);
|
||||
schedule.setCheckTime(schedule.getDutyOnTime());
|
||||
schedule.setStatusInfo(schedule.getDutyOnStatusInfo());
|
||||
}
|
||||
return R.ok().put("data",onLate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询早退
|
||||
*/
|
||||
@GetMapping("/detailDutyEarly")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation(value = "查询早退",response = TenCheckMemberCountVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="memberId",value = "姓名Id",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
// @ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R detailDutyEarly(@RequestParam Map<String, Object> params){
|
||||
|
||||
params.put("status", Constant.CHECK_ZAOTUI);
|
||||
List<TenCheckScheduleEntity> onEarly = tenCheckService.findDutyOffInfo(params);
|
||||
for(TenCheckScheduleEntity schedule: onEarly){
|
||||
TenCheckEntity check = tenCheckService.getById(schedule.getCheckId());
|
||||
check.setRgb(check.getRgb());
|
||||
schedule.setCheckEntity(check);
|
||||
schedule.setCheckTime(schedule.getDutyOffTime());
|
||||
schedule.setStatusInfo(schedule.getDutyOffStatusInfo());
|
||||
|
||||
}
|
||||
return R.ok().put("data",onEarly);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下载考勤统计
|
||||
*/
|
||||
@GetMapping("/checkMemberExcel")
|
||||
@RequiresPermissions("ten:check:list")
|
||||
@ApiOperation("下载考勤统计")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="memberName",value = "姓名",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptId",value = "部门id多个,逗号隔开",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="jobNumber",value = "工号",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateStart",value = "日期开始",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="dateEnd",value = "日期结束",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="deptName",value = "部门名称",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public void checkMemberExcel(@RequestParam Map<String, Object> params) {
|
||||
String deptName = (String)params.get("deptName");
|
||||
String startTime = (String)params.get("dateStart");
|
||||
String endTime = (String)params.get("dateEnd");
|
||||
params.put("tenantId",getUser().getTenantId());
|
||||
|
||||
List<TenCheckMemberCountVo> dataList = tenCheckService.findCheckMemberCountList(params);
|
||||
|
||||
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN);//上边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN);//右边框
|
||||
|
||||
|
||||
HSSFCellStyle biaoTi1 = workbook.createCellStyle();
|
||||
biaoTi1.setAlignment(HorizontalAlignment.CENTER); // 居中
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setFontName("宋体");
|
||||
font.setFontHeightInPoints((short) 14);// 字体大小
|
||||
font.setBold(true);
|
||||
biaoTi1.setFont(font);
|
||||
|
||||
|
||||
HSSFCellStyle biaoTi2 = workbook.createCellStyle();
|
||||
HSSFFont font2 = workbook.createFont();
|
||||
font2.setFontName("宋体");
|
||||
font2.setFontHeightInPoints((short) 11);// 字体大小
|
||||
font2.setBold(true);
|
||||
biaoTi2.setFont(font2);
|
||||
|
||||
|
||||
HSSFCellStyle biaoTi3 = workbook.createCellStyle();
|
||||
biaoTi3.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
biaoTi3.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
biaoTi3.setBorderTop(BorderStyle.THIN);//上边框
|
||||
biaoTi3.setBorderRight(BorderStyle.THIN);//右边框
|
||||
biaoTi3.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.index);
|
||||
biaoTi3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
|
||||
HSSFCellStyle juzhong = workbook.createCellStyle();
|
||||
//垂直居中
|
||||
juzhong.setVerticalAlignment(juzhong.getVerticalAlignmentEnum().CENTER);
|
||||
|
||||
|
||||
HSSFCellStyle biaoTiRiQi = workbook.createCellStyle();
|
||||
biaoTiRiQi.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
biaoTiRiQi.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
biaoTiRiQi.setBorderTop(BorderStyle.THIN);//上边框
|
||||
biaoTiRiQi.setBorderRight(BorderStyle.THIN);//右边框
|
||||
biaoTiRiQi.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.index);
|
||||
biaoTiRiQi.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
|
||||
HSSFSheet sheet = workbook.createSheet("考勤统计");
|
||||
//第一行
|
||||
HSSFRow row1 = sheet.createRow(0);
|
||||
//第一单元格
|
||||
HSSFCell cell = row1.createCell(0);
|
||||
//设置单元格内容
|
||||
cell.setCellValue("考勤统计");
|
||||
//合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列
|
||||
// 合并单元格
|
||||
CellRangeAddress cellRangeBiaoti = new CellRangeAddress(0, 0, 0, 10); // 起始行, 终止行, 起始列, 终止列
|
||||
sheet.addMergedRegion(cellRangeBiaoti);
|
||||
cell.setCellStyle(biaoTi1);
|
||||
|
||||
|
||||
// 第二行
|
||||
HSSFRow row2 = sheet.createRow(1);
|
||||
//创建单元格并设置单元格内容
|
||||
HSSFCell cellProjectName = row2.createCell(0);
|
||||
cellProjectName.setCellValue("部门:" + deptName);
|
||||
cellProjectName.setCellStyle(biaoTi2);
|
||||
|
||||
// 第三行
|
||||
HSSFRow row3 = sheet.createRow(2);
|
||||
//创建单元格并设置单元格内容
|
||||
HSSFCell cellDateUnit = row3.createCell(0);
|
||||
cellDateUnit.setCellValue("时间段:" + startTime + " - " + endTime);
|
||||
cellDateUnit.setCellStyle(biaoTi2);
|
||||
|
||||
// 第四行
|
||||
HSSFRow row4 = sheet.createRow(3);
|
||||
//创建单元格并设置单元格内容
|
||||
HSSFCell xingming = row4.createCell(0);
|
||||
xingming.setCellValue("姓名");
|
||||
// CellRangeAddress cellRangeXingming = new CellRangeAddress(3, 4, 0, 0);
|
||||
// sheet.addMergedRegion(cellRangeXingming);
|
||||
xingming.setCellStyle(biaoTi3);
|
||||
// ExcelUtil.setCellRangeBorder(BorderStyle.THIN, cellRangeXingming, sheet);
|
||||
|
||||
HSSFCell deptNamecell = row4.createCell(1);
|
||||
deptNamecell.setCellValue("部门");
|
||||
// CellRangeAddress cellRangeDeptName = new CellRangeAddress(3, 4, 1, 1);
|
||||
// sheet.addMergedRegion(cellRangeDeptName);
|
||||
deptNamecell.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell jobNumber = row4.createCell(2);
|
||||
jobNumber.setCellValue("工号");
|
||||
// CellRangeAddress cellRangejobNumber = new CellRangeAddress(3, 4, 2, 2);
|
||||
// sheet.addMergedRegion(cellRangejobNumber);
|
||||
jobNumber.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell idNumber = row4.createCell(3);
|
||||
idNumber.setCellValue("身份证号");
|
||||
// CellRangeAddress cellRangejobNumber = new CellRangeAddress(3, 4, 2, 2);
|
||||
// sheet.addMergedRegion(cellRangejobNumber);
|
||||
idNumber.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell checkDays = row4.createCell(4);
|
||||
checkDays.setCellValue("出勤天数");
|
||||
// CellRangeAddress cellRangecheckDays = new CellRangeAddress(3, 4, 3, 3);
|
||||
// sheet.addMergedRegion(cellRangecheckDays);
|
||||
checkDays.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell dutyOnOkCell = row4.createCell(5);
|
||||
dutyOnOkCell.setCellValue("正常签到");
|
||||
// CellRangeAddress cellRangeDutyOnOk = new CellRangeAddress(3, 4, 4, 4);
|
||||
// sheet.addMergedRegion(cellRangeDutyOnOk);
|
||||
dutyOnOkCell.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell dutyOnLateCell = row4.createCell(6);
|
||||
dutyOnLateCell.setCellValue("迟到");
|
||||
// CellRangeAddress cellRangeWubie = new CellRangeAddress(3, 4, 5, 5);
|
||||
// sheet.addMergedRegion(cellRangeWubie);
|
||||
dutyOnLateCell.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell dutyOnNoCell = row4.createCell(7);
|
||||
dutyOnNoCell.setCellValue("未签到");
|
||||
// CellRangeAddress cellRangeOnNo = new CellRangeAddress(3, 4, 6, 6);
|
||||
// sheet.addMergedRegion(cellRangeOnNo);
|
||||
dutyOnNoCell.setCellStyle(biaoTi3);
|
||||
|
||||
|
||||
HSSFCell dutyOffOkCell = row4.createCell(8);
|
||||
dutyOffOkCell.setCellValue("正常签退");
|
||||
// CellRangeAddress cellRangeDutyOffOk = new CellRangeAddress(3, 4, 7, 7);
|
||||
// sheet.addMergedRegion(cellRangeDutyOffOk);
|
||||
dutyOffOkCell.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell dutyOnEarlyCell = row4.createCell(9);
|
||||
dutyOnEarlyCell.setCellValue("早退");
|
||||
// CellRangeAddress cellRangeearly = new CellRangeAddress(3, 4, 8, 8);
|
||||
// sheet.addMergedRegion(cellRangeearly);
|
||||
dutyOnEarlyCell.setCellStyle(biaoTi3);
|
||||
|
||||
HSSFCell dutyOffNoCell = row4.createCell(10);
|
||||
dutyOffNoCell.setCellValue("未签退");
|
||||
// CellRangeAddress cellRangeOffNo = new CellRangeAddress(3, 4, 9, 9);
|
||||
// sheet.addMergedRegion(cellRangeOffNo);
|
||||
dutyOffNoCell.setCellStyle(biaoTi3);
|
||||
|
||||
|
||||
|
||||
//创建数据行
|
||||
for(int i = 0;i<dataList.size();i++){
|
||||
TenCheckMemberCountVo vo = dataList.get(i);
|
||||
HSSFRow rowData = sheet.createRow(i+4);
|
||||
HSSFCell cellDataName = rowData.createCell(0);
|
||||
cellDataName.setCellValue(vo.getMemberName());
|
||||
cellDataName.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDeptName = rowData.createCell(1);
|
||||
cellDataDeptName.setCellValue(vo.getDeptName());
|
||||
cellDataDeptName.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataJobnumber = rowData.createCell(2);
|
||||
cellDataJobnumber.setCellValue(vo.getJobNumber());
|
||||
cellDataJobnumber.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataIdNumber = rowData.createCell(3);
|
||||
cellDataIdNumber.setCellValue(vo.getIdNumber());
|
||||
cellDataIdNumber.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataCheckDays = rowData.createCell(4);
|
||||
cellDataCheckDays.setCellValue(vo.getCheckDayCount());
|
||||
cellDataCheckDays.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOnOk = rowData.createCell(5);
|
||||
cellDataDutyOnOk.setCellValue(vo.getDutyOnOkCount());
|
||||
cellDataDutyOnOk.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOnLate = rowData.createCell(6);
|
||||
cellDataDutyOnLate.setCellValue(vo.getDutyOnLateCount());
|
||||
cellDataDutyOnLate.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOnNo = rowData.createCell(7);
|
||||
cellDataDutyOnNo.setCellValue("");
|
||||
cellDataDutyOnNo.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOffOk = rowData.createCell(8);
|
||||
cellDataDutyOffOk.setCellValue(vo.getDutyOffOkCount());
|
||||
cellDataDutyOffOk.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOffEarly = rowData.createCell(9);
|
||||
cellDataDutyOffEarly.setCellValue(vo.getDutyOffEarlyCount());
|
||||
cellDataDutyOffEarly.setCellStyle(cellStyle);
|
||||
|
||||
HSSFCell cellDataDutyOffNo = rowData.createCell(10);
|
||||
cellDataDutyOffNo.setCellValue("");
|
||||
cellDataDutyOffNo.setCellStyle(cellStyle);
|
||||
}
|
||||
|
||||
//准备将Excel的输出流通过response输出到页面下载
|
||||
//八进制输出流
|
||||
response.setContentType("application/octet-stream");
|
||||
|
||||
//这后面可以设置导出Excel的名称,此例中名为student.xls
|
||||
response.setHeader("content-disposition", "attachment;filename=attence.xls");
|
||||
|
||||
|
||||
// response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// String fileName = URLEncoder.encode("统计报表.xlsx", "UTF-8");
|
||||
// response.setHeader("Content-disposition", "attachment;filename=" + fileName );
|
||||
response.setHeader("Access-Control-Expose-Headers", "content-disposition");
|
||||
|
||||
|
||||
//刷新缓冲
|
||||
try {
|
||||
response.flushBuffer();
|
||||
//workbook将Excel写入到response的输出流中,供页面下载
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.*;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||
import net.shapelight.modules.sys.service.SysUserService;
|
||||
import net.shapelight.modules.ten.entity.TenCellDeptEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRuleEntity;
|
||||
import net.shapelight.modules.ten.entity.TenScheduleEntity;
|
||||
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellDeptService;
|
||||
import net.shapelight.modules.ten.service.TenRuleService;
|
||||
import net.shapelight.modules.ten.service.TenScheduleService;
|
||||
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("ten/rule")
|
||||
@Api(value="考勤规则",tags={"考勤规则"})
|
||||
public class TenRuleController extends AbstractController {
|
||||
@Autowired
|
||||
private TenRuleService tenRuleService;
|
||||
@Autowired
|
||||
private TenScheduleService tenScheduleService;
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private TenUserScopeService tenUserScopeService;
|
||||
@Autowired
|
||||
private TenCellDeptService tenCellDeptService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("ten:rule")
|
||||
@ApiOperation(value = "考勤规则列表",response = TenRuleEntity.class)
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
String tenantId = getUser().getTenantId() + "";
|
||||
params.put("tenantId", tenantId + "");
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
|
||||
params.put("cellId", scope.getCellId().toString());
|
||||
}else{
|
||||
return R.error("您无权访问");
|
||||
}
|
||||
PageUtils page = tenRuleService.queryPage(params);
|
||||
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/info/{ruleId}")
|
||||
@RequiresPermissions("ten:rule")
|
||||
@ApiOperation(value = "考勤规则详细信息",response = TenRuleEntity.class)
|
||||
public R info(@PathVariable("ruleId") Long ruleId){
|
||||
TenRuleEntity ruleEntity = tenRuleService.getById(ruleId);
|
||||
List<TenScheduleEntity> scheduleEntityList = tenScheduleService.list(
|
||||
new QueryWrapper<TenScheduleEntity>()
|
||||
.eq("rule_id",ruleEntity.getRuleId())
|
||||
// .eq("tenant_id",ruleEntity.getTenantId())
|
||||
);
|
||||
ruleEntity.setScheduleEntityList(scheduleEntityList);
|
||||
return R.ok().put("data", ruleEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("ten:rule")
|
||||
@ApiOperation(value = "添加")
|
||||
public R save(@RequestBody TenRuleEntity tenRule){
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
|
||||
tenRule.setCellId(scope.getCellId());
|
||||
tenRule.getScheduleEntityList().get(0).setCellId(scope.getCellId());
|
||||
}else{
|
||||
return R.error("您无权访问");
|
||||
}
|
||||
// tenRuleService.save(tenRule);
|
||||
TenScheduleEntity scheduleEntity = tenRule.getScheduleEntityList().get(0);
|
||||
int onTime = MyDateUtils.getSeconds(scheduleEntity.getDutyOn());
|
||||
int offTime = MyDateUtils.getSeconds(scheduleEntity.getDutyOff());
|
||||
int chidaoTime = onTime + scheduleEntity.getLateTime() * 60;
|
||||
int zaotuiTime = offTime - scheduleEntity.getEarlyTime() * 60;
|
||||
int onBegin = MyDateUtils.getSeconds(scheduleEntity.getOnBegin());
|
||||
int onEnd = MyDateUtils.getSeconds(scheduleEntity.getOnEnd());
|
||||
int offBegin = MyDateUtils.getSeconds(scheduleEntity.getOffBegin());
|
||||
int offEnd = MyDateUtils.getSeconds(scheduleEntity.getOffEnd());
|
||||
|
||||
if(onTime>offTime){
|
||||
return R.error("上班时间不能再当天里晚于下班时间");
|
||||
}
|
||||
if (onBegin>onTime) {
|
||||
return R.error("上班最早打卡时间必须在上班时间之前");
|
||||
}
|
||||
if(offEnd<offTime){
|
||||
return R.error("下班最晚打卡时间必须在下班时间之后");
|
||||
}
|
||||
if(chidaoTime>offTime){
|
||||
return R.error("迟到时间必须在下班时间之前");
|
||||
}
|
||||
if(zaotuiTime<onTime){
|
||||
return R.error("早退时间必须在上班时间之后");
|
||||
}
|
||||
if(chidaoTime>zaotuiTime){
|
||||
return R.error("迟到时间必须在早退时间之前");
|
||||
}
|
||||
if(onEnd>offBegin){
|
||||
return R.error("上班最晚打卡时间必须在下班最早打卡时间之前");
|
||||
}
|
||||
if(onEnd<chidaoTime){
|
||||
return R.error("上班最晚打卡时间必须在迟到时间之后");
|
||||
}
|
||||
if(offBegin>zaotuiTime){
|
||||
return R.error("下班最早打卡时间必须在早退时间之后");
|
||||
}
|
||||
Date now = new Date();
|
||||
tenRule.setTenantId(getUser().getTenantId());
|
||||
tenRule.setCreateBy(getUser().getUsername());
|
||||
tenRule.setCreateTime(now);
|
||||
tenRule.setLastUpdateBy(getUser().getUsername());
|
||||
tenRule.setLastUpdateTime(now);
|
||||
tenRuleService.saveTr(tenRule);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("ten:rule")
|
||||
@ApiOperation(value = "修改")
|
||||
public R update(@RequestBody TenRuleEntity tenRule){
|
||||
tenRule.setLastUpdateBy(getUser().getUsername());
|
||||
tenRule.setLastUpdateTime(new Date());
|
||||
tenRuleService.updateByIdTr(tenRule);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@RequiresPermissions("ten:rule")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody Long[] ruleIds){
|
||||
tenRuleService.removeByIds(Arrays.asList(ruleIds));
|
||||
for(Long ruleId: ruleIds){
|
||||
tenScheduleService.remove(new QueryWrapper<TenScheduleEntity>()
|
||||
.eq("rule_id",ruleId));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getDeptTree")
|
||||
@RequiresPermissions("ten:rule")
|
||||
public R getDeptTree(){
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
Long cellId = new Long(0l);
|
||||
//小区管理员
|
||||
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
|
||||
cellId = scope.getCellId();
|
||||
}else{
|
||||
return R.error("您无权访问");
|
||||
}
|
||||
List<TenCellDeptEntity> page = tenCellDeptService.list(new QueryWrapper<TenCellDeptEntity>()
|
||||
.eq("cell_id",cellId));
|
||||
for(TenCellDeptEntity cellDeptEntity: page){
|
||||
if(cellDeptEntity.getChildrenList().size() == 0){
|
||||
cellDeptEntity.setHasChildren(false);
|
||||
}
|
||||
}
|
||||
JSONArray dataTree = TreeUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(page)),"deptId","parentId","childrenList");
|
||||
return R.ok().put("data", dataTree);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import net.shapelight.modules.ten.entity.TenCheckEntity;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
import net.shapelight.modules.ten.vo.AttendanceDayVo;
|
||||
import net.shapelight.modules.ten.vo.TenCheckMemberCountVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface TenCheckDao extends BaseMapper<TenCheckEntity> {
|
||||
|
||||
IPage<TenCheckMemberCountVo> findCheckMemberCount(Page page, @Param("params") Map params);
|
||||
|
||||
IPage<TenCheckEntity> findMemberCheckList(Page page, @Param("params") Map params);
|
||||
|
||||
List<TenCheckMemberCountVo> findCheckMemberList(@Param("params") Map params);
|
||||
|
||||
Integer findDutyOnCount(@Param("params") Map params);
|
||||
List<TenCheckScheduleEntity> findDutyOnInfo(@Param("params") Map params);
|
||||
|
||||
Integer findDutyOffCount(@Param("params") Map params);
|
||||
List<TenCheckScheduleEntity> findDutyOffInfo(@Param("params") Map params);
|
||||
|
||||
|
||||
IPage<AttendanceDayVo> findAttendanceDayPage(Page page, @Param("params") Map params);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface TenCheckScheduleDao extends BaseMapper<TenCheckScheduleEntity> {
|
||||
|
||||
}
|
|
@ -112,7 +112,7 @@ public interface TenPersonDao {
|
|||
IPage<TenPersonEntity> selectByDeptId(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key);
|
||||
IPage<TenPersonEntity> selectByDeptIdForGuest(Page page,@Param("deptId")Long deptId, @Param("cellId")Long cellId, @Param("key")String key);
|
||||
|
||||
|
||||
TenPersonEntity getByIdWithDelete(@Param("personId")Long personId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenRuleEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface TenRuleDao extends BaseMapper<TenRuleEntity> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenScheduleEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface TenScheduleDao extends BaseMapper<TenScheduleEntity> {
|
||||
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_check")
|
||||
public class TenCheckEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Long checkId;
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
@ApiModelProperty("人员id")
|
||||
private Long memberId;
|
||||
/**
|
||||
* 考勤规则id
|
||||
*/
|
||||
@ApiModelProperty("考勤规则id")
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
@ApiModelProperty("打卡日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date checkDate;
|
||||
/**
|
||||
* 星期几1,2,3,4,5,6,7
|
||||
*/
|
||||
@ApiModelProperty("星期几")
|
||||
private Integer checkDay;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ApiModelProperty("姓名")
|
||||
private String memberName;
|
||||
/**
|
||||
* 0没有1女2男
|
||||
*/
|
||||
@ApiModelProperty("0没有1女2男")
|
||||
private Integer gender;
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
@ApiModelProperty("手机")
|
||||
private String mobile;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
@ApiModelProperty("工号")
|
||||
private String jobNumber;
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
@ApiModelProperty("职位")
|
||||
private String position;
|
||||
/**
|
||||
* ic卡号
|
||||
*/
|
||||
@ApiModelProperty("ic卡号")
|
||||
private String icNumber;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idNumber;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
private Long deptId;
|
||||
/**
|
||||
* rgb
|
||||
*/
|
||||
@ApiModelProperty("rgb头像")
|
||||
private String rgb;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@ApiModelProperty("部门名称")
|
||||
private String deptName;
|
||||
//
|
||||
@ApiModelProperty("打卡信息")
|
||||
@TableField(exist = false)
|
||||
private String checkScheduleInfo;
|
||||
|
||||
@ApiModelProperty("打卡详细信息")
|
||||
@TableField(exist = false)
|
||||
private List<TenCheckScheduleEntity> checkScheduleList;
|
||||
|
||||
@ApiModelProperty("规则名称")
|
||||
@TableField(exist = false)
|
||||
private String ruleName;
|
||||
|
||||
@ApiModelProperty("考勤星期")
|
||||
@TableField(exist = false)
|
||||
private String days;
|
||||
|
||||
@ApiModelProperty("考勤时间段")
|
||||
@TableField(exist = false)
|
||||
private String schedules;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 小区ID
|
||||
*/
|
||||
@ApiModelProperty("小区ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_check_schedule")
|
||||
public class TenCheckScheduleEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Long checkScheduleId;
|
||||
/**
|
||||
* 打卡id
|
||||
*/
|
||||
@ApiModelProperty("打卡id")
|
||||
private Long checkId;
|
||||
/**
|
||||
* 班次序列号1,2,3
|
||||
*/
|
||||
@ApiModelProperty("班次序列号1,2,3")
|
||||
private Integer scheduleIndex;
|
||||
/**
|
||||
* 上班识别记录id
|
||||
*/
|
||||
@ApiModelProperty("上班识别记录id")
|
||||
private Long dutyOnRecordId;
|
||||
/**
|
||||
* 下班识别记录id
|
||||
*/
|
||||
@ApiModelProperty("下班识别记录id")
|
||||
private Long dutyOffRecordId;
|
||||
/**
|
||||
* 上班识别时间
|
||||
*/
|
||||
@ApiModelProperty("上班识别时间")
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
private Time dutyOnTime;
|
||||
/**
|
||||
* 下班识别时间
|
||||
*/
|
||||
@ApiModelProperty("下班识别时间")
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
private Time dutyOffTime;
|
||||
/**
|
||||
* 上班状态0缺卡1正常2迟到
|
||||
*/
|
||||
@ApiModelProperty("上班状态0缺卡1正常2迟到")
|
||||
private Integer dutyOnStatus;
|
||||
/**
|
||||
* 上班状态信息
|
||||
*/
|
||||
@ApiModelProperty("上班状态信息")
|
||||
private String dutyOnStatusInfo;
|
||||
/**
|
||||
* 下班状态0缺卡1正常3早退
|
||||
*/
|
||||
@ApiModelProperty("下班状态0缺卡1正常3早退")
|
||||
private Integer dutyOffStatus;
|
||||
/**
|
||||
* 下班状态信息
|
||||
*/
|
||||
@ApiModelProperty("下班状态信息")
|
||||
private String dutyOffStatusInfo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private TenCheckEntity checkEntity;
|
||||
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField(exist = false)
|
||||
private Time checkTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String statusInfo;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 小区ID
|
||||
*/
|
||||
@ApiModelProperty("小区ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import net.shapelight.common.base.BaseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_rule")
|
||||
public class TenRuleEntity extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
private String ruleName;
|
||||
/**
|
||||
* 班次1,2,3
|
||||
*/
|
||||
@ApiModelProperty("班次1,2,3")
|
||||
private Integer ruleType;
|
||||
/**
|
||||
* 星期几1,2,3,4,5,6,7
|
||||
*/
|
||||
@ApiModelProperty("星期几1,2,3,4,5,6,7")
|
||||
private String days;
|
||||
/**
|
||||
* 部门id数组
|
||||
*/
|
||||
@ApiModelProperty("部门id数组")
|
||||
private String deptIds;
|
||||
|
||||
@ApiModelProperty("班次列表")
|
||||
@TableField(exist = false)
|
||||
private List<TenScheduleEntity> scheduleEntityList;
|
||||
|
||||
@ApiModelProperty("部门信息")
|
||||
@TableField(exist = false)
|
||||
private String deptNames;
|
||||
|
||||
@ApiModelProperty("人数")
|
||||
@TableField(exist = false)
|
||||
private Integer memberCount;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 小区ID
|
||||
*/
|
||||
@ApiModelProperty("小区ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_schedule")
|
||||
public class TenScheduleEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Long scheduleId;
|
||||
/**
|
||||
* 考勤规则id
|
||||
*/
|
||||
@ApiModelProperty("考勤规则id")
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 班次序号
|
||||
*/
|
||||
@ApiModelProperty("班次序号")
|
||||
private Integer scheduleIndex;
|
||||
/**
|
||||
* 上班时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("上班时间")
|
||||
private Time dutyOn;
|
||||
/**
|
||||
* 下班时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("下班时间")
|
||||
private Time dutyOff;
|
||||
/**
|
||||
* 迟到时间
|
||||
*/
|
||||
@ApiModelProperty("迟到时间")
|
||||
private Integer lateTime;
|
||||
/**
|
||||
* 早退时间
|
||||
*/
|
||||
@ApiModelProperty("早退时间")
|
||||
private Integer earlyTime;
|
||||
/**
|
||||
* 上班最早签到时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("上班最早签到时间")
|
||||
private Time onBegin;
|
||||
/**
|
||||
* 上班最晚签到时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("上班最晚签到时间")
|
||||
private Time onEnd;
|
||||
/**
|
||||
* 下班最早签退时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("下班最早签退时间")
|
||||
private Time offBegin;
|
||||
/**
|
||||
* 下班最晚签退时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty("下班最晚签退时间")
|
||||
private Time offEnd;
|
||||
/**
|
||||
* 上班是否打卡
|
||||
*/
|
||||
@ApiModelProperty("上班是否打卡")
|
||||
private Integer onCheckFlag;
|
||||
/**
|
||||
* 下班是否打卡
|
||||
*/
|
||||
@ApiModelProperty("下班是否打卡")
|
||||
private Integer offCheckFlag;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 小区ID
|
||||
*/
|
||||
@ApiModelProperty("小区ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface TenCheckScheduleService extends IService<TenCheckScheduleEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenCheckEntity;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
//import net.shapelight.modules.ten.entity.TenMemberEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRecordEntity;
|
||||
import net.shapelight.modules.ten.vo.TenCheckMemberCountVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface TenCheckService extends IService<TenCheckEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
TenCheckEntity findMemberCheck(Long memberId, String checkDate);
|
||||
|
||||
void saveCheck(TenPersonEntity member, TenRecordEntity record);
|
||||
|
||||
PageUtils findCheckMemberCount(Map<String, Object> params);
|
||||
List<TenCheckMemberCountVo> findCheckMemberCountList(Map<String, Object> params);
|
||||
|
||||
int findDutyOnCount(Map params);
|
||||
List<TenCheckScheduleEntity> findDutyOnInfo(Map params);
|
||||
|
||||
int findDutyOffCount(Map params);
|
||||
List<TenCheckScheduleEntity> findDutyOffInfo(Map params);
|
||||
|
||||
PageUtils attendanceDayPage(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
|
@ -140,5 +140,7 @@ public interface TenPersonService {
|
|||
PageUtils selectByDeptIdQueryPage(Map<String, Object> params);
|
||||
PageUtils selectByDeptIdForGuestQueryPage(Map<String, Object> params);
|
||||
|
||||
TenPersonEntity getByIdWithDelete(Long id);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenRuleEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface TenRuleService extends IService<TenRuleEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
boolean saveTr(TenRuleEntity entity);
|
||||
|
||||
boolean updateByIdTr(TenRuleEntity entity);
|
||||
|
||||
boolean removeByIdsTr(Long[] ruleIds);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param memberId 人员id
|
||||
* @param week 星期
|
||||
* @return
|
||||
*/
|
||||
TenRuleEntity findMemberRules(Long memberId, Long cellId, Integer week);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenScheduleEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface TenScheduleService extends IService<TenScheduleEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenCheckScheduleDao;
|
||||
import net.shapelight.modules.ten.entity.TenCheckScheduleEntity;
|
||||
import net.shapelight.modules.ten.service.TenCheckScheduleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service("tenCheckScheduleService")
|
||||
public class TenCheckScheduleServiceImpl extends ServiceImpl<TenCheckScheduleDao, TenCheckScheduleEntity> implements TenCheckScheduleService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<TenCheckScheduleEntity> page = this.page(
|
||||
new Query<TenCheckScheduleEntity>().getPage(params),
|
||||
new QueryWrapper<TenCheckScheduleEntity>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,562 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.shapelight.common.config.GlobalValue;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.dao.TenCheckDao;
|
||||
import net.shapelight.modules.ten.entity.*;
|
||||
import net.shapelight.modules.ten.service.*;
|
||||
import net.shapelight.modules.ten.vo.AttendanceDayVo;
|
||||
import net.shapelight.modules.ten.vo.TenCheckMemberCountVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service("tenCheckService")
|
||||
public class TenCheckServiceImpl extends ServiceImpl<TenCheckDao, TenCheckEntity> implements TenCheckService {
|
||||
|
||||
@Autowired
|
||||
private TenCheckScheduleService tenCheckScheduleService;
|
||||
@Autowired
|
||||
private TenRuleService tenRuleService;
|
||||
@Autowired
|
||||
private TenScheduleService tenScheduleService;
|
||||
@Autowired
|
||||
private TenCellDeptService tenCellDeptService;
|
||||
@Autowired
|
||||
private GlobalValue globalValue;
|
||||
@Autowired
|
||||
private TenPersonService tenPersonService;
|
||||
|
||||
|
||||
/**
|
||||
* 考勤记录
|
||||
*/
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String deptId = (String) params.get("deptId");
|
||||
//
|
||||
// List<Long> depts = new ArrayList<>();
|
||||
// if(StringUtils.isNotBlank(deviceId)){
|
||||
// depts = tenDeptService.getSubDeptIdList(Long.parseLong(deviceId));
|
||||
// depts.add(Long.parseLong(deviceId));
|
||||
// }
|
||||
// IPage<TenCheckEntity> page = this.page(
|
||||
// new Query<TenCheckEntity>().getPage(params),
|
||||
// new QueryWrapper<TenCheckEntity>()
|
||||
// .eq("tenant_id",params.get("tenantId"))
|
||||
// .eq(StringUtils.isNotBlank((String) params.get("memberId")), "member_Id", params.get("memberId"))
|
||||
// .like(StringUtils.isNotBlank((String) params.get("memberName")), "member_name", params.get("memberName"))
|
||||
// .ge(StringUtils.isNotBlank((String) params.get("dateStart")), "check_date", params.get("dateStart"))
|
||||
// .le(StringUtils.isNotBlank((String) params.get("dateEnd")), "check_date", params.get("dateEnd"))
|
||||
// .in(depts.size()>0, "dept_id", depts)
|
||||
// .like(StringUtils.isNotBlank((String) params.get("jobNumber")), "job_number", params.get("jobNumber"))
|
||||
// .eq(StringUtils.isNotBlank((String) params.get("checkDay")), "check_day", params.get("checkDay"))
|
||||
// .orderByDesc("check_date")
|
||||
// );
|
||||
// if (depts.size()>0) {
|
||||
// params.put("deptIds",depts);
|
||||
// }
|
||||
Page pageParam = new Page();
|
||||
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
|
||||
pageParam.setSize(Long.parseLong((String) params.get("limit")));
|
||||
IPage<TenCheckEntity> page = baseMapper.findMemberCheckList(pageParam,params);
|
||||
for (TenCheckEntity checkEntity : page.getRecords()) {
|
||||
List<TenCheckScheduleEntity> checkSchedules = tenCheckScheduleService.list(
|
||||
new QueryWrapper<TenCheckScheduleEntity>()
|
||||
.eq("check_id", checkEntity.getCheckId())
|
||||
.orderByAsc("schedule_index")
|
||||
);
|
||||
StringBuffer info = new StringBuffer();
|
||||
for (TenCheckScheduleEntity cs : checkSchedules) {
|
||||
//上班状态0缺卡1正常2迟到
|
||||
if (cs.getDutyOnStatus().intValue() != 0) {
|
||||
info.append("签到:" + cs.getDutyOnTime() + " " + cs.getDutyOnStatusInfo() + ",");
|
||||
}
|
||||
//下班状态0缺卡1正常3早退
|
||||
if (cs.getDutyOffStatus().intValue() != 0) {
|
||||
info.append("签退:" + cs.getDutyOffTime() + " " + cs.getDutyOffStatusInfo() + ",");
|
||||
}
|
||||
}
|
||||
checkEntity.setCheckScheduleInfo(info.toString());
|
||||
TenRuleEntity ruleEntity = tenRuleService.getById(checkEntity.getRuleId());
|
||||
if(ruleEntity!=null){
|
||||
checkEntity.setRuleName(ruleEntity.getRuleName());
|
||||
checkEntity.setDays(ruleEntity.getDays());
|
||||
|
||||
List<TenScheduleEntity> schedules = tenScheduleService.list(
|
||||
new QueryWrapper<TenScheduleEntity>()
|
||||
.eq("rule_id",ruleEntity.getRuleId())
|
||||
);
|
||||
StringBuffer schBuf = new StringBuffer();
|
||||
for(TenScheduleEntity schedule: schedules){
|
||||
schBuf.append(schedule.getDutyOn()+"-"+schedule.getDutyOff()+",");
|
||||
}
|
||||
checkEntity.setSchedules(schBuf.toString());
|
||||
}else{
|
||||
checkEntity.setRuleName("");
|
||||
checkEntity.setDays("");
|
||||
checkEntity.setSchedules("");
|
||||
}
|
||||
// checkEntity.setRgb(globalValue.getFileUrl()+checkEntity.getRgb());
|
||||
checkEntity.setRgb(checkEntity.getRgb());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils attendanceDayPage(Map<String, Object> params) {
|
||||
// String dateStart = (String) params.get("dateStart");
|
||||
// String dateEnd = (String) params.get("dateEnd");
|
||||
String deptId = (String) params.get("deptId");
|
||||
Page pageParam = new Page();
|
||||
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
|
||||
pageParam.setSize(Long.parseLong((String) params.get("limit")));
|
||||
IPage<AttendanceDayVo> page = baseMapper.findAttendanceDayPage(pageParam, params);
|
||||
for(AttendanceDayVo vo: page.getRecords()){
|
||||
Map<String, Object> p = new HashMap<>();
|
||||
p.put("deptId",deptId);
|
||||
String date = DateUtils.format(vo.getCheckDate(), DateUtils.DATE_DAY);
|
||||
p.put("dateStart",date);
|
||||
p.put("dateEnd",date);
|
||||
p.put("status", Constant.CHECK_OK);
|
||||
p.put("tenantId",params.get("tenantId"));
|
||||
Integer dutyOnOkCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnOkCount(dutyOnOkCount);
|
||||
|
||||
Integer dutyOffOkCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffOkCount(dutyOffOkCount);
|
||||
|
||||
p.put("status", Constant.CHECK_CHIDAO);
|
||||
Integer dutyOnLateCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnLateCount(dutyOnLateCount);
|
||||
|
||||
p.put("status", Constant.CHECK_ZAOTUI);
|
||||
Integer dutyOnEarlyCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffEarlyCount(dutyOnEarlyCount);
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils findCheckMemberCount(Map<String, Object> params) {
|
||||
Page pageParam = new Page();
|
||||
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
|
||||
pageParam.setSize(Long.parseLong((String) params.get("limit")));
|
||||
IPage<TenCheckMemberCountVo> page = baseMapper.findCheckMemberCount(pageParam, params);
|
||||
|
||||
for(TenCheckMemberCountVo vo: page.getRecords()){
|
||||
|
||||
// TenPersonEntity memberEntity = tenPersonService.getByIdWithDelete(vo.getMemberId());
|
||||
TenPersonEntity memberEntity = tenPersonService.getByIdWithDelete(vo.getMemberId());
|
||||
vo.setMemberName(memberEntity.getName());
|
||||
vo.setRgb(memberEntity.getOrgImage());
|
||||
vo.setDeptId(memberEntity.getDeptId());
|
||||
TenCellDeptEntity deptEntity = tenCellDeptService.getById(memberEntity.getDeptId());
|
||||
if(deptEntity!=null){
|
||||
vo.setDeptName(deptEntity.getName());
|
||||
}
|
||||
// vo.setJobNumber(memberEntity.getJobNumber());
|
||||
vo.setIdNumber(memberEntity.getIdCard());
|
||||
|
||||
|
||||
Map<String, Object> p = new HashMap<>();
|
||||
p.put("memberId",vo.getMemberId());
|
||||
p.put("deptId",vo.getDeptId());
|
||||
p.put("dateStart",params.get("dateStart"));
|
||||
p.put("dateEnd",params.get("dateEnd"));
|
||||
p.put("status", Constant.CHECK_OK);
|
||||
Integer dutyOnOkCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnOkCount(dutyOnOkCount);
|
||||
|
||||
Integer dutyOffOkCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffOkCount(dutyOffOkCount);
|
||||
|
||||
p.put("status", Constant.CHECK_CHIDAO);
|
||||
Integer dutyOnLateCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnLateCount(dutyOnLateCount);
|
||||
|
||||
p.put("status", Constant.CHECK_ZAOTUI);
|
||||
Integer dutyOnEarlyCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffEarlyCount(dutyOnEarlyCount);
|
||||
|
||||
vo.setRgb(vo.getRgb());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TenCheckMemberCountVo> findCheckMemberCountList(Map<String, Object> params) {
|
||||
// Page pageParam = new Page();
|
||||
// pageParam.setCurrent(Long.parseLong((String) params.get("page")));
|
||||
// pageParam.setSize(Long.parseLong((String) params.get("limit")));
|
||||
List<TenCheckMemberCountVo> page = baseMapper.findCheckMemberList( params);
|
||||
|
||||
for(TenCheckMemberCountVo vo: page){
|
||||
|
||||
|
||||
TenPersonEntity memberEntity = tenPersonService.getByIdWithDelete(vo.getMemberId());
|
||||
vo.setMemberName(memberEntity.getName());
|
||||
vo.setRgb(memberEntity.getOrgImage());
|
||||
vo.setDeptId(memberEntity.getDeptId());
|
||||
TenCellDeptEntity deptEntity = tenCellDeptService.getById(memberEntity.getDeptId());
|
||||
if(deptEntity!=null){
|
||||
vo.setDeptName(deptEntity.getName());
|
||||
}
|
||||
// vo.setJobNumber(memberEntity.getJobNumber());
|
||||
vo.setIdNumber(memberEntity.getIdCard());
|
||||
|
||||
Map<String, Object> p = new HashMap<>();
|
||||
p.put("memberId",vo.getMemberId());
|
||||
p.put("deptId",vo.getDeptId());
|
||||
p.put("dateStart",params.get("dateStart"));
|
||||
p.put("dateEnd",params.get("dateEnd"));
|
||||
p.put("status", Constant.CHECK_OK);
|
||||
Integer dutyOnOkCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnOkCount(dutyOnOkCount);
|
||||
|
||||
Integer dutyOffOkCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffOkCount(dutyOffOkCount);
|
||||
|
||||
p.put("status", Constant.CHECK_CHIDAO);
|
||||
Integer dutyOnLateCount = baseMapper.findDutyOnCount(p);
|
||||
vo.setDutyOnLateCount(dutyOnLateCount);
|
||||
|
||||
p.put("status", Constant.CHECK_ZAOTUI);
|
||||
Integer dutyOnEarlyCount = baseMapper.findDutyOffCount(p);
|
||||
vo.setDutyOffEarlyCount(dutyOnEarlyCount);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TenCheckScheduleEntity> findDutyOnInfo(Map params) {
|
||||
return baseMapper.findDutyOnInfo(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenCheckScheduleEntity> findDutyOffInfo(Map params) {
|
||||
return baseMapper.findDutyOffInfo(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findDutyOnCount(Map params) {
|
||||
return baseMapper.findDutyOnCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findDutyOffCount(Map params) {
|
||||
return baseMapper.findDutyOffCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenCheckEntity findMemberCheck(Long memberId, String checkDate) {
|
||||
// TenCheckEntity check = this.getOne(new QueryWrapper<TenCheckEntity>()
|
||||
// .eq("member_id", memberId)
|
||||
// .eq("check_date", checkDate));
|
||||
List<TenCheckEntity> checkList = this.list(new QueryWrapper<TenCheckEntity>()
|
||||
.eq("member_id", memberId)
|
||||
.eq("check_date", checkDate));
|
||||
TenCheckEntity check = null;
|
||||
if(checkList.size()>0){
|
||||
check = checkList.get(0);
|
||||
}
|
||||
if (check != null) {
|
||||
List<TenCheckScheduleEntity> cs = tenCheckScheduleService.list(
|
||||
new QueryWrapper<TenCheckScheduleEntity>()
|
||||
.eq("check_id", check.getCheckId())
|
||||
);
|
||||
check.setCheckScheduleList(cs);
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveCheck(TenPersonEntity member, TenRecordEntity record) {
|
||||
String checkDate = DateUtils.format(record.getRecordTime(), DateUtils.DATE_DAY);
|
||||
int week = DateUtils.dateToWeek(checkDate);
|
||||
TenRuleEntity rule = tenRuleService.findMemberRules(member.getPersonId(), member.getCellId(), week);
|
||||
TenCheckEntity checkEntity = this.findMemberCheck(member.getPersonId(), checkDate);
|
||||
//1. 当天首次打卡
|
||||
if (checkEntity == null) {
|
||||
//如果有考勤规则,则打卡
|
||||
if (rule != null) {
|
||||
checkEntity = new TenCheckEntity();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String s = sdf.format(record.getRecordTime());
|
||||
try {
|
||||
Date date = sdf.parse(s);
|
||||
checkEntity.setCheckDate(date);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("格式化日期失败");
|
||||
}
|
||||
checkEntity.setMemberId(member.getPersonId());
|
||||
checkEntity.setMemberName(member.getName());
|
||||
checkEntity.setRuleId(rule.getRuleId());
|
||||
checkEntity.setCheckDay(week);
|
||||
checkEntity.setGender(member.getGender());
|
||||
// checkEntity.setIcNumber(member.getIcNumber());
|
||||
checkEntity.setIdNumber(member.getIdCard());
|
||||
// checkEntity.setJobNumber(member.getJobNumber());
|
||||
checkEntity.setDeptId(member.getDeptId());
|
||||
checkEntity.setMobile(member.getMobile());
|
||||
TenCellDeptEntity deptEntity = tenCellDeptService.getById(member.getDeptId());
|
||||
checkEntity.setDeptName(deptEntity.getName());
|
||||
// checkEntity.setPosition(member.getPosition());
|
||||
checkEntity.setRgb(member.getOrgImage());
|
||||
checkEntity.setTenantId(record.getTenantId());
|
||||
//保存打卡基础信息
|
||||
|
||||
//
|
||||
for (TenScheduleEntity schedule : rule.getScheduleEntityList()) {
|
||||
//打卡时间
|
||||
LocalTime recordTime = record.getRecordTime().toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
|
||||
TenCheckScheduleEntity checkSchedule = null;
|
||||
//上班需要打卡
|
||||
if (schedule.getOnCheckFlag().intValue() == 1) {
|
||||
//打卡时间在最早打卡时间和最晚打卡时间之间,可以打卡
|
||||
if (recordTime.isAfter(schedule.getOnBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOnEnd().toLocalTime())) {
|
||||
checkSchedule = new TenCheckScheduleEntity();
|
||||
|
||||
checkSchedule.setScheduleIndex(schedule.getScheduleIndex());
|
||||
|
||||
checkSchedule.setDutyOnRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOnTime(Time.valueOf(recordTime));
|
||||
//判断状态
|
||||
LocalTime chidaoTime = schedule.getDutyOn().toLocalTime().plusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isBefore(chidaoTime)) {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOnStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_CHIDAO);
|
||||
int chidao = recordTime.getHour() * 60 + recordTime.getMinute() - (schedule.getDutyOn().toLocalTime().getHour() * 60 + schedule.getDutyOn().toLocalTime().getMinute());
|
||||
checkSchedule.setDutyOnStatusInfo("迟到" + chidao + "分钟");
|
||||
}
|
||||
this.save(checkEntity);
|
||||
checkSchedule.setCheckId(checkEntity.getCheckId());
|
||||
checkSchedule.setTenantId(checkEntity.getTenantId());
|
||||
tenCheckScheduleService.save(checkSchedule);
|
||||
} else {
|
||||
//不在上班打卡时间内
|
||||
}
|
||||
} else {//上班不需要打卡
|
||||
|
||||
}
|
||||
|
||||
//下班需要打卡
|
||||
if (schedule.getOffCheckFlag().intValue() == 1) {
|
||||
//打卡时间在最早打卡时间和最晚打卡时间之间,可以打卡
|
||||
if (recordTime.isAfter(schedule.getOffBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOffEnd().toLocalTime())) {
|
||||
checkSchedule = new TenCheckScheduleEntity();
|
||||
// checkSchedule.setCheckId(checkEntity.getCheckId());
|
||||
checkSchedule.setScheduleIndex(schedule.getScheduleIndex());
|
||||
|
||||
checkSchedule.setDutyOffRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOffTime(Time.valueOf(recordTime));
|
||||
//判断状态
|
||||
LocalTime zaotuiTime = schedule.getDutyOff().toLocalTime().minusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isAfter(zaotuiTime)) {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOffStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_ZAOTUI);
|
||||
int zaotui = schedule.getDutyOff().toLocalTime().getHour() * 60 + schedule.getDutyOff().toLocalTime().getMinute() - (recordTime.getHour() * 60 + recordTime.getMinute());
|
||||
checkSchedule.setDutyOffStatusInfo("早退" + zaotui + "分钟");
|
||||
}
|
||||
TenCheckEntity checkEntityTest = this.findMemberCheck(member.getPersonId(), checkDate);
|
||||
if(checkEntityTest==null){
|
||||
this.save(checkEntity);
|
||||
checkSchedule.setCheckId(checkEntity.getCheckId());
|
||||
checkSchedule.setTenantId(checkEntity.getTenantId());
|
||||
}else{
|
||||
checkSchedule.setCheckId(checkEntityTest.getCheckId());
|
||||
checkSchedule.setTenantId(checkEntityTest.getTenantId());
|
||||
}
|
||||
tenCheckScheduleService.save(checkSchedule);
|
||||
} else {
|
||||
//不在上班打卡时间内
|
||||
}
|
||||
} else {//上班不需要打卡
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
//没有考勤规则,不打卡
|
||||
}
|
||||
} else {//非首次打卡
|
||||
//如果有考勤规则,则打卡
|
||||
if (rule != null) {
|
||||
for (TenScheduleEntity schedule : rule.getScheduleEntityList()) {
|
||||
//打卡时间
|
||||
LocalTime recordTime = record.getRecordTime().toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
|
||||
TenCheckScheduleEntity checkSchedule = tenCheckScheduleService.getOne(
|
||||
new QueryWrapper<TenCheckScheduleEntity>()
|
||||
.eq("check_id", checkEntity.getCheckId())
|
||||
.eq("schedule_index", schedule.getScheduleIndex())
|
||||
.eq("tenant_id",checkEntity.getTenantId())
|
||||
);
|
||||
//上班需要打卡
|
||||
if (schedule.getOnCheckFlag().intValue() == 1) {
|
||||
if(checkSchedule!=null){//当前班次有打过卡
|
||||
//当前班次上班还没有打过卡
|
||||
if(checkSchedule.getDutyOnStatus().intValue()==0){
|
||||
if (recordTime.isAfter(schedule.getOnBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOnEnd().toLocalTime())) {
|
||||
checkSchedule.setDutyOnRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOnTime(Time.valueOf(recordTime));
|
||||
//判断状态
|
||||
LocalTime chidaoTime = schedule.getDutyOn().toLocalTime().plusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isBefore(chidaoTime)) {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOnStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_CHIDAO);
|
||||
int chidao = recordTime.getHour() * 60 + recordTime.getMinute() - (schedule.getDutyOn().toLocalTime().getHour() * 60 + schedule.getDutyOn().toLocalTime().getMinute());
|
||||
checkSchedule.setDutyOnStatusInfo("迟到" + chidao + "分钟");
|
||||
}
|
||||
tenCheckScheduleService.updateById(checkSchedule);
|
||||
}else{
|
||||
//不在打卡范围内
|
||||
}
|
||||
}else{
|
||||
//上班已打卡
|
||||
}
|
||||
}else{//当前班次还没有打过卡
|
||||
if (recordTime.isAfter(schedule.getOnBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOnEnd().toLocalTime())) {
|
||||
|
||||
checkSchedule = new TenCheckScheduleEntity();
|
||||
checkSchedule.setScheduleIndex(schedule.getScheduleIndex());
|
||||
checkSchedule.setCheckId(checkEntity.getCheckId());
|
||||
checkSchedule.setDutyOnRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOnTime(Time.valueOf(recordTime));
|
||||
checkSchedule.setTenantId(record.getTenantId());
|
||||
//判断状态
|
||||
LocalTime chidaoTime = schedule.getDutyOn().toLocalTime().plusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isBefore(chidaoTime)) {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOnStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOnStatus(Constant.CHECK_CHIDAO);
|
||||
int chidao = recordTime.getHour() * 60 + recordTime.getMinute() - (schedule.getDutyOn().toLocalTime().getHour() * 60 + schedule.getDutyOn().toLocalTime().getMinute());
|
||||
checkSchedule.setDutyOnStatusInfo("迟到" + chidao + "分钟");
|
||||
}
|
||||
tenCheckScheduleService.save(checkSchedule);
|
||||
}else{
|
||||
//不在范围内
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//下班需要打卡
|
||||
if (schedule.getOffCheckFlag().intValue() == 1) {
|
||||
if(checkSchedule!=null){//当前班次有打过卡
|
||||
//当前班次下班还没有打过卡
|
||||
// if(checkSchedule.getDutyOffStatus().intValue()==0){
|
||||
// if (recordTime.isAfter(schedule.getOffBegin().toLocalTime())
|
||||
// && recordTime.isBefore(schedule.getOffEnd().toLocalTime())) {
|
||||
// checkSchedule.setDutyOffRecordId(record.getRecordId());
|
||||
// checkSchedule.setDutyOffTime(Time.valueOf(recordTime));
|
||||
// //判断状态
|
||||
// LocalTime zaotuiTime = schedule.getDutyOff().toLocalTime().minusMinutes(schedule.getLateTime());
|
||||
//
|
||||
// //正常
|
||||
// if (recordTime.isAfter(zaotuiTime)) {
|
||||
// checkSchedule.setDutyOffStatus(Constant.CHECK_OK);
|
||||
// checkSchedule.setDutyOffStatusInfo("正常");
|
||||
// } else {
|
||||
// checkSchedule.setDutyOffStatus(Constant.CHECK_ZAOTUI);
|
||||
// int zaotui = schedule.getDutyOff().toLocalTime().getHour() * 60 + schedule.getDutyOff().toLocalTime().getMinute() - (recordTime.getHour() * 60 + recordTime.getMinute());
|
||||
// checkSchedule.setDutyOffStatusInfo("早退" + zaotui + "分钟");
|
||||
// }
|
||||
// tenCheckScheduleService.updateById(checkSchedule);
|
||||
// }
|
||||
// }else{
|
||||
// //下班已经打过卡,再次更新打卡时间
|
||||
// }
|
||||
if (recordTime.isAfter(schedule.getOffBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOffEnd().toLocalTime())) {
|
||||
checkSchedule.setDutyOffRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOffTime(Time.valueOf(recordTime));
|
||||
//判断状态
|
||||
LocalTime zaotuiTime = schedule.getDutyOff().toLocalTime().minusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isAfter(zaotuiTime)) {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOffStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_ZAOTUI);
|
||||
int zaotui = schedule.getDutyOff().toLocalTime().getHour() * 60 + schedule.getDutyOff().toLocalTime().getMinute() - (recordTime.getHour() * 60 + recordTime.getMinute());
|
||||
checkSchedule.setDutyOffStatusInfo("早退" + zaotui + "分钟");
|
||||
}
|
||||
tenCheckScheduleService.updateById(checkSchedule);
|
||||
}
|
||||
}else{//当前班次还没有打过卡
|
||||
if (recordTime.isAfter(schedule.getOffBegin().toLocalTime())
|
||||
&& recordTime.isBefore(schedule.getOffEnd().toLocalTime())) {
|
||||
checkSchedule = new TenCheckScheduleEntity();
|
||||
checkSchedule.setScheduleIndex(schedule.getScheduleIndex());
|
||||
checkSchedule.setCheckId(checkEntity.getCheckId());
|
||||
|
||||
checkSchedule.setDutyOffRecordId(record.getRecordId());
|
||||
checkSchedule.setDutyOffTime(Time.valueOf(recordTime));
|
||||
//判断状态
|
||||
LocalTime zaotuiTime = schedule.getDutyOff().toLocalTime().minusMinutes(schedule.getLateTime());
|
||||
|
||||
//正常
|
||||
if (recordTime.isAfter(zaotuiTime)) {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_OK);
|
||||
checkSchedule.setDutyOffStatusInfo("正常");
|
||||
} else {
|
||||
checkSchedule.setDutyOffStatus(Constant.CHECK_ZAOTUI);
|
||||
int zaotui = schedule.getDutyOff().toLocalTime().getHour() * 60 + schedule.getDutyOff().toLocalTime().getMinute() - (recordTime.getHour() * 60 + recordTime.getMinute());
|
||||
checkSchedule.setDutyOffStatusInfo("早退" + zaotui + "分钟");
|
||||
}
|
||||
tenCheckScheduleService.save(checkSchedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//没有考勤规则,不打卡
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2304,4 +2304,9 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
IPage<TenPersonEntity> page = tenPersonDao.selectByDeptIdForGuest(pageParam, deptId, cellId, key);
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenPersonEntity getByIdWithDelete(Long id) {
|
||||
return tenPersonDao.getByIdWithDelete(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenRuleDao;
|
||||
import net.shapelight.modules.ten.entity.TenCellDeptEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRuleEntity;
|
||||
import net.shapelight.modules.ten.entity.TenScheduleEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellDeptService;
|
||||
import net.shapelight.modules.ten.service.TenPersonService;
|
||||
import net.shapelight.modules.ten.service.TenRuleService;
|
||||
import net.shapelight.modules.ten.service.TenScheduleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service("tenRuleService")
|
||||
public class TenRuleServiceImpl extends ServiceImpl<TenRuleDao, TenRuleEntity> implements TenRuleService {
|
||||
|
||||
@Autowired
|
||||
private TenScheduleService tenScheduleService;
|
||||
@Autowired
|
||||
private TenPersonService tenPersonService;
|
||||
@Autowired
|
||||
private TenCellDeptService tenCellDeptService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<TenRuleEntity> page = this.page(
|
||||
new Query<TenRuleEntity>().getPage(params),
|
||||
new QueryWrapper<TenRuleEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.eq("cell_id",params.get("cellId"))
|
||||
);
|
||||
|
||||
//获取详细班次,通过规则id
|
||||
for(TenRuleEntity ruleEntity: page.getRecords()){
|
||||
List<TenScheduleEntity> scheduleEntityList = tenScheduleService.list(
|
||||
new QueryWrapper<TenScheduleEntity>()
|
||||
.eq("rule_id",ruleEntity.getRuleId())
|
||||
.eq("tenant_id",ruleEntity.getTenantId())
|
||||
.eq("cell_id",params.get("cellId"))
|
||||
);
|
||||
ruleEntity.setScheduleEntityList(scheduleEntityList);
|
||||
|
||||
String deptIds = ruleEntity.getDeptIds();
|
||||
String[] deptIdArray = deptIds.split(",");
|
||||
StringBuffer deptNames = new StringBuffer();
|
||||
int memberCount = 0;
|
||||
for(String deptId: deptIdArray){
|
||||
TenCellDeptEntity deptEntity = tenCellDeptService.getById(deptId);
|
||||
if(deptEntity!=null){
|
||||
deptNames.append(deptEntity.getName()+",");
|
||||
// int mCount = tenPersonService.count(new QueryWrapper<TenMemberEntity>()
|
||||
// .eq("dept_id",deptId));
|
||||
// memberCount += mCount;
|
||||
}
|
||||
}
|
||||
ruleEntity.setDeptNames(deptNames.toString());
|
||||
ruleEntity.setMemberCount(memberCount);
|
||||
}
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveTr(TenRuleEntity entity) {
|
||||
//1. 保存基础规则信息
|
||||
this.save(entity);
|
||||
|
||||
//2. 保存班次信息
|
||||
for(TenScheduleEntity schedule: entity.getScheduleEntityList()){
|
||||
schedule.setRuleId(entity.getRuleId());
|
||||
schedule.setTenantId(entity.getTenantId());
|
||||
}
|
||||
tenScheduleService.saveBatch(entity.getScheduleEntityList());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateByIdTr(TenRuleEntity entity) {
|
||||
//1. 保存基础规则信息
|
||||
this.updateById(entity);
|
||||
|
||||
//2. 保存班次信息
|
||||
for(TenScheduleEntity schedule: entity.getScheduleEntityList()){
|
||||
schedule.setRuleId(entity.getRuleId());
|
||||
schedule.setTenantId(entity.getTenantId());
|
||||
}
|
||||
tenScheduleService.saveOrUpdateBatch(entity.getScheduleEntityList());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean removeByIdsTr(Long[] ruleIds) {
|
||||
//1. 删除基础规则信息
|
||||
this.removeByIds(Arrays.asList(ruleIds));
|
||||
//2. 删除班次信息
|
||||
tenScheduleService.remove(new QueryWrapper<TenScheduleEntity>().in("rule_id",ruleIds));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenRuleEntity findMemberRules(Long memberId, Long cellId, Integer week) {
|
||||
TenPersonEntity member = tenPersonService.getById(memberId,cellId);
|
||||
Long deptId = member.getDeptId();
|
||||
List<TenRuleEntity> rules = this.list(new QueryWrapper<TenRuleEntity>()
|
||||
.last("where find_in_set("+deptId+",dept_ids) and find_in_set("+week+",days) order by create_time desc"));
|
||||
//只拿出来第一个,最后一次添加的哪个
|
||||
TenRuleEntity memberRule = null;
|
||||
if(rules.size()>0){
|
||||
memberRule = rules.get(0);
|
||||
List<TenScheduleEntity> ss = tenScheduleService.list(
|
||||
new QueryWrapper<TenScheduleEntity>()
|
||||
.eq("rule_id",memberRule.getRuleId())
|
||||
);
|
||||
memberRule.setScheduleEntityList(ss);
|
||||
}
|
||||
return memberRule;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenScheduleDao;
|
||||
import net.shapelight.modules.ten.entity.TenScheduleEntity;
|
||||
import net.shapelight.modules.ten.service.TenScheduleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service("tenScheduleService")
|
||||
public class TenScheduleServiceImpl extends ServiceImpl<TenScheduleDao, TenScheduleEntity> implements TenScheduleService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<TenScheduleEntity> page = this.page(
|
||||
new Query<TenScheduleEntity>().getPage(params),
|
||||
new QueryWrapper<TenScheduleEntity>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package net.shapelight.modules.ten.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AttendanceDayVo {
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
@ApiModelProperty("打卡日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date checkDate;
|
||||
/**
|
||||
* 星期几1,2,3,4,5,6,7
|
||||
*/
|
||||
@ApiModelProperty("星期几")
|
||||
private Integer checkDay;
|
||||
|
||||
// @ApiModelProperty("部门id")
|
||||
// private Long deptId;
|
||||
//
|
||||
// @ApiModelProperty("部门名称")
|
||||
// private String deptName;
|
||||
|
||||
/**
|
||||
* 出勤天数
|
||||
*/
|
||||
@ApiModelProperty("出勤天数")
|
||||
private Integer checkDayCount;
|
||||
|
||||
/**
|
||||
* 正常签到
|
||||
*/
|
||||
@ApiModelProperty("正常签到次数")
|
||||
private Integer dutyOnOkCount;
|
||||
|
||||
/**
|
||||
* 迟到次数
|
||||
*/
|
||||
@ApiModelProperty("迟到次数")
|
||||
private Integer dutyOnLateCount;
|
||||
|
||||
/**
|
||||
* 正常签退次数
|
||||
*/
|
||||
@ApiModelProperty("正常签退次数")
|
||||
private Integer dutyOffOkCount;
|
||||
|
||||
/**
|
||||
* 早退次数
|
||||
*/
|
||||
@ApiModelProperty("早退次数")
|
||||
private Integer dutyOffEarlyCount;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package net.shapelight.modules.ten.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class TenCheckMemberCountVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
@ApiModelProperty("人员id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long memberId;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ApiModelProperty("姓名")
|
||||
private String memberName;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
@ApiModelProperty("工号")
|
||||
private String jobNumber;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idNumber;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
private Long deptId;
|
||||
/**
|
||||
* rgb
|
||||
*/
|
||||
@ApiModelProperty("rgb头像")
|
||||
private String rgb;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@ApiModelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 出勤天数
|
||||
*/
|
||||
@ApiModelProperty("出勤天数")
|
||||
private Integer checkDayCount;
|
||||
|
||||
/**
|
||||
* 正常签到
|
||||
*/
|
||||
@ApiModelProperty("正常签到次数")
|
||||
private Integer dutyOnOkCount;
|
||||
|
||||
/**
|
||||
* 迟到次数
|
||||
*/
|
||||
@ApiModelProperty("迟到次数")
|
||||
private Integer dutyOnLateCount;
|
||||
|
||||
/**
|
||||
* 正常签退次数
|
||||
*/
|
||||
@ApiModelProperty("正常签退次数")
|
||||
private Integer dutyOffOkCount;
|
||||
|
||||
/**
|
||||
* 早退次数
|
||||
*/
|
||||
@ApiModelProperty("早退次数")
|
||||
private Integer dutyOffEarlyCount;
|
||||
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ spring:
|
|||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.10.20:3306/cell_db_v8_http_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true
|
||||
url: jdbc:mysql://192.168.10.20:3306/cell_db_v9_check?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true
|
||||
username: user
|
||||
password: user@server001
|
||||
# url: jdbc:mysql://39.96.9.232:3306/cell_db_v8_http?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&rewriteBatchedStatements=true
|
||||
|
|
|
@ -31,7 +31,7 @@ spring:
|
|||
enabled: true
|
||||
file-size-threshold: 1000MB
|
||||
redis:
|
||||
database: 0
|
||||
database: 10
|
||||
host: 192.168.10.20
|
||||
port: 6379
|
||||
password: 123456 # 密码(默认为空)
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenCheckDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<!-- <resultMap type="net.shapelight.modules.ten.entity.TenCheckEntity" id="tenCheckMap">-->
|
||||
<!-- <result property="checkId" column="check_id"/>-->
|
||||
<!-- <result property="memberId" column="member_id"/>-->
|
||||
<!-- <result property="ruleId" column="rule_id"/>-->
|
||||
<!-- <result property="checkDate" column="check_date"/>-->
|
||||
<!-- <result property="checkDay" column="check_day"/>-->
|
||||
<!-- <result property="memberName" column="member_name"/>-->
|
||||
<!-- <result property="gender" column="gender"/>-->
|
||||
<!-- <result property="mobile" column="mobile"/>-->
|
||||
<!-- <result property="jobNumber" column="job_number"/>-->
|
||||
<!-- <result property="position" column="position"/>-->
|
||||
<!-- <result property="icNumber" column="ic_number"/>-->
|
||||
<!-- <result property="idNumber" column="id_number"/>-->
|
||||
<!-- <result property="deptId" column="dept_id"/>-->
|
||||
<!-- <result property="deptName" column="dept_name"/>-->
|
||||
<!-- <result property="rgb" column="rgb"/>-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
|
||||
|
||||
<select id="findMemberCheckList" resultType="net.shapelight.modules.ten.entity.TenCheckEntity">
|
||||
select * from ten_check c
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1=1
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and c.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.memberName != null and params.memberName!=''">
|
||||
and m.name like CONCAT('%', '${params.memberName}', '%')
|
||||
</if>
|
||||
<!-- <if test="params.jobNumber != null and params.jobNumber!=''">-->
|
||||
<!-- and m.job_number like CONCAT('%', '${params.jobNumber}', '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.deptIds != null">-->
|
||||
<!-- and m.dept_id in-->
|
||||
<!-- <foreach item="deptId" collection="params.deptIds" open="(" separator="," close=")">-->
|
||||
<!-- #{deptId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
|
||||
<if test="params.checkDay != null and params.checkDay!=''">
|
||||
and c.check_day = #{params.checkDay}
|
||||
</if>
|
||||
|
||||
order by check_date desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findCheckMemberCount" resultType="net.shapelight.modules.ten.vo.TenCheckMemberCountVo">
|
||||
select c.member_id, COUNT(*) as checkDayCount from ten_check c
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1=1
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.memberName != null and params.memberName!=''">
|
||||
and m.name like CONCAT('%', '${params.memberName}', '%')
|
||||
</if>
|
||||
<!-- <if test="params.jobNumber != null and params.jobNumber!=''">-->
|
||||
<!-- and m.job_number like CONCAT('%', '${params.jobNumber}', '%')-->
|
||||
<!-- </if>-->
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and c.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
GROUP BY c.member_id
|
||||
</select>
|
||||
|
||||
|
||||
<!-- <select id="findCheckMemberCount" resultType="net.shapelight.modules.ten.vo.TenCheckMemberCountVo">-->
|
||||
<!-- select member_id, member_name, job_number,id_number,dept_id, dept_name, rgb,COUNT(*) as checkDayCount from ten_check-->
|
||||
<!-- where 1=1-->
|
||||
<!-- <if test="params.memberId != null and params.memberId!=''">-->
|
||||
<!-- and member_id like CONCAT('%', '${params.memberId}', '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.memberName != null and params.memberName!=''">-->
|
||||
<!-- and member_name like CONCAT('%', '${params.memberName}', '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.deptId != null and params.deptId!=''">-->
|
||||
<!-- and dept_id = #{params.deptId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.dateStart != null and params.dateStart!=''">-->
|
||||
<!-- and check_date >= #{params.dateStart}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.dateEnd != null and params.dateEnd!=''">-->
|
||||
<!-- and check_date <= #{params.dateEnd}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.tenantId != null and params.tenantId!=''">-->
|
||||
<!-- and tenant_id = #{params.tenantId}-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY member_id, member_name, job_number, id_number,dept_id, dept_name, rgb-->
|
||||
<!-- </select>-->
|
||||
|
||||
|
||||
<select id="findCheckMemberList" resultType="net.shapelight.modules.ten.vo.TenCheckMemberCountVo">
|
||||
select c.member_id, COUNT(*) as checkDayCount from ten_check c
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1=1
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.memberName != null and params.memberName!=''">
|
||||
and m.name like CONCAT('%', '${params.memberName}', '%')
|
||||
</if>
|
||||
<!-- <if test="params.jobNumber != null and params.jobNumber!=''">-->
|
||||
<!-- and m.job_number like CONCAT('%', '${params.jobNumber}', '%')-->
|
||||
<!-- </if>-->
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and c.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
GROUP BY c.member_id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findDutyOnCount" resultType="integer">
|
||||
select count(*) from ten_check_schedule cs left join ten_check c
|
||||
on cs.check_id = c.check_id
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1 = 1
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and cs.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
and cs.duty_on_status = #{params.status}
|
||||
</select>
|
||||
|
||||
<select id="findDutyOnInfo" resultType="net.shapelight.modules.ten.entity.TenCheckScheduleEntity">
|
||||
select cs.* from ten_check_schedule cs left join ten_check c
|
||||
on cs.check_id = c.check_id
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1 = 1
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and cs.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
and cs.duty_on_status = #{params.status}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="findDutyOffCount" resultType="integer">
|
||||
select count(*) from ten_check_schedule cs left join ten_check c
|
||||
on cs.check_id = c.check_id
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1 = 1
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and cs.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
and cs.duty_off_status = #{params.status}
|
||||
</select>
|
||||
|
||||
<select id="findDutyOffInfo" resultType="net.shapelight.modules.ten.entity.TenCheckScheduleEntity">
|
||||
select cs.* from ten_check_schedule cs left join ten_check c
|
||||
on cs.check_id = c.check_id
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1 = 1
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and cs.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.memberId != null and params.memberId!=''">
|
||||
and c.member_id = #{params.memberId}
|
||||
</if>
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
and cs.duty_off_status = #{params.status}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findAttendanceDayPage" resultType="net.shapelight.modules.ten.vo.AttendanceDayVo">
|
||||
SELECT c.check_date checkDate,COUNT(*) checkDayCount,c.check_day checkDay FROM ten_check c
|
||||
left join ten_person m on c.member_id = m.person_id
|
||||
where 1 = 1
|
||||
<if test="params.dateStart != null and params.dateStart!=''">
|
||||
and c.check_date >= #{params.dateStart}
|
||||
</if>
|
||||
<if test="params.dateEnd != null and params.dateEnd!=''">
|
||||
and c.check_date <= #{params.dateEnd}
|
||||
</if>
|
||||
<if test="params.deptId != null and params.deptId!=''">
|
||||
and m.dept_id = #{params.deptId}
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId!=''">
|
||||
and c.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
GROUP BY c.check_date,c.check_day
|
||||
order by c.check_date desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenCheckScheduleDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<!-- <resultMap type="net.shapelight.modules.ten.entity.TenCheckScheduleEntity" id="tenCheckScheduleMap">-->
|
||||
<!-- <result property="checkScheduleId" column="check_schedule_id"/>-->
|
||||
<!-- <result property="checkId" column="check_id"/>-->
|
||||
<!-- <result property="scheduleIndex" column="schedule_index"/>-->
|
||||
<!-- <result property="dutyOnRecordId" column="duty_on_record_id"/>-->
|
||||
<!-- <result property="dutyOffRecordId" column="duty_off_record_id"/>-->
|
||||
<!-- <result property="dutyOnTime" column="duty_on_time"/>-->
|
||||
<!-- <result property="dutyOffTime" column="duty_off_time"/>-->
|
||||
<!-- <result property="dutyOnStatus" column="duty_on_status"/>-->
|
||||
<!-- <result property="dutyOnStatusInfo" column="duty_on_status_info"/>-->
|
||||
<!-- <result property="dutyOffStatus" column="duty_off_status"/>-->
|
||||
<!-- <result property="dutyOffStatusInfo" column="duty_off_status_info"/>-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
|
||||
</mapper>
|
|
@ -1214,6 +1214,10 @@
|
|||
|
||||
</select>
|
||||
|
||||
<select id="getByIdWithDelete" resultMap="BaseResultMap">
|
||||
select * from ten_person where person_id = #{personId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenRuleDao">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenScheduleDao">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -8,6 +8,7 @@ import org.joda.time.LocalDate;
|
|||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -25,6 +26,10 @@ public class DateUtils {
|
|||
public final static String DATE_TIME_DB= "yyyyMMddHHmmss";
|
||||
public final static String DATE_YEAR_MONTH= "yyyyMMdd";
|
||||
public final static String DATE_MONTH= "yyyy-MM";
|
||||
public final static String DATE_TIME_YEARMONTH= "yyyyMM";
|
||||
public final static String DATE_DAY= "yyyy-MM-dd";
|
||||
public final static String DATE_HOUR= "HH:mm:ss";
|
||||
public final static String DATE_DIR = "YYYYMM";
|
||||
|
||||
/**
|
||||
* 日期格式化 日期格式为:yyyy-MM-dd
|
||||
|
@ -183,4 +188,27 @@ public class DateUtils {
|
|||
|
||||
return lastDayOfMonth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期获取 星期 (2019-05-06 ——> 星期一)
|
||||
* @param datetime
|
||||
* @return
|
||||
*/
|
||||
public static int dateToWeek(String datetime) {
|
||||
|
||||
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Date date;
|
||||
try {
|
||||
date = f.parse(datetime);
|
||||
cal.setTime(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//一周的第几天
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK)-1;
|
||||
if (w <= 0)
|
||||
w = 7;
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
v4.0
|
||||
1.sys_device_type表 启用other字段,0表示2d,1表示3d,v4.0加入,空表示2d
|
||||
2.ten_device表增加两个字段,识别阈值:recognize_score_3d,检测方式:detection_type
|
||||
3.ten_person表增加5个字段:depth,face_model,source_file,camera_param
|
||||
4.ten_record表增加8个字段:depth,source_file,duration,threshold,distance,score3d,temperature,camera_param
|
||||
|
||||
|
||||
v4.0 数据库修改内容
|
||||
alter table ten_device_copy1
|
||||
ADD COLUMN recognize_score3d varchar(30) DEFAULT '62,65' COMMENT '3d识别阈值',
|
||||
ADD COLUMN detection_type tinyint(1) DEFAULT 0 COMMENT '0:默认2d检测, 1:3d检测';
|
||||
|
||||
|
||||
alter table ten_person_copy1
|
||||
ADD COLUMN depth varchar(200) COMMENT '深度图片',
|
||||
ADD COLUMN face_model varchar(200) COMMENT '脸模',
|
||||
ADD COLUMN source_file varchar(200) COMMENT '源文件',
|
||||
ADD COLUMN camera_param varchar(200) COMMENT '相机参数';
|
||||
|
||||
alter table ten_record_9999999999999
|
||||
ADD COLUMN depth varchar(200) COMMENT '深度图片',
|
||||
ADD COLUMN source_file varchar(200) COMMENT '源文件',
|
||||
ADD COLUMN camera_param varchar(200) COMMENT '相机参数',
|
||||
ADD COLUMN duration int(11) COMMENT '耗时',
|
||||
ADD COLUMN threshold varchar(50) COMMENT '阈值',
|
||||
ADD COLUMN distance float COMMENT '距离',
|
||||
ADD COLUMN score3d varchar(50) COMMENT '分数',
|
||||
ADD COLUMN temperature float COMMENT '体温';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------v8.0 http协议版本,数据库更新说明:先执行以下sql语句,在跑批处理程序-----------------
|
||||
1.ten_device表增加字段:app_language,lat,lon
|
||||
2.ten_person表增加字段:thd_feature,dept_id
|
||||
3.ten_person表person_type字段默认5000
|
||||
4.sys_menu表增加4条参数2001,2002,2003,2004
|
||||
5.ten_company表增加type_id字段关联
|
||||
6.ten_label表type字段类型修改为int
|
||||
7.增加表 ten_cell_dept
|
||||
8.增加表 ten_device_operate_log
|
||||
9.增加表 ten_company_type
|
||||
10.页面修改角色
|
||||
|
||||
|
||||
|
||||
alter table ten_device ADD COLUMN app_language tinyint(1) DEFAULT 0 COMMENT 'app版本';
|
||||
alter table ten_device ADD COLUMN lat varchar(50) DEFAULT '' COMMENT '纬度';
|
||||
alter table ten_device ADD COLUMN lon varchar(50) DEFAULT '' COMMENT '经度';
|
||||
|
||||
alter table ten_person ADD COLUMN thd_feature varchar(10240) COMMENT '3d特征';
|
||||
alter table ten_person ADD COLUMN dept_id bigint(20) COMMENT '部门id';
|
||||
alter table ten_person ALTER COLUMN person_type SET DEFAULT 5000;
|
||||
|
||||
INSERT INTO `sys_menu` VALUES (2001, 3, '设备Log', 'sys/deviceLog', 'sys:devicelog', 1, 'shebei', 6, 'system_devicelog');
|
||||
INSERT INTO `sys_menu` VALUES (2002, 1210, '操作记录', 'ten/deviceoperatelog', 'ten:deviceoperatelog', 1, 'shebei', 6, 'tenant_deviceoperatelog');
|
||||
INSERT INTO `sys_menu` VALUES (2003, 1234, '组织管理', 'ten/celldept', 'ten:celldept', 1, 'shebei', 6, 'tenant_celldept');
|
||||
INSERT INTO `sys_menu` VALUES (2004, 1220, '单位类别', 'ten/companytype', 'ten:companytype', 1, 'shebei', 6, 'tenant_companytype');
|
||||
|
||||
alter table ten_company ADD COLUMN type_id bigint(20) COMMENT '类别id';
|
||||
|
||||
ALTER TABLE ten_label MODIFY COLUMN type INT(11);
|
||||
|
||||
CREATE TABLE `ten_cell_dept` (
|
||||
`dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门/楼栋',
|
||||
`parent_id` bigint(20) DEFAULT NULL COMMENT '父级目录',
|
||||
`cell_id` bigint(20) NOT NULL COMMENT '小区ID',
|
||||
`name` varchar(200) DEFAULT NULL COMMENT '名称',
|
||||
`lable` varchar(100) DEFAULT NULL COMMENT '标签',
|
||||
`lat` varchar(50) DEFAULT '' COMMENT '纬度',
|
||||
`lon` varchar(50) DEFAULT '' COMMENT '经度',
|
||||
`other` varchar(200) DEFAULT '' COMMENT '其他',
|
||||
`remark` varchar(100) DEFAULT '' COMMENT '备注',
|
||||
`picture` varchar(1024) DEFAULT '' COMMENT '照片',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(100) DEFAULT '' COMMENT '创建人',
|
||||
`last_update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`last_update_by` varchar(100) DEFAULT '' COMMENT '更新人',
|
||||
`delete_flag` tinyint(1) DEFAULT '0' COMMENT '0未删除1删除',
|
||||
`tenant_id` bigint(20) unsigned zerofill DEFAULT '00000000000000000000' COMMENT '运营商ID',
|
||||
`xa_sync` tinyint(1) DEFAULT '0' COMMENT '第三方是否同步1是0否默认0',
|
||||
`p_id` int(18) DEFAULT NULL COMMENT '地址序号',
|
||||
`dzbm` varchar(100) DEFAULT NULL COMMENT '地址编码',
|
||||
`is_room` tinyint(1) DEFAULT '0' COMMENT '是否是户室0否1是',
|
||||
`room_type` tinyint(1) DEFAULT '0' COMMENT '类型:自住,出租',
|
||||
PRIMARY KEY (`dept_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=37291 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `ten_company_type` (
|
||||
`type_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`name` varchar(100) DEFAULT '' COMMENT '标签名称',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(100) DEFAULT '' COMMENT '创建人',
|
||||
`last_update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`last_update_by` varchar(100) DEFAULT '' COMMENT '更新人',
|
||||
`delete_flag` tinyint(1) DEFAULT '0' COMMENT '0未删除1删除',
|
||||
`tenant_id` bigint(20) NOT NULL COMMENT '运营商ID',
|
||||
PRIMARY KEY (`type_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10033 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='标签';
|
||||
|
||||
CREATE TABLE `ten_device_operate_log` (
|
||||
`log_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`sn` varchar(100) DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`operation` varchar(200) DEFAULT NULL COMMENT '用户操作',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '运营商Id',
|
||||
PRIMARY KEY (`log_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=667 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE `sys_device_log` (
|
||||
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`sn` varchar(50) DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`log` varchar(16000) DEFAULT NULL,
|
||||
PRIMARY KEY (`log_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=418 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
------------------------v9.0 考勤版本-----------------
|
||||
1.增加表ten_rule
|
||||
2.增加表ten_schedule
|
||||
3.增加表ten_check
|
||||
4.增加表ten_check_schedule
|
||||
5.menu表增加2010,2011,2012,2013,2014五条记录
|
Loading…
Reference in New Issue