Browse Source

打卡记录

LIVE_YE 7 months ago
parent
commit
fa7c7ccd09

+ 31 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/clock/ClockRecordController.java

@@ -1,8 +1,10 @@
 package com.ruoyi.web.controller.clock;
 
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
+import com.ruoyi.system.domain.ClockUserInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -54,6 +56,16 @@ public class ClockRecordController extends BaseController {
         return clockRecordService.selectClockRecordListRl(clockRecord);
     }
 
+
+    /**
+     * 查询打卡记录(只给当天的第一天和最后一条)
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:info')")
+    @GetMapping("/info")
+    public AjaxResult info(ClockRecord clockRecord) {
+        return clockRecordService.selectClockRecordListInfo(clockRecord);
+    }
+
     /**
      * 导出打卡记录列表
      */
@@ -104,4 +116,23 @@ public class ClockRecordController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] clockIds) {
         return toAjax(clockRecordService.deleteClockRecordByClockIds(clockIds));
     }
+
+    /**
+     * 个人月打卡记录统计
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:personage:month')")
+    @GetMapping("/personage/month")
+    public AjaxResult personage(ClockRecord clockRecord) {
+        return clockRecordService.personage(clockRecord);
+    }
+
+    /**
+     * 月打卡记录统计
+     */
+    @PreAuthorize("@ss.hasPermi('system:clock:all:month')")
+    @GetMapping("/all/month")
+    public TableDataInfo all(ClockUserInfo clockUserInfo) {
+        List<Map<String,Object>> listMap = clockRecordService.all(clockUserInfo);
+        return getDataTable(listMap);
+    }
 }

+ 24 - 19
ruoyi-admin/src/main/java/com/ruoyi/web/controller/clock/ClockUserInfoController.java

@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.clock;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -29,18 +30,16 @@ import com.ruoyi.common.core.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/system/info")
-public class ClockUserInfoController extends BaseController
-{
+public class ClockUserInfoController extends BaseController {
     @Autowired
     private IClockUserInfoService clockUserInfoService;
 
-/**
- * 查询打卡人员信息列表
- */
-@PreAuthorize("@ss.hasPermi('system:info:list')")
-@GetMapping("/list")
-    public TableDataInfo list(ClockUserInfo clockUserInfo)
-    {
+    /**
+     * 查询打卡人员信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:info:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(ClockUserInfo clockUserInfo) {
         startPage();
         List<ClockUserInfo> list = clockUserInfoService.selectClockUserInfoList(clockUserInfo);
         return getDataTable(list);
@@ -52,8 +51,7 @@ public class ClockUserInfoController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:info:export')")
     @Log(title = "打卡人员信息", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, ClockUserInfo clockUserInfo)
-    {
+    public void export(HttpServletResponse response, ClockUserInfo clockUserInfo) {
         List<ClockUserInfo> list = clockUserInfoService.selectClockUserInfoList(clockUserInfo);
         ExcelUtil<ClockUserInfo> util = new ExcelUtil<ClockUserInfo>(ClockUserInfo.class);
         util.exportExcel(response, list, "打卡人员信息数据");
@@ -64,8 +62,7 @@ public class ClockUserInfoController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:info:query')")
     @GetMapping(value = "/{userId}")
-    public AjaxResult getInfo(@PathVariable("userId") Long userId)
-    {
+    public AjaxResult getInfo(@PathVariable("userId") Long userId) {
         return success(clockUserInfoService.selectClockUserInfoByUserId(userId));
     }
 
@@ -75,8 +72,7 @@ public class ClockUserInfoController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:info:add')")
     @Log(title = "打卡人员信息", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody ClockUserInfo clockUserInfo)
-    {
+    public AjaxResult add(@RequestBody ClockUserInfo clockUserInfo) {
         return toAjax(clockUserInfoService.insertClockUserInfo(clockUserInfo));
     }
 
@@ -86,8 +82,7 @@ public class ClockUserInfoController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:info:edit')")
     @Log(title = "打卡人员信息", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
-    public AjaxResult edit(@RequestBody ClockUserInfo clockUserInfo)
-    {
+    public AjaxResult edit(@RequestBody ClockUserInfo clockUserInfo) {
         return toAjax(clockUserInfoService.updateClockUserInfo(clockUserInfo));
     }
 
@@ -97,8 +92,18 @@ public class ClockUserInfoController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:info:remove')")
     @Log(title = "打卡人员信息", businessType = BusinessType.DELETE)
     @GetMapping("/delete/{userIds}")
-    public AjaxResult remove(@PathVariable Long[] userIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] userIds) {
         return toAjax(clockUserInfoService.deleteClockUserInfoByUserIds(userIds));
     }
+
+    /**
+     * 查询打卡人员打卡信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:info:record:list')")
+    @GetMapping("/record/list")
+    public TableDataInfo recordList(ClockUserInfo clockUserInfo) {
+        startPage();
+        List<ClockUserInfo> list = clockUserInfoService.selectClockUserInfoRecordList(clockUserInfo);
+        return getDataTable(list);
+    }
 }

+ 61 - 3
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -8,9 +8,7 @@ import java.time.temporal.TemporalAdjusters;
 import java.time.*;
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalAdjusters;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -303,4 +301,64 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
         return dateList;
     }
+
+    /**
+     * 判断当前日期是星期几
+     *
+     * @param pTime 修要判断的时间
+     * @return dayForWeek 判断结果
+     * @Exception 发生异常
+     */
+
+    public static int dayForWeek(String pTime) throws Exception {
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        Calendar c = Calendar.getInstance();
+
+        c.setTime(format.parse(pTime));
+
+        int dayForWeek = 0;
+
+        if (c.get(Calendar.DAY_OF_WEEK) == 1) {
+
+            dayForWeek = 7;
+
+        } else {
+
+            dayForWeek = c.get(Calendar.DAY_OF_WEEK) - 1;
+
+        }
+
+        return dayForWeek;
+
+    }
+
+    /******
+     * 获取两个日期中间的所有日期
+     * @param start
+     * @param end
+     * @return
+     */
+    public static List<Date> getDatesBetween(String start, String end) {
+        List<Date> dates = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date startDate = sdf.parse(start);
+            Date endDate = sdf.parse(end);
+
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(startDate);
+
+            while (!calendar.getTime().after(endDate)) {
+                dates.add(calendar.getTime());
+                calendar.add(Calendar.DAY_OF_MONTH, 1);
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        return dates;
+    }
+
 }

+ 71 - 38
ruoyi-system/src/main/java/com/ruoyi/system/domain/ClockRecord.java

@@ -38,28 +38,39 @@ public class ClockRecord extends BaseEntity
     @Excel(name = "人员身份证号")
     private String idCard;
 
+    /** 打卡记录完整时间(yyyy-MM-dd HH:mm:ss) */
+    @Excel(name = "打卡记录完整时间")
+    private String recordDt;
+
     /** 打卡记录日期(yyyy-mm-dd) */
     @Excel(name = "打卡记录日期")
+    private String recordDate;
+
+    /** 打卡记录时间(HH:mm:ss) */
+    @Excel(name = "打卡记录时间")
     private String recordTime;
 
+    /** 打卡地点 */
+    @Excel(name = "打卡地点")
+    private String recordLocations;
+
     /** 周几(1:星期一,2:星期二,3:星期三,4:星期四,5:星期五,6:星期六,7:星期日) */
     @Excel(name = "周几", readConverterExp = "1=星期一,2=星期二,3=星期三,4=星期四,5=星期五,6=星期六,7=星期日")
     private String week;
 
-    /** 上班打卡时间 */
-    @Excel(name = "上班打卡时间")
-    private String workingTime;
-
-    /** 下班打卡时间 */
-    @Excel(name = "下班打卡时间")
-    private String dutyTime;
-
     private String startTime;
 
     private String endTime;
 
-    /** 是否打卡 N:否,Y:是*/
-    @Excel(name = "是否打卡", readConverterExp = "N=否,Y=是")
+    /** 打卡情况  1:正常打卡,2:外勤打卡,3:迟到,4:早退*/
+    @Excel(name = "打卡情况", readConverterExp = "1=正常打卡,2=外勤打卡,3=迟到,4=早退")
+    private String isOutwork;
+
+    /** 图片地址*/
+    private String pictureUrl;
+
+    /** 上班,下班打卡 1:上班,2:下班*/
+    @Excel(name = "上班,下班打卡", readConverterExp = "1=上班,2=下班")
     private String type;
 
     public void setClockId(Long clockId) 
@@ -125,23 +136,29 @@ public class ClockRecord extends BaseEntity
     {
         return recordTime;
     }
-    public void setWorkingTime(String workingTime) 
-    {
-        this.workingTime = workingTime;
+
+    public String getRecordDt() {
+        return recordDt;
     }
 
-    public String getWorkingTime() 
-    {
-        return workingTime;
+    public void setRecordDt(String recordDt) {
+        this.recordDt = recordDt;
     }
-    public void setDutyTime(String dutyTime) 
-    {
-        this.dutyTime = dutyTime;
+
+    public String getRecordDate() {
+        return recordDate;
     }
 
-    public String getDutyTime() 
-    {
-        return dutyTime;
+    public void setRecordDate(String recordDate) {
+        this.recordDate = recordDate;
+    }
+
+    public String getIsOutwork() {
+        return isOutwork;
+    }
+
+    public void setIsOutwork(String isOutwork) {
+        this.isOutwork = isOutwork;
     }
 
     public String getStartTime() {
@@ -176,23 +193,39 @@ public class ClockRecord extends BaseEntity
         this.week = week;
     }
 
+    public String getPictureUrl() {
+        return pictureUrl;
+    }
+
+    public void setPictureUrl(String pictureUrl) {
+        this.pictureUrl = pictureUrl;
+    }
+
+    public String getRecordLocations() {
+        return recordLocations;
+    }
+
+    public void setRecordLocations(String recordLocations) {
+        this.recordLocations = recordLocations;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("clockId", getClockId())
-            .append("userId", getUserId())
-            .append("deptName", getDeptName())
-            .append("userName", getUserName())
-            .append("phonenumber", getPhonenumber())
-            .append("idCard", getIdCard())
-            .append("recordTime", getRecordTime())
-            .append("workingTime", getWorkingTime())
-            .append("dutyTime", getDutyTime())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "ClockRecord{" +
+                "clockId=" + clockId +
+                ", userId=" + userId +
+                ", deptName=" + deptName +
+                ", userName='" + userName + '\'' +
+                ", phonenumber='" + phonenumber + '\'' +
+                ", idCard='" + idCard + '\'' +
+                ", recordDt='" + recordDt + '\'' +
+                ", recordDate='" + recordDate + '\'' +
+                ", recordTime='" + recordTime + '\'' +
+                ", week='" + week + '\'' +
+                ", startTime='" + startTime + '\'' +
+                ", endTime='" + endTime + '\'' +
+                ", isOutwork='" + isOutwork + '\'' +
+                ", type='" + type + '\'' +
+                '}';
     }
 }

+ 23 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/ClockUserInfo.java

@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.Map;
+
 /**
  * 打卡人员信息对象 clock_user_info
  * 
@@ -41,6 +43,11 @@ public class ClockUserInfo extends BaseEntity
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
 
+    private Map<String,Object> clockMap;
+
+    /** 日期(yyyy-mm) */
+    private String recordDate;
+
     public void setUserId(Long userId) 
     {
         this.userId = userId;
@@ -105,6 +112,22 @@ public class ClockUserInfo extends BaseEntity
         return delFlag;
     }
 
+    public Map<String, Object> getClockMap() {
+        return clockMap;
+    }
+
+    public void setClockMap(Map<String, Object> clockMap) {
+        this.clockMap = clockMap;
+    }
+
+    public String getRecordDate() {
+        return recordDate;
+    }
+
+    public void setRecordDate(String recordDate) {
+        this.recordDate = recordDate;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 68 - 10
ruoyi-system/src/main/java/com/ruoyi/system/domain/DutySchedule.java

@@ -18,6 +18,25 @@ public class DutySchedule extends BaseEntity
     /** id */
     private Long dutyId;
 
+    /** 经度 */
+    @Excel(name = "经度")
+    private String lon;
+
+    /** 纬度 */
+    @Excel(name = "纬度")
+    private String lat;
+
+    /** 打卡中心地点 */
+    @Excel(name = "打卡中心地点")
+    private String locations;
+
+    /** 打卡范围,单位米 */
+    @Excel(name = "打卡范围")
+    private String distance;
+
+    /** 外勤打卡是否需要拍照 N:否,Y:是 */
+    private String isPicture;
+
     /** 上班时间 */
     @Excel(name = "上班时间")
     private String startWorkTime;
@@ -54,17 +73,56 @@ public class DutySchedule extends BaseEntity
         return endWorkTime;
     }
 
+    public String getLon() {
+        return lon;
+    }
+
+    public void setLon(String lon) {
+        this.lon = lon;
+    }
+
+    public String getLat() {
+        return lat;
+    }
+
+    public void setLat(String lat) {
+        this.lat = lat;
+    }
+
+    public String getDistance() {
+        return distance;
+    }
+
+    public void setDistance(String distance) {
+        this.distance = distance;
+    }
+
+    public String getIsPicture() {
+        return isPicture;
+    }
+
+    public void setIsPicture(String isPicture) {
+        this.isPicture = isPicture;
+    }
+
+    public String getLocations() {
+        return locations;
+    }
+
+    public void setLocations(String locations) {
+        this.locations = locations;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("dutyId", getDutyId())
-            .append("startWorkTime", getStartWorkTime())
-            .append("endWorkTime", getEndWorkTime())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "DutySchedule{" +
+                "dutyId=" + dutyId +
+                ", lon='" + lon + '\'' +
+                ", lat='" + lat + '\'' +
+                ", distance='" + distance + '\'' +
+                ", isPicture='" + isPicture + '\'' +
+                ", startWorkTime='" + startWorkTime + '\'' +
+                ", endWorkTime='" + endWorkTime + '\'' +
+                '}';
     }
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DutyScheduleMapper.java

@@ -58,4 +58,6 @@ public interface DutyScheduleMapper
      * @return 结果
      */
     public int deleteDutyScheduleByDutyIds(Long[] dutyIds);
+
+    DutySchedule selectDutyScheduleByDutyNew();
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IClockRecordService.java

@@ -1,9 +1,11 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.ClockRecord;
+import com.ruoyi.system.domain.ClockUserInfo;
 
 /**
  * 打卡记录Service接口
@@ -64,4 +66,10 @@ public interface IClockRecordService
     AjaxResult selectClockRecordListRl(ClockRecord clockRecord);
 
     AjaxResult kqdc();
+
+    AjaxResult selectClockRecordListInfo(ClockRecord clockRecord);
+
+    AjaxResult personage(ClockRecord clockRecord);
+
+    List<Map<String,Object>> all(ClockUserInfo clockUserInfo);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IClockUserInfoService.java

@@ -58,4 +58,6 @@ public interface IClockUserInfoService
      * @return 结果
      */
     public int deleteClockUserInfoByUserId(Long userId);
+
+    List<ClockUserInfo> selectClockUserInfoRecordList(ClockUserInfo clockUserInfo);
 }

+ 245 - 29
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClockRecordServiceImpl.java

@@ -1,14 +1,21 @@
 package com.ruoyi.system.service.impl;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.ClockUserInfo;
+import com.ruoyi.system.domain.DutySchedule;
 import com.ruoyi.system.domain.OrderFood;
 import com.ruoyi.system.mapper.ClockUserInfoMapper;
+import com.ruoyi.system.mapper.DutyScheduleMapper;
 import com.ruoyi.system.mapper.OrderFoodMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,6 +38,8 @@ public class ClockRecordServiceImpl implements IClockRecordService
     private ClockUserInfoMapper clockUserInfoMapper;
     @Autowired
     private OrderFoodMapper orderFoodMapper;
+    @Autowired
+    private DutyScheduleMapper dutyScheduleMapper;
 
     /**
      * 查询打卡记录
@@ -53,6 +62,17 @@ public class ClockRecordServiceImpl implements IClockRecordService
     @Override
     public List<ClockRecord> selectClockRecordList(ClockRecord clockRecord)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        List<SysRole> roles = user.getRoles();
+        boolean bl = true;
+        for (SysRole role : roles) {
+            if("admin".equals(role.getRoleKey()) || "administrators".equals(role.getRoleKey())){
+                bl = false;
+            }
+        }
+        if(bl){
+            clockRecord.setUserId(user.getUserId());
+        }
         return clockRecordMapper.selectClockRecordList(clockRecord);
     }
 
@@ -65,6 +85,20 @@ public class ClockRecordServiceImpl implements IClockRecordService
     @Override
     public int insertClockRecord(ClockRecord clockRecord)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        clockRecord.setUserId(user.getUserId());
+        clockRecord.setUserName(user.getNickName());
+        clockRecord.setPhonenumber(user.getPhonenumber());
+        /*String[] dt = clockRecord.getRecordDt().split(" ");
+        clockRecord.setRecordDate(dt[0]);
+        clockRecord.setRecordTime(dt[1]);*/
+        //判断传入的时间是周几
+        try {
+            int dayForWeek = DateUtils.dayForWeek(clockRecord.getRecordDate());
+            clockRecord.setWeek(String.valueOf(dayForWeek));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         clockRecord.setCreateTime(DateUtils.getNowDate());
         return clockRecordMapper.insertClockRecord(clockRecord);
     }
@@ -114,18 +148,19 @@ public class ClockRecordServiceImpl implements IClockRecordService
         resultMap.put("name",clockUserInfo.getUserName());
         //查询最新打卡数据
         ClockRecord clockRecordNew = clockRecordMapper.selectClockRecordNew(clockRecord);
-        resultMap.put("time",clockRecordNew.getRecordTime());
+        resultMap.put("time",clockRecordNew.getRecordDate());
         //todo 上下班时间
-        resultMap.put("workTime","");
+        DutySchedule dutySchedule = dutyScheduleMapper.selectDutyScheduleByDutyNew();
+        resultMap.put("workTime",dutySchedule.getStartWorkTime()+" - "+dutySchedule.getEndWorkTime());
         //查询查询月打卡数据
         List<ClockRecord> clockRecords = clockRecordMapper.selectOrderFoodListRl(clockRecord);
         //按日期分类
         Map<String, List<ClockRecord>> clockTime = new HashMap<>();
         if (clockRecords != null && clockRecords.size() > 0){
-            clockTime = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getRecordTime));
+            clockTime = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getRecordDate));
         }
         //查询传入月所有日期
-        List<String> dayList = DateUtils.getDay(DateUtils.parseDate(clockRecord.getRecordTime()));
+        List<String> dayList = DateUtils.getDay(DateUtils.parseDate(clockRecord.getRecordDate()));
         //写入数据
         List<Map> mapList = new ArrayList<>();
         if (dayList.size()> 0){
@@ -133,26 +168,36 @@ public class ClockRecordServiceImpl implements IClockRecordService
                 Map<String,Object> map = new HashMap<>(5);
                 map.put("date",day);
                 map.put("am","未打卡");
-                //上午打卡标识 1:打卡,2:未打卡
-                map.put("amex","2");
+                //上午打卡标识 1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                map.put("amex","5");
                 map.put("pm","未打卡");
-                //下午打卡标识 1:打卡,2:未打卡
-                map.put("pmex","2");
+                //下午打卡标识 1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                map.put("pmex","5");
                 if (clockTime.size() > 0){
                     List<ClockRecord> clockRecordList = clockTime.get(day);
                     if (clockRecordList != null && clockRecordList.size() > 0){
-                        for (ClockRecord clock : clockRecordList) {
-                            if(StringUtils.isNotEmpty(clock.getWorkingTime())){
-                                map.put("am",clock.getWorkingTime());
-                                //上午打卡表示 1:打卡,2:未打卡
-                                map.put("amex","1");
-                            }
-                            if(StringUtils.isNotEmpty(clock.getDutyTime())){
-                                map.put("pm",clock.getDutyTime());
-                                //下午打卡表示 1:打卡,2:未打卡
-                                map.put("pmex","1");
-                            }
+                        clockRecordList = clockRecordList.stream().sorted(Comparator.comparing(ClockRecord::getRecordTime).reversed()).collect(Collectors.toList());
+                        if("1".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                            map.put("am",clockRecordList.get(clockRecordList.size()-1).getRecordTime());
+                            //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("amex",clockRecordList.get(clockRecordList.size()-1).getIsOutwork());
+                        }
+                        if("2".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                            map.put("pm",clockRecordList.get(clockRecordList.size()-1).getRecordTime());
+                            //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("pmex",clockRecordList.get(clockRecordList.size()-1).getIsOutwork());
                         }
+                        if("1".equals(clockRecordList.get(0).getType())){
+                            map.put("am",clockRecordList.get(0).getRecordTime());
+                            //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("amex",clockRecordList.get(0).getIsOutwork());
+                        }
+                        if("2".equals(clockRecordList.get(0).getType())){
+                            map.put("pm",clockRecordList.get(0).getRecordTime());
+                            //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("pmex",clockRecordList.get(0).getIsOutwork());
+                        }
+
                     }
                 }
                 mapList.add(map);
@@ -171,22 +216,24 @@ public class ClockRecordServiceImpl implements IClockRecordService
         //查询当天应打卡人数
         int dkzs = 0;
         ClockRecord clockRecord = new ClockRecord();
-        clockRecord.setRecordTime(day);
+        clockRecord.setRecordDate(day);
         List<ClockRecord> clockRecords = clockRecordMapper.selectClockRecordList(clockRecord);
+        Map<String, List<ClockRecord>> clockUserId = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getUserName));
+        //查询打卡人员
+        ClockUserInfo clockUserInfo = new ClockUserInfo();
+        clockUserInfo.setDelFlag("0");
+        List<ClockUserInfo> clockUserInfoList = clockUserInfoMapper.selectClockUserInfoList(clockUserInfo);
         //已打卡人数
         int ydk = 0;
         //未打卡人数
         int wdk = 0;
-        if(clockRecords!=null && clockRecords.size()>0){
-            dkzs = clockRecords.size();
-            for (ClockRecord record : clockRecords) {
-                if(StringUtils.isNotEmpty(record.getWorkingTime()) || StringUtils.isNotEmpty(record.getDutyTime())){
-                    ydk++;
-                }else{
-                    wdk++;
-                }
-            }
+        if(clockUserId!=null && clockUserId.size()>0){
+            ydk = clockUserId.size();
+        }
+        if(clockUserInfoList!=null && clockUserInfoList.size()>0){
+            wdk = clockUserInfoList.size()-clockUserId.size();
         }
+
         //订餐统计
         OrderFood orderFood = new OrderFood();
         orderFood.setOrderFoodTime(DateUtils.parseDate(day));
@@ -216,4 +263,173 @@ public class ClockRecordServiceImpl implements IClockRecordService
         resultMap.put("dcDinner",dcDinner);
         return AjaxResult.success(resultMap);
     }
+
+    @Override
+    public AjaxResult selectClockRecordListInfo(ClockRecord clockRecord) {
+        Map<String, Object> resultMap = new HashMap<>();
+
+        DutySchedule dutySchedule = dutyScheduleMapper.selectDutyScheduleByDutyNew();
+        resultMap.put("workTime",dutySchedule.getStartWorkTime()+" - "+dutySchedule.getEndWorkTime());
+
+        //查询查询月打卡数据
+        List<ClockRecord> clockRecords = clockRecordMapper.selectClockRecordList(clockRecord);
+        //按日期分类
+        Map<String, List<ClockRecord>> clockTime = new HashMap<>();
+        if (clockRecords != null && clockRecords.size() > 0){
+            clockTime = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getRecordDate));
+        }
+        //查询传入月所有日期
+        List<Date> dayList = DateUtils.getDatesBetween(clockRecord.getStartTime(),clockRecord.getEndTime());
+        //写入数据
+        List<Map> mapList = new ArrayList<>();
+        if (dayList.size()> 0){
+            for (Date day : dayList) {
+                Map<String,Object> map = new HashMap<>(5);
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+                map.put("date",format.format(day));
+                map.put("am","未打卡");
+                //上午打卡标识  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                map.put("amex","5");
+                map.put("pm","未打卡");
+                //下午打卡标识  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                map.put("pmex","5");
+                if (clockTime.size() > 0){
+                    List<ClockRecord> clockRecordList = clockTime.get(format.format(day));
+                    if (clockRecordList != null && clockRecordList.size() > 0){
+                        clockRecordList = clockRecordList.stream().sorted(Comparator.comparing(ClockRecord::getRecordTime).reversed()).collect(Collectors.toList());
+                        if("1".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                            map.put("am",clockRecordList.get(clockRecordList.size()-1).getRecordTime());
+                            //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("amex",clockRecordList.get(clockRecordList.size()-1).getIsOutwork());
+                        }
+                        if("2".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                            map.put("pm",clockRecordList.get(clockRecordList.size()-1).getRecordTime());
+                            //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("pmex",clockRecordList.get(clockRecordList.size()-1).getIsOutwork());
+                        }
+                        if("1".equals(clockRecordList.get(0).getType())){
+                            map.put("am",clockRecordList.get(0).getRecordTime());
+                            //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("amex",clockRecordList.get(0).getIsOutwork());
+                        }
+                        if("2".equals(clockRecordList.get(0).getType())){
+                            map.put("pm",clockRecordList.get(0).getRecordTime());
+                            //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                            map.put("pmex",clockRecordList.get(0).getIsOutwork());
+                        }
+
+                    }
+                }
+                mapList.add(map);
+            }
+        }
+        //日历数据
+        resultMap.put("rlData",mapList);
+        return AjaxResult.success(resultMap);
+    }
+
+    @Override
+    public AjaxResult personage(ClockRecord clockRecord) {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        clockRecord.setUserId(user.getUserId());
+        Map<String, Object> resultMap = statistics(clockRecord);
+        return AjaxResult.success(resultMap);
+    }
+
+    @Override
+    public List<Map<String,Object>> all(ClockUserInfo clockUserInfo) {
+        List<Map<String,Object>> listMap = new ArrayList<>();
+        startPage();
+        List<ClockUserInfo> clockUserList = clockUserInfoMapper.selectClockUserInfoList(clockUserInfo);
+        clearPage();
+        for (ClockUserInfo userInfo : clockUserList) {
+            ClockRecord clockRecord = new ClockRecord();
+            clockRecord.setUserId(userInfo.getUserId());
+            clockRecord.setRecordDate(clockUserInfo.getRecordDate()+"-01");
+            Map<String, Object> resultMap = statistics(clockRecord);
+            resultMap.put("name",userInfo.getUserName());
+            listMap.add(resultMap);
+        }
+        return listMap;
+    }
+
+    /**
+     * 设置请求分页数据
+     */
+    protected void startPage() {
+        PageUtils.startPage();
+    }
+
+    /**
+     * 清理分页的线程变量
+     */
+    protected void clearPage() {
+        PageUtils.clearPage();
+    }
+
+    public Map<String, Object> statistics(ClockRecord clockRecord) {
+        Map<String, Object> resultMap = new HashMap<>();
+        //迟到
+        int cd = 0;
+        //早退
+        int zt = 0;
+        //外勤
+        int wq = 0;
+
+        if(StringUtils.isEmpty(clockRecord.getRecordDate())){
+            clockRecord.setRecordDate(DateUtils.getDate());
+        }
+        //查询查询月打卡数据
+        List<ClockRecord> clockRecords = clockRecordMapper.selectClockRecordList(clockRecord);
+        //按日期分类
+        Map<String, List<ClockRecord>> clockTime = new HashMap<>();
+        if (clockRecords != null && clockRecords.size() > 0){
+            clockTime = clockRecords.stream().collect(Collectors.groupingBy(ClockRecord::getRecordDate));
+        }
+        for (String key : clockTime.keySet()) {
+            List<ClockRecord> clockRecordList = clockTime.get(key);
+            clockRecordList = clockRecordList.stream().sorted(Comparator.comparing(ClockRecord::getRecordTime).reversed()).collect(Collectors.toList());
+            for (ClockRecord record : clockRecordList) {
+                if("1".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                    if("3".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        cd++;
+                    }
+                    if("2".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        wq++;
+                    }
+                }
+                if("2".equals(clockRecordList.get(clockRecordList.size()-1).getType())){
+                    if("4".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        zt++;
+                    }
+                    if("2".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        wq++;
+                    }
+                }
+                if("1".equals(clockRecordList.get(0).getType())){
+                    if("3".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        cd++;
+                    }
+                    if("2".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        wq++;
+                    }
+                }
+                if("2".equals(clockRecordList.get(0).getType())){
+                    if("4".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        zt++;
+                    }
+                    if("2".equals(clockRecordList.get(clockRecordList.size()-1).getIsOutwork())){
+                        wq++;
+                    }
+                }
+            }
+
+        }
+        resultMap.put("cd",cd);
+        resultMap.put("zt",zt);
+        resultMap.put("wq",wq);
+        return resultMap;
+    }
+
+
 }

+ 56 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClockUserInfoServiceImpl.java

@@ -1,7 +1,14 @@
 package com.ruoyi.system.service.impl;
 
+import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.ClockRecord;
+import com.ruoyi.system.mapper.ClockRecordMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.ClockUserInfoMapper;
@@ -19,6 +26,8 @@ public class ClockUserInfoServiceImpl implements IClockUserInfoService
 {
     @Autowired
     private ClockUserInfoMapper clockUserInfoMapper;
+    @Autowired
+    private ClockRecordMapper clockRecordMapper;
 
     /**
      * 查询打卡人员信息
@@ -93,4 +102,51 @@ public class ClockUserInfoServiceImpl implements IClockUserInfoService
     {
         return clockUserInfoMapper.deleteClockUserInfoByUserId(userId);
     }
+
+    @Override
+    public List<ClockUserInfo> selectClockUserInfoRecordList(ClockUserInfo clockUserInfo) {
+        List<ClockUserInfo> clockUserList = clockUserInfoMapper.selectClockUserInfoList(clockUserInfo);
+        String date = DateUtils.getDate();
+        for (ClockUserInfo userInfo : clockUserList) {
+            Map<String,Object> clockMap = new HashMap<>();
+            clockMap.put("date",date);
+            clockMap.put("am","未打卡");
+            //上午打卡标识 1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+            clockMap.put("amex","5");
+            clockMap.put("pm","未打卡");
+            //下午打卡标识 1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+            clockMap.put("pmex","5");
+            //查询当天的所有打卡信息
+            ClockRecord clockRecord = new ClockRecord();
+            clockRecord.setUserId(userInfo.getUserId());
+            clockRecord.setRecordDate(date);
+            List<ClockRecord> clockRecords = clockRecordMapper.selectClockRecordList(clockRecord);
+            if (clockRecords != null && clockRecords.size() > 0){
+                clockRecords = clockRecords.stream().sorted(Comparator.comparing(ClockRecord::getRecordTime).reversed()).collect(Collectors.toList());
+                if("1".equals(clockRecords.get(clockRecords.size()-1).getType())){
+                    clockMap.put("am",clockRecords.get(clockRecords.size()-1).getRecordTime());
+                    //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                    clockMap.put("amex",clockRecords.get(clockRecords.size()-1).getIsOutwork());
+                }
+                if("2".equals(clockRecords.get(clockRecords.size()-1).getType())){
+                    clockMap.put("pm",clockRecords.get(clockRecords.size()-1).getRecordTime());
+                    //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                    clockMap.put("pmex",clockRecords.get(clockRecords.size()-1).getIsOutwork());
+                }
+                if("1".equals(clockRecords.get(0).getType())){
+                    clockMap.put("am",clockRecords.get(0).getRecordTime());
+                    //上午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                    clockMap.put("amex",clockRecords.get(0).getIsOutwork());
+                }
+                if("2".equals(clockRecords.get(0).getType())){
+                    clockMap.put("pm",clockRecords.get(0).getRecordTime());
+                    //下午打卡表示  1:正常打卡,2:外勤打卡,3:迟到,4:早退,5:未打卡
+                    clockMap.put("pmex",clockRecords.get(0).getIsOutwork());
+                }
+
+            }
+            userInfo.setClockMap(clockMap);
+        }
+        return clockUserList;
+    }
 }

+ 32 - 22
ruoyi-system/src/main/resources/mapper/system/ClockRecordMapper.xml

@@ -11,10 +11,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userName"    column="user_name"    />
         <result property="phonenumber"    column="phonenumber"    />
         <result property="idCard"    column="id_card"    />
+        <result property="recordDt"    column="record_dt"    />
+        <result property="recordDate"    column="record_date"    />
         <result property="recordTime"    column="record_time"    />
+        <result property="recordLocations"    column="record_locations"    />
         <result property="week"    column="week"    />
-        <result property="workingTime"    column="working_time"    />
-        <result property="dutyTime"    column="duty_time"    />
+        <result property="isOutwork"    column="is_outwork"    />
+        <result property="pictureUrl"    column="picture_url"    />
         <result property="type"    column="type"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -24,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectClockRecordVo">
-        select clock_id, user_id, dept_name, user_name, phonenumber, id_card, record_time,week, working_time, duty_time,type, create_by, create_time, update_by, update_time, remark from clock_record
+        select clock_id, user_id, dept_name, user_name, phonenumber, id_card,record_dt,record_date, record_time,record_locations,week, is_outwork,picture_url,type, create_by, create_time, update_by, update_time, remark from clock_record
     </sql>
 
     <select id="selectClockRecordList" parameterType="ClockRecord" resultMap="ClockRecordResult">
@@ -35,16 +38,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
             <if test="phonenumber != null  and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
             <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
-            <if test="recordTime != null  and recordTime != ''"> and record_time = #{recordTime}</if>
+            <if test="recordDate != null  and recordDate != ''"> and record_date = #{recordDate}</if>
             <if test="week != null  and week != ''"> and week = #{week}</if>
-            <if test="workingTime != null  and workingTime != ''"> and working_time = #{workingTime}</if>
-            <if test="dutyTime != null  and dutyTime != ''"> and duty_time = #{dutyTime}</if>
+            <if test="isOutwork != null  and isOutwork != ''"> and is_outwork = #{isOutwork}</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
-                AND record_time &gt;= #{startTime}
+                AND record_date &gt;= #{startTime}
             </if>
             <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-                AND record_time &lt;= #{endTime}
+                AND record_date &lt;= #{endTime}
             </if>
         </where>
     </select>
@@ -61,23 +63,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
             <if test="phonenumber != null  and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
             <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
-            <if test="recordTime != null  and recordTime != ''">
-                and date_format(record_time,'%Y%m') = date_format(#{recordTime},'%Y%m')
+            <if test="recordDate != null  and recordDate != ''">
+                and date_format(record_date,'%Y%m') = date_format(#{recordDate},'%Y%m')
             </if>
-            <if test="workingTime != null  and workingTime != ''"> and working_time = #{workingTime}</if>
-            <if test="dutyTime != null  and dutyTime != ''"> and duty_time = #{dutyTime}</if>
+            <if test="isOutwork != null  and isOutwork != ''"> and is_outwork = #{isOutwork}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
-                AND record_time &gt;= #{startTime}
+                AND record_date &gt;= #{startTime}
             </if>
             <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-                AND record_time &lt;= #{endTime}
+                AND record_date &lt;= #{endTime}
             </if>
         </where>
     </select>
     <select id="selectClockRecordNew" parameterType="ClockRecord" resultMap="ClockRecordResult">
         <include refid="selectClockRecordVo"/>
-        where (working_time!=null or duty_time!=null)
-        and user_id = #{userId}
+        where user_id = #{userId}
         order by record_time desc limit 1
     </select>
 
@@ -89,10 +90,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null and userName != ''">user_name,</if>
             <if test="phonenumber != null">phonenumber,</if>
             <if test="idCard != null">id_card,</if>
+            <if test="recordDt != null">record_dt,</if>
+            <if test="recordDate != null">record_date,</if>
             <if test="recordTime != null">record_time,</if>
+            <if test="recordLocations != null">record_locations,</if>
             <if test="week != null">week,</if>
-            <if test="workingTime != null">working_time,</if>
-            <if test="dutyTime != null">duty_time,</if>
+            <if test="isOutwork != null  and isOutwork != ''"> is_outwork,</if>
+            <if test="pictureUrl != null  and pictureUrl != ''"> picture_url,</if>
             <if test="type != null  and type != ''">type,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -106,10 +110,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null and userName != ''">#{userName},</if>
             <if test="phonenumber != null">#{phonenumber},</if>
             <if test="idCard != null">#{idCard},</if>
+            <if test="recordDt != null">#{recordDt},</if>
+            <if test="recordDate != null">#{recordDate},</if>
             <if test="recordTime != null">#{recordTime},</if>
+            <if test="recordLocations != null"> #{recordLocations},</if>
             <if test="week != null">#{week},</if>
-            <if test="workingTime != null">#{workingTime},</if>
-            <if test="dutyTime != null">#{dutyTime},</if>
+            <if test="isOutwork != null  and isOutwork != ''">#{isOutwork},</if>
+            <if test="pictureUrl != null  and pictureUrl != ''"> #{pictureUrl},</if>
             <if test="type != null  and type != ''">#{type},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -127,10 +134,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null and userName != ''">user_name = #{userName},</if>
             <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
             <if test="idCard != null">id_card = #{idCard},</if>
+            <if test="recordDt != null">record_dt= #{recordDt},</if>
+            <if test="recordDate != null">record_date = #{recordDate},</if>
             <if test="recordTime != null">record_time = #{recordTime},</if>
+            <if test="recordLocations != null">record_locations = #{recordLocations},</if>
             <if test="week != null "> and week = #{week},</if>
-            <if test="workingTime != null">working_time = #{workingTime},</if>
-            <if test="dutyTime != null">duty_time = #{dutyTime},</if>
+            <if test="isOutwork != null  and isOutwork != ''"> is_outwork = #{isOutwork},</if>
+            <if test="pictureUrl != null  and pictureUrl != ''"> picture_url=#{pictureUrl},</if>
             <if test="type != null  and type != ''">type = #{type},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/ClockUserInfoMapper.xml

@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
             <if test="phonenumber != null  and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
             <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
+            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if>
         </where>
     </select>
     

+ 26 - 2
ruoyi-system/src/main/resources/mapper/system/DutyScheduleMapper.xml

@@ -6,6 +6,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="DutySchedule" id="DutyScheduleResult">
         <result property="dutyId"    column="duty_id"    />
+        <result property="lon"    column="lon"    />
+        <result property="lat"    column="lat"    />
+        <result property="locations"    column="locations"    />
+        <result property="distance"    column="distance"    />
+        <result property="isPicture"    column="is_picture"    />
         <result property="startWorkTime"    column="start_work_time"    />
         <result property="endWorkTime"    column="end_work_time"    />
         <result property="createBy"    column="create_by"    />
@@ -16,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectDutyScheduleVo">
-        select duty_id, start_work_time, end_work_time, create_by, create_time, update_by, update_time, remark from duty_schedule
+        select duty_id,lon,lat,locations,distance,is_picture, start_work_time, end_work_time, create_by, create_time, update_by, update_time, remark from duty_schedule
     </sql>
 
     <select id="selectDutyScheduleList" parameterType="DutySchedule" resultMap="DutyScheduleResult">
@@ -31,10 +36,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectDutyScheduleVo"/>
         where duty_id = #{dutyId}
     </select>
-        
+    <select id="selectDutyScheduleByDutyNew" parameterType="Long" resultMap="DutyScheduleResult">
+        <include refid="selectDutyScheduleVo"/>
+        order by create_time desc limit 1
+    </select>
+
     <insert id="insertDutySchedule" parameterType="DutySchedule" useGeneratedKeys="true" keyProperty="dutyId">
         insert into duty_schedule
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="lon != null">lon,</if>
+            <if test="lat != null">lat,</if>
+            <if test="locations != null">locations,</if>
+            <if test="distance != null">distance,</if>
+            <if test="isPicture != null">is_picture,</if>
             <if test="startWorkTime != null">start_work_time,</if>
             <if test="endWorkTime != null">end_work_time,</if>
             <if test="createBy != null">create_by,</if>
@@ -44,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">remark,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="lon != null">#{lon},</if>
+            <if test="lat != null">#{lat},</if>
+            <if test="locations != null">#{locations},</if>
+            <if test="distance != null">#{distance},</if>
+            <if test="isPicture != null">#{isPicture},</if>
             <if test="startWorkTime != null">#{startWorkTime},</if>
             <if test="endWorkTime != null">#{endWorkTime},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -57,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateDutySchedule" parameterType="DutySchedule">
         update duty_schedule
         <trim prefix="SET" suffixOverrides=",">
+            <if test="lon != null">lon = #{lon},</if>
+            <if test="lat != null">lat = #{lat},</if>
+            <if test="locations != null">locations = #{locations},</if>
+            <if test="distance != null">distance = #{distance},</if>
+            <if test="isPicture != null">is_picture = #{isPicture},</if>
             <if test="startWorkTime != null">start_work_time = #{startWorkTime},</if>
             <if test="endWorkTime != null">end_work_time = #{endWorkTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>