| | |
| | | t=4; |
| | | rule=config.getString("afternoon_work_off"); |
| | | }else {//上班 |
| | | if(check(record,"1")) { |
| | | if(check(record,1)!=null) { |
| | | throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL); |
| | | } |
| | | fse.setValue("punch_type","1"); |
| | |
| | | }else {//上班 |
| | | //上班卡,比上午下班早,记上午上班卡 |
| | | if(dataCompareTo(fse.getDate("punch_time"),config.getDate("morning_work_off")) ) { |
| | | if(check(record,"1")) { |
| | | if(check(record,1)!=null) { |
| | | throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL); |
| | | } |
| | | fse.setValue("punch_type","1"); |
| | | t=1; |
| | | rule=config.getString("morning_work"); |
| | | }else {//记下午上班卡 |
| | | if(check(record,"3")) { |
| | | if(check(record,3)!=null) { |
| | | throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL); |
| | | } |
| | | fse.setValue("punch_type","3"); |
| | |
| | | rule=rule.substring(10); |
| | | rule=DateUtil.formatDate(new Date())+rule; |
| | | } |
| | | if(t%2==0) { |
| | | ///如下是下班卡,并且当天已经打过了,只是去修改最后打卡时间,不是新增一条打卡记录 |
| | | String uuid=check(record,t); |
| | | if(uuid!=null) { |
| | | fse.setValue("uuid", uuid); |
| | | } |
| | | } |
| | | |
| | | long resutl=signinResult(DateUtil.parse(rule),fse.getDate("punch_time"),t); |
| | | if(resutl>0) { |
| | | fse.setValue("sign_in_result", 0);//迟到 |
| | |
| | | } |
| | | |
| | | //上班时间不能重复打卡 |
| | | private boolean check(DataTableEntity record,String type) { |
| | | private String check(DataTableEntity record,int type) { |
| | | for(int i=0;i<record.getRows();i++) { |
| | | if(type.equals( record.getFieldSetEntity(i).getString("punch_type"))) { |
| | | return true; |
| | | if(type==record.getFieldSetEntity(i).getInteger("punch_type").intValue()) { |
| | | return record.getFieldSetEntity(i).getString("uuid"); |
| | | } |
| | | } |
| | | return false; |
| | | return null; |
| | | } |
| | | |
| | | /** |