| | |
| | | } |
| | | } |
| | | /** |
| | | * 计算请假天数 |
| | | * @return |
| | | * @throws BaseException |
| | | */ |
| | | @RequestMapping(value = "/getDay/{version}", method = RequestMethod.POST) |
| | | public String getDay(HttpServletRequest request) { |
| | | try { |
| | | //获取参数 |
| | | FieldSetEntity fse=null; |
| | | Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA); |
| | | if(bean != null) { |
| | | RequestParameterEntity reqp=(RequestParameterEntity)bean; |
| | | fse = reqp.getFormData(); |
| | | } |
| | | //判断参数是否为空 |
| | | if(bean == null || fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText()); |
| | | } |
| | | //判断表名是否正常 |
| | | if (!CmnConst.PRODUCT_SYS_ASK_FOR_LEAVE.equals(fse.getTableName())) { |
| | | SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); |
| | | return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText()); |
| | | } |
| | | FieldSetEntity fs = leaveRequestService.getDay(fse); |
| | | return OK_List(fs); |
| | | }catch(BaseException e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | }catch (Exception e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(SystemCode.SYSTEM_GET_LEAVE_REQUEST_INFO_FAIL.getValue(),SystemCode.SYSTEM_GET_LEAVE_REQUEST_INFO_FAIL.getText()); |
| | | } |
| | | } |
| | | /** |
| | | * @Date: 2020-03-30 16:13 |
| | | * @Author: ZhouJie |
| | | * @Description: 删除请假申请 |
| | |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | import com.product.core.service.support.QueryFilterService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 计算请假天数 |
| | | * @param fs |
| | | * @return |
| | | * @throws BaseException |
| | | */ |
| | | public FieldSetEntity getDay(FieldSetEntity fs) throws BaseException { |
| | | DataTableEntity dt = baseDao.listTable(com.product.org.admin.config.CmnConst.PRODUCT_SYS_COMPANY_HOLIDAY, "date_holiday >=? and date_holiday<=?", new String[]{fs.getString("start_time"), fs.getString("end_time")}); |
| | | String dateStr1 = fs.getString("start_time"); |
| | | String dateStr2 = fs.getString("end_time"); |
| | | |
| | | // 使用DateTimeFormatter解析日期字符串 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | // 将字符串解析为LocalDate对象 |
| | | LocalDate date1 = LocalDate.parse(dateStr1, formatter); |
| | | LocalDate date2 = LocalDate.parse(dateStr2, formatter); |
| | | |
| | | // 计算两个日期之间的天数差 |
| | | long daysBetween = java.time.Duration.between(date1.atStartOfDay(), date2.atStartOfDay()).toDays()+1; |
| | | fs.setValue("day",daysBetween-dt.getRows()); |
| | | |
| | | return fs; |
| | | } |
| | | /** |
| | | * @Date: 2020-03-30 16:43 |
| | | * @Author: ZhouJie |
| | |
| | | sb.append(" ,',',if(d.punch_range_two is not null and d.punch_range_two>f.distance,'超出打卡范围',0) "); |
| | | sb.append(" ,',',if(d.punch_time_three is not null and d.punch_time_three>f.distance,'超出打卡范围',0) "); |
| | | sb.append(" ,',',if(d.punch_range_four is not null and d.punch_range_four>f.distance,'超出打卡范围',0)) dkfw, "); |
| | | sb.append(" CASE WHEN b.uuid is not null THEN c.dict_label ELSE "); |
| | | sb.append(" CASE WHEN b.uuid is not null THEN '请假' ELSE "); |
| | | sb.append(" CASE WHEN d.uuid is not null THEN "); |
| | | sb.append(" CONCAT(IF(d.punch_time_one IS TRUE, IF ( DATE_FORMAT(d.punch_time_one, '%H:%i:%S' )>DATE_FORMAT(f.morning_work, '%H:%i:%S'), CONCAT('上午迟到',TIMESTAMPDIFF(MINUTE, DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.morning_work, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S'),d.punch_time_one),'分钟'), 0 ), '上午上班未打卡' ) "); |
| | | sb.append(" ,',',IF(d.punch_time_two IS TRUE, IF ( DATE_FORMAT(d.punch_time_two, '%H:%i:%S' )<DATE_FORMAT(f.morning_work_off, '%H:%i:%S') and f.morning_work_off is not null, CONCAT('上午早退',TIMESTAMPDIFF(MINUTE,d.punch_time_two,DATE_FORMAT(CONCAT(a.punch_date,' ',DATE_FORMAT(f.morning_work_off, '%H:%i:%S')),'%Y-%m-%d %H:%i:%S')),'分钟'), 0 ), '上午下班未打卡' ) "); |
| | |
| | | sb.append(" LEFT JOIN (SELECT * FROM product_oa_ask_for_leave WHERE user_id=? and flow_flag=2) b "); |
| | | param.add(user_id); |
| | | sb.append(" on DATE_FORMAT( a.punch_date, '%Y-%m-%d' )>= DATE_FORMAT( b.start_time, '%Y-%m-%d' ) and DATE_FORMAT( a.punch_date, '%Y-%m-%d' )<= DATE_FORMAT( b.end_time, '%Y-%m-%d' ) "); |
| | | sb.append(" LEFT JOIN (SELECT * FROM product_sys_dict where dict_name='Leave_Type') c on b.leave_type =c.dict_value "); |
| | | sb.append(" LEFT JOIN product_oa_punch_record d on a.punch_date=DATE_FORMAT( d.punch_time_one, '%Y-%m-%d' ) "); |
| | | sb.append(" LEFT JOIN (SELECT applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d') replenish_date,max(replacement_card_type) bk FROM product_oa_replenish_punch "); |
| | | sb.append(" where applicant=? and flow_flag=2 GROUP BY applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d')) e on a.punch_date=e.replenish_date "); |
| | |
| | | FieldSetEntity fs = dt.getFieldSetEntity(i); |
| | | //当天打卡处理 |
| | | if (fs.getString("punch_date").equals(day)){ |
| | | if (fs.getString("reidis").equals("全天未打卡")){ |
| | | if (null!=fs.getString("reidis")&&fs.getString("reidis").equals("全天未打卡")){ |
| | | fs.setValue("reidis",null); |
| | | fs.setValue("dkfw",null); |
| | | }else { |
| | |
| | | reidis[j]="0"; |
| | | } |
| | | } |
| | | String string = Arrays.toString(reidis); |
| | | String string=""; |
| | | if(reidis.length!=1){ |
| | | string = Arrays.toString(reidis); |
| | | }else { |
| | | string=fs.getString("reidis"); |
| | | } |
| | | fs.setValue("reidis",string); |
| | | } |
| | | } |