Commit 99bbb8f4 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!303
parents 459d3431 6b53ad6b
...@@ -9,6 +9,7 @@ import java.util.Date; ...@@ -9,6 +9,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.codehaus.jettison.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
...@@ -97,8 +99,10 @@ import cn.timer.api.dto.kqmk.AttSchedule; ...@@ -97,8 +99,10 @@ import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttSchedulingDto; import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto; import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto; import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceMachineStatus;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto; import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto; import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.AttstateDate;
import cn.timer.api.dto.kqmk.BalanceSheetDataDto; import cn.timer.api.dto.kqmk.BalanceSheetDataDto;
import cn.timer.api.dto.kqmk.CalendarDetailsDto; import cn.timer.api.dto.kqmk.CalendarDetailsDto;
import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto; import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto;
...@@ -579,6 +583,44 @@ public class TimeCardController { ...@@ -579,6 +583,44 @@ public class TimeCardController {
return ResultUtil.data(attendanList,"操作成功!"); return ResultUtil.data(attendanList,"操作成功!");
} }
@PostMapping(value = "/att_machine_status")
@ApiOperation(value = "15.1:获取考勤机状态", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 28)
public Result<Object> AttendanceMachineStatus(@CurrentUser UserBean userBean,@RequestBody AttendanceMachineStatus balance) {
String msg = "";
List<AttstateDate> stas = new ArrayList<AttstateDate>();
String[] state = balance.getState();
if(state.length > 0) {
for(int p=0;p<state.length;p++){
AttstateDate sta = AttstateDate.builder().build();
String url = mac_command+"/getDevInfo";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", state[p]);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
com.alibaba.fastjson.JSONObject object = JSON.parseObject(request.getBody());
System.err.println(object.get("message"));
msg = object.get("message").toString();
sta.setCode(state[p]);
sta.setState(Integer.valueOf(object.get("data").toString()));
stas.add(sta);
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败");
}
}
}
return ResultUtil.data(stas,msg);
}
@SuppressWarnings("all") @SuppressWarnings("all")
@GetMapping(value="/synchrotime/{code}") @GetMapping(value="/synchrotime/{code}")
@ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明")
...@@ -685,6 +727,7 @@ public class TimeCardController { ...@@ -685,6 +727,7 @@ public class TimeCardController {
KqglAssoKqj kqj = KqglAssoKqj.builder().build().selectOne(new QueryWrapper<KqglAssoKqj>().lambda().eq(KqglAssoKqj::getCode, kqglassokqj.getCode())); KqglAssoKqj kqj = KqglAssoKqj.builder().build().selectOne(new QueryWrapper<KqglAssoKqj>().lambda().eq(KqglAssoKqj::getCode, kqglassokqj.getCode()));
if(kqj == null) { if(kqj == null) {
String msg = "";
if(!kqglassokqj.insert()) if(!kqglassokqj.insert())
return ResultUtil.error("操作失败--新增考勤机"); return ResultUtil.error("操作失败--新增考勤机");
...@@ -697,13 +740,15 @@ public class TimeCardController { ...@@ -697,13 +740,15 @@ public class TimeCardController {
HttpEntity httpEntity = new HttpEntity(params, headers); HttpEntity httpEntity = new HttpEntity(params, headers);
try { try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class); ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
System.err.print(request.getBody()); com.alibaba.fastjson.JSONObject object = JSON.parseObject(request.getBody());
System.err.println(object.get("message"));
msg = object.get("message").toString();
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); // System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败"); return ResultUtil.success(msg);
} }
return ResultUtil.data(kqglassokqj,"操作成功!"); return ResultUtil.data(kqglassokqj,msg);
}else { }else {
return ResultUtil.error("考勤机已存在或已被使用"); return ResultUtil.error("考勤机已存在或已被使用");
} }
...@@ -1167,6 +1212,7 @@ public class TimeCardController { ...@@ -1167,6 +1212,7 @@ public class TimeCardController {
System.err.print(request.getBody()); System.err.print(request.getBody());
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); System.err.println("提示:考勤机服务出错");
return ResultUtil.error("删除失败:提示:考勤机服务出错"); return ResultUtil.error("删除失败:提示:考勤机服务出错");
} }
} }
...@@ -2848,7 +2894,7 @@ public class TimeCardController { ...@@ -2848,7 +2894,7 @@ public class TimeCardController {
@GetMapping(value = "/Weekly_attendance_data/{date}") @GetMapping(value = "/Weekly_attendance_data/{date}")
@ApiOperation(value = "考勤周数据", httpMethod = "GET", notes = "查询数据") @ApiOperation(value = "考勤周数据--app接口", httpMethod = "GET", notes = "查询数据")
public Result<Object> Weekly_attendance_data(@CurrentUser UserBean userBean,@PathVariable("date") String date) throws ParseException { public Result<Object> Weekly_attendance_data(@CurrentUser UserBean userBean,@PathVariable("date") String date) throws ParseException {
......
package cn.timer.api.dto.kqmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendanceMachineStatus {
private String[] state;
}
package cn.timer.api.dto.kqmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttstateDate {
private String code;
private int state;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment