Commit e582ef85 by ilal Committed by chenzg

提交

parent b020f289
...@@ -25,7 +25,12 @@ import javax.transaction.Transactional; ...@@ -25,7 +25,12 @@ import javax.transaction.Transactional;
import cn.timer.api.utils.redis.RedisUtil; import cn.timer.api.utils.redis.RedisUtil;
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.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -34,6 +39,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -34,6 +39,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -63,9 +69,13 @@ import cn.hutool.poi.excel.ExcelUtil; ...@@ -63,9 +69,13 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import cn.timer.api.bean.clazz.CommonArea; import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion; import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.kqgl.UserEquiRelation;
import cn.timer.api.bean.kqmk.KqglAssoKqj;
import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance; import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules; import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz; import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
import cn.timer.api.bean.kqmk.KqglAssoYhsb;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso; import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin; import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb; import cn.timer.api.bean.yggl.YgglAttaClfjb;
...@@ -95,6 +105,8 @@ import cn.timer.api.controller.kqgl.ClockInTool; ...@@ -95,6 +105,8 @@ import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.atttimer.RealTimeUpdate; import cn.timer.api.controller.kqgl.atttimer.RealTimeUpdate;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService; import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.clazz.CommonAreaMapper; import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper; import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper; import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
...@@ -235,6 +247,14 @@ public class YgglController { ...@@ -235,6 +247,14 @@ public class YgglController {
@Autowired @Autowired
private RealTimeUpdate realtimeupdate; private RealTimeUpdate realtimeupdate;
@Autowired
private KqglAssoKqzdkfsMapper kqglassokqzdkfsmapper;
@Value("${config-8timer.machine8timerUrl}")
public String mac_command; // 回调地址
@Autowired
private UserEquiRelationMapper userequirelationmapper;
/** /**
* 添加员工档案 * 添加员工档案
* *
...@@ -312,6 +332,40 @@ public class YgglController { ...@@ -312,6 +332,40 @@ public class YgglController {
if(addygdaDto.getAttgroupid() != null) { if(addygdaDto.getAttgroupid() != null) {
KqglAssoYhkqz.builder().kqzid(attgroupid).userid(login.getId()).qyid(userBean.getOrgCode()).build().insert(); KqglAssoYhkqz.builder().kqzid(attgroupid).userid(login.getId()).qyid(userBean.getOrgCode()).build().insert();
List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, addygdaDto.getAttgroupid()).eq(KqglAssoKqzdkfs::getType, 1));
for(KqglAssoKqzdkfs abp:kqjs) {
KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();
KqglAssoYhsb kqjry = KqglAssoYhsb.builder().build().selectOne(new QueryWrapper<KqglAssoYhsb>().lambda().eq(KqglAssoYhsb::getUserId, login.getId()).eq(KqglAssoYhsb::getKqjid, kqj.getId()));
if(kqjry == null) {
YgglMainEmp yggluser = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getEmpNum, login.getId()));
String url = mac_command+"/addUserName";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", kqj.getCode());
params.add("userId", login.getId());
params.add("userName", yggluser.getName());
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
KqglAssoYhsb.builder().build().delete(new QueryWrapper<KqglAssoYhsb>().lambda().eq(KqglAssoYhsb::getUserId, login.getId()).eq(KqglAssoYhsb::getKqjid, kqj.getId()));
KqglAssoYhsb uskqj = KqglAssoYhsb.builder().userId(login.getId()).kqjid(kqj.getId()).type(1).build();
UserEquiRelation isgly = userequirelationmapper.selectByuserId(login.getId());
if(isgly != null) {
uskqj.setIsGly(isgly.getIsGly());
}else {
uskqj.setIsGly(0);
}
if (!uskqj.insert())
return ResultUtil.error("操作失败--新增用户与设备关系");
}
}
} }
if(syq == 0) { if(syq == 0) {
......
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