shicf
2024-10-24 ba2e1fd1409677db4bd2b7a9aae9448cb165d8bf
src/main/java/com/product/mobile/core/service/SignInService.java
@@ -79,7 +79,7 @@
               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");
@@ -101,14 +101,14 @@
            }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");
@@ -124,6 +124,14 @@
         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);//迟到
@@ -158,13 +166,13 @@
   }
   
   //上班时间不能重复打卡
   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;
   }
   /**