Browse Source

增加接口,修改钉钉用户考勤

seyanew 4 days ago
parent
commit
5cd3dacb89

+ 35 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserDingdingTimeController.java

@@ -1,6 +1,7 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.UserDingdingTime;
 import com.management.platform.mapper.UserDingdingTimeMapper;
@@ -39,5 +40,39 @@ public class UserDingdingTimeController {
         }
         return msg;
     }
+
+    /**
+     * 传参companyId, userId, workDate, workHours, startTime, endTime
+     * @param dingdingTime
+     * @return
+     */
+    @RequestMapping("/setUserCardTime")
+    public HttpRespMsg setUserCardTime(UserDingdingTime dingdingTime) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if (dingdingTime.getCompanyId() == null ) {
+            msg.setError("companyId必传");
+        }
+        if (dingdingTime.getUserId() == null ) {
+            if (msg.getMsg() != null) {
+                msg.setError(msg.getMsg() + ", userId必传");
+            } else {
+                msg.setError("userId必传");
+            }
+        }
+        if (dingdingTime.getWorkDate() == null ) {
+            if (msg.getMsg() != null) {
+                msg.setError(msg.getMsg() + ", workDate必传");
+            } else {
+                msg.setError("workDate必传");
+            }
+        }
+        dingdingTime.setModifiedByAdmin(true);
+
+        QueryWrapper<UserDingdingTime> queryWrapper = new QueryWrapper<UserDingdingTime>().eq("user_id", dingdingTime.getUserId())
+                .eq("work_date", dingdingTime.getWorkDate()).eq("company_id", dingdingTime.getCompanyId());
+        userDingdingTimeMapper.update(dingdingTime,queryWrapper);
+        msg.data = userDingdingTimeMapper.selectOne(queryWrapper);
+        return msg;
+    }
 }