|
@@ -1,16 +1,25 @@
|
|
|
package com.boman.web.core.service.attendance;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.boman.common.core.constant.Constants;
|
|
|
import com.boman.common.core.utils.DateUtils;
|
|
|
+import com.boman.common.core.utils.StringUtils;
|
|
|
+import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
import com.boman.common.core.web.domain.AjaxResult;
|
|
|
+import com.boman.web.core.domain.FormDataDto;
|
|
|
import com.boman.web.core.service.common.ICommonService;
|
|
|
+import org.aspectj.weaver.loadtime.Aj;
|
|
|
import org.gavaghan.geodesy.GlobalCoordinates;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.concurrent.locks.Condition;
|
|
|
|
|
|
import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
|
|
|
import static com.boman.domain.constant.AttendanceConst.ATTENDANCE_NOW_TIME;
|
|
@@ -34,8 +43,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
* @param userName userName
|
|
|
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
|
|
*/
|
|
|
- @Override
|
|
|
- public List<JSONObject> listByUserName(String tableName, Long userName) {
|
|
|
+ private List<JSONObject> listByUserName(String tableName, Long userName) {
|
|
|
requireNonNull(tableName, "tableName is empty");
|
|
|
requireNonNull(userName, "userName is empty");
|
|
|
|
|
@@ -45,4 +53,75 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
map.put(ATTENDANCE_NOW_TIME, yyyyMm);
|
|
|
return commonService.getByMap(tableName, map);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手机端考勤记录页面
|
|
|
+ * 功能描述: 根据tableName和userId查找当月考勤
|
|
|
+ *
|
|
|
+ * @param tableName tableName
|
|
|
+ * @param userName userName
|
|
|
+ * @return java.util.List<com.alibaba.fastjson.JSONObject>
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult attendanceRecord(String tableName, Long userName) {
|
|
|
+ List<JSONObject> byMap = listByUserName(tableName, userName);
|
|
|
+ List<String> dateList = new ArrayList<>();
|
|
|
+ //定义三个返回值
|
|
|
+ int leave = 0;
|
|
|
+ int late = 0;
|
|
|
+ int leaveOr = 0;
|
|
|
+ if (byMap.size()>0){
|
|
|
+ for (JSONObject jsonObject : byMap) {
|
|
|
+ if (ObjectUtils.isNotEmpty(jsonObject.get("attendance_table_leave")) && "Y".equals(String.valueOf(jsonObject.get("attendance_table_leave")))){
|
|
|
+ leave += 1;
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(jsonObject.get("attendance_table_late")) && "Y".equals(String.valueOf(jsonObject.get("attendance_table_late")))){
|
|
|
+ late += 1;
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(jsonObject.get("attendance_table_leave_or")) && "Y".equals(String.valueOf(jsonObject.get("attendance_table_leave_or")))) {
|
|
|
+ leaveOr += 1;
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(jsonObject.get("attendance_table_todaytime"))){
|
|
|
+ String todayTime = String.valueOf(jsonObject.get("attendance_table_todaytime"));
|
|
|
+ dateList.add(todayTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String,Object> mapObj = new HashMap<>(3);
|
|
|
+ mapObj.put("leave",leave);
|
|
|
+ mapObj.put("late",late);
|
|
|
+ mapObj.put("leaveOr",leaveOr);
|
|
|
+ mapObj.put("dateList",dateList);
|
|
|
+ return AjaxResult.success(mapObj);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *根据tableName和userId查找当月考勤详细记录
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult detailedRecord(FormDataDto dto) {
|
|
|
+ List<JSONObject> byMap = commonService.getByMap(dto.getTable(), dto.getFixedData());
|
|
|
+ List<Map<String,Object>> detailedRecordList = new ArrayList<>();
|
|
|
+ if (ObjectUtils.isNotEmpty(byMap)){
|
|
|
+ for (JSONObject jsonObject : byMap) {
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ Object attendanceTableWork = jsonObject.get("attendance_table_work");
|
|
|
+ Object attendanceTableOffWork = jsonObject.get("attendance_table_offwork");
|
|
|
+ map.put("attendanceTableWork","未打卡");
|
|
|
+ map.put("attendanceTableOffWork","未打卡");
|
|
|
+ if (ObjectUtils.isNotEmpty(attendanceTableWork)){
|
|
|
+ map.put("attendanceTableWork",attendanceTableWork+"已打卡");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(attendanceTableOffWork)) {
|
|
|
+ map.put("attendanceTableWork", attendanceTableOffWork + "已打卡");
|
|
|
+ }
|
|
|
+ map.put("dateTime",jsonObject.get("attendance_table_week") + " " + jsonObject.get("attendance_table_todaytime"));
|
|
|
+ detailedRecordList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(detailedRecordList);
|
|
|
+ }
|
|
|
}
|