Commit 2fe03523 by lal Committed by chenzg

提交

parent 1fa0b5be
...@@ -9,9 +9,6 @@ import java.util.Date; ...@@ -9,9 +9,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.management.Query;
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;
...@@ -72,6 +69,7 @@ import cn.timer.api.bean.yggl.YgglMainEmp; ...@@ -72,6 +69,7 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException; import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.kqgl.atttimer.RealTimeUpdate;
import cn.timer.api.dao.kqgl.PunchRecordMapper; import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper; import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper; import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
...@@ -95,6 +93,7 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper; ...@@ -95,6 +93,7 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper;
import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper; import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper;
import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper; import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttLateLate; import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttMemberSettings; import cn.timer.api.dto.kqmk.AttMemberSettings;
import cn.timer.api.dto.kqmk.AttSchedule; import cn.timer.api.dto.kqmk.AttSchedule;
...@@ -137,6 +136,7 @@ import cn.timer.api.utils.ResponseResult; ...@@ -137,6 +136,7 @@ import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api(tags = "3.0[1]考勤模块") @Api(tags = "3.0[1]考勤模块")
...@@ -1191,37 +1191,39 @@ public class TimeCardController { ...@@ -1191,37 +1191,39 @@ public class TimeCardController {
@ApiOperationSupport(order = 39) @ApiOperationSupport(order = 39)
public Result<Integer> DelAttendanceGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) { public Result<Integer> DelAttendanceGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
List<UserAttendanceRel> attusers = userattendancerelmapper.selectAttendanceOfficerByKqzid(id, userBean.getOrgCode());//该考勤组人数 List<UserAttendanceRel> attusers = userattendancerelmapper.selectAttendanceOfficerByKqzid(id, userBean.getOrgCode());//该考勤组人数
//该考勤组所绑定的考勤机 //该考勤组所绑定的考勤机
List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id).eq(KqglAssoKqzdkfs::getType, 1)); List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id).eq(KqglAssoKqzdkfs::getType, 1));
String DevId = ""; String DevId = "";
for(KqglAssoKqzdkfs abp:kqjs) { for(KqglAssoKqzdkfs abp:kqjs) {
KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();//查询考勤机“序列号” KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();//查询考勤机“序列号”
if(kqj != null) { if(kqj != null) {
DevId = kqj.getCode(); DevId = kqj.getCode();
for(UserAttendanceRel user:attusers) { for(UserAttendanceRel user:attusers) {
String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID
String url = mac_command+"/deleteUser";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", DevId);
params.add("userId", user_id);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
System.err.print(request.getBody());
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错-5");
return ResultUtil.error("删除失败:提示:考勤机服务出错");
}
}
}
String url = mac_command+"/deleteUser";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("devId", DevId);
params.add("userId", user_id);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
System.err.print(request.getBody());
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错-5");
return ResultUtil.error("删除失败:提示:考勤机服务出错");
}
} }
}
}
List<AdditionalDto> userlist = kqglassoleavebalancemapper.RealTimeUpdate(userBean.getOrgCode(),id);
if(KqglMainKqz.builder().id(id).build().deleteById()) { if(KqglMainKqz.builder().id(id).build().deleteById()) {
userequirelationmapper.deleteBykqzid(id); userequirelationmapper.deleteBykqzid(id);
...@@ -1243,6 +1245,12 @@ public class TimeCardController { ...@@ -1243,6 +1245,12 @@ public class TimeCardController {
//刪除假期规则-适用范围 //刪除假期规则-适用范围
KqglAssoRulesVice.builder().build().delete(new QueryWrapper<KqglAssoRulesVice>().lambda().eq(KqglAssoRulesVice::getAttgroupId, id)); KqglAssoRulesVice.builder().build().delete(new QueryWrapper<KqglAssoRulesVice>().lambda().eq(KqglAssoRulesVice::getAttgroupId, id));
try {
realtimeupdate.AttendanceTask(userBean.getOrgCode(), 0, 3,userlist);
} catch (ParseException e) {
e.printStackTrace();
}
return ResultUtil.data(id,"删除成功"); return ResultUtil.data(id,"删除成功");
} }
return ResultUtil.error("删除失败"); return ResultUtil.error("删除失败");
...@@ -1258,6 +1266,9 @@ public class TimeCardController { ...@@ -1258,6 +1266,9 @@ public class TimeCardController {
private KqglAssoTeshuMapper kqglassoteshumapper; private KqglAssoTeshuMapper kqglassoteshumapper;
@Autowired @Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper; private KqglAssoPbmxMapper kqglassopbmxmapper;
@Autowired
private RealTimeUpdate realtimeupdate;
/** /**
* 新建考勤组 * 新建考勤组
*/ */
...@@ -1417,6 +1428,13 @@ public class TimeCardController { ...@@ -1417,6 +1428,13 @@ public class TimeCardController {
kqglassopbmxmapper.insertKqglAssoPbmxList(schlist); kqglassopbmxmapper.insertKqglAssoPbmxList(schlist);
} }
try {
realtimeupdate.AttendanceTask(userBean.getOrgCode(), attid, 1,null);
} catch (ParseException e) {
e.printStackTrace();
}
return ResultUtil.data(attgro,"操作成功!"); return ResultUtil.data(attgro,"操作成功!");
} }
...@@ -1448,11 +1466,27 @@ public class TimeCardController { ...@@ -1448,11 +1466,27 @@ public class TimeCardController {
return ResultUtil.data(usatt); return ResultUtil.data(usatt);
} }
@SuppressWarnings("all") // @SuppressWarnings("all")
@PostMapping(value = "/setmembers") @PostMapping(value = "/setmembers")
@ApiOperation(value = "考勤设置成员", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "考勤设置成员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Attsetmembers(@CurrentUser UserBean userBean,@RequestBody AttMemberSettings attsetuser) { public Result<Object> Attsetmembers(@CurrentUser UserBean userBean,@RequestBody AttMemberSettings attsetuser) {
List<KqglAssoKqzdkfs> qtdkfs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().ne(KqglAssoKqzdkfs::getType, 1).eq(KqglAssoKqzdkfs::getKqzId, attsetuser.getAttgroupid()));
if(qtdkfs.size() > 0) {
//考勤组新增员工
String[] addmember = attsetuser.getAddMember();
for(int a=0;a<addmember.length;a++){
KqglAssoYhkqz.builder().kqzid(attsetuser.getAttgroupid()).userid(Integer.valueOf(addmember[a])).qyid(userBean.getOrgCode()).build().insert();
}
//考勤组减少员工
String[] removemember = attsetuser.getRemoveMember();
for(int r=0;r<removemember.length;r++){
//用户和考勤组关系表
KqglAssoYhkqz.builder().build().delete(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getKqzid, attsetuser.getAttgroupid()).eq(KqglAssoYhkqz::getUserid, removemember[r]));
}
}
//确认当前考勤组是否存在考勤机打卡 //确认当前考勤组是否存在考勤机打卡
List<KqglAssoKqzdkfs> dkfs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getType, 1).eq(KqglAssoKqzdkfs::getKqzId, attsetuser.getAttgroupid())); List<KqglAssoKqzdkfs> dkfs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getType, 1).eq(KqglAssoKqzdkfs::getKqzId, attsetuser.getAttgroupid()));
if(dkfs.size() > 0) { if(dkfs.size() > 0) {
...@@ -1460,8 +1494,12 @@ public class TimeCardController { ...@@ -1460,8 +1494,12 @@ public class TimeCardController {
String DevId = null; String DevId = null;
int kqjid = 0; int kqjid = 0;
KqglAssoKqj kqj = KqglAssoKqj.builder().id(fss.getDkfsid()).build().selectById();//查询考勤机“序列号” KqglAssoKqj kqj = KqglAssoKqj.builder().id(fss.getDkfsid()).build().selectById();//查询考勤机“序列号”
DevId = kqj.getCode(); if(kqj != null) {
kqjid = kqj.getId(); DevId = kqj.getCode();
kqjid = kqj.getId();
}else {
return ResultUtil.error("考勤机不存在");
}
//考勤组新增员工 //考勤组新增员工
String[] addmember = attsetuser.getAddMember(); String[] addmember = attsetuser.getAddMember();
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
package cn.timer.api.controller.yggl; package cn.timer.api.controller.yggl;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -90,6 +91,7 @@ import cn.timer.api.config.enums.SysRoleType; ...@@ -90,6 +91,7 @@ import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.config.exception.Regular; import cn.timer.api.config.exception.Regular;
import cn.timer.api.config.validation.ValidList; import cn.timer.api.config.validation.ValidList;
import cn.timer.api.controller.kqgl.ClockInTool; import cn.timer.api.controller.kqgl.ClockInTool;
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.kqmk.KqglAssoLeaveBalanceMapper; import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
...@@ -222,6 +224,9 @@ public class YgglController { ...@@ -222,6 +224,9 @@ public class YgglController {
return ResultUtil.data(bmgw); return ResultUtil.data(bmgw);
} }
@Autowired
private RealTimeUpdate realtimeupdate;
/** /**
* 添加员工档案 * 添加员工档案
* *
...@@ -320,6 +325,11 @@ public class YgglController { ...@@ -320,6 +325,11 @@ public class YgglController {
} }
try {
realtimeupdate.AttendanceTask(userBean.getOrgCode(), ygglMainEmp.getEmpNum(), 2,null);
} catch (ParseException e) {
e.printStackTrace();
}
return ResultUtil.data(ygglMainEmp, "添加员工成功!"); return ResultUtil.data(ygglMainEmp, "添加员工成功!");
} else { } else {
......
...@@ -31,4 +31,8 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala ...@@ -31,4 +31,8 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
// JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid); // JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
Double Sumbalancedays(int userid,int orgcode,int leaverulesid); Double Sumbalancedays(int userid,int orgcode,int leaverulesid);
List<AdditionalDto> RealTimeUpdate(int orgcode,int kqzid);
List<AdditionalDto> selectAdditionalByempnum(int orgcode,int empnum);
} }
...@@ -136,6 +136,35 @@ ...@@ -136,6 +136,35 @@
and emp.job_status != 3 and emp.job_status != 3
</select> </select>
<select id="RealTimeUpdate" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
IFNULL(c.name,null) as department,
IFNULL(gw.`name`,null) as position
from yggl_main_emp emp
LEFT JOIN kqgl_asso_yhkqz as yhkqz on yhkqz.userid = emp.emp_num
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
and yhkqz.kqzid = #{kqzid}
and emp.job_status != 3;
</select>
<select id="selectAdditionalByempnum" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
IFNULL(c.name,null) as department,
IFNULL(gw.`name`,null) as position
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
and emp.job_status != 3
and emp.emp_num = #{empnum}
</select>
<!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap"> <!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays select bal.userid,SUM(bal.balance_days) as balancedays
......
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