java110 пре 5 година
родитељ
комит
a3141f0cd3

+ 7 - 0
java110-bean/src/main/java/com/java110/dto/machine/MachineTranslateDto.java

@@ -47,6 +47,11 @@ public class MachineTranslateDto extends PageDto implements Serializable {
     public static final String CMD_ADD_TEAM_CAR_FEE_CONFIG = "901";
     public static final String CMD_UPDATE_TEAM_CAR_FEE_CONFIG = "902";
     public static final String CMD_DELETE_TEAM_CAR_FEE_CONFIG = "903";
+
+    public static final String CMD_ADD_ATTENDANCE_CLASSES = "911";
+    public static final String CMD_UPDATE_ATTENDANCE_CLASSES = "912";
+    public static final String CMD_DELETE_ATTENDANCE_CLASSES = "913";
+
     public static final String CMD_OPEN_DOOR = "5";
 
     //小区信息
@@ -56,6 +61,8 @@ public class MachineTranslateDto extends PageDto implements Serializable {
     public static final String TYPE_PARKING_AREA = "2233";
     public static final String TYPE_OWNER_CAR = "4455";
     public static final String TYPE_TEAM_CAR_FEE_CONFIG = "1122";
+    public static final String TYPE_ATTENDANCE = "1111";
+
 
     //同步状态
     public static final String STATE_SUCCESS = "20000";

+ 10 - 0
service-job/src/main/java/com/java110/job/adapt/hcIot/IotConstant.java

@@ -84,6 +84,16 @@ public class IotConstant {
     //删除车辆
     public static final String DELETE_TEAM_CAR_FEE_CONFIG = "/extApi/fee/deleteTempCarFee";
 
+    //添加考勤班次
+    public static final String ADD_ATTENDANCE_CLASSES_STAFFS = "/extApi/attendance/addAttendanceClassStaffs";
+
+    //添加考勤班次
+    public static final String ADD_ATTENDANCE_CLASSES = "/extApi/attendance/addAttendanceClass";
+    //修改考勤班次
+    public static final String UPDATE_ATTENDANCE_CLASSES = "/extApi/attendance/updateAttendanceClass";
+    //删除考勤班次
+    public static final String DELETE_ATTENDANCE_CLASSES = "/extApi/attendance/deleteAttendanceClass";
+
     public static final String HC_TOKEN = "HC_ACCESS_TOKEN";
 
     //单位为秒

+ 21 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/asyn/impl/IotSendAsynImpl.java

@@ -15,6 +15,7 @@
  */
 package com.java110.job.adapt.hcIot.asyn.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
 import com.java110.core.factory.GenerateCodeFactory;
@@ -34,7 +35,11 @@ import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -1049,14 +1054,14 @@ public class IotSendAsynImpl implements IIotSendAsyn {
     @Override
     public void addAttendance(JSONObject postParameters, List<JSONObject> staffs) {
         MachineTranslateDto machineTranslateDto = getMachineTranslateDto(postParameters,
-                MachineTranslateDto.CMD_DELETE_TEAM_CAR_FEE_CONFIG,
+                MachineTranslateDto.CMD_ADD_ATTENDANCE_CLASSES,
                 DEFAULT_MACHINE_CODE,
                 DEFAULT_MACHINE_ID,
-                "extBwId",
-                "carNum",
-                MachineTranslateDto.TYPE_TEAM_CAR_FEE_CONFIG);
+                "extClassesId",
+                "classesName",
+                MachineTranslateDto.TYPE_ATTENDANCE);
         ResponseEntity<String> responseEntity = null;
-        String url = IotConstant.getUrl(IotConstant.DELETE_TEAM_CAR_FEE_CONFIG);
+        String url = IotConstant.getUrl(IotConstant.ADD_ATTENDANCE_CLASSES);
         try {
             postParameters.put("taskId", machineTranslateDto.getMachineTranslateId());
             HttpEntity httpEntity = new HttpEntity(postParameters.toJSONString(), getHeaders());
@@ -1080,6 +1085,16 @@ public class IotSendAsynImpl implements IIotSendAsyn {
 
                 return;
             }
+
+            url = IotConstant.getUrl(IotConstant.ADD_ATTENDANCE_CLASSES_STAFFS);
+            for (JSONObject staff : staffs) {
+                staff.put("taskId", machineTranslateDto.getMachineTranslateId());
+            }
+
+            httpEntity = new HttpEntity(JSONArray.toJSONString(staffs), getHeaders());
+            responseEntity = outRestTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
+
+
         } catch (Exception e) {
             machineTranslateDto.setState(MachineTranslateDto.STATE_ERROR);
             machineTranslateDto.setRemark(e.getLocalizedMessage());