|
@@ -3,10 +3,13 @@ package com.jpsoft.smart.modules.mobile.controller;
|
|
import cn.hutool.core.date.DateField;
|
|
import cn.hutool.core.date.DateField;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
|
+import com.google.gson.internal.$Gson$Types;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.TemperatureConfig;
|
|
import com.jpsoft.smart.config.TemperatureConfig;
|
|
import com.jpsoft.smart.modules.base.dto.WorkAttendanceDTO;
|
|
import com.jpsoft.smart.modules.base.dto.WorkAttendanceDTO;
|
|
|
|
+import com.jpsoft.smart.modules.base.dto.WorkDTO;
|
|
import com.jpsoft.smart.modules.base.entity.AlarmConfig;
|
|
import com.jpsoft.smart.modules.base.entity.AlarmConfig;
|
|
|
|
+import com.jpsoft.smart.modules.base.entity.CompanyInfo;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.service.AlarmConfigService;
|
|
import com.jpsoft.smart.modules.base.service.AlarmConfigService;
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
import com.jpsoft.smart.modules.base.service.CompanyInfoService;
|
|
@@ -67,26 +70,70 @@ public class WorkAttendanceApiController {
|
|
@RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
@RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
@ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
|
|
- @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "result", value = "全部/缺卡(0/1)", required = true, paramType = "form")
|
|
})
|
|
})
|
|
|
|
+
|
|
public MessageResult<Map> pageList(@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
public MessageResult<Map> pageList(@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
- @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,String result,
|
|
|
|
+
|
|
@RequestAttribute String subject, String token) {
|
|
@RequestAttribute String subject, String token) {
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
-
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("record_time", "desc"));
|
|
sortList.add(new Sort("record_time", "desc"));
|
|
-
|
|
|
|
- PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
|
-
|
|
|
|
searchParams.put("personId", personInfo.getId());
|
|
searchParams.put("personId", personInfo.getId());
|
|
|
|
|
|
|
|
+ if ("1".equals(result)){
|
|
|
|
+ searchParams.put("result","0");
|
|
|
|
+ }
|
|
Page<WorkAttendance> page = workAttendanceService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
Page<WorkAttendance> page = workAttendanceService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
+ Page<WorkDTO> workDTOPage = PojoUtils.convertPage(page,WorkDTO.class);
|
|
|
|
+ if (workDTOPage.getResult().size()>0){
|
|
|
|
+ for (WorkDTO workDTO : workDTOPage){
|
|
|
|
+ FillAttendance fillAttendance = fillAttendanceService.findByBusinessWorkAttendanceId(workDTO.getId());
|
|
|
|
+ if (workDTO.getResult().equals("0")){
|
|
|
|
+ if (fillAttendance !=null){
|
|
|
|
+ workDTO.setStatus(fillAttendance.getStatus());
|
|
|
|
+ if (fillAttendance.getStatus().equals("0")){
|
|
|
|
+ workDTO.setStatusN("审核中");
|
|
|
|
+ }else if (fillAttendance.getStatus().equals("1")){
|
|
|
|
+ workDTO.setStatusN("通过");
|
|
|
|
+ }else if (fillAttendance.getStatus().equals("2")){
|
|
|
|
+ workDTO.setStatusN("拒绝");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ workDTO.setStatusN("未处理");
|
|
|
|
+ }
|
|
|
|
+ }else if (workDTO.getResult().equals("1")){
|
|
|
|
+ if (fillAttendance != null && fillAttendance.getStatus().equals("1")){
|
|
|
|
+ workDTO.setStatus("1");
|
|
|
|
+ workDTO.setStatusN("审核通过");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ dataMap = PojoUtils.pageWrapper(workDTOPage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // searchParams.put("personId", personInfo.getId());
|
|
|
|
|
|
- Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
|
|
|
|
|
|
+ // Page<WorkAttendance> page = workAttendanceService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
+
|
|
|
|
+ // Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
|
|
|
|
|
|
msgResult.setData(dataMap);
|
|
msgResult.setData(dataMap);
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
@@ -117,10 +164,13 @@ public class WorkAttendanceApiController {
|
|
throw new Exception("申请人不存在");
|
|
throw new Exception("申请人不存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
|
+
|
|
String workAttendanceDate = "";
|
|
String workAttendanceDate = "";
|
|
String workAttendanceTime = "";
|
|
String workAttendanceTime = "";
|
|
if (StringUtils.isNotBlank(workAttendanceId)) {
|
|
if (StringUtils.isNotBlank(workAttendanceId)) {
|
|
WorkAttendance workAttendance = workAttendanceService.get(workAttendanceId);
|
|
WorkAttendance workAttendance = workAttendanceService.get(workAttendanceId);
|
|
|
|
+ AlarmConfig alarmConfig = alarmConfigService.get(workAttendance.getAlarmConfigId());
|
|
if (workAttendance == null) {
|
|
if (workAttendance == null) {
|
|
throw new Exception("考勤记录不存在");
|
|
throw new Exception("考勤记录不存在");
|
|
}
|
|
}
|
|
@@ -130,13 +180,29 @@ public class WorkAttendanceApiController {
|
|
//考勤日期
|
|
//考勤日期
|
|
workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
//考勤时间段
|
|
//考勤时间段
|
|
- workAttendanceTime = DateUtil.format(workAttendance.getRecordTime(), "HH:mm") + "-" + DateUtil.format(workAttendance.getCreateTime(), "HH:mm");
|
|
|
|
|
|
+ workAttendanceTime = alarmConfig.getStartTime() + "-" + alarmConfig.getEndTime();
|
|
} else {
|
|
} else {
|
|
workAttendanceDate = DateUtil.today();
|
|
workAttendanceDate = DateUtil.today();
|
|
// String newWorkAttendanceTime = "";
|
|
// String newWorkAttendanceTime = "";
|
|
//获取当天星期,国外和国内一周开始日期不一样,要偏一天
|
|
//获取当天星期,国外和国内一周开始日期不一样,要偏一天
|
|
Integer weekDay = DateUtil.dayOfWeek(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -1));
|
|
Integer weekDay = DateUtil.dayOfWeek(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -1));
|
|
- List<AlarmConfig> alarmConfigList = alarmConfigService.findByCompanyIdAndWeekDay(personInfo.getCompanyId(), '%' + weekDay.toString() + '%');
|
|
|
|
|
|
+ // List<AlarmConfig> alarmConfigList = alarmConfigService.findByCompanyIdAndWeekDay(personInfo.getCompanyId(), '%' + weekDay.toString() + '%');
|
|
|
|
+
|
|
|
|
+ String[] arr = companyInfo.getCode().split(",");
|
|
|
|
+
|
|
|
|
+ Set<Integer> weekdaySet = new TreeSet<>();
|
|
|
|
+
|
|
|
|
+ List<AlarmConfig> alarmConfigList = null;
|
|
|
|
+
|
|
|
|
+ for (int i=arr.length-1;i>=0;i--) {
|
|
|
|
+ alarmConfigList = alarmConfigService.findByCompanyId(arr[i]);
|
|
|
|
+
|
|
|
|
+ if (alarmConfigList!=null && alarmConfigList.size()>0){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
if (alarmConfigList.size() <= 0) {
|
|
if (alarmConfigList.size() <= 0) {
|
|
throw new Exception("当天无考勤配置");
|
|
throw new Exception("当天无考勤配置");
|
|
@@ -280,10 +346,15 @@ public class WorkAttendanceApiController {
|
|
throw new Exception("只有缺卡才能申请补卡");
|
|
throw new Exception("只有缺卡才能申请补卡");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ FillAttendance fillAttendance = fillAttendanceService.findByBusinessWorkAttendanceId(workAttendanceId);
|
|
|
|
+ if (fillAttendance != null && fillAttendance.getStatus().equals("1")){
|
|
|
|
+ throw new Exception("已经审核通过");
|
|
|
|
+ }
|
|
|
|
+
|
|
//考勤日期
|
|
//考勤日期
|
|
- workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
|
|
|
|
+ // workAttendanceDate = DateUtil.format(workAttendance.getRecordTime(), "yyyy-MM-dd");
|
|
//考勤时间段
|
|
//考勤时间段
|
|
- workAttendanceTime = DateUtil.format(workAttendance.getRecordTime(), "HH:mm") + "-" + DateUtil.format(workAttendance.getCreateTime(), "HH:mm");
|
|
|
|
|
|
+ // workAttendanceTime = DateUtil.format(workAttendance.getRecordTime(), "HH:mm") + "-" + DateUtil.format(workAttendance.getCreateTime(), "HH:mm");
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -374,6 +445,7 @@ public class WorkAttendanceApiController {
|
|
Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
if (fillAttendancePage.getResult().size()>0){
|
|
if (fillAttendancePage.getResult().size()>0){
|
|
for (FillAttendance fillAttendance : fillAttendancePage){
|
|
for (FillAttendance fillAttendance : fillAttendancePage){
|
|
|
|
+ fillAttendance.setFaceImageUrl(personInfo.getFaceImageUrl());
|
|
if (fillAttendance.getType().equals("1")){
|
|
if (fillAttendance.getType().equals("1")){
|
|
fillAttendance.setTypeN("外勤打卡");
|
|
fillAttendance.setTypeN("外勤打卡");
|
|
}
|
|
}
|
|
@@ -436,6 +508,8 @@ public class WorkAttendanceApiController {
|
|
Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
Page<FillAttendance> fillAttendancePage = fillAttendanceService.pageSearch(searchParam, pageIndex, pageSize, sortList);
|
|
if (fillAttendancePage.getResult().size()>0){
|
|
if (fillAttendancePage.getResult().size()>0){
|
|
for (FillAttendance fillAttendance : fillAttendancePage){
|
|
for (FillAttendance fillAttendance : fillAttendancePage){
|
|
|
|
+ PersonInfo workerPerson = personInfoService.get(fillAttendance.getPersonId());
|
|
|
|
+ fillAttendance.setFaceImageUrl(workerPerson.getFaceImageUrl());
|
|
if (fillAttendance.getType().equals("1")){
|
|
if (fillAttendance.getType().equals("1")){
|
|
fillAttendance.setTypeN("外勤打卡");
|
|
fillAttendance.setTypeN("外勤打卡");
|
|
}
|
|
}
|
|
@@ -473,7 +547,7 @@ public class WorkAttendanceApiController {
|
|
})
|
|
})
|
|
public MessageResult<Map> approvalList(
|
|
public MessageResult<Map> approvalList(
|
|
@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
- @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "100") int pageSize,
|
|
@RequestAttribute String subject, String token) {
|
|
@RequestAttribute String subject, String token) {
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
@@ -603,29 +677,9 @@ public class WorkAttendanceApiController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-// 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);
|
|
msgResult.setResult(true);
|
|
|
|
+ msgResult.setMessage("成功");
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
log.error(ex.getMessage(), ex);
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|