Commit d6d888c6 by lal

提交

parent a5ce3bfb
......@@ -38,6 +38,7 @@ public class PunchRecord implements Serializable {
private String remarks;// 考勤备注
private Integer punchmode;// 考勤机打卡方式==>1:指紋;2:人脸;3:密码;4:ID卡
private String punchequipment;// 打卡设备
private String commentary;
private String username = "";
private String dept = "";
......@@ -45,6 +46,8 @@ public class PunchRecord implements Serializable {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public Integer getId() {
return id;
}
......@@ -262,4 +265,12 @@ public class PunchRecord implements Serializable {
this.post = post;
}
public String getCommentary() {
return commentary;
}
public void setCommentary(String commentary) {
this.commentary = commentary;
}
}
\ No newline at end of file
......@@ -99,4 +99,7 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> {
@ApiModelProperty(value = "打卡设备 ", example = "打卡设备")
private String punchequipment;
@ApiModelProperty(value="解释 ",example="解释")
private String commentary;
}
\ No newline at end of file
......@@ -68,6 +68,10 @@ public class ClockInController {
@ApiOperation(value = "1:考勤机打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<Object> punchclock(@RequestParam String json) throws Exception {
String msg = "未知错误,请联系管理员";
int sbyf = 0;//0:失败;1:成功
JSONObject jsonArray = new JSONObject(json);
String asDevId = jsonArray.get("dev_id").toString();//考勤机编码
String asUserId = jsonArray.get("user_id").toString();//打卡用户id
......@@ -84,26 +88,46 @@ public class ClockInController {
int userid = user.getEmpNum();
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null) {
List<KqglAssoKqzdkfs> kqjs = KqglAssoKqzdkfs.builder().build().selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attgro.getId()));
if(kqjs.size() > 0) {
/*******/
long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");
String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式
//打卡当天开始时间,打卡当天结束时间
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
int dkmx = 0;
int shifid = 0;
long punchcardtime = 0,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
boolean isRange = true;
int atttype = 0;
ClockCollectData clockt = new ClockCollectData();
/*******/
if(attgro != null) {
List<KqglAssoKqzdkfs> kqjs = KqglAssoKqzdkfs.builder().build().selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, attgro.getId()));
if(kqjs.size() > 0) {
// long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");
// String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式
//打卡当天开始时间,打卡当天结束时间
// Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
// Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
//查询打卡当天是否有记录
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userid)
.ge(KqglAssoDkmx::getDksj, startDate).le(KqglAssoDkmx::getDksj, endDate));
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,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
if(attdate.getAttsch().size() > 0) {
List<AttSchedule> ash = attdate.getAttsch();
int y = 0;
clockt.setShifid(ash.get(y).getId());
shifid = ash.get(y).getId();//班次id
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
......@@ -117,8 +141,8 @@ public class ClockInController {
endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime();
}
}
long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
int atttype = 0;
// long punchcardtime,punchstart,punchend = 0;//应打卡时间,应打卡开始时间,应打卡结束时间
// int atttype = 0;
if(dkmc == null) {//上班1 ****新增
punchcardtime = starttime1;
punchstart = starttime1ks;
......@@ -145,13 +169,16 @@ public class ClockInController {
punchcardtime = 0;punchstart = 0;punchend = 0;atttype = 7;
}
}
if(clockt.getShifid() != 0) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attdate.getAttsch().size() > 0 && clockt.getShifid() > 0){//有无班次
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, clockt.getShifid()));
}
//打卡记录录入 -- 打卡是否有时间范围限制
boolean isRange = true;
// boolean isRange = true;
if(punchstart>0 && punchend>0) {
String staputime = new SimpleDateFormat("HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("HH:mm").format(punchend);//应打卡结束时间
......@@ -310,9 +337,25 @@ public class ClockInController {
}
}else {
System.out.println("当前打卡时间不在范围内");
// System.out.println("当前打卡时间不在范围内");
msg = "当前打卡时间不在范围内";
sbyf = 0;
}
}else {
msg = "当前是休息时间";
sbyf = 0;
}
}else {
// return ResultUtil.error("打卡失败!,未加入考勤组!");
msg="打卡失败!,未加入考勤组!";
sbyf = 0;
}
/*************************************************************************************************************************************************************************************/
/*************************************************************************************************************************************************************************************/
//原始打卡记录数据录入**************************************************************************************************************************************
int results = 0;
Long time = (time_ - punchcardtime)/1000/60;
......@@ -328,41 +371,84 @@ public class ClockInController {
int type,status = 0;
if((atttype)%2 > 0){
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if(punchcardtime == 0){status = 1;}else{
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2;
}else{
if(isRange) {// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if(time > 0){status = 3;}else if(results == 0){status = 1;}
}else {status = 2;}
if(time > 0){
status = 3;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
}
}else{
type = 2;// 类型(类型 0:无排班打卡 1:上班 2:下班)
if(punchcardtime == 0){status = 1;}else{
if(punchcardtime == 0 && clockt.getShifid() != 0){
status = 1;
}if(punchcardtime == 0 && clockt.getShifid() == 0) {
status = 2;
}else{
if(isRange) {
if(time < 0){status = 4;}else if(results == 0){status = 1;}
}else {status = 2;}
if(time < 0){
status = 4;
}else if(results == 0){
status = 1;
}
}else {
status = 2;
}
}
}
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
long attime;
// if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if(punchcardtime == 0){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if(punchcardtime == 0){// 考勤时间(应打卡时间)
attime = new Date().getTime();
}else{
attime = punchcardtime;
}
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 = "考勤机密码打卡";
}
String commentary = "未知";
if(sbyf == 1) {
commentary = "打卡成功";
}else {
commentary = msg;
}
//cardtype--1:GPS,2:WIFI,3:考勤机
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype)
.cardType(3).qyid(qyid).attdate(attdate_+" "+ClockInTool.dateToWeek2(putime)).attime(attime).dkmxid(dkmx).bcid(clockt.getShifid()).remarks(remarks).punchmode(Integer.valueOf(asVerifyMode))
.punchequipment(asDevId).build();
.cardType(3).qyid(qyid).attdate(attdate_+" "+ClockInTool.dateToWeek2(putime)).attime(attime).dkmxid(dkmx).bcid(shifid).remarks(remarks).punchmode(Integer.valueOf(asVerifyMode))
.punchequipment(asDevId).commentary(commentary).build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
}else {
return ResultUtil.error("打卡失败!,未加入考勤组!");
}
}else {
return ResultUtil.error("打卡失败!,用户不存在!");
}
if(sbyf == 1) {
return ResultUtil.data(null, "打卡成功");
}else {
return ResultUtil.data(msg, "打卡失败");
}
}
@Autowired
......
......@@ -2195,8 +2195,14 @@ public class TimeCardController {
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(data,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
int type = 0;
if((chpunchr.getClocktype())%2 > 0){
type = 1;
}else {
type = 2;
}
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(chpunchr.getClocktype()).status(9).sort(chpunchr.getClocktype())
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(changed_time).results(results).userId(chpunchr.getNum()).type(type).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()) {
......
......@@ -105,7 +105,7 @@ public class AttendanceTaskTiming{
*/
//3.添加定时任务
@Scheduled(cron = "0 10 15 * * ?")
@Scheduled(cron = "0 55 10 * * ?")
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
......@@ -155,7 +155,7 @@ public class AttendanceTaskTiming{
KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
// for(int t = 0;t<orgcodelist.size();t++){
int org_code = 117;//orgcodelist.get(t).getId();//企业组织代码
int org_code = 310;//orgcodelist.get(t).getId();//企业组织代码
List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code);
for(AdditionalDto user : userlist) {
double traveltotal = 0,egresstotal = 0,overtimetotal = 0;
......
......@@ -23,6 +23,7 @@
<result column="remarks" property="remarks" jdbcType="VARCHAR" />
<result column="punchmode" property="punchmode" jdbcType="INTEGER" />
<result column="punchequipment" property="punchequipment" jdbcType="VARCHAR" />
<result column="commentary" property="commentary" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="dept" property="dept" jdbcType="VARCHAR" />
......
......@@ -25,6 +25,7 @@
<result column="remarks" property="remarks" />
<result column="punchmode" property="punchmode" />
<result column="punchequipment" property="punchequipment" />
<result column="commentary" property="commentary" />
</resultMap>
<sql id="Base_Column_List">
......@@ -48,7 +49,8 @@
bcid,
remarks,
punchmode,
punchequipment
punchequipment,
commentary
</sql>
<sql id="Base_Column_List_Alias">
......@@ -72,7 +74,8 @@
bcid KqglAssoDkjl_bcid,
remarks KqglAssoDkjl_remarks,
punchmode KqglAssoDkjl_punchmode,
punchequipment KqglAssoDkjl_punchequipment
punchequipment KqglAssoDkjl_punchequipment,
commentary KqglAssoDkjl_explain
</sql>
<!--
......@@ -138,7 +141,10 @@
punchmode,
</if>
<if test ='null != punchequipment'>
punchequipment
punchequipment,
</if>
<if test ='null != commentary'>
commentary
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -200,7 +206,10 @@
#{punchmode},
</if>
<if test ='null != punchequipment'>
#{punchequipment}
#{punchequipment},
</if>
<if test ='null != commentary'>
#{commentary}
</if>
</trim>
</insert>
......@@ -232,7 +241,8 @@
<if test ='null != bcid'>bcid = #{bcid},</if>
<if test ='null != remarks'>remarks = #{remarks},</if>
<if test ='null != punchmode'>punchmode = #{punchmode},</if>
<if test ='null != punchequipment'>punchequipment = #{punchequipment}</if>
<if test ='null != punchequipment'>punchequipment = #{punchequipment},</if>
<if test ='null != commentary'>commentary = #{commentary}</if>
</set>
WHERE id = #{id}
</update>
......
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