Commit 1a41ba99 by lal

提交

parent 3fd049db
......@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
......@@ -20,6 +21,29 @@ import java.util.Set;
public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/**
* @param timeStr
* @param addnumber
* @return 通过java Calendar 实现时间+ 分钟
*/
public static String addtime(String timeStr, String addnumber) {
String str = null;
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = df.parse(timeStr);
// 时间累计
Calendar gc = new GregorianCalendar();
gc.setTime(date);
gc.add(GregorianCalendar.MINUTE, Integer.parseInt(addnumber));
str = df.format(gc.getTime());
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return str;
}
/**
* 获取指定年月的第一天
......
......@@ -64,9 +64,9 @@ 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.config.exception.CustomException;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
......@@ -75,6 +75,7 @@ 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.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
......@@ -95,6 +96,7 @@ import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.ChangePunchResultsDto;
import cn.timer.api.dto.kqmk.CompensateDto;
import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
......@@ -608,7 +610,7 @@ public class TimeCardController {
return ResultUtil.success("失败");
}
return ResultUtil.success("操作成功!");
return ResultUtil.data(kqglassokqj,"操作成功!");
}
/**
......@@ -2072,6 +2074,108 @@ public class TimeCardController {
}
@Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper;
/**
* 更改打卡结果
* @throws ParseException
*/
@PostMapping(value = "/change_punch_results")
@ApiOperation(value = "更改打卡结果", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> ChangePunchResults(@CurrentUser UserBean userBean,@RequestBody ChangePunchResultsDto chpunchr) throws ParseException {
String data = chpunchr.getData();//应更改时间yyyy-MMM-dd
String minutes = chpunchr.getMinutes();//更改分钟数
KqglAssoBcsz dkbc = kqglassobcszmapper.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, chpunchr.getBcszid()));
String clock_time = null;//应打卡时间
long clock_time_ = 0l;
long changed_time = 0l;//改过的最终时间
int results = 0;//打卡结果
if(dkbc != null){
if(chpunchr.getClocktype() == 1) {
clock_time = (data+" "+dkbc.getSbdk1()+":00").replaceAll("\r|\n", "");
}else if(chpunchr.getClocktype() == 2) {
clock_time = (data+" "+dkbc.getXbdk1()+":00").replaceAll("\r|\n", "");
}else if(chpunchr.getClocktype() == 3) {
clock_time = (data+" "+dkbc.getSbdk2()+":00").replaceAll("\r|\n", "");
}else if(chpunchr.getClocktype() == 4) {
clock_time = (data+" "+dkbc.getXbdk2()+":00").replaceAll("\r|\n", "");
}else if(chpunchr.getClocktype() == 5) {
clock_time = (data+" "+dkbc.getSbdk3()+":00").replaceAll("\r|\n", "");
}else {
clock_time = (data+" "+dkbc.getXbdk3()+":00").replaceAll("\r|\n", "");
}
if(chpunchr.getAtttype() == 1) {//正常
changed_time = Long.valueOf(ClockInTool.dateToStamp(clock_time));
}else if(chpunchr.getAtttype() == 2) {//迟到
changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_time, minutes)));
results = Integer.valueOf(minutes);
}else {//早退
changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_time, "-"+minutes)));
results = Integer.valueOf(minutes);
}
long sbdk1 = 0,xbdk1 = 0,sbdk2 = 0,xbdk2 = 0,sbdk3 = 0,xbdk3 = 0;
int sbdk1jg = 0,xbdk1jg = 0,sbdk2jg = 0,xbdk2jg = 0,sbdk3jg = 0,xbdk3jg = 0;
//kqgl_asso_dkmx 打卡明细是否存在打卡记录
KqglAssoDkmx dkmx = kqglassodkmxmapper.selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getData, chpunchr.getData()).eq(KqglAssoDkmx::getUserid, chpunchr.getNum()));
if(dkmx != null) {
if(chpunchr.getClocktype() == 1) {
sbdk1 = changed_time;
sbdk1jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).sbdk1(sbdk1).sbdk1jg(sbdk1jg).build().updateById();
}else if(chpunchr.getClocktype() == 2) {
xbdk1 = changed_time;
xbdk1jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).xbdk1(xbdk1).xbdk1jg(xbdk1jg).build().updateById();
}else if(chpunchr.getClocktype() == 3) {
sbdk2 = changed_time;
sbdk2jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).sbdk2(sbdk2).sbdk2jg(sbdk2jg).build().updateById();
}else if(chpunchr.getClocktype() == 4) {
xbdk2 = changed_time;
xbdk2jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).xbdk2(xbdk2).xbdk2jg(xbdk2jg).build().updateById();
}else if(chpunchr.getClocktype() == 5) {
sbdk3 = changed_time;
sbdk3jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).sbdk3(sbdk3).sbdk3jg(sbdk3jg).build().updateById();
}else {
xbdk3 = changed_time;
xbdk3jg = results;
KqglAssoDkmx.builder().id(dkmx.getId()).xbdk3(xbdk3).xbdk3jg(xbdk3jg).build().updateById();
}
}
//打卡记录表
clock_time_ = Long.valueOf(ClockInTool.dateToStamp(clock_time));
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(chpunchr.getClocktype()).status(9).sort(chpunchr.getClocktype())
.cardType(3).qyid(userBean.getOrgCode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(data)).attime(clock_time_).dkmxid(dkmx.getId()).bcid(chpunchr.getBcszid()).remarks("管理员改为正常").punchmode(0)
.punchequipment("").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常");
}
return ResultUtil.success("操作成功!");
}else {
return ResultUtil.error("操作失败,检查班次是否存在");
}
}
// @GetMapping(value = "/summary_report")
// @ApiOperation(value = "考勤汇总报表(暂时不用)", httpMethod = "GET", notes = "接口发布说明")
// public Result<Object> attendance_summary_report() {
......
package cn.timer.api.dto.kqmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChangePunchResultsDto {
private Integer atttype;// 类型:1:正常;2:迟到;3:早退
private Integer bcszid;// 班次ID
private String minutes;// 更改分钟数
private Integer num;// 员工id
private Integer clocktype;// 打卡类型 1:上班1 2:下班1 3:上班2 4:下班2...
private String data;//当天应打卡时间
}
......@@ -22,7 +22,14 @@ public class DailyDetailsDto {
private String attdate;// 考勤日期
private Integer userid;// 用户ID
private String data;// 日期
private String address;// 打卡地址
private String remarks;// 打卡备注
private Integer cardtype;// 打卡类型(1:GPS,2:WIFI,3:考勤机)
private String macaddress;// WIFI打卡地址
private String macname;// WIFI打卡名称
private Integer bcszid;
private String bcname;
private String bcsbdk1;
private String bcxbdk1;
......@@ -30,7 +37,7 @@ public class DailyDetailsDto {
private String bcxbdk2;
private String bcsbdk3;
private String bcxbdk3;
private String sbdk1;// 上班1打卡时间
private Integer sbdk1jg;// 上班1打卡结果
private String xbdk1;// 下班1打卡时间
......@@ -63,7 +70,7 @@ public class DailyDetailsDto {
private String holidaytransferovertime;// 节假日(转加班费)
private Integer leaverulesid;//
private String duration;//
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
}
......@@ -151,6 +151,13 @@
<result column="dept" property="dept" />
<result column="post" property="post" />
<result column="address" property="address" />
<result column="remarks" property="remarks" />
<result column="cardtype" property="cardtype" />
<result column="macaddress" property="macaddress" />
<result column="macname" property="macname" />
<result column="bcszid" property="bcszid" />
<result column="bcname" property="bcname" />
<result column="bcsbdk1" property="bcsbdk1" />
<result column="bcxbdk1" property="bcxbdk1" />
......@@ -243,6 +250,12 @@
<select id="Dailydetails" resultMap="DailyDetailsMap">
select sum.`name`,sum.num,sum.dept,sum.post,
(select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group) as attname,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.bcszid, '') bcszid,
IFNULL(rtj.bcname, '') bcname,
IFNULL(rtj.bcsbdk1, '') bcsbdk1,
IFNULL(rtj.bcxbdk1, '') bcxbdk1,
......@@ -288,7 +301,7 @@
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
dkjl.attdate,
dkjl.attdate,bcsz.id as bcszid,
bcsz.`name` as bcname,bcsz.sbdk1 as bcsbdk1,bcsz.xbdk1 as bcxbdk1,bcsz.sbdk2 as bcsbdk2,bcsz.xbdk2 as bcxbdk2,bcsz.sbdk3 as bcsbdk3,bcsz.xbdk3 as bcxbdk3,
dkmx.`userid`,dkmx.`data` ,dkmx.`sbdk1`,dkmx.`sbdk1jg`,dkmx.`xbdk1` ,dkmx.`xbdk1jg`,dkmx.`sbdk2` ,dkmx.`sbdk2jg` ,dkmx.`xbdk2` ,
dkmx.`xbdk2jg`,dkmx.`sbdk3` ,dkmx.`sbdk3jg` ,dkmx.`xbdk3`,dkmx.`xbdk3jg` ,dkmx.`ydkcs` ,dkmx.`gzsc` ,dkmx.`qyid`,dkmx.`dksj` ,
......
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