|
@@ -1,27 +1,38 @@
|
|
|
package com.jpsoft.smart.modules.mobile.controller;
|
|
|
|
|
|
+import cn.hutool.core.date.DateField;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.smart.config.OSSConfig;
|
|
|
import com.jpsoft.smart.config.TemperatureConfig;
|
|
|
+import com.jpsoft.smart.modules.base.dto.WorkAttendanceDTO;
|
|
|
+import com.jpsoft.smart.modules.base.entity.AlarmConfig;
|
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
|
import com.jpsoft.smart.modules.base.service.AlarmConfigService;
|
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
|
+import com.jpsoft.smart.modules.business.entity.FillAttendance;
|
|
|
+import com.jpsoft.smart.modules.business.entity.FillAttendanceFiles;
|
|
|
import com.jpsoft.smart.modules.business.entity.WorkAttendance;
|
|
|
+import com.jpsoft.smart.modules.business.service.FillAttendanceFilesService;
|
|
|
+import com.jpsoft.smart.modules.business.service.FillAttendanceService;
|
|
|
import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.math3.random.HaltonSequenceGenerator;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/mobile/workAttendance")
|
|
@@ -42,15 +53,25 @@ public class WorkAttendanceApiController {
|
|
|
@Autowired
|
|
|
private WorkAttendanceService workAttendanceService;
|
|
|
|
|
|
- @ApiOperation(value="考勤记录")
|
|
|
- @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
+ @Autowired
|
|
|
+ private FillAttendanceService fillAttendanceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FillAttendanceFilesService fillAttendanceFilesService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OSSConfig ossConfig;
|
|
|
+
|
|
|
+ @ApiOperation(value = "考勤记录")
|
|
|
+ @RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
- @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> pageList(@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
- @RequestAttribute String subject, String token){
|
|
|
+ public MessageResult<Map> pageList(@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -65,13 +86,416 @@ public class WorkAttendanceApiController {
|
|
|
|
|
|
Page<WorkAttendance> page = workAttendanceService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
|
|
- Map<String,Object> dataMap = PojoUtils.pageWrapper(page);
|
|
|
+ Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
|
|
|
+
|
|
|
+ msgResult.setData(dataMap);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "补卡申请获取时间段")
|
|
|
+ @RequestMapping(value = "patchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "workAttendanceId", value = "考勤id", required = false, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> patchCard(String workAttendanceId, @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("申请人不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ String workAttendanceDate = "";
|
|
|
+ String workAttendanceTime = "";
|
|
|
+ if (StringUtils.isNotBlank(workAttendanceId)) {
|
|
|
+ WorkAttendance workAttendance = workAttendanceService.get(workAttendanceId);
|
|
|
+ if (workAttendance == null) {
|
|
|
+ throw new Exception("考勤记录不存在");
|
|
|
+ }
|
|
|
+ if (!"0".equals(workAttendance.getResult())) {
|
|
|
+ throw new Exception("只有缺卡才能申请补卡");
|
|
|
+ }
|
|
|
+ //考勤日期
|
|
|
+ workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
|
+ //考勤时间段
|
|
|
+ workAttendanceTime = DateUtil.format(workAttendance.getRecordTime(), "HH:mm") + "-" + DateUtil.format(workAttendance.getCreateTime(), "HH:mm");
|
|
|
+ } else {
|
|
|
+ workAttendanceDate = DateUtil.today();
|
|
|
+ // String newWorkAttendanceTime = "";
|
|
|
+ //获取当天星期,国外和国内一周开始日期不一样,要偏一天
|
|
|
+ Integer weekDay = DateUtil.dayOfWeek(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -1));
|
|
|
+ List<AlarmConfig> alarmConfigList = alarmConfigService.findByCompanyIdAndWeekDay(personInfo.getCompanyId(), '%' + weekDay.toString() + '%');
|
|
|
+
|
|
|
+ if (alarmConfigList.size() <= 0) {
|
|
|
+ throw new Exception("当天无考勤配置");
|
|
|
+ }
|
|
|
+ for (AlarmConfig alarmConfig : alarmConfigList) {
|
|
|
+ Long nowTime = new Date().getTime();
|
|
|
+ // Date startTime = DateUtil.parseTime(alarmConfig.getStartTime());
|
|
|
+ Long startTime = DateUtil.parse(alarmConfig.getStartTime()).getTime();
|
|
|
+ Long endTime = DateUtil.parse(alarmConfig.getEndTime()).getTime();
|
|
|
+ if (nowTime <= endTime && nowTime >= startTime) {
|
|
|
+ workAttendanceTime = alarmConfig.getStartTime() + "-" + alarmConfig.getEndTime();
|
|
|
+ break;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(workAttendanceTime)) {
|
|
|
+ throw new Exception("不在考勤时间段");
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
+ dataMap.put("workAttendanceId", workAttendanceId);
|
|
|
+ dataMap.put("workAttendanceDate", workAttendanceDate);
|
|
|
+ dataMap.put("workAttendanceTime", workAttendanceTime);
|
|
|
msgResult.setData(dataMap);
|
|
|
msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "补卡申请数据提交")
|
|
|
+ @RequestMapping(value = "postPatchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "workAttendanceId", value = "考勤id", required = false, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "workAttendanceDate", value = "考勤日期", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "workAttendanceTime", value = "考勤时间段", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "type", value = "外勤打卡/补卡(1/2)", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "content", value = "申请理由", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "photoFile", value = "图片", required = false, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "approvalPersonId", value = "审核人", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<WorkAttendanceDTO> postPatchCard(
|
|
|
+ String workAttendanceId,
|
|
|
+ @RequestParam("workAttendanceDate") String workAttendanceDate,
|
|
|
+ @RequestParam("workAttendanceTime") String workAttendanceTime,
|
|
|
+ @RequestParam("type") String type,
|
|
|
+ @RequestParam("content") String content,
|
|
|
+ String photoFile,
|
|
|
+ @RequestParam("approvalPersonId") String approvalPersonId,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<WorkAttendanceDTO> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //查询操作人
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("申请人不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ //审核人
|
|
|
+ PersonInfo approvalPerson = personInfoService.get(Long.valueOf(approvalPersonId));
|
|
|
+ if (approvalPerson == null) {
|
|
|
+ throw new Exception("审核人不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ String alarmConfigId = "";
|
|
|
+
|
|
|
+ //外勤打卡
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ String newWorkAttendanceDate = DateUtil.today();
|
|
|
+ String newWorkAttendanceTime = "";
|
|
|
+ // workAttendanceDate = DateUtil.today();
|
|
|
+ //获取当天星期,国外和国内一周开始日期不一样,要偏一天
|
|
|
+ Integer weekDay = DateUtil.dayOfWeek(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -1));
|
|
|
+ List<AlarmConfig> alarmConfigList = alarmConfigService.findByCompanyIdAndWeekDay(personInfo.getCompanyId(), '%' + weekDay.toString() + '%');
|
|
|
+
|
|
|
+ if (alarmConfigList.size() <= 0) {
|
|
|
+ throw new Exception("当天无考勤配置");
|
|
|
+ }
|
|
|
+ for (AlarmConfig alarmConfig : alarmConfigList) {
|
|
|
+ Long nowTime = new Date().getTime();
|
|
|
+ // Date startTime = DateUtil.parseTime(alarmConfig.getStartTime());
|
|
|
+ Long startTime = DateUtil.parse(alarmConfig.getStartTime()).getTime();
|
|
|
+ Long endTime = DateUtil.parse(alarmConfig.getEndTime()).getTime();
|
|
|
+ if (nowTime <= endTime && nowTime >= startTime) {
|
|
|
+ newWorkAttendanceTime = alarmConfig.getStartTime() + "-" + alarmConfig.getEndTime();
|
|
|
+ alarmConfigId = alarmConfig.getId();
|
|
|
+ break;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(newWorkAttendanceTime)) {
|
|
|
+ throw new Exception("不在考勤时间段");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!workAttendanceDate.equals(newWorkAttendanceDate) || !workAttendanceTime.equals(newWorkAttendanceTime)) {
|
|
|
+ throw new Exception("考勤数据错误,请确认");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> searchParam = new HashMap<>();
|
|
|
+ searchParam.put("alarmConfigId", alarmConfigId);
|
|
|
+ searchParam.put("personId", personInfo.getId());
|
|
|
+ searchParam.put("maxRecordTime", DateUtil.beginOfDay(new Date()));
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("record_time", "desc"));
|
|
|
+ Page<WorkAttendance> workAttendancePage = workAttendanceService.pageSearch(searchParam, 1, 20, true, sortList);
|
|
|
+ if (workAttendancePage.getResult().size() > 0) {
|
|
|
+ throw new Exception("此时间段已有打卡记录");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ //补卡
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ if (StringUtils.isBlank(workAttendanceId)) {
|
|
|
+ throw new Exception("考勤记录id不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ WorkAttendance workAttendance = workAttendanceService.get(workAttendanceId);
|
|
|
+ if (workAttendance == null) {
|
|
|
+ throw new Exception("考勤记录不存在");
|
|
|
+ }
|
|
|
+ if (!"0".equals(workAttendance.getResult())) {
|
|
|
+ throw new Exception("只有缺卡才能申请补卡");
|
|
|
+ }
|
|
|
+
|
|
|
+ //考勤日期
|
|
|
+ workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
|
+ //考勤时间段
|
|
|
+ workAttendanceTime = DateUtil.format(workAttendance.getRecordTime(), "HH:mm") + "-" + DateUtil.format(workAttendance.getCreateTime(), "HH:mm");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ FillAttendance fillAttendance = fillAttendanceService.insertAndfile(workAttendanceId, workAttendanceDate, workAttendanceTime, content, type, photoFile, approvalPersonId, personInfo.getId(), alarmConfigId);
|
|
|
+
|
|
|
+
|
|
|
+// //新增外勤打卡、补卡申请记录
|
|
|
+// FillAttendance fillAttendance = new FillAttendance();
|
|
|
+// fillAttendance.setId(UUID.randomUUID().toString());
|
|
|
+// fillAttendance.setPersonId(personInfo.getId());
|
|
|
+// fillAttendance.setType(type);
|
|
|
+// fillAttendance.setFillDay(workAttendanceDate);
|
|
|
+// fillAttendance.setFillAttendanceTime(workAttendanceTime);
|
|
|
+// fillAttendance.setContent(content);
|
|
|
+// fillAttendance.setApprovalPersonId(Long.valueOf(approvalPersonId));
|
|
|
+// fillAttendance.setStatus("0");
|
|
|
+// fillAttendance.setBusinessWorkAttendanceId(workAttendanceId);
|
|
|
+// String approvalNo = com.jpsoft.smart.modules.common.utils.StringUtils.getApprovalNo();
|
|
|
+// fillAttendance.setApprovalNo(approvalNo);
|
|
|
+// fillAttendance.setCreateTime(new Date());
|
|
|
+// fillAttendance.setDelFlag(false);
|
|
|
+// fillAttendanceService.insert(fillAttendance);
|
|
|
+//
|
|
|
+// //照片不为空保存资料
|
|
|
+//
|
|
|
+// if (photoFile != null) {
|
|
|
+// FillAttendanceFiles fillAttendanceFiles = new FillAttendanceFiles();
|
|
|
+// fillAttendanceFiles.setId(UUID.randomUUID().toString());
|
|
|
+// fillAttendanceFiles.setFillAttendanceId(fillAttendance.getId());
|
|
|
+// fillAttendanceFiles.setFileUrl(photoFile);
|
|
|
+// fillAttendanceFiles.setCreateTime(new Date());
|
|
|
+// fillAttendanceFiles.setDelFlag(false);
|
|
|
+// fillAttendanceFilesService.insert(fillAttendanceFiles);
|
|
|
+// }
|
|
|
+
|
|
|
+ WorkAttendanceDTO workAttendanceDTO = new WorkAttendanceDTO();
|
|
|
+ BeanUtils.copyProperties(fillAttendance, workAttendanceDTO);
|
|
|
+ workAttendanceDTO.setFillAttendanceDayAndTime(fillAttendance.getFillDay() + " " + fillAttendance.getFillAttendanceTime());
|
|
|
+ workAttendanceDTO.setPersonName(personInfo.getName());
|
|
|
+ workAttendanceDTO.setFaceImageUrl(personInfo.getFaceImageUrl());
|
|
|
+ workAttendanceDTO.setApprovalPersonName(approvalPerson.getName());
|
|
|
+ if (fillAttendance.getType().equals("1")) {
|
|
|
+ workAttendanceDTO.setTypeN("外勤打卡");
|
|
|
+ } else if (fillAttendance.getType().equals("2")) {
|
|
|
+ workAttendanceDTO.setTypeN("补卡");
|
|
|
+ }
|
|
|
+ workAttendanceDTO.setCompanyName(personInfo.getCompanyName());
|
|
|
+ workAttendanceDTO.setFillAttendanceFilesUrl(photoFile == null ? "" : photoFile);
|
|
|
+
|
|
|
+ msgResult.setData(workAttendanceDTO);
|
|
|
+ msgResult.setMessage("提交成功");
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "个人考勤申请记录列表")
|
|
|
+ @RequestMapping(value = "ownListPatchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> ownListPatchCard(
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> searchParam = new HashMap<>();
|
|
|
+ searchParam.put("personId", personInfo.getId());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
+ Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
|
+ if (fillAttendancePage.getResult().size()>0){
|
|
|
+ for (FillAttendance fillAttendance : fillAttendancePage){
|
|
|
+ if (fillAttendance.getType().equals("1")){
|
|
|
+ fillAttendance.setTypeN("外勤打卡");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ fillAttendance.setTypeN("补卡");
|
|
|
+ }
|
|
|
+ if (fillAttendance.getStatus().equals("0")){
|
|
|
+ fillAttendance.setStatusN("审核中");
|
|
|
+ }if (fillAttendance.getStatus().equals("1")){
|
|
|
+ fillAttendance.setStatusN("通过");
|
|
|
+ }if (fillAttendance.getStatus().equals("2")){
|
|
|
+ fillAttendance.setStatusN("拒绝");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(fillAttendancePage));
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "审核人考勤申请记录列表")
|
|
|
+ @RequestMapping(value = "adminListPatchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "status", value = "状态(0:未处理,3:已处理)", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> adminListPatchCard(
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestAttribute String subject, String token,String status) {
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> searchParam = new HashMap<>();
|
|
|
+ searchParam.put("approvalPersonId", personInfo.getId());
|
|
|
+ if (status.equals("0")){
|
|
|
+ searchParam.put("status",status);
|
|
|
+ }else {
|
|
|
+ //已处理
|
|
|
+ searchParam.put("notStatus","0");
|
|
|
+ }
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
+ Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
|
+ if (fillAttendancePage.getResult().size()>0){
|
|
|
+ for (FillAttendance fillAttendance : fillAttendancePage){
|
|
|
+ if (fillAttendance.getType().equals("1")){
|
|
|
+ fillAttendance.setTypeN("外勤打卡");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ fillAttendance.setTypeN("补卡");
|
|
|
+ }
|
|
|
+ if (fillAttendance.getStatus().equals("0")){
|
|
|
+ fillAttendance.setStatusN("审核中");
|
|
|
+ }if (fillAttendance.getStatus().equals("1")){
|
|
|
+ fillAttendance.setStatusN("通过");
|
|
|
+ }if (fillAttendance.getStatus().equals("2")){
|
|
|
+ fillAttendance.setStatusN("拒绝");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(fillAttendancePage));
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
}
|
|
|
- catch (Exception ex){
|
|
|
- log.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "审核人列表")
|
|
|
+ @RequestMapping(value = "approvalList", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<Map> approvalList(
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+ Map<String,Object> searchParam = new HashMap<>();
|
|
|
+ searchParam.put("companyId",personInfo.getCompanyId());
|
|
|
+ searchParam.put("popedom","%2%");
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","asc"));
|
|
|
+ Page<PersonInfo> page = personInfoService.pageSearch(searchParam,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -79,4 +503,140 @@ public class WorkAttendanceApiController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "考勤申请记录详情")
|
|
|
+ @RequestMapping(value = "detailPatchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "id", value = "考勤申请id", required = true, paramType = "form"),
|
|
|
+ })
|
|
|
+ public MessageResult<WorkAttendanceDTO> detailPatchCard(@RequestParam("id") String id,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<WorkAttendanceDTO> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+ FillAttendance fillAttendance = fillAttendanceService.get(id);
|
|
|
+ if (fillAttendance == null){
|
|
|
+ throw new Exception("记录不存在");
|
|
|
+ }
|
|
|
+ FillAttendanceFiles fillAttendanceFiles = fillAttendanceFilesService.findByFillAttendanceId(fillAttendance.getId());
|
|
|
+
|
|
|
+
|
|
|
+ PersonInfo approvalPerson = personInfoService.get(fillAttendance.getApprovalPersonId());
|
|
|
+
|
|
|
+ WorkAttendanceDTO workAttendanceDTO = new WorkAttendanceDTO();
|
|
|
+ BeanUtils.copyProperties(fillAttendance, workAttendanceDTO);
|
|
|
+ workAttendanceDTO.setFillAttendanceDayAndTime(fillAttendance.getFillDay() + " " + fillAttendance.getFillAttendanceTime());
|
|
|
+ workAttendanceDTO.setPersonName(personInfo.getName());
|
|
|
+ workAttendanceDTO.setFaceImageUrl(personInfo.getFaceImageUrl());
|
|
|
+ workAttendanceDTO.setApprovalPersonName(approvalPerson.getName());
|
|
|
+ if (fillAttendance.getType().equals("1")) {
|
|
|
+ workAttendanceDTO.setTypeN("外勤打卡");
|
|
|
+ } else if (fillAttendance.getType().equals("2")) {
|
|
|
+ workAttendanceDTO.setTypeN("补卡");
|
|
|
+ }
|
|
|
+ workAttendanceDTO.setCompanyName(personInfo.getCompanyName());
|
|
|
+ workAttendanceDTO.setFillAttendanceFilesUrl(fillAttendanceFiles.getFileUrl() == null ? "" : fillAttendanceFiles.getFileUrl());
|
|
|
+
|
|
|
+ msgResult.setData(workAttendanceDTO);
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "考勤申请记录审核")
|
|
|
+ @RequestMapping(value = "approvalPatchCard", method = RequestMethod.POST)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "ids", value = "考勤申请ids", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "content", value = "审核意见", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "status", value = "通过/拒绝(1/2)", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<WorkAttendanceDTO> approvalPatchCard(@RequestParam("ids") String ids,String content,@RequestParam("status") String status,
|
|
|
+ @RequestAttribute String subject, String token) {
|
|
|
+ MessageResult<WorkAttendanceDTO> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("人员不存在");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(ids)){
|
|
|
+ throw new Exception("请选择要处理的几率");
|
|
|
+ }
|
|
|
+ List<String> idList = Arrays.asList(ids.split(","));
|
|
|
+ for (String id : idList){
|
|
|
+ FillAttendance fillAttendance = fillAttendanceService.get(id);
|
|
|
+ if (fillAttendance != null){
|
|
|
+ if ("2".equals(status)) {
|
|
|
+ fillAttendance.setStatus(status);
|
|
|
+ fillAttendance.setUpdateTime(new Date());
|
|
|
+ fillAttendance.setUpdateBy(personInfo.getName());
|
|
|
+ fillAttendance.setApprovalTime(new Date());
|
|
|
+ fillAttendance.setApprovalContent(content);
|
|
|
+ fillAttendanceService.update(fillAttendance);
|
|
|
+ }else {
|
|
|
+ fillAttendanceService.updateAndWorkAtten(personInfo,content,fillAttendance);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// FillAttendanceFiles fillAttendanceFiles = fillAttendanceFilesService.findByFillAttendanceId(fillAttendance.getId());
|
|
|
+//
|
|
|
+//
|
|
|
+// PersonInfo approvalPerson = personInfoService.get(fillAttendance.getApprovalPersonId());
|
|
|
+//
|
|
|
+// WorkAttendanceDTO workAttendanceDTO = new WorkAttendanceDTO();
|
|
|
+// BeanUtils.copyProperties(fillAttendance, workAttendanceDTO);
|
|
|
+// workAttendanceDTO.setFillAttendanceDayAndTime(fillAttendance.getFillDay() + " " + fillAttendance.getFillAttendanceTime());
|
|
|
+// workAttendanceDTO.setPersonName(personInfo.getName());
|
|
|
+// workAttendanceDTO.setFaceImageUrl(personInfo.getFaceImageUrl());
|
|
|
+// workAttendanceDTO.setApprovalPersonName(approvalPerson.getName());
|
|
|
+// if (fillAttendance.getType().equals("1")) {
|
|
|
+// workAttendanceDTO.setTypeN("外勤打卡");
|
|
|
+// } else if (fillAttendance.getType().equals("2")) {
|
|
|
+// workAttendanceDTO.setTypeN("补卡");
|
|
|
+// }
|
|
|
+// workAttendanceDTO.setCompanyName(personInfo.getCompanyName());
|
|
|
+// workAttendanceDTO.setFillAttendanceFilesUrl(fillAttendanceFiles.getFileUrl() == null ? "" : fillAttendanceFiles.getFileUrl());
|
|
|
+//
|
|
|
+// msgResult.setData(workAttendanceDTO);
|
|
|
+
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|