Commit 87da5e53 by leialin

Merge branch 'lal' into 'develop'

考勤机打卡

See merge request 8timerv2/8timerapiv200!133
parents b601b5e7 8fe84dee
...@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqmk.KqglAssoBcsz; import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl; import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx; import cn.timer.api.bean.kqmk.KqglAssoDkmx;
...@@ -28,6 +29,7 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban; ...@@ -28,6 +29,7 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz; import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException; import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper; import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper; import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttLateLate; import cn.timer.api.dto.kqmk.AttLateLate;
...@@ -49,6 +51,10 @@ public class ClockInController { ...@@ -49,6 +51,10 @@ public class ClockInController {
@Autowired @Autowired
private KqglMainKqzMapper kqglmainkqzmapper; private KqglMainKqzMapper kqglmainkqzmapper;
//打卡明细表
@Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE"); SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
...@@ -90,7 +96,7 @@ public class ClockInController { ...@@ -90,7 +96,7 @@ public class ClockInController {
int dkmx = 0; int dkmx = 0;
//查询打卡当天是否有记录 //查询打卡当天是否有记录
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid) KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.gt(KqglAssoDkmx::getDksj, startDate).lt(KqglAssoDkmx::getDksj, endDate)); .ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate));
AttendanceCardListDto attdate = MethodCall(qyid,userid,putime); AttendanceCardListDto attdate = MethodCall(qyid,userid,putime);
ClockCollectData clockt = new ClockCollectData(); ClockCollectData clockt = new ClockCollectData();
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0, long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
...@@ -182,21 +188,29 @@ public class ClockInController { ...@@ -182,21 +188,29 @@ public class ClockInController {
dkmx = pcd.getId(); dkmx = pcd.getId();
}else { //*****修改 }else { //*****修改
dkmx = dkmc.getId(); dkmx = dkmc.getId();
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1 if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() == null)){//下班1
int xbdk1jg = 0; pcd.setId(dkmc.getId());
pcd.setXbdk1(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){}else{xbdk1jg = Math.abs(Integer.valueOf(time.toString()));}//上班1打卡结果 if(time > 0){
pcd.setXbdk1jg(0);// 打卡结果
}else{
pcd.setXbdk1jg(Math.abs(Integer.valueOf(time.toString())));//上班1打卡结果
}
} }
double gzsc = 0;
if(dkmc.getSbdk1() != null){ if(dkmc.getSbdk1() != null){
Long time = (time_ - dkmc.getSbdk1())/1000/60; Long time = (time_ - dkmc.getSbdk1())/1000/60;
gzsc = Math.abs(Double.valueOf(time.toString()));//只打一次卡时计算工作时长 pcd.setGzsc(Math.abs(Double.valueOf(time.toString())));//只打一次卡时计算工作时长
} }
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(time_).xbdk1jg(xbdk1jg).gzsc(gzsc).build().updateById();
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) }else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班2 && (("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() == null)){//上班2
int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0; int sbdk2jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
...@@ -207,26 +221,44 @@ public class ClockInController { ...@@ -207,26 +221,44 @@ public class ClockInController {
yzcdsc = sbdk2jg - yzcd; yzcdsc = sbdk2jg - yzcd;
} }
if(sbdk2jg > kgcdfzs) {kgcdcs++;} if(sbdk2jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk2(time_).sbdk2jg(sbdk2jg).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build().updateById();
pcd.setId(dkmc.getId());
pcd.setSbdk2(time_);//上班1打卡时间
pcd.setSbdk2jg(sbdk2jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) }else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班2 && (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() == null)){//下班2
int xbdk2jg = 0;
pcd.setId(dkmc.getId());
pcd.setXbdk2(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){}else{xbdk2jg = Math.abs(Integer.valueOf(time.toString()));} if(time > 0){
pcd.setXbdk2jg(0);// 打卡结果
}else{
pcd.setXbdk2jg(Math.abs(Integer.valueOf(time.toString())));
} }
}
//班次为4次时,计算工作时长 //班次为4次时,计算工作时长
double worktime = 0;
if(dkmc.getSbdk2() != null){ if(dkmc.getSbdk2() != null){
Long time = (time_ - dkmc.getSbdk2())/1000/60; Long time = (time_ - dkmc.getSbdk2())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc()); BigDecimal om = new BigDecimal(dkmc.getGzsc());
BigDecimal on = new BigDecimal(time); BigDecimal on = new BigDecimal(time);
worktime = Math.abs(om.add(on).doubleValue()); double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
} }
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk2(time_).xbdk2jg(xbdk2jg).gzsc(worktime).build().updateById(); kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) }else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null) && (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班3 && (("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() == null)){//上班3
int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0; int sbdk3jg = 0,yzcdsc = 0,yzcdcs = 0,kgcdcs = 0;
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
...@@ -237,27 +269,44 @@ public class ClockInController { ...@@ -237,27 +269,44 @@ public class ClockInController {
yzcdsc = sbdk3jg - yzcd; yzcdsc = sbdk3jg - yzcd;
} }
if(sbdk3jg > kgcdfzs) {kgcdcs++;} if(sbdk3jg > kgcdfzs) {kgcdcs++;}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk3(time_).sbdk3jg(sbdk3jg).yzcdcs(yzcdcs).yzcdsc(Double.valueOf(yzcdsc)).kgcdfzs(kgcdcs).build().updateById();
pcd.setId(dkmc.getId());
pcd.setSbdk3(time_);//上班1打卡时间
pcd.setSbdk3jg(sbdk3jg);
pcd.setYzcdcs(yzcdcs);
pcd.setYzcdsc(Double.valueOf(yzcdsc));
pcd.setKgcdfzs(kgcdcs);
kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
}else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null) }else if((!("").equals(dkmc.getSbdk1()) || dkmc.getSbdk1() != null) && (!("").equals(dkmc.getXbdk1()) || dkmc.getXbdk1() != null)
&& (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null) && (!("").equals(dkmc.getSbdk2()) || dkmc.getSbdk2() != null) && (!("").equals(dkmc.getXbdk2()) || dkmc.getXbdk2() != null)
&& (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班3 && (!("").equals(dkmc.getSbdk3()) || dkmc.getSbdk3() != null) && (("").equals(dkmc.getXbdk3()) || dkmc.getXbdk3() == null)){//下班3
int xbdk3jg = 0;
pcd.setId(dkmc.getId());
pcd.setXbdk3(time_);//下班1打卡时间
if(punchcardtime != 0){//有应打卡时间时 if(punchcardtime != 0){//有应打卡时间时
Long time = (time_ - punchcardtime)/1000/60; Long time = (time_ - punchcardtime)/1000/60;
if(time > 0){}else{xbdk3jg = Math.abs(Integer.valueOf(time.toString()));} if(time > 0){
pcd.setXbdk3jg(0);// 打卡结果
}else{
pcd.setXbdk3jg(Math.abs(Integer.valueOf(time.toString())));
}
} }
//班次为6次时,计算工作时长 //班次为6次时,计算工作时长
double worktime = 0;
if(dkmc.getSbdk3() != null){ if(dkmc.getSbdk3() != null){
Long time = (time_ - dkmc.getSbdk3())/1000/60; Long time = (time_ - dkmc.getSbdk3())/1000/60;
BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次 BigDecimal om = new BigDecimal(dkmc.getGzsc());//第二次
BigDecimal on = new BigDecimal(time); BigDecimal on = new BigDecimal(time);
worktime = Math.abs(om.add(on).doubleValue()); double worktime = Math.abs(om.add(on).doubleValue());
pcd.setGzsc(worktime);
} }
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk3(time_).xbdk3jg(xbdk3jg).gzsc(worktime).build().updateById();
} }
pcd.setId(dkmc.getId());
if(atttype <= 6){ if(atttype <= 6){
KqglAssoDkmx.builder().id(dkmc.getId()).build().updateById(); int update = kqglassodkmxmapper.updateByPrimaryKeySelective(pcd);//修改打卡记录
} }
} }
...@@ -295,7 +344,8 @@ public class ClockInController { ...@@ -295,7 +344,8 @@ public class ClockInController {
} }
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式 String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
long attime; long attime;
if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间) // if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if(punchcardtime == 0){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
String remarks = ""; String remarks = "";
if(("1").equals(asVerifyMode)) {remarks = "考勤机指纹打卡";}else if(("20").equals(asVerifyMode)) {remarks = "考勤机人脸打卡";}else if(("40").equals(asVerifyMode)) {remarks = "考勤机掌纹打卡";}else if(("60").equals(asVerifyMode)) {remarks = "考勤机密码打卡";} if(("1").equals(asVerifyMode)) {remarks = "考勤机指纹打卡";}else if(("20").equals(asVerifyMode)) {remarks = "考勤机人脸打卡";}else if(("40").equals(asVerifyMode)) {remarks = "考勤机掌纹打卡";}else if(("60").equals(asVerifyMode)) {remarks = "考勤机密码打卡";}
//cardtype--1:GPS,2:WIFI,3:考勤机 //cardtype--1:GPS,2:WIFI,3:考勤机
......
...@@ -38,6 +38,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -38,6 +38,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.timer.api.bean.kqgl.PunchCardDetails; import cn.timer.api.bean.kqgl.PunchCardDetails;
import cn.timer.api.bean.kqgl.PunchRecord; import cn.timer.api.bean.kqgl.PunchRecord;
import cn.timer.api.bean.kqgl.UserAttendanceRel;
import cn.timer.api.bean.kqgl.UserEquiRelation; import cn.timer.api.bean.kqgl.UserEquiRelation;
import cn.timer.api.bean.kqmk.KqglAssOvertimeVice; import cn.timer.api.bean.kqmk.KqglAssOvertimeVice;
import cn.timer.api.bean.kqmk.KqglAssoBcsz; import cn.timer.api.bean.kqmk.KqglAssoBcsz;
...@@ -65,6 +66,7 @@ import cn.timer.api.config.annotation.CurrentUser; ...@@ -65,6 +66,7 @@ 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.dao.kqgl.PunchCardDetailsMapper; import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
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.UserEquiRelationMapper; import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper; import cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper;
import cn.timer.api.dao.kqmk.KqglAssoBcszMapper; import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
...@@ -109,7 +111,6 @@ import cn.timer.api.utils.Result; ...@@ -109,7 +111,6 @@ 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.ApiOperation; import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
@Api(tags = "3.0[1]考勤模块") @Api(tags = "3.0[1]考勤模块")
@RestController @RestController
...@@ -123,6 +124,10 @@ public class TimeCardController { ...@@ -123,6 +124,10 @@ public class TimeCardController {
@Autowired @Autowired
private KqglAssOvertimeViceMapper kqglassovertimevicemapper; private KqglAssOvertimeViceMapper kqglassovertimevicemapper;
//用户和考勤组关系
@Autowired
private UserAttendanceRelMapper userattendancerelmapper;
/** /**
* 查询列表-获取班次数据-分页 * 查询列表-获取班次数据-分页
*/ */
...@@ -399,7 +404,7 @@ public class TimeCardController { ...@@ -399,7 +404,7 @@ public class TimeCardController {
} }
}else { }else {
for(YgglMainEmp ye:yggl) { for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("1-1") KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("-1-1")
.reason("不限制余额").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额 .reason("不限制余额").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
} }
} }
...@@ -476,18 +481,15 @@ public class TimeCardController { ...@@ -476,18 +481,15 @@ public class TimeCardController {
@ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> SynchronizationTime(@CurrentUser UserBean userBean,@PathVariable("code") String code) { public Result<Object> SynchronizationTime(@CurrentUser UserBean userBean,@PathVariable("code") String code) {
JSONObject vResultJson = new JSONObject();
vResultJson.put("devId", code);
String sFinal = vResultJson.toString();
String url = StaticVariable.mac_command+"/setTime"; String url = StaticVariable.mac_command+"/setTime";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal); params.add("devId", code);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
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());
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败"); return ResultUtil.success("失败");
...@@ -506,20 +508,17 @@ public class TimeCardController { ...@@ -506,20 +508,17 @@ public class TimeCardController {
KqglAssoKqj kqj = KqglAssoKqj.builder().id(kqjid).build().selectById();//查询考勤机“序列号” KqglAssoKqj kqj = KqglAssoKqj.builder().id(kqjid).build().selectById();//查询考勤机“序列号”
for(int a=0;a<xgyh.length;a++){ for(int a=0;a<xgyh.length;a++){
JSONObject vResultJson = new JSONObject();
vResultJson.put("devId", kqj.getCode());
vResultJson.put("userId", xgyh[a]);
vResultJson.put("privilege", 1);
String sFinal = vResultJson.toString();
String url = StaticVariable.mac_command+"/addUserPrivilege"; String url = StaticVariable.mac_command+"/addUserPrivilege";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal); params.add("devId", kqj.getCode());
params.add("userId", xgyh[a]);
params.add("privilege", 1);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
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());
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败"); return ResultUtil.success("失败");
...@@ -539,20 +538,18 @@ public class TimeCardController { ...@@ -539,20 +538,18 @@ public class TimeCardController {
for(int a=0;a<xgyh.length;a++){ for(int a=0;a<xgyh.length;a++){
JSONObject vResultJson = new JSONObject();
vResultJson.put("devId", kqj.getCode());
vResultJson.put("userId", xgyh[a]);
vResultJson.put("privilege", 2);
String sFinal = vResultJson.toString();
String url = StaticVariable.mac_command+"/addUserPrivilege"; String url = StaticVariable.mac_command+"/addUserPrivilege";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal); params.add("devId", kqj.getCode());
params.add("userId", xgyh[a]);
params.add("privilege", 2);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
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());
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败"); return ResultUtil.success("失败");
...@@ -583,19 +580,16 @@ public class TimeCardController { ...@@ -583,19 +580,16 @@ public class TimeCardController {
if(!kqglassokqj.insert()) if(!kqglassokqj.insert())
return ResultUtil.error("操作失败--新增考勤机"); return ResultUtil.error("操作失败--新增考勤机");
JSONObject vResultJson = new JSONObject();
vResultJson.put("devId", kqglassokqj.getCode());
vResultJson.put("orgCode", userBean.getOrgCode());
String sFinal = vResultJson.toString();
String url = StaticVariable.mac_command+"/addDev"; String url = StaticVariable.mac_command+"/addDev";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal); params.add("orgCode", kqglassokqj.getType());
params.add("devId", kqglassokqj.getCode());
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
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());
} catch (RestClientException e) { } catch (RestClientException e) {
System.err.println("提示:考勤机服务出错"); System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败"); return ResultUtil.success("失败");
...@@ -944,29 +938,28 @@ public class TimeCardController { ...@@ -944,29 +938,28 @@ 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) {
if(KqglMainKqz.builder().id(id).build().deleteById()) { if(KqglMainKqz.builder().id(id).build().deleteById()) {
// List<UserAttendanceRel> attusers = userattendancerelservice.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();//查询考勤机“序列号”
// 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
// JSONObject vResultJson = new JSONObject();
// vResultJson.put("devId", DevId); String url = StaticVariable.mac_command+"/deleteUser";
// vResultJson.put("userId", user_id); HttpHeaders headers = new HttpHeaders();
// String sFinal = vResultJson.toString(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// String url = StaticVariable.mac_command+"/deleteUser"; params.add("devId", DevId);
// HttpHeaders headers = new HttpHeaders(); params.add("userId", user_id);
// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); RestTemplate restTemplate = new RestTemplate();
// params.add("json", sFinal); HttpEntity httpEntity = new HttpEntity(params, headers);
// RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
// HttpEntity httpEntity = new HttpEntity(params, headers); System.err.print(request.getBody());
// ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class); }
// } }
// } userequirelationmapper.deleteBykqzid(id);
// userequirelationmapper.deleteBykqzid(id);
//删除考勤组绑定的打卡方式 //删除考勤组绑定的打卡方式
KqglAssoKqzdkfs.builder().build().delete(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id)); KqglAssoKqzdkfs.builder().build().delete(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id));
...@@ -1062,24 +1055,30 @@ public class TimeCardController { ...@@ -1062,24 +1055,30 @@ public class TimeCardController {
KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById(); KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();
KqglAssoYhsb kqjry = KqglAssoYhsb.builder().build().selectOne(new QueryWrapper<KqglAssoYhsb>().lambda().eq(KqglAssoYhsb::getUserId, Integer.valueOf(attser[u])).eq(KqglAssoYhsb::getKqjid, kqj.getId())); KqglAssoYhsb kqjry = KqglAssoYhsb.builder().build().selectOne(new QueryWrapper<KqglAssoYhsb>().lambda().eq(KqglAssoYhsb::getUserId, Integer.valueOf(attser[u])).eq(KqglAssoYhsb::getKqjid, kqj.getId()));
if(kqjry == null) { if(kqjry == null) {
KqglAssoYhsb uskqj = KqglAssoYhsb.builder().userId(Integer.valueOf(attser[u])).kqjid(kqj.getId()).type(1).isGly(kqjry.getIsGly()).build(); KqglAssoYhsb uskqj = KqglAssoYhsb.builder().userId(Integer.valueOf(attser[u])).kqjid(kqj.getId()).type(1).build();
UserEquiRelation isgly = userequirelationmapper.selectByuserId(Integer.valueOf(attser[u]));
if(isgly != null) {
uskqj.setIsGly(isgly.getIsGly());
}else {
uskqj.setIsGly(0);
}
if (!uskqj.insert()) if (!uskqj.insert())
return ResultUtil.error("操作失败--新增用户与设备关系"); return ResultUtil.error("操作失败--新增用户与设备关系");
YgglMainEmp yggluser = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getEmpNum, attser[u])); YgglMainEmp yggluser = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).eq(YgglMainEmp::getEmpNum, attser[u]));
JSONObject vResultJson = new JSONObject();
vResultJson.put("devId", kqj.getCode());
vResultJson.put("userId", attser[u]);
vResultJson.put("userName", yggluser.getName());
String sFinal = vResultJson.toString();
String url = StaticVariable.mac_command+"/addUserName"; String url = StaticVariable.mac_command+"/addUserName";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal); params.add("devId", kqj.getCode());
params.add("userId", attser[u]);
params.add("userName", yggluser.getName());
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers); HttpEntity httpEntity = new HttpEntity(params, headers);
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class); ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
System.err.print(request.getBody());
} }
} }
} }
......
...@@ -16,4 +16,6 @@ import cn.timer.api.dto.kqmk.AttSubsidiaryDto; ...@@ -16,4 +16,6 @@ import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
public interface KqglAssoDkmxMapper extends BaseMapper<KqglAssoDkmx> { public interface KqglAssoDkmxMapper extends BaseMapper<KqglAssoDkmx> {
AttSubsidiaryDto subsidiary(int userid, String data); AttSubsidiaryDto subsidiary(int userid, String data);
int updateByPrimaryKeySelective(KqglAssoDkmx kqglassodkmx);
} }
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
bmgw.post, bmgw.post,
dkmx.* dkmx.*
from kqgl_asso_dkmx dkmx from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id left join zzgl_bmgw_m um on um.id = m.up_id
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
bmgw.post, bmgw.post,
dkmx.* dkmx.*
from kqgl_asso_dkmx dkmx from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id left join zzgl_bmgw_m um on um.id = m.up_id
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
bmgw.post, bmgw.post,
info.`name` username info.`name` username
from kqgl_asso_dkjl dkjl from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{param.qyid}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id left join zzgl_bmgw_m um on um.id = m.up_id
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
bmgw.post, bmgw.post,
info.`name` username info.`name` username
from kqgl_asso_dkjl dkjl from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id left join zzgl_bmgw_m um on um.id = m.up_id
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
bmgw.post, bmgw.post,
info.`name` username info.`name` username
from kqgl_asso_dkjl dkjl from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id left join zzgl_bmgw_m um on um.id = m.up_id
......
...@@ -96,6 +96,34 @@ ...@@ -96,6 +96,34 @@
GROUP BY dk.userid GROUP BY dk.userid
</select> </select>
<update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
UPDATE kqgl_asso_dkmx
<set>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != data'>data = #{data},</if>
<if test ='null != sbdk1'>sbdk1 = #{sbdk1},</if>
<if test ='null != sbdk1jg'>sbdk1jg = #{sbdk1jg},</if>
<if test ='null != xbdk1'>xbdk1 = #{xbdk1},</if>
<if test ='null != xbdk1jg'>xbdk1jg = #{xbdk1jg},</if>
<if test ='null != sbdk2'>sbdk2 = #{sbdk2},</if>
<if test ='null != sbdk2jg'>sbdk2jg = #{sbdk2jg},</if>
<if test ='null != xbdk2'>xbdk2 = #{xbdk2},</if>
<if test ='null != xbdk2jg'>xbdk2jg = #{xbdk2jg},</if>
<if test ='null != sbdk3'>sbdk3 = #{sbdk3},</if>
<if test ='null != sbdk3jg'>sbdk3jg = #{sbdk3jg},</if>
<if test ='null != xbdk3'>xbdk3 = #{xbdk3},</if>
<if test ='null != xbdk3jg'>xbdk3jg = #{xbdk3jg},</if>
<if test ='null != ydkcs'>ydkcs = #{ydkcs},</if>
<if test ='null != gzsc'>gzsc = #{gzsc},</if>
<if test ='null != qyid'>qyid = #{qyid},</if>
<if test ='null != dksj'>dksj = #{dksj},</if>
<if test ='null != yzcdcs'>yzcdcs = #{yzcdcs},</if>
<if test ='null != yzcdsc'>yzcdsc = #{yzcdsc},</if>
<if test ='null != kgcdfzs'>kgcdfzs = #{kgcdfzs}</if>
</set>
WHERE id = #{id}
</update>
<!-- <!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
...@@ -237,34 +265,6 @@ ...@@ -237,34 +265,6 @@
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
UPDATE kqgl_asso_dkmx
<set>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != data'>data = #{data},</if>
<if test ='null != sbdk1'>sbdk1 = #{sbdk1},</if>
<if test ='null != sbdk1jg'>sbdk1jg = #{sbdk1jg},</if>
<if test ='null != xbdk1'>xbdk1 = #{xbdk1},</if>
<if test ='null != xbdk1jg'>xbdk1jg = #{xbdk1jg},</if>
<if test ='null != sbdk2'>sbdk2 = #{sbdk2},</if>
<if test ='null != sbdk2jg'>sbdk2jg = #{sbdk2jg},</if>
<if test ='null != xbdk2'>xbdk2 = #{xbdk2},</if>
<if test ='null != xbdk2jg'>xbdk2jg = #{xbdk2jg},</if>
<if test ='null != sbdk3'>sbdk3 = #{sbdk3},</if>
<if test ='null != sbdk3jg'>sbdk3jg = #{sbdk3jg},</if>
<if test ='null != xbdk3'>xbdk3 = #{xbdk3},</if>
<if test ='null != xbdk3jg'>xbdk3jg = #{xbdk3jg},</if>
<if test ='null != ydkcs'>ydkcs = #{ydkcs},</if>
<if test ='null != gzsc'>gzsc = #{gzsc},</if>
<if test ='null != qyid'>qyid = #{qyid},</if>
<if test ='null != dksj'>dksj = #{dksj},</if>
<if test ='null != yzcdcs'>yzcdcs = #{yzcdcs},</if>
<if test ='null != yzcdsc'>yzcdsc = #{yzcdsc},</if>
<if test ='null != kgcdfzs'>kgcdfzs = #{kgcdfzs}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap"> <select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
......
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