/**
  * 根据OA处理类型转换成考勤类型
  *
  * @param busCode
  * @return
  */
 private AdcAttendType getAdcAttendTypeRecByBuscode(String busCode) {
   AdcAttendTypeExample example = new AdcAttendTypeExample();
   example.createCriteria().andBusCodeEqualTo(busCode);
   List recList = adcAttendTypeMapper.selectByExample(example);
   if (recList.size() == 0) {
     return null;
   } else {
     return (AdcAttendType) recList.get(0);
   }
 }
  /**
   * 处理一条adc_shift_leave的记录,看看能否应用到排班表中
   *
   * @throws ParseException
   */
  public int procAdcShiftLeaveOne(AdcShiftLeave record) throws ParseException {
    // 检查是否有排班记录
    AdcShiftSchedulingExample exp = new AdcShiftSchedulingExample();
    exp.createCriteria()
        .andSchDateEqualTo(record.getAdcDate())
        .andEmpidEqualTo(record.getEmpid())
        .andDeptidEqualTo(record.getDeptid());
    List<AdcShiftScheduling> items = adcShiftSchedulingMapper.selectByExample(exp);
    if (items.size() == 0) {
      return 0;
    }
    AdcShiftScheduling adcShiftScheduling = items.get(0);

    AdcAttendType attendType = adcAttendTypeMapper.selectByPrimaryKey(record.getAdcId());
    if (HrUtils.isEmpty(attendType)) {
      return -1;
    }

    if (attendType.getTypeType().equalsIgnoreCase("1")) {
      adcShiftScheduling.setAdcId(record.getAdcId());
    }
    adcShiftScheduling.setCount(record.getAffDays());

    /** 徐岩加于2015.09.29 用于处理由值班表产生的adc_shift_leave记录 */
    String shiftId = record.getShiftId();
    if (!HrUtils.isEmpty(shiftId)) {
      Map dateMap = adcShiftUtils.getWorkAndOffTime(shiftId, record.getAdcDate());
      adcShiftScheduling.setWorkTime((Date) dateMap.get("dateWork"));
      adcShiftScheduling.setOffTime((Date) dateMap.get("dateOff"));
      adcShiftScheduling.setShiftId(shiftId);
      adcShiftScheduling.setAdcId((String) dateMap.get("adc_id"));
    }

    /** 处理半天效果: 判断影响天数字段的值 1:无0.5天效果 -0.5:上午半天 0.5:下午半天 */
    if (record.getAffDays().floatValue() == 1) {
      adcShiftScheduling.setOffTime(null);
      adcShiftScheduling.setWorkTime(null);
      adcShiftScheduling.setShiftId(null);
    } else if (record.getAffDays().floatValue() == -0.5) {
      adcShiftScheduling.setWorkTime(null);
    } else if (record.getAffDays().floatValue() == 0.5) {
      adcShiftScheduling.setOffTime(null);
    }

    exp.clear();
    exp.createCriteria().andIdEqualTo(adcShiftScheduling.getId());
    adcShiftSchedulingMapper.updateByExample(adcShiftScheduling, exp);
    return 1;
  }