Commit b1255a14 by Administrator

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!91
parents 834c5689 4ad4f63f
......@@ -61,7 +61,10 @@ public class KqglAssoLeaveBalance extends Model<KqglAssoLeaveBalance> {
@ApiModelProperty(value = "修改序号 修改序号", example = "101")
private Integer modifyNumber;
@ApiModelProperty(value="企业组织代码 企业组织代码",example="101")
@ApiModelProperty(value = "企业组织代码 企业组织代码", example = "101")
private Integer orgCode;
@ApiModelProperty(value = "是否为系统自动 0:否;1:是", example = "101")
private Integer isAutomatic;
}
\ No newline at end of file
......@@ -47,7 +47,7 @@ public class KqglAssoTeshu extends Model<KqglAssoTeshu> {
private Integer bcid;
@ApiModelProperty(value = "录入时间 录入时间", example = "101")
private Integer lusjTime;
private Long lusjTime;
@ApiModelProperty(value = "录入人员 录入人员", example = "101")
private Integer luryid;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -44,7 +44,7 @@ import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags = "3.0考勤打卡")
@Api(tags = "3.0[3]考勤打卡")
@RestController
@Transactional
@RequestMapping(value = "/kqdk", produces = { "application/json", "multipart/form-data" })
......
......@@ -4,9 +4,14 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
/**
* @author Yl123 2020-05-11
......@@ -14,6 +19,114 @@ import java.util.Locale;
*/
public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/**
* 根据 年、月 获取对应的月份 的 天数
*/
public static int getDaysByYearMonth(int year, int month)
{
Calendar a = Calendar.getInstance();
a.set(Calendar.YEAR, year);
a.set(Calendar.MONTH, month - 1);
a.set(Calendar.DATE, 1);
a.roll(Calendar.DATE, -1);
int maxDate = a.get(Calendar.DATE);
return maxDate;
}
/**
* 获取月份起始日期
*
* @param date
* @return
* @throws ParseException
*/
public static String getMinMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
calendar.setTime(famt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH,
calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
return famt.format(calendar.getTime());
}
/**
* 获取月份最后日期
*
* @param date
* @return
* @throws ParseException
*/
public static String getMaxMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
calendar.setTime(famt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH,
calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return famt.format(calendar.getTime());
}
/**
* 对比两个字符串数组
* @param t1
* @param t2
* @return
*/
public static <T> List<T> compare(T[] t1, T[] t2) {
List<T> list1 = Arrays.asList(t1); //将t1数组转成list数组
List<T> list2 = new ArrayList<T>();//用来存放2个数组中不相同的元素
for (T t : t2) {
if (!list1.contains(t)) {
list2.add(t);
}
}
return list2;
}
public static String[] array_unique(String[] ss) {
Set<String> set=new HashSet<String>(Arrays.asList(ss));
return set.toArray(new String[set.size()]);
//或者return new HashSet<String>(Arrays.asList(ss)).toArray(new String[0]);
}
public static byte[] CreateBSCommBufferFromString(String sCmdParam,byte[] bytCmd) {
try{
if (sCmdParam.length() == 0){
return bytCmd;
}
byte[] bytText = sCmdParam.getBytes("UTF-8");
byte[] bytTextLen = int2byte(bytText.length + 1);
bytCmd=new byte[4 + bytText.length + 1];
System.arraycopy(bytTextLen,0,bytCmd,0,bytTextLen.length);
System.arraycopy(bytText,0,bytCmd,4,bytText.length);
bytCmd[4 + bytText.length] = 0;
return bytCmd;
}catch(Exception e){
e.printStackTrace();
bytCmd=new byte[0];
return bytCmd;
}
}
public static byte[] int2byte(int res) {
byte[] targets = new byte[4];
targets[0] = (byte) (res & 0xff);
targets[1] = (byte) ((res >> 8) & 0xff);
targets[2] = (byte) ((res >> 16) & 0xff);
targets[3] = (byte) (res >>> 24);
return targets;
}
public static byte[] ConcateByteArray(byte[] abytDest, byte[] abytSrc) {
int len_dest = abytDest.length + abytSrc.length;
if (abytSrc.length == 0)
return abytDest;
byte[] bytTmp = new byte[len_dest];
System.arraycopy(abytDest, 0, bytTmp, 0, abytDest.length);
System.arraycopy(abytSrc, 0, bytTmp, abytDest.length, abytSrc.length);
return bytTmp;
}
public static String dateToWeek2(String datetime) {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
......
package cn.timer.api.controller.kqgl;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -16,6 +25,8 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -25,9 +36,17 @@ 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.AttGroupBinPunchMode;
import cn.timer.api.bean.kqgl.AttendanceMachine;
import cn.timer.api.bean.kqgl.PunchCardDetails;
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.kqmk.KqglAssOvertimeVice;
import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkdz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.bean.kqmk.KqglAssoDkwx;
import cn.timer.api.bean.kqmk.KqglAssoKqj;
import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
......@@ -40,40 +59,61 @@ import cn.timer.api.bean.kqmk.KqglAssoPbmx;
import cn.timer.api.bean.kqmk.KqglAssoRulesVice;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
import cn.timer.api.bean.kqmk.KqglAssoYhsb;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.Initialization.StaticVariable;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
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.kqmk.KqglAssOvertimeViceMapper;
import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkdzMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoRulesViceMapper;
import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper;
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.kqgl.AttemacDto;
import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.CompensateDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto;
import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto;
import cn.timer.api.dto.kqmk.LeaveTypeDto;
import cn.timer.api.dto.kqmk.MachinememberDto;
import cn.timer.api.dto.kqmk.SetConditionsDto;
import cn.timer.api.dto.kqmk.StartTimeRestDto;
import cn.timer.api.dto.kqmk.VacationInformationDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
@Api(tags = "3.0考勤模块")
@Api(tags = "3.0[1]考勤模块")
@RestController
@Transactional
@RequestMapping(value = "/kqmk", produces = { "application/json", "multipart/form-data" })
......@@ -88,7 +128,7 @@ public class TimeCardController {
/**
* 查询列表-获取班次数据-分页
*/
@PostMapping(value = "/select_shifts")
@PostMapping(value = "/ShiftDataList")
@ApiOperation(value = "1.获取班次数据-根据 组织机构代码-分页", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<Object> selectShifts(@CurrentUser UserBean userBean, @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
......@@ -349,9 +389,16 @@ public class TimeCardController {
return ResultUtil.error("操作失败");
Integer id = learul.getId();
Console.log("新增/修改--假期规则id: " + id);
if(leaverules.getLeaveBalance() == 0) {//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
KqglAssoLeaveBalance.builder().build().delete(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getLeaveRulesId, id)
.eq(KqglAssoLeaveBalance :: getOrgCode, userBean.getOrgCode()));
if(leaverules.getLeaveBalance() == 1) {//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
//该项公司员工余额为“0”
List<YgglMainEmp> yggl = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("+0")
.reason("系统按照规则自动").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
}
}
List<KqglAssoRulesVice> vices = new ArrayList<KqglAssoRulesVice>();
String[] rest = leaverules.getRange();
......@@ -421,6 +468,103 @@ public class TimeCardController {
return ResultUtil.data(attendanList,"操作成功!");
}
@GetMapping(value="/synchrotime/{code}")
@ApiOperation(value = "考勤机一键同步", httpMethod = "GET", notes = "接口发布说明")
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";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败");
}
return ResultUtil.success("成功");
}
/**
* 移除考勤机管理员
*/
@PostMapping(value = "/removeadministrator/{kqjid}/{id}")
@ApiOperation(value = "移除考勤机管理员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> RemoveAdministrator(@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++){
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";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败");
}
KqglAssoYhsb.builder().id(id).isGly(0).build().updateById();
}
}
return ResultUtil.success("成功");
}
@PostMapping(value = "/modifyauthority/{kqjid}/{id}")
@ApiOperation(value = "添加考勤机管理员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> ModifyAuthority(@CurrentUser UserBean userBean,@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++){
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";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败");
}
UserEquiRelation kqjry = new UserEquiRelation();
kqjry.setId(id);
kqjry.setIsGly(1);
userequirelationmapper.updateByPrimaryKeySelective(kqjry);
}
}
return ResultUtil.success("成功");
}
/**
* 新增考勤机
*/
......@@ -431,7 +575,29 @@ public class TimeCardController {
kqglassokqj.setLuryid(userBean.getEmpNum());
kqglassokqj.setLusjTime(new Date().getTime());
kqglassokqj.setQyid(userBean.getOrgCode());
return kqglassokqj.insert() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
if(!kqglassokqj.insert())
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";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
try {
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
} catch (RestClientException e) {
System.err.println("提示:考勤机服务出错");
return ResultUtil.success("失败");
}
return ResultUtil.success("操作成功!");
}
/**
......@@ -523,21 +689,6 @@ public class TimeCardController {
return KqglAssoDkdz.builder().id(id).build().deleteById() ? ResultUtil.success("删除成功!") : ResultUtil.error("没有找到该对象");
}
/**
* 获取打卡地址所在考勤组数据*********
*/
// @GetMapping(value="/PunchAddressGroup/{id}")
// @ApiOperation(value = "获取打卡地址所在考勤组数据", httpMethod = "GET", notes = "接口发布说明")
// @ApiOperationSupport(order = 14)
// public Result<List<AttendanceGroup>> getPunchAddressGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
//
// int qyid = userBean.getOrgCode();//坏小孩【企业id】
// int userid = userBean.getEmpNum();//用户id
//
// List<AttendanceGroup> attaddressownlist = attendancegroupservice.selectByPrimaryAttAddressOwn(qyid,id);
// return ResultUtil.data(attaddressownlist);
// }
/*********打卡WIFI***********/
/**
* 获取打卡WIFI数据
......@@ -596,19 +747,6 @@ public class TimeCardController {
return KqglAssoDkwx.builder().id(id).build().deleteById() ? ResultUtil.success("删除成功!") : ResultUtil.error("没有找到该对象");
}
/**
* 获取打卡WIFI所在考勤组数据*****
*/
// @GetMapping(value="/PunchWIFIGroup/{id}")
// @ApiOperation(value = "获取打卡WIFI所在考勤组数据", httpMethod = "GET", notes = "接口发布说明")
// @ApiOperationSupport(order = 20)
// public Result<List<AttendanceGroup>> getPunchWIFIGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
// int qyid = userBean.getOrgCode();//坏小孩【企业id】
//
// List<AttendanceGroup> attwifiownlist = attendancegroupservice.selectByPrimaryAttWIFIOwn(qyid,id);
// return ResultUtil.data(attwifiownlist);
// }
@Autowired
private KqglAssoLeaveBalanceMapper kqglassoleavebalancemapper;
/**
......@@ -727,7 +865,7 @@ public class TimeCardController {
return ResultUtil.data(pageAs, leadto, "操作成功!");
}
/*****************考勤组***********************/
/**
* 查询列表-考勤组-分页
*/
......@@ -790,14 +928,44 @@ public class TimeCardController {
return ResultUtil.data(yggl);
}
//用户和考勤组关系
@Autowired
private UserAttendanceRelMapper userattendancerelservice;
//用户与设备关系表
@Autowired
private UserEquiRelationMapper userequirelationmapper;
/**
* 删除考勤组
*/
@DeleteMapping(value = "/AttendanceGroup/{id}")
@ApiOperation(value = "39:删除考勤组", httpMethod = "DELETE", notes = "接口发布说明")
@ApiOperationSupport(order = 39)
public Result<Integer> DelAttendanceGroup(@PathVariable("id") Integer id) {
public Result<Integer> DelAttendanceGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
if(KqglMainKqz.builder().id(id).build().deleteById()) {
// List<UserAttendanceRel> attusers = userattendancerelservice.selectAttendanceOfficerByKqzid(id, userBean.getOrgCode());//该考勤组人数
// //该考勤组所绑定的考勤机
// List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id).eq(KqglAssoKqzdkfs::getType, 1));
// String DevId = "";
// for(KqglAssoKqzdkfs abp:kqjs) {
// KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();//查询考勤机“序列号”
// DevId = kqj.getCode();
// for(UserAttendanceRel user:attusers) {
// String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID
// JSONObject vResultJson = new JSONObject();
// vResultJson.put("devId", DevId);
// vResultJson.put("userId", user_id);
// String sFinal = vResultJson.toString();
// String url = StaticVariable.mac_command+"/deleteUser";
// HttpHeaders headers = new HttpHeaders();
// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// params.add("json", sFinal);
// RestTemplate restTemplate = new RestTemplate();
// HttpEntity httpEntity = new HttpEntity(params, headers);
// ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
// }
// }
// userequirelationmapper.deleteBykqzid(id);
//删除考勤组绑定的打卡方式
KqglAssoKqzdkfs.builder().build().delete(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id));
//删除用户和考勤组关系表
......@@ -820,6 +988,870 @@ public class TimeCardController {
return ResultUtil.error("删除失败");
}
@Autowired
private KqglAssoKqzdkfsMapper kqglassokqzdkfsmapper;
@Autowired
private KqglAssoYhkqzMapper kqglassoyhkqzmapper;
@Autowired
private KqglAssoZhoupaibanMapper kqglassozhoupaibanmapper;
@Autowired
private KqglAssoTeshuMapper kqglassoteshumapper;
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
/**
* 新建考勤组
*/
@PostMapping(value = "/AttendanceGroup")
@ApiOperation(value = "40:新增考勤组数据", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 40)
public Result<Object> AttendanceGroupList(@CurrentUser UserBean userBean,@RequestBody AttendanceAssistantDto attass) {
KqglMainKqz attgro = KqglMainKqz.builder().name(attass.getName()).kqbz(attass.getRemarks()).pbfs(attass.getAtttype()).qyid(userBean.getOrgCode())
.isWq(attass.getFieldpersonnel()).isFdjjr(attass.getLegalholidays()).isXzbcdk(attass.getOptscheduling()).sybc(String.join(",",attass.getAttShifts()))
.isDqtx(attass.getAttRemind()).txry(String.join(",",attass.getAttRemindUserids())).txfs(attass.getAdvanceDays()).txxhts(attass.getRemCycleDays())
.txsjTime(attass.getReminderTime()).tsfs(String.join(",",attass.getPromptingMode())).isWpbsdk(attass.getAttRemind()).kqkssjTime(attass.getNewAttTime())
.zsgzsc(attass.getLeastworkTime()).zcgzsc(attass.getNormalWorkTime()).jbzdsc(attass.getMaxOvertimeTime()).overtimeRulesId(attass.getOvertimeRulesId()).build();
// if (!attgro.insertOrUpdate())
if (!attgro.insert())
return ResultUtil.error("操作失败--新增考勤组");
Integer attid = attgro.getId();
Console.log("新增--考勤组id: " + attid);
List<KqglAssoKqzdkfs> kqzdkfslist = new ArrayList<KqglAssoKqzdkfs>();
String[] attmac = attass.getAttmachines();//考勤机
if(attmac.length>0){
for (int i = 0; i < attmac.length; i++) {
KqglAssoKqzdkfs attgbpmac = KqglAssoKqzdkfs.builder().dkfsid(Integer.valueOf(attmac[i])).kqzId(attid).type(1).qyid(userBean.getOrgCode()).state(1).build();
kqzdkfslist.add(attgbpmac);
}
}
String[] atad = attass.getAttadds();//考勤地址
if(atad.length > 0){
for(int a=0;a<atad.length;a++){
KqglAssoKqzdkfs attgbpadd = KqglAssoKqzdkfs.builder().dkfsid(Integer.valueOf(atad[a])).kqzId(attid).type(2).qyid(userBean.getOrgCode()).state(1).build();
kqzdkfslist.add(attgbpadd);
}
}
String[] atwf = attass.getAttwifis();//考勤WIFI
if(atwf.length > 0){
for(int f=0;f<atwf.length;f++){
KqglAssoKqzdkfs attgbpwf = KqglAssoKqzdkfs.builder().dkfsid(Integer.valueOf(atwf[f])).kqzId(attid).type(3).qyid(userBean.getOrgCode()).state(1).build();
kqzdkfslist.add(attgbpwf);
}
}
if(kqzdkfslist.size()>0){
kqglassokqzdkfsmapper.insertKqglAssokqzdKfsList(kqzdkfslist);
}
//用户和考勤组关系
List<KqglAssoYhkqz> yhkqzlist = new ArrayList<KqglAssoYhkqz>();
String[] attser = attass.getAttuserids();
if(attser.length>0){
for(int u=0;u<attser.length;u++){
if(attass.getAtttype() == 2){ KqglAssoPbmx.builder().build().delete(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, Integer.valueOf(attser[u])));}
KqglAssoYhkqz.builder().build().delete(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, Integer.valueOf(attser[u])));
KqglAssoYhkqz kquser = KqglAssoYhkqz.builder().kqzid(attid).userid(Integer.valueOf(attser[u])).qyid(userBean.getOrgCode()).build();
yhkqzlist.add(kquser);
List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attid).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, Integer.valueOf(attser[u])).eq(KqglAssoYhsb::getKqjid, kqj.getId()));
if(kqjry == null) {
KqglAssoYhsb uskqj = KqglAssoYhsb.builder().userId(Integer.valueOf(attser[u])).kqjid(kqj.getId()).type(1).isGly(kqjry.getIsGly()).build();
if (!uskqj.insert())
return ResultUtil.error("操作失败--新增用户与设备关系");
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";
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("json", sFinal);
RestTemplate restTemplate = new RestTemplate();
HttpEntity httpEntity = new HttpEntity(params, headers);
ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
}
}
}
}
if(yhkqzlist.size()>0){
kqglassoyhkqzmapper.insertKqglAssoKqzdkfsList(yhkqzlist);
}
List<KqglAssoZhoupaiban> attweeklist = new ArrayList<KqglAssoZhoupaiban>();//固定排版周记录
String[] weektime = attass.getAttWeekdays();//周工作日【固定排班】
String[] weekshif = attass.getAttWeekdaysShifts();//周工作日班次【固定排班】
if(weektime.length>0 && weekshif.length>0 && attass.getAtttype() == 1){
for(int h=0;h<weektime.length;h++){
KqglAssoZhoupaiban attweek = KqglAssoZhoupaiban.builder().kqzid(attid).type(Integer.valueOf(weektime[h])).bcid(Integer.valueOf(weekshif[h])).build();
attweeklist.add(attweek);
}
}
String[] attFrWorkdays = attass.getAttFreeWorkdays();// 周工作日【自由工时】
if(attFrWorkdays.length>0 && attass.getAtttype() == 3){
for(int w=0;w<attFrWorkdays.length;w++){
KqglAssoZhoupaiban attfrwor = KqglAssoZhoupaiban.builder().kqzid(attid).type(Integer.valueOf(attFrWorkdays[w])).bcid(0).build();
attweeklist.add(attfrwor);
}
}
if(attweeklist.size()>0){
kqglassozhoupaibanmapper.insertKqglAssoZhoupaibanList(attweeklist);
}
List<KqglAssoTeshu> speclist = new ArrayList<KqglAssoTeshu>();
String[] attmuspudata = attass.getAttMustPunchData();// 必须打卡的日期【固定排班】
String[] attmuspushifid = attass.getAttMustPunchShifid();// 必须打卡的班次id【固定排班】
String[] attnonpudata = attass.getAttNonPunchData();// 不用打卡的日期【固定排班】
if(attmuspudata.length>0 && attmuspushifid.length>0 && attass.getAtttype() == 1){
for(int m=0;m<attmuspudata.length;m++){
KqglAssoTeshu mut = KqglAssoTeshu.builder().kqzid(attid).tsrq(attmuspudata[m]).bcid(Integer.valueOf(attmuspushifid[m])).lusjTime(new Date().getTime()).luryid(userBean.getEmpNum()).type(1).build();
speclist.add(mut);
}
}
if(attnonpudata.length>0 && attass.getAtttype() == 1){
for(int n=0;n<attnonpudata.length;n++){
KqglAssoTeshu non = KqglAssoTeshu.builder().kqzid(attid).tsrq(attnonpudata[n]).bcid(0).lusjTime(new Date().getTime()).luryid(userBean.getEmpNum()).type(2).build();
speclist.add(non);
}
}
if(speclist.size()>0){
kqglassoteshumapper.insertKqglAssoTeshuList(speclist);
}
//记录排班(排班制)
List<KqglAssoPbmxDto> schlist=new ArrayList<KqglAssoPbmxDto>();
KqglAssoPbmxDto[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){
for(int p=0;p<schedules.length;p++){
KqglAssoPbmxDto sch = KqglAssoPbmxDto.builder().userid(schedules[p].getUserid()).data(schedules[p].getData()).bcid(schedules[p].getBcid()).kqzid(attid).build();
schlist.add(sch);
}
}
if(schlist.size()>0){
kqglassopbmxmapper.insertKqglAssoPbmxList(schlist);
}
return ResultUtil.data(attgro,"操作成功!");
}
@PutMapping(value="/switch")
@ApiOperation(value = "41:设置假期规则开关", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 41)
public Result<Object> setswitch(@CurrentUser UserBean userBean, @RequestBody SetConditionsDto setconditionsdto) {
return KqglAssoLeaveRules.builder().id(setconditionsdto.getId()).isOpen(setconditionsdto.getParameters()).build().updateById() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
}
/**
* 获取修改的排班明细--【修改考勤组】--------------------------------------------------------------------------------------
*/
@PostMapping(value = "/AttGroupSchedulingList")
@ApiOperation(value = "42:获取修改的排班明细", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 42)
public Result<Object> getAttGroupSchedulingList(@CurrentUser UserBean userBean,@RequestBody AttSchedulingDto attscheduling) {
String str = new SimpleDateFormat("yyyy-MM").format(new Date());
if(("").equals(attscheduling.getDate()) || attscheduling.getDate() == null){
attscheduling.setDate(str);
}
attscheduling.setQyid(userBean.getOrgCode());
List<KqglAssoPbmxDto> schlist = kqglassopbmxmapper.selectAttGroupScheduling(attscheduling);
return ResultUtil.data(schlist);
}
/**
* 根据考勤组id获取班次信息--【修改考勤组】
*/
@GetMapping(value="/roster/{id}/{date}")
@ApiOperation(value = "43:根据考勤组id获取班次信息", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 43)
public Result<Object> getRosterList(@PathVariable("id") Integer id,@PathVariable("date") String date) {
KqzAttendanceGroupSearchDto jycx = KqzAttendanceGroupSearchDto.builder().overall(date).qyid(id).build();
List<KqglAssoBcsz> shifs = kqglassobcszmapper.selectRosterByKqzid(jycx);
return ResultUtil.data(shifs);
}
private SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private KqglAssoDkjlMapper kqglassodkjlmapper;
//打卡记录
@Autowired
private PunchRecordMapper punchrecordservice;
//打卡明细表
@Autowired
private PunchCardDetailsMapper punchcarddetailsservice;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* @throws ParseException
*/
@PutMapping(value = "/attscheduling")
@ApiOperation(value = "44:修改考勤组排班", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 44)
public Result<Object> updateAttscheduling(@CurrentUser UserBean userBean,@RequestBody AttendanceAssistantDto attass) throws ParseException {
int id = Integer.valueOf(attass.getAttgroupid());//修改数据id
List<KqglAssoPbmxDto> schlist = new ArrayList<KqglAssoPbmxDto>();
KqglAssoPbmxDto[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){
for(int p=0;p<schedules.length;p++){
KqglAssoPbmxDto sch = KqglAssoPbmxDto.builder().userid(schedules[p].getUserid()).data(schedules[p].getData()).bcid(schedules[p].getBcid()).kqzid(Integer.valueOf(attass.getAttgroupid())).build();
schlist.add(sch);
String data = mat.format(new Date(schedules[p].getData().toString()));
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
KqglAssoBcsz banci = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, schedules[p].getBcid()));
Long sbdk1 = 0l,xbdk1 = 0l,sbdk2 = 0l,xbdk2 = 0l,sbdk3 = 0l,xbdk3 = 0l;
if(banci != null){
if(banci.getSxbcs()== 1 || banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk1(),2)+":00"));
xbdk1 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk1(),2)+":00"));
}
if(banci.getSxbcs()== 2 || banci.getSxbcs()== 3){
sbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk2(),2)+":00"));
xbdk2 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk2(),2)+":00"));
}
if(banci.getSxbcs()== 3){
sbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getSbdk3(),2)+":00"));
xbdk3 = Long.valueOf(ClockInTool.dateToStamp(data+" "+ClockInTool.dealDateFormat(banci.getXbdk3(),2)+":00"));
}
}
KqglAssoDkjl mapuca = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).last("LIMIT 1"));
List<KqglAssoDkjl> mapucalist = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
// List<KqglAssoDkjl> initial = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if(mapucalist.size() > 0){
RestMethod(mapucalist,mapucalist.get(0).getDkmxid());
}
}
KqglAssoDkjl minAttid = null,maxAttid = null;
int dkmxid = 0;
if(mapucalist.size() > 0){
//最小值
minAttid = mapucalist.stream().min(Comparator.comparing(KqglAssoDkjl::getId)).get();
//最大值
maxAttid = mapucalist.stream().max(Comparator.comparing(KqglAssoDkjl::getId)).get();
//对应打卡明细表id
dkmxid = maxAttid.getDkmxid();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if(mapuca != null && !(schedules[p].getBcid()).equals(mapuca.getBcid())){
if(banci != null){//修改后有班次打卡
if(banci.getSxbcs() == 1){//修改后一天打两次
if(mapucalist.size() > 2){/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for(KqglAssoDkjl pre : mapucalist){
if(pre.getId() != minAttid.getId() && pre.getId() != maxAttid.getId()){//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
int results=0;long attime;
if((pre.getSort())%2 > 0){
Long time = (pre.getDktime() - sbdk1)/1000/60;
if(time > 0){ results= Integer.valueOf(time.toString());}
attime= sbdk1;//上班应打卡时间
}else{
Long time = (pre.getDktime() - xbdk1)/1000/60;
if(time > 0){}else{results = Math.abs(Integer.valueOf(time.toString()));}
attime = xbdk1;//下班应打卡时间
}
KqglAssoDkjl.builder().id(pre.getId()).status(0).sort(0).results(results).attime(attime).bcid(banci.getId()).build().updateById();
}else {
if(pre.getId() == minAttid.getId()){//上班
Long time = (pre.getDktime() - sbdk1)/1000/60;
int status=0,results=0;//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){ status=3; results=Integer.valueOf(time.toString());}else{ status = 1; results = 0;}
KqglAssoDkjl.builder().id(pre.getId()).type(1).status(status).results(results).attime(sbdk1).bcid(banci.getId()).build().updateById();
}else if(pre.getId() == maxAttid.getId()){//下班
Long time = (pre.getDktime() - xbdk1)/1000/60;
int status=0,results=0;
if(time > 0){ status = 1; results = 0;}else{ status = 4; results = Math.abs(Integer.valueOf(time.toString()));}
KqglAssoDkjl.builder().id(pre.getId()).type(2).status(status).results(results).attime(xbdk1).bcid(banci.getId()).sort(2).build().updateById();
}
}
}
KqglAssoDkjl mindata = KqglAssoDkjl.builder().id(minAttid.getId()).build().selectById();
KqglAssoDkmx.builder().id(dkmxid).sbdk1(mindata.getDktime()).sbdk1jg(mindata.getResults()).xbdk1(null).xbdk1jg(0).sbdk2(null).sbdk2jg(0).xbdk2(null)
.xbdk2jg(0).sbdk3(null).sbdk3jg(0).ydkcs(banci.getSxbcs()*2).gzsc(Double.valueOf("0")).build().updateById();
KqglAssoDkjl maxdata = KqglAssoDkjl.builder().id(maxAttid.getId()).build().selectById();
Long woktimes = (maxdata.getDktime() - mindata.getDktime())/1000/60;
KqglAssoDkmx.builder().id(dkmxid).xbdk1(maxdata.getDktime()).xbdk1jg(maxdata.getResults()).gzsc(Double.valueOf(woktimes)).build().updateById();
}else {
KqglAssoDkjl mindataone = null;
if(minAttid != null || maxAttid != null){
int status=0,results=0;
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){ status = 3; results = Integer.valueOf(time.toString()); }else{ status = 1; results=0; }
KqglAssoDkjl.builder().id(mapucalist.get(0).getId()).type(1).status(status).results(results).attime(sbdk1).bcid(banci.getId()).build().updateById();
mindataone = KqglAssoDkjl.builder().id(minAttid.getId()).build().selectById();
KqglAssoDkmx.builder().id(dkmxid).sbdk1(mindataone.getDktime()).sbdk1jg(mindataone.getResults()).ydkcs(banci.getSxbcs()*2).gzsc(Double.valueOf("0")).build().updateById();
}
if(maxAttid != null && minAttid.getId() != maxAttid.getId()){
int status=0,results=0;
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){ status = 1; results=0; }else{ status = 4; results = Math.abs(Integer.valueOf(time.toString())); }
KqglAssoDkjl.builder().id(mapucalist.get(1).getId()).type(2).status(status).results(results).attime(xbdk1).bcid(banci.getId()).sort(2).build().updateById();
KqglAssoDkjl maxdata = KqglAssoDkjl.builder().id(maxAttid.getId()).build().selectById();
Long woktimes = (maxdata.getDktime() - mindataone.getDktime())/1000/60;
KqglAssoDkmx.builder().id(dkmxid).xbdk1(maxdata.getDktime()).xbdk1jg(maxdata.getResults()).gzsc(Double.valueOf(woktimes)).build().updateById();
}
}
}else if(banci.getSxbcs() == 2){//修改后一天打四次
if(mapucalist.size() > 4){//当天打卡多次
String[] str= new String[3];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}else{//上班
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(4);
record.setAttime(xbdk2);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[2] = String.valueOf(maxdata.getId());
}
if(y == 3 || y > 3 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else{
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{//打卡小于4次
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}else if(banci.getSxbcs() == 3){//修改后一天打六次
if(mapucalist.size() > 6){//当天打卡多次
String[] str= new String[5];
for(int y=0;y<mapucalist.size();y++){
if(y == 0){//上班
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
Long time = (mindata.getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
if(y == 1 || y == 2 || y == 3 || y == 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
if((mapucalist.get(y).getSort())%2 == 0){//下班
if(y == 1){
Long time = (mapucalist.get(y).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//下班应打卡时间
str[0] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 3){
Long time = (mapucalist.get(y).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk2);//下班应打卡时间
str[2] = String.valueOf(mapucalist.get(y).getId());
}
}else{//上班
if(y == 2){
Long time = (mapucalist.get(y).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//上班应打卡时间
str[1] = String.valueOf(mapucalist.get(y).getId());
}
if(y == 4){
Long time = (mapucalist.get(y).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//上班应打卡时间
str[3] = String.valueOf(mapucalist.get(y).getId());
}
}
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord maxdata = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//下班
if(mapucalist.get(y).getId() == maxdata.getId()){//下班
PunchRecord record = new PunchRecord();
record.setId(maxdata.getId());
record.setType(2);//下班
Long time = (maxdata.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setSort(6);
record.setAttime(xbdk3);
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
str[4] = String.valueOf(maxdata.getId());
}
if(y == 5 || y > 5 && mapucalist.get(y).getId() != maxdata.getId()){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(y).getId());
record.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setSort(0);//序号(0:打卡无效:此记录已被更新)
record.setResults(0);// 打卡结果
record.setAttime(mapucalist.get(y).getDktime());//上班应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord mindata = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails record = new PunchCardDetails();
record.setId(dkmxid);//需修改的明细id
record.setSbdk1(mindata.getDktime());
record.setSbdk1jg(mindata.getResults());// 上班1打卡结果
record.setXbdk1(null);
record.setXbdk1jg(0);// 下班1打卡结果
record.setSbdk2(null);
record.setSbdk2jg(0);// 上班2打卡结果
record.setXbdk2(null);
record.setXbdk2jg(0);// 下班2打卡结果
record.setSbdk3(null);
record.setSbdk3jg(0);// 上班3打卡结果
record.setXbdk3(null);
record.setXbdk3jg(0);// 下班3打卡结果
record.setYdkcs(banci.getSxbcs()*2);//应打卡次数
record.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.ModifyPunchDetails(record);
for(int t=0;t<str.length;t++){
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(Integer.valueOf(str[t]));//单条打卡明细
PunchCardDetails dkmx = new PunchCardDetails();
dkmx.setId(dkmxid);//需修改的明细id
if(t == 0){
dkmx.setXbdk1(dtdkmx.getDktime());
dkmx.setXbdk1jg(dtdkmx.getResults());// 下班1打卡结果
}else if(t == 1){
dkmx.setSbdk2(dtdkmx.getDktime());
dkmx.setSbdk2jg(dtdkmx.getResults());// 上班2打卡结果
}else if(t == 2){
dkmx.setXbdk2(dtdkmx.getDktime());
dkmx.setXbdk2jg(dtdkmx.getResults());// 下班2打卡结果
}else if(t == 3){
dkmx.setSbdk3(dtdkmx.getDktime());
dkmx.setSbdk3jg(dtdkmx.getResults());// 上班3打卡结果
}else{
dkmx.setXbdk3(dtdkmx.getDktime());
dkmx.setXbdk3jg(dtdkmx.getResults());// 下班3打卡结果
}
Long woktimes = (dtdkmx.getDktime() - mindata.getDktime())/1000/60;
dkmx.setGzsc(Double.valueOf(woktimes));
punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}else{
PunchRecord mindataone = null;
if(minAttid != null || maxAttid != null){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(0).getId());//当天一条记录的id
record.setType(1);//上班
Long time = (mapucalist.get(0).getDktime() - sbdk1)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
mindataone = punchrecordservice.selectByPrimaryKey(minAttid.getId());//上班
PunchCardDetails dan = new PunchCardDetails();
dan.setId(dkmxid);//需修改的明细id
dan.setSbdk1(mindataone.getDktime());
dan.setSbdk1jg(mindataone.getResults());// 上班1打卡结果
dan.setYdkcs(banci.getSxbcs()*2);//应打卡次数
dan.setGzsc(Double.valueOf("0"));
punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails pcd = new PunchCardDetails();
if(mapucalist.size() >= 2){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(1).getId());//当天一条记录的id
record.setType(2);
Long time = (mapucalist.get(1).getDktime() - xbdk1)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk1);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(1).getId());//单条打卡明细
pcd.setXbdk1(dtdkmx.getDktime());
pcd.setXbdk1jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 3){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(2).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(2).getDktime() - sbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(2).getId());//单条打卡明细
pcd.setSbdk2(dtdkmx.getDktime());
pcd.setSbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 4){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(3).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(3).getDktime() - xbdk2)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(xbdk2);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(3).getId());//单条打卡明细
pcd.setXbdk2(dtdkmx.getDktime());
pcd.setXbdk2jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 5){
PunchRecord record = new PunchRecord();
record.setId(mapucalist.get(4).getId());//当天一条记录的id
record.setType(1);
Long time = (mapucalist.get(4).getDktime() - sbdk3)/1000/60;
if(time > 0){
record.setStatus(3);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record.setResults(Integer.valueOf(time.toString()));// 打卡结果
}else{
record.setStatus(1);
record.setResults(0);// 打卡结果
}
record.setAttime(sbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(mapucalist.get(4).getId());//单条打卡明细
pcd.setSbdk3(dtdkmx.getDktime());
pcd.setSbdk3jg(dtdkmx.getResults());
}
if(mapucalist.size() >= 6){
PunchRecord record = new PunchRecord();
record.setId(maxAttid.getId());//当天一条记录的id
record.setType(2);
Long time = (maxAttid.getDktime() - xbdk3)/1000/60;
if(time > 0){
record.setStatus(1);
record.setResults(0);// 打卡结果
}else{
record.setStatus(4);
record.setResults(Math.abs(Integer.valueOf(time.toString())));// 打卡结果
}
record.setAttime(xbdk3);//当天应打卡时间
record.setBcid(banci.getId());//班次id
punchrecordservice.updateByPrimaryKeySelective(record);
PunchRecord dtdkmx = punchrecordservice.selectByPrimaryKey(maxAttid.getId());//单条打卡明细
pcd.setXbdk3(dtdkmx.getDktime());
pcd.setXbdk3jg(dtdkmx.getResults());
}
pcd.setId(dkmxid);
punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}
}else{////修改后班次为休息的
RestMethod(mapucalist,dkmxid);
}
}
}
}
if(schlist.size()>0){
//删除排班明细表(自由排班)
KqglAssoPbmx.builder().build().delete(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getKqzid, id));
kqglassopbmxmapper.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.error("修改考勤组排班失败");
}
/**
* 班次修改调用方法
*/
public void RestMethod(List<KqglAssoDkjl> mapucalist,int dkmxid){
int q = 1;
for(KqglAssoDkjl pres : mapucalist){
int type = 0;
if(q%2 > 0){type= 1;}else{type = 2;}
KqglAssoDkjl.builder().id(pres.getId()).results(0).type(type).status(1).sort(q).attime(pres.getDktime()).bcid(0).build().updateById();
q++;
}
if(mapucalist.size() > 0){/*******修改打卡明细数据****/
KqglAssoDkmx pcd = KqglAssoDkmx.builder().build();
if(mapucalist.size() >= 1){ pcd.setSbdk1(mapucalist.get(0).getDktime());pcd.setSbdk1jg(0);}
if(mapucalist.size() >= 2){ pcd.setXbdk1(mapucalist.get(1).getDktime());pcd.setXbdk1jg(0);}
if(mapucalist.size() >= 3){ pcd.setSbdk2(mapucalist.get(2).getDktime());pcd.setSbdk2jg(0);}
if(mapucalist.size() >= 4){ pcd.setXbdk2(mapucalist.get(3).getDktime()); pcd.setXbdk2jg(0);}
if(mapucalist.size() >= 5){ pcd.setSbdk3(mapucalist.get(4).getDktime()); pcd.setSbdk3jg(0);}
if(mapucalist.size() >= 6){ pcd.setXbdk3(mapucalist.get(5).getDktime()); pcd.setXbdk3jg(0);}
pcd.setId(dkmxid);
pcd.updateById();
}
}
@PostMapping(value = "/leave_balance_list")
@ApiOperation(value = "45:获取修改的排班明细", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 45)
public Result<Object> LeaveBalanceList(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
IPage<EmployeeLeaveBalanceDto> page = new Page<EmployeeLeaveBalanceDto>(
attquerycriteriadto.getCurrentPage() == null ? 1 : attquerycriteriadto.getCurrentPage(),
attquerycriteriadto.getTotalPage() == null ? 10 : attquerycriteriadto.getTotalPage());
attquerycriteriadto.setOrgCode(userBean.getOrgCode());
attquerycriteriadto.setEmpNum(userBean.getEmpNum());
// 缺-部门id 搜索
IPage<EmployeeLeaveBalanceDto> pageAs = kqglassoleavebalancemapper.selectPageByQueryLeaveBalance(page, attquerycriteriadto);
List<EmployeeLeaveBalanceDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
/**************************/
/**
* 查询列表-加班补偿方式
......
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto;
/**
......@@ -17,4 +19,6 @@ public interface KqglAssoBcszMapper extends BaseMapper<KqglAssoBcsz> {
int insert(KqglAssoBcsz kqglassobcsz);
int update(KqglAssoBcsz kqglassobcsz);
List<KqglAssoBcsz> selectRosterByKqzid(KqzAttendanceGroupSearchDto kqzattendancegroupsearchdto);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
......@@ -13,4 +16,6 @@ import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
@Repository
public interface KqglAssoKqzdkfsMapper extends BaseMapper<KqglAssoKqzdkfs> {
int insertKqglAssokqzdKfsList(List<KqglAssoKqzdkfs> kqglassokqzdkfs);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
/**
* 员工假期余额
......@@ -13,4 +18,5 @@ import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
@Repository
public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBalance> {
IPage<EmployeeLeaveBalanceDto> selectPageByQueryLeaveBalance(IPage<EmployeeLeaveBalanceDto> page,@Param("param") AttqueryCriteriaDto attquerycriteriadto);
}
package cn.timer.api.dao.kqmk;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoPbmx;
import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
/**
......@@ -16,4 +19,8 @@ import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
public interface KqglAssoPbmxMapper extends BaseMapper<KqglAssoPbmx> {
KqglAssoPbmxDto getScheduleSpecificAttendance(Integer kqzid, Integer userid, String date);
int insertKqglAssoPbmxList(List<KqglAssoPbmxDto> kqglassopbmxdto);
List<KqglAssoPbmxDto> selectAttGroupScheduling(AttSchedulingDto attschedulingdto);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
/**
......@@ -13,4 +16,6 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
@Repository
public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> {
int insertKqglAssoTeshuList(List<KqglAssoTeshu> kqglassoteshu);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
/**
......@@ -13,4 +16,5 @@ import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
@Repository
public interface KqglAssoYhkqzMapper extends BaseMapper<KqglAssoYhkqz> {
int insertKqglAssoKqzdkfsList(List<KqglAssoYhkqz> kqglassoyhkqz);
}
package cn.timer.api.dao.kqmk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
/**
......@@ -13,4 +16,5 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
@Repository
public interface KqglAssoZhoupaibanMapper extends BaseMapper<KqglAssoZhoupaiban> {
int insertKqglAssoZhoupaibanList(List<KqglAssoZhoupaiban> kqglassozhoupaiban);
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttSchedulingDto implements Serializable{
private static final long serialVersionUID = 5519260557957197035L;
private Integer qyid;
private String date;
private Integer kqzid;
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendanceAssistantDto implements Serializable{
private static final long serialVersionUID = -3561517817976805144L;
String name;// 考勤组名称 *
String remarks;// 备注 *
String[] attmachines;// 考勤机
String[] attadds;// 办公地点考勤
String[] attwifis;// WiFi考勤
String[] attuserids;// 考勤成员
int atttype;// 考勤类型:1-固定排班、2-排班制、3-自由工时 *
int legalholidays;// 是否开启法定节假日:0-否、1-是 *
String[] attWeekdays;// 周工作日【固定排班】
String[] attWeekdaysShifts;// 周工作日班次【固定排班】
String[] attMustPunchData;// 必须打卡的日期【固定排班】
String[] attMustPunchShifid;// 必须打卡的班次id【固定排班】
String[] attNonPunchData;// 不用打卡的日期【固定排班】
String[] attShifts;// 排班制 选择的班次【排班制】
int attRemind;// 是否开启提醒:0-否、1-是【排班制】
String[] attRemindUserids;// 提醒人员【排班制】
int advanceDays;// 提前多少天数提醒【排班制】
int remCycleDays;// 提醒循环天数【排班制】
String reminderTime;// 提醒时间【排班制】
String[] promptingMode;// 提醒方式:PC端、APP客户端、短信、邮件【排班制】
KqglAssoPbmxDto[] schedules;// 排班日期【排班制】--班次id、日期
// SchedulesUserids[] schedulesUserids;// 排班【排班制】----用户id
int optscheduling;// 未排班时,员工可选择班次打卡
String newAttTime;// 每天几点开始新的考勤【自由工时】
String[] attFreeWorkdays;// 周工作日【自由工时】
String leastworkTime;// 至少需工作时间【自由工时】
String normalWorkTime;// 正常工作时长【自由工时】
String maxOvertimeTime;// 加班最大时长【自由工时】
String attgroupid;
int overtimeRulesId;//加班id
int fieldpersonnel;//外勤
}
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 BalanceSheetDataDto {
@ApiModelProperty(value = "假期规则id", example = "字段说明")
private Integer leaverulesid;
@ApiModelProperty(value = "余额天数 ", example = "字段说明")
private Integer balancedays;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeLeaveBalanceDto {
@ApiModelProperty(value = "员工工号 ", example = "字段说明")
private Integer empnum;
@ApiModelProperty(value = "员工名称 ", example = "字段说明")
private String empname;
@ApiModelProperty(value = "部门 ", example = "字段说明")
private String department;
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private String rztime;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqzAttendanceGroupSearchDto implements Serializable {
private static final long serialVersionUID = 4927912739465404926L;
private String overall;
private Integer qyid;
}
package cn.timer.api.dto.kqmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SetConditionsDto {
private Integer id;
private Integer parameters;
}
......@@ -147,6 +147,17 @@
luryid KqglAssoBcsz_luryid
</sql>
<select id="selectRosterByKqzid" resultMap="BaseResultMap">
select bcsz.* from kqgl_asso_bcsz bcsz
where bcsz.id in (
select pbmx.bcid from kqgl_asso_pbmx pbmx
where pbmx.kqzid = #{qyid,jdbcType=INTEGER}
<if test="overall != null" >
and SUBSTR(pbmx.`data`,1,7) = #{overall,jdbcType=VARCHAR}
</if>
GROUP BY pbmx.bcid
)
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoBcsz">
......
......@@ -30,6 +30,29 @@
state KqglAssoKqzdkfs_state
</sql>
<insert id="insertKqglAssokqzdKfsList" parameterType="java.util.List" >
insert into kqgl_asso_kqzdkfs (dkfsid, kqz_id, type, qyid, state)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.dkfsid != null" >
#{item.dkfsid,jdbcType=INTEGER},
</if>
<if test="item.kqzId != null" >
#{item.kqzId,jdbcType=INTEGER},
</if>
<if test="item.type != null" >
#{item.type,jdbcType=INTEGER},
</if>
<if test="item.qyid != null" >
#{item.qyid,jdbcType=INTEGER},
</if>
<if test="item.state != null" >
#{item.state,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoKqzdkfs">
......
......@@ -14,6 +14,18 @@
<result column="modify_timer" property="modifyTimer" />
<result column="modify_number" property="modifyNumber" />
<result column="org_code" property="orgCode" />
<result column="is_automatic" property="isAutomatic" />
</resultMap>
<resultMap id="LeaveBalanceMap" type="cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="rztime" property="rztime" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
</resultMap>
<sql id="Base_Column_List">
......@@ -26,7 +38,8 @@
modify_userid,
modify_timer,
modify_number,
org_code
org_code,
is_automatic
</sql>
<sql id="Base_Column_List_Alias">
......@@ -39,9 +52,33 @@
modify_userid KqglAssoLeaveBalance_modify_userid,
modify_timer KqglAssoLeaveBalance_modify_timer,
modify_number KqglAssoLeaveBalance_modify_number,
org_code KqglAssoLeaveBalance_org_code
org_code KqglAssoLeaveBalance_org_code,
is_automatic KqglAssoLeaveBalance_is_automatic
</sql>
<select id="selectPageByQueryLeaveBalance" resultMap="LeaveBalanceMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
yz.leave_rules_id as leaverulesid,
yz.balancedays
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
LEFT JOIN (select bal.leave_rules_id,bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.org_code = #{param.orgCode}
GROUP BY bal.userid,bal.leave_rules_id) as yz on yz.userid = emp.emp_num
where emp.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
ORDER BY emp.emp_num DESC
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveBalance">
......@@ -72,7 +109,10 @@
modify_number,
</if>
<if test ='null != orgCode'>
org_code
org_code,
</if>
<if test ='null != isAutomatic'>
is_automatic
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -101,7 +141,10 @@
#{modifyNumber},
</if>
<if test ='null != orgCode'>
#{orgCode}
#{orgCode},
</if>
<if test ='null != isAutomatic'>
#{isAutomatic}
</if>
</trim>
</insert>
......@@ -122,7 +165,8 @@
<if test ='null != modifyUserid'>modify_userid = #{modifyUserid},</if>
<if test ='null != modifyTimer'>modify_timer = #{modifyTimer},</if>
<if test ='null != modifyNumber'>modify_number = #{modifyNumber},</if>
<if test ='null != orgCode'>org_code = #{orgCode}</if>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != isAutomatic'>is_automatic = #{isAutomatic}</if>
</set>
WHERE id = #{id}
</update>
......
......@@ -94,6 +94,41 @@
and pbmx.`data` = #{date}
</select>
<insert id="insertKqglAssoPbmxList" parameterType="java.util.List" >
insert into kqgl_asso_pbmx (userid, data, bcid, kqzid)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.userid != null" >
#{item.userid,jdbcType=INTEGER},
</if>
<if test="item.data != null" >
#{item.data,jdbcType=DATE},
</if>
<if test="item.bcid != null" >
#{item.bcid,jdbcType=INTEGER},
</if>
<if test="item.kqzid != null" >
#{item.kqzid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<select id="selectAttGroupScheduling" resultMap="AssoPbmxMap">
select pbmx.*,
info.`name` as username,
bcsz.`name` bcname,
SUBSTR(pbmx.`data`,1,7) as yemo,
SUBSTR(pbmx.`data`,9,10) as xsrq
from kqgl_asso_pbmx pbmx
LEFT JOIN yggl_main_emp as info on info.emp_num = pbmx.userid
LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = pbmx.bcid
where info.org_code = #{qyid,jdbcType=INTEGER}
<if test="date != null" >
and SUBSTR(pbmx.`data`,1,7) = #{date,jdbcType=VARCHAR}
</if>
and pbmx.kqzid = #{kqzid,jdbcType=INTEGER}
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoPbmx">
......
......@@ -33,6 +33,31 @@
type KqglAssoTeshu_type
</sql>
<insert id="insertKqglAssoTeshuList" parameterType="java.util.List" >
insert into kqgl_asso_teshu (kqzid, tsrq, bcid, lusj_time, luryid, type)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.kqzid != null" >
#{item.kqzid,jdbcType=INTEGER},
</if>
<if test="item.tsrq != null" >
#{item.tsrq,jdbcType=VARCHAR},
</if>
<if test="item.bcid != null" >
#{item.bcid,jdbcType=INTEGER},
</if>
<if test="item.lusjTime != null" >
#{item.lusjTime,jdbcType=BIGINT},
</if>
<if test="item.luryid != null" >
#{item.luryid,jdbcType=INTEGER},
</if>
<if test="item.type != null" >
#{item.type,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoTeshu">
......
......@@ -24,6 +24,22 @@
qyid KqglAssoYhkqz_qyid
</sql>
<insert id="insertKqglAssoKqzdkfsList" parameterType="java.util.List" >
insert into kqgl_asso_yhkqz (kqzid, userid, qyid)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.kqzid != null" >
#{item.kqzid,jdbcType=INTEGER},
</if>
<if test="item.userid != null" >
#{item.userid,jdbcType=INTEGER},
</if>
<if test="item.qyid != null" >
#{item.qyid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoYhkqz">
......
......@@ -24,6 +24,23 @@
bcid KqglAssoZhoupaiban_bcid
</sql>
<insert id="insertKqglAssoZhoupaibanList" parameterType="java.util.List" >
insert into kqgl_asso_zhoupaiban (kqzid, type, bcid)
<foreach collection="list" item="item" index="index" open="values " close="" separator=",">
(
<if test="item.kqzid != null" >
#{item.kqzid,jdbcType=INTEGER},
</if>
<if test="item.type != null" >
#{item.type,jdbcType=INTEGER},
</if>
<if test="item.bcid != null" >
#{item.bcid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoZhoupaiban">
......
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