Commit 990354f4 by 284718418@qq.com

修改bug474 添加删除考勤机内成员接口代码

parent 547dd23f
......@@ -11,16 +11,19 @@ import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import cn.timer.api.bean.dzht.DzhtAssoMbzj;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestClientException;
......@@ -1717,6 +1720,44 @@ public class TimeCardController {
/**
* 移除考勤机管理员
*/
@SuppressWarnings("all")
@PostMapping(value = "/removeemp/{kqjid}/{id}")
@ApiOperation(value = "删除考勤机内成员", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 46)
public Result<Object> RemoveEmp(@PathVariable int kqjid,@PathVariable int id, @RequestBody Map<String,String> mmd) {
String[] xgyh = mmd.get("a").split(",");
if(xgyh.length > 0){
KqglAssoKqj kqj = KqglAssoKqj.builder().id(kqjid).build().selectById();//查询考勤机“序列号”
for(int a=0;a<xgyh.length;a++){
String url = mac_command+"/deleteUser";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", kqj.getCode());
params.add("userId", xgyh[a]);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
if (!StringUtils.isEmpty(request) && request.getStatusCode() == HttpStatus.OK) {
Logoutput(request.getBody());
JSONObject jsonObj = JSON.parseObject(request.getBody());
if (!"200".equals(jsonObj.getString("code"))) {
return ResultUtil.error(jsonObj.getString("message"));
}
}
} catch (RestClientException e) {
Logoutput("提示:考勤机服务出错-3");
return ResultUtil.success("失败");
}
KqglAssoYhsb.builder().id(id).build().deleteById();
}
}
return ResultUtil.success("成功");
}
/**
* 根据用户id和假期id查询余额具体数据
*/
@PostMapping(value = "/modify_employee_balance")
......
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