Commit d7ffb230 by lal

提交

parent bfa43d61
......@@ -19,7 +19,8 @@ public class InitializeSetting implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
StaticVariable.mac_command = "http://120.24.24.239:8095/cmd";//考勤机执行命令
// StaticVariable.mac_command = "http://120.24.24.239:8095";//考勤机执行命令
StaticVariable.mac_command = "http://172.20.10.2:8088";//考勤机执行命令
}
}
......@@ -36,6 +36,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console;
import cn.timer.api.bean.kqgl.KqglAssoKqjgly;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.UserAttendanceRel;
......@@ -86,6 +87,7 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper;
import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper;
import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttMemberSettings;
import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
......@@ -104,6 +106,7 @@ import cn.timer.api.dto.kqmk.ModifyEmployeeBalanceDto;
import cn.timer.api.dto.kqmk.OriginalRecordDto;
import cn.timer.api.dto.kqmk.SetConditionsDto;
import cn.timer.api.dto.kqmk.StartTimeRestDto;
import cn.timer.api.dto.kqmk.UserAttendanceRelDto;
import cn.timer.api.dto.kqmk.VacationInformationDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult;
......@@ -1150,6 +1153,92 @@ public class TimeCardController {
}
/**
* 获取当前考勤组所有人员
*/
@GetMapping(value="/AttUserGroupList/{id}")
@ApiOperation(value = "获取当前考勤组所有人员", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getAttUserGroupList(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
UserAttendanceRelDto usatt = UserAttendanceRelDto.builder().build();
List<UserAttendanceRel> userattgor = userattendancerelmapper.selectAttendanceOfficerByKqzid(id,userBean.getOrgCode());
usatt.setUseratts(userattgor);
KqglMainKqz kqztypeid = kqglmainkqzmapper.selectOne(new QueryWrapper<KqglMainKqz>().lambda().eq(KqglMainKqz::getId, id));
usatt.setTypeid(kqztypeid.getPbfs());
return ResultUtil.data(usatt);
}
@PostMapping(value = "/setmembers")
@ApiOperation(value = "考勤设置成员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Attsetmembers(@CurrentUser UserBean userBean,@RequestBody AttMemberSettings attsetuser) {
//确认当前考勤组是否存在考勤机打卡
List<KqglAssoKqzdkfs> dkfs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getType, 1).eq(KqglAssoKqzdkfs::getKqzId, attsetuser.getAttgroupid()));
if(dkfs.size() > 0) {
for(KqglAssoKqzdkfs fss:dkfs) {
String DevId = null;
int kqjid = 0;
KqglAssoKqj kqj = KqglAssoKqj.builder().id(fss.getDkfsid()).build().selectById();//查询考勤机“序列号”
DevId = kqj.getCode();
kqjid = kqj.getId();
//考勤组新增员工
String[] addmember = attsetuser.getAddMember();
String urladd = StaticVariable.mac_command+"/addUserName";
for(int a=0;a<addmember.length;a++){
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", DevId);
params.add("userId", addmember[a]);
YgglMainEmp yggluser = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getEmpNum, addmember[a]));
params.add("userName", yggluser.getName());
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
ResponseEntity<String> request = restTemplate.postForEntity(urladd, httpEntity, String.class);
System.err.print(request.getBody());
//需要改下下
KqglAssoYhsb uskqj = KqglAssoYhsb.builder().userId(Integer.valueOf(addmember[a])).kqjid(kqjid).type(1).isGly(0).build();
if (!uskqj.insert())
return ResultUtil.error("操作失败--新增用户与设备关系");
}
//考勤组减少员工
String[] removemember = attsetuser.getRemoveMember();
String urlre = StaticVariable.mac_command+"/deleteUser";
for(int r=0;r<removemember.length;r++){
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", DevId);
params.add("userId", removemember[r]);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
ResponseEntity<String> request = restTemplate.postForEntity(urlre, httpEntity, String.class);
System.err.print(request.getBody());
//用户与设备关系表
KqglAssoYhsb.builder().build().delete(new QueryWrapper<KqglAssoYhsb>().lambda().eq(KqglAssoYhsb::getUserId, removemember[r]).eq(KqglAssoYhsb::getKqjid, kqjid).eq(KqglAssoYhsb::getType, 1));
//考勤机管理员
KqglAssoKqjgly.builder().build().delete(new QueryWrapper<KqglAssoKqjgly>().lambda().eq(KqglAssoKqjgly::getKqjid, kqjid).eq(KqglAssoKqjgly::getUserid, removemember[r]));
}
}
}
//删除--kqgl_asso_yhkqz[用户和考勤组关系表]
return ResultUtil.success("成功");
}
@PutMapping(value="/switch")
@ApiOperation(value = "41:设置假期规则开关", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 41)
......@@ -1910,7 +1999,6 @@ public class TimeCardController {
// return ResultUtil.data(map);
// }
/**************************/
/**
* 查询列表-加班补偿方式
......
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttMemberSettings {
@ApiModelProperty(value = "考勤组id", example = "字段说明")
private Integer attgroupid;
@ApiModelProperty(value = "考勤组新增员工", example = "字段说明")
private String[] addMember;
@ApiModelProperty(value = "考勤组减少员工 ", example = "字段说明")
private String[] removeMember;
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import java.util.List;
import cn.timer.api.bean.kqgl.UserAttendanceRel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserAttendanceRelDto implements Serializable{
private static final long serialVersionUID = 8904448757565309401L;
private Integer typeid;
private List<UserAttendanceRel> useratts;
}
\ No newline at end of file
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