/**
   * 支援制度キーとデータ更新日指定取得
   *
   * @param supportKey
   * @param updDate
   * @return
   */
  public SpSupportTbl findOne(final String supportKey, final Timestamp updDate) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    // キー
    Specification<SpSupportTbl> whereSupportKey =
        StringUtil.isNull(supportKey)
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("supportKey"), supportKey);
              }
            };
    // データ更新日
    Specification<SpSupportTbl> whereUpdDate =
        DateUtil.isNull(updDate)
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("updDate"), updDate);
              }
            };

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return spSupportTblRepository.findOne(Specifications.where(whereSupportKey).and(whereUpdDate));
  }
  public List<T> findAll(UserInfo userInfo, F form) {
    logger.infoCode("I0001");

    // 必須
    Specification<T> whereUserKey =
        new Specification<T>() {
          @Override
          public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.equal(root.get("usUserTbl").get("userKey"), userInfo.getTargetUserKey());
          }
        };
    // 言語
    Specification<T> whereLanguage =
        StringUtil.isNull(form.getLanguage())
            ? null
            : new Specification<T>() {
              @Override
              public Predicate toPredicate(
                  Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("paperLanguage"), form.getLanguage());
              }
            };

    List<T> list =
        (List<T>)
            repository.findAll(
                (Specification<T>) Specifications.where(whereUserKey).and(whereLanguage));

    logger.infoCode("I0002");
    return list;
  }
  @Transactional
  public boolean importData(UserInfo userInfo, List<F> list) {
    logger.infoCode("I0001");
    try {

      for (int i = 0; i < list.size(); i++) {
        F form = list.get(i);

        T entity = (T) form.getNewTbl();
        entity = this.getPortfolioTbl(form, entity);

        entity.setPublicFlag(form.getPublicFlag());

        UsUserTbl usUserTbl = new UsUserTbl();
        usUserTbl.setUserKey(userInfo.getTargetUserKey());
        entity.setUsUserTbl(usUserTbl);
        entity.setUpdUserKey(userInfo.getLoginUserKey());
        entity.setUpdDate(DateUtil.getNowTimestamp());

        repository.save(entity);
      }

      repository.flush();
      logger.infoCode("I0002");
      return true;
    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }
    return false;
  }
Ejemplo n.º 4
0
  public EvEventTbl findOne(UserInfo userInfo, EventForm form) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    // 定数区分
    Specification<EvEventTbl> whereEventKey =
        StringUtil.isNull(form.getEventKey())
            ? null
            : new Specification<EvEventTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<EvEventTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("eventKey"), form.getEventKey());
              }
            };
    Specification<EvEventTbl> whereUpdDate =
        DateUtil.isNull(form.getUpdDate())
            ? null
            : new Specification<EvEventTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<EvEventTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("updDate"), form.getUpdDate());
              }
            };

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return evEventTblRepository.findOne(Specifications.where(whereEventKey).and(whereUpdDate));
  }
  @Transactional
  public boolean update(UserInfo userInfo, F form) {
    logger.infoCode("I0001");
    try {
      T entity = (T) form.getNewTbl();

      if (form.getPageMode().equals(CommonConst.PAGE_MODE_EDIT)) {
        entity =
            findOne(
                form.getGyosekiKey(), userInfo.getTargetUserKey(), form.getUpdDateAsTimestamp());
        if (entity == null) {
          throw new Exception();
        }
      }

      entity = (T) getPortfolioTbl(form, entity);

      UsUserTbl usUserTbl = new UsUserTbl();
      usUserTbl.setUserKey(userInfo.getTargetUserKey());
      entity.setUsUserTbl(usUserTbl);
      entity.setUpdUserKey(userInfo.getLoginUserKey());
      entity.setUpdDate(DateUtil.getNowTimestamp());

      entity = (T) repository.saveAndFlush(entity);

      if (entity != null) {
        logger.infoCode("I0002");
        return true;
      }

    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }
    return false;
  }
Ejemplo n.º 6
0
  @Transactional
  public boolean delete(UserInfo userInfo, EventForm form) {
    logger.infoCode("I0001");
    try {

      if (userInfo.isMgmt2() || userInfo.isMgmt3() || userInfo.isMgmt4()) {
        logger.infoCode("I0002");
        return false;
      }

      EvEventTbl entity = findOne(userInfo, form);

      evEventPublicTblRepository.delete(entity.getEvEventPublicTbls());

      int c1 = evEventTblRepository.delete(form.getEventKey(), form.getUpdDate());

      if (c1 > 0) {
        evEventPublicTblRepository.flush();
        evEventTblRepository.flush();
        logger.infoCode("I0002");
        return true;
      }
    } catch (Exception e) {
      logger.errorCode("E1009", e); // E1009=削除に失敗しました。{0}
    }
    return false;
  }
  @Transactional
  public boolean updateAll(UserInfo userInfo, F form) {
    logger.infoCode("I0001");
    try {

      List<T> list = findAll(userInfo, form);

      for (int i = 0; i < list.size(); i++) {
        T entity = list.get(i);

        entity.setPublicFlag(form.getPublicFlag());

        UsUserTbl usUserTbl = new UsUserTbl();
        usUserTbl.setUserKey(userInfo.getTargetUserKey());
        entity.setUsUserTbl(usUserTbl);
        entity.setUpdUserKey(userInfo.getLoginUserKey());
        entity.setUpdDate(DateUtil.getNowTimestamp());

        repository.save(entity);
      }
      repository.flush();
      logger.infoCode("I0002");
      return true;
    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }
    return false;
  }
Ejemplo n.º 8
0
  public List<EvEventPublicTbl> findAll() {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    List<EvEventPublicTbl> list = evEventPublicTblRepository.findAll();

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return list;
  }
  /**
   * 新規追加、更新
   *
   * @param form
   * @param userInfo
   * @return
   */
  @Transactional
  public boolean update(SupportForm form, UserInfo userInfo) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}
    try {
      SpSupportTbl entity = new SpSupportTbl();

      // 更新の場合
      if (CommonConst.PAGE_MODE_EDIT.equals(form.getPageMode())) {
        entity = findOne(form.getSupportKey(), form.getUpdDate());
        if (entity == null) {
          throw new Exception();
        }
      }
      //
      entity.setSupportSpkikiKbn(form.getSupportSpkikiKbn());
      entity.setSupportHirakuKbn(form.getSupportHirakuKbn());
      entity.setSupportSybCode(form.getSupportSybCode());
      entity.setSupportAreaKbn(form.getSupportAreaKbn());
      entity.setSupportKeyword(form.getSupportKeyword());
      entity.setSupportStartDate(
          DateUtil.formatTimestampStart(
              DateUtil.getTimestamp(form.getSupportStartDate(), CommonConst.DEFAULT_YYYYMMDD)));
      entity.setSupportEndDate(
          DateUtil.formatTimestampEnd(
              DateUtil.getTimestamp(form.getSupportEndDate(), CommonConst.DEFAULT_YYYYMMDD)));
      entity.setSupportTitle(form.getSupportTitle());
      entity.setSupportContent(form.getSupportContent());
      entity.setUrl(form.getUrl());
      entity.setPartyCode(userInfo.getTargetPartyCode());

      // 更新以外の場合(新規、コピー)
      if (!CommonConst.PAGE_MODE_EDIT.equals(form.getPageMode())) {
        entity.setSupportInsDate(DateUtil.getNowTimestamp());
      }
      entity.setPublicFlag(form.getPublicFlag());
      //
      entity.setUpdUserKey(userInfo.getLoginUserKey());
      entity.setUpdDate(DateUtil.getNowTimestamp());
      //
      entity = spSupportTblRepository.saveAndFlush(entity);

      if (entity != null) {
        logger.infoCode("I0002"); // I0002=メソッド終了:{0}
        return true;
      }

    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }
    return false;
  }
  /**
   * 一覧取得
   *
   * @param form
   * @param locale
   * @return
   */
  public List<SpSupportDto> findSupportBatchTarget(SupportForm form, Locale locale) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    Date today = DateUtil.toDate(DateUtil.getSysdate("yyyyMMdd"));

    // 取得条件:公開
    Specification<SpSupportTbl> wherePublicFlag =
        StringUtil.isNull(form.getSearchPublicFlag())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("publicFlag"), form.getSearchPublicFlag());
              }
            };

    // 取得条件:日付
    Specification<SpSupportTbl> whereEnDay =
        StringUtil.isNull(form.getSearchDateType())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                // batch処理
                if (SEARCH_DATE_TYPE_BATCH.equals(form.getSearchDateType().toLowerCase())) {
                  Predicate predicate = cb.conjunction();
                  Predicate predicate2 = cb.conjunction();
                  predicate2 =
                      cb.and(predicate2, cb.equal(root.get("updDate").as(Date.class), today));
                  predicate2 =
                      cb.and(
                          predicate2, cb.lessThan(root.get("eventSendDate").as(Date.class), today));

                  predicate =
                      cb.and(predicate, cb.equal(root.get("eventSendDate").as(Date.class), today));
                  predicate = cb.or(predicate2);
                  return predicate;
                }
                return null;
              }
            };

    List<SpSupportTbl> list =
        spSupportTblRepository.findAll(Specifications.where(wherePublicFlag).and(whereEnDay));

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return getDtoList(list, locale);
  }
  public F findOne(UserInfo userInfo, F form) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    if (form.getGyosekiKey() == null && form.getUpdDate() == null) {
      return null;
    }

    T gyPaperTbl =
        findOne(form.getGyosekiKey(), userInfo.getTargetUserKey(), form.getUpdDateAsTimestamp());
    if (gyPaperTbl == null) {
      return null;
    }
    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return getPortfolioForm(gyPaperTbl);
  }
  /**
   * 削除
   *
   * @param form
   * @return
   */
  @Transactional
  public boolean delete(SupportForm form) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}
    try {

      int c = spSupportTblRepository.delete(form.getSupportKey(), form.getUpdDate());

      if (c > 0) {
        spSupportTblRepository.flush();
        logger.infoCode("I0002"); // I0002=メソッド終了:{0}
        return true;
      }
    } catch (Exception e) {
      logger.errorCode("E1009", e); // E1009=削除に失敗しました。{0}
    }
    return false;
  }
Ejemplo n.º 13
0
  /**
   * @param name
   * @param model
   * @return
   */
  @RequestMapping({"", "/", "/list"})
  public String list(@ModelAttribute(FORM_NAME) final EventForm form, Model model, Locale locale) {

    logger.infoCode("I0001");

    List<EvEventViewDto> eventPresentList = new ArrayList<>();

    // if (userInfo.isUser1() || userInfo.isUser2() || userInfo.isUser3() ||
    // userInfo.isUser4()) {
    // publicFlag = true;
    // eventPresentList = eventServiceImpl.findAllEvent(userInfo,
    // publicFlag, partyCodeFlag, roleFlag, false);
    // }
    //
    // if (userInfo.isMgmt1()) {
    // partyCodeFlag = true;
    // eventPresentList = eventServiceImpl.findAllEvent(userInfo,
    // publicFlag, partyCodeFlag, roleFlag, false);
    // }
    //
    // if (userInfo.isMgmt2() || userInfo.isMgmt3() || userInfo.isMgmt4()) {
    // publicFlag = true;
    // roleFlag = true;
    // eventPresentList = eventServiceImpl.findAllEvent(userInfo,
    // publicFlag, partyCodeFlag, roleFlag, false);
    // }

    // if (userInfo.isAdmin()) {
    // eventPresentList = eventServiceImpl.findAllEvent(userInfo,
    // publicFlag, partyCodeFlag, roleFlag, false);
    eventPresentList = eventServiceImpl.findAllEventViewDto(userInfo, locale);
    // }

    model.addAttribute("eventPresentList", eventPresentList);

    if (logger.isDebugEnabled()) {
      logger.debug("LoginUserKey=" + userInfo.getLoginUserKey());
      logger.debug("TargetUserKey=" + userInfo.getTargetUserKey());
    }

    // dump
    modelDump(logger, model, "index");

    return LIST_PAGE;
  }
  public List<F> findAllProfileView(UserInfo userInfo, String[] publicFlags) {
    logger.infoCode("I0001");

    //
    Specification<T> whereUserKey =
        new Specification<T>() {
          @Override
          public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.equal(root.get("usUserTbl").get("userKey"), userInfo.getTargetUserKey());
          }
        };

    // 取得条件:
    Specification<T> wherePublicFlags =
        publicFlags == null
            ? null
            : new Specification<T>() {
              @Override
              public Predicate toPredicate(
                  Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                Predicate predicate = cb.conjunction();
                for (int i = 0; i < publicFlags.length; i++) {
                  String keyword = publicFlags[i];
                  if (i == 0) {
                    predicate = cb.and(predicate, cb.equal(root.get("publicFlag"), keyword));
                  } else {
                    predicate = cb.or(predicate, cb.equal(root.get("publicFlag"), keyword));
                  }
                }
                return predicate;
              }
            };

    List<T> list =
        (List<T>)
            repository.findAll(
                (Specification<T>) Specifications.where(whereUserKey).and(wherePublicFlags));

    logger.infoCode("I0002");
    return getDtoList(list);
  }
 @Transactional
 public boolean delete(UserInfo userInfo, F form) {
   logger.infoCode("I0001");
   try {
     if (form.getPageMode().equals(CommonConst.PAGE_MODE_DELETE)) {
       T entity =
           findOne(
               form.getGyosekiKey(), userInfo.getTargetUserKey(), form.getUpdDateAsTimestamp());
       if (entity == null) {
         String objInfo = "key=" + form.getGyosekiKey() + " updDate=" + form.getUpdDate();
         logger.errorCode("E1009", "entity donot find " + objInfo); // E1009=削除に失敗しました。{0}
         return false;
       }
       repository.delete(entity.getGyosekiKey());
       repository.flush();
       logger.infoCode("I0002");
       return true;
     }
   } catch (Exception e) {
     logger.errorCode("E1009", e); // E1009=削除に失敗しました。{0}
   }
   return false;
 }
Ejemplo n.º 16
0
  public boolean insertCmInfo(
      UserInfo userInfo, EventForm form, String opeKbn, String roleCode, String partyCode) {
    boolean result = false;

    try {
      CmInfoTbl entity = new CmInfoTbl();
      entity.setSendDate(DateUtil.getNowTimestamp());
      entity.setTitle(form.getEventTitle());
      entity.setDataKbn("2");
      entity.setOpeKbn(opeKbn);
      entity.setInfoRefKey(form.getEventKey());
      entity.setMakeUserKey(userInfo.getLoginUserKey());
      entity.setUpdDate(DateUtil.getNowTimestamp());
      entity.setUpdUserKey(userInfo.getLoginUserKey());

      entity = cmInfoTblRepository.save(entity);
      String infoKey = entity.getInfoKey();

      if (infoKey != null && StringUtil.isNotNull(infoKey)) {
        CmInfoPublicTbl entitySub = new CmInfoPublicTbl();
        CmInfoPublicTblPK id = new CmInfoPublicTblPK();
        id.setInfoKey(infoKey);
        id.setSeqNo(1);
        entitySub.setId(id);
        entitySub.setPublicKbn("1");
        entitySub.setRole(roleCode);
        entitySub.setPartyCode(partyCode);
        entitySub.setUpdDate(DateUtil.getNowTimestamp());
        entitySub.setUpdUserKey(userInfo.getLoginUserKey());

        cmInfoPublicTblRepository.save(entitySub);

        cmInfoTblRepository.flush();
        cmInfoPublicTblRepository.flush();

        result = true;
      }

    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }

    return result;
  }
Ejemplo n.º 17
0
  @SuppressWarnings("unchecked")
  public List<EventDto> findAllEvent(
      UserInfo userInfo,
      Boolean publicFlag,
      Boolean partyCodeFlag,
      Boolean roleFlag,
      boolean past) {
    logger.infoCode("I0001");
    String partyCode = null;
    String roleCode = null;

    StringBuilder sb = new StringBuilder();
    sb.append("SELECT");
    sb.append("    A.EVENT_KEY");
    sb.append("  , A.EVENT_TITLE");
    sb.append("  , A.EVENT_SEND_DATE");
    sb.append("  , A.EVENT_RECRUIT");
    sb.append("  , A.EVENT_TELNO");
    sb.append("  , A.PARTY_CODE");
    sb.append("  , A.PARTY_NAME");
    sb.append("  , A.EVENT_START_DATE");
    sb.append("  , A.EVENT_PLACE");
    sb.append("  , A.EVENT_MEMO");
    sb.append("  , A.EVENT_UNIT");
    sb.append("  , A.SUBJECT_INS_KBN");
    sb.append("  , A.PUBLIC_FLAG");
    sb.append("  , A.UPD_DATE");
    sb.append("  , A.UPD_USER_KEY");
    sb.append("  , ARRAY_TO_STRING(ARRAY_AGG(C.PARTY_NAME), ',') AS PARTY_NAME");
    sb.append("  , ARRAY_TO_STRING(ARRAY_AGG(C.PARTY_NAME_EN), ',') AS PARTY_NAME_EN");
    sb.append(" FROM");
    sb.append("  EV_EVENT_TBL A ");
    sb.append("  INNER JOIN EV_EVENT_PUBLIC_TBL B ");
    sb.append("    ON A.EVENT_KEY = B.EVENT_KEY ");

    sb.append("  INNER JOIN MS_PARTY_TBL C ");
    sb.append("    ON B.PARTY_CODE = C.PARTY_CODE ");
    sb.append(" WHERE");

    if (past) {
      sb.append("   CURRENT_DATE < A.EVENT_START_DATE ");
    } else {
      sb.append("  CURRENT_DATE >= A.EVENT_START_DATE ");
      sb.append("  AND CURRENT_DATE <= A.EVENT_SEND_DATE ");
    }

    if (publicFlag) {
      sb.append("  AND A.PUBLIC_FLAG = '1' ");
    }

    if (partyCodeFlag) {
      sb.append("  AND  (B.PARTY_CODE = :partyCode ");
      sb.append("    OR");
      sb.append("    A.PARTY_CODE = :partyCode )");
    }

    if (roleFlag) {
      sb.append("  AND  (B.ROLE = :role ");
      sb.append("    OR");
      sb.append("    A.PARTY_CODE = :partyCode )");
    }

    sb.append(" GROUP BY");
    sb.append("    A.EVENT_KEY");
    sb.append("  , A.EVENT_TITLE");
    sb.append("  , A.EVENT_SEND_DATE");
    sb.append("  , A.EVENT_RECRUIT");
    sb.append("  , A.EVENT_TELNO");
    sb.append("  , A.PARTY_CODE");
    sb.append("  , A.PARTY_NAME");
    sb.append("  , A.EVENT_START_DATE");
    sb.append("  , A.EVENT_PLACE");
    sb.append("  , A.EVENT_MEMO");
    sb.append("  , A.EVENT_UNIT");
    sb.append("  , A.SUBJECT_INS_KBN");
    sb.append("  , A.PUBLIC_FLAG");
    sb.append("  , A.UPD_DATE");
    sb.append("  , A.UPD_USER_KEY");
    sb.append(" ORDER BY");
    sb.append("  A.EVENT_SEND_DATE DESC");
    String sql = sb.toString();

    Query query = entityManager.createNativeQuery(sql);
    query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
    if (partyCodeFlag) {
      query.setParameter("partyCode", userInfo.getTargetPartyCode());
    }
    if (roleFlag) {
      query.setParameter("partyCode", userInfo.getTargetPartyCode());
      query.setParameter("role", userInfo.getTargetRole());
    }

    List<EventDto> list = new ArrayList<>();
    List<Map> resultList = new ArrayList<>();
    resultList = query.getResultList();

    for (int i = 0; i < resultList.size(); i++) {
      EventDto dto = new EventDto();
      dto = (EventDto) objectUtil.setMapCopyValue(dto, resultList.get(i));
      list.add(dto);
    }

    logger.infoCode("I0002");
    return list;
  }
 public List<F> findAllDto(UserInfo userInfo, F form) {
   logger.infoCode("I0001");
   List<T> list = findAll(userInfo, form);
   logger.infoCode("I0002");
   return getDtoList(list);
 }
 @PostConstruct
 protected void init() {
   logger.setMessageSource(messageSource);
 }
Ejemplo n.º 20
0
  @Transactional
  public boolean update(EventForm form, UserInfo userInfo) {
    logger.infoCode("I0001");
    try {
      EvEventTbl entity = new EvEventTbl();

      if (form.getPageMode().equals(CommonConst.PAGE_MODE_EDIT)) {
        entity = findOne(userInfo, form);
        if (entity == null) {
          throw new Exception();
        }
      }

      entity.setUpdUserKey(userInfo.getLoginUserKey());
      entity.setPartyCode(userInfo.getLoginPartyCode());
      entity.setPartyName(userInfo.getLoginPartyName());
      //
      entity.setEventKey(form.getEventKey());
      entity.setEventMemo(form.getEventMemo());
      entity.setEventPlace(form.getEventPlace());
      entity.setEventRecruit(form.getEventRecruit());
      entity.setEventSendDate(form.getEventSendDateAsTimestamp());
      entity.setEventStartDate(form.getEventStartDateAsTimestamp());
      entity.setEventTelno(form.getEventTelno());
      entity.setEventTitle(form.getEventTitle());
      entity.setEventUnit(form.getEventUnit());

      entity.setSubjectInsKbn(form.getSubjectInsKbn());
      entity.setPublicFlag(form.getPublicFlag());
      entity.setUpdDate(DateUtil.getNowTimestamp());

      // 更新テーブル:イベント公開範囲テーブル
      if (form.getPageMode().equals(CommonConst.PAGE_MODE_EDIT)) {
        // イベント公開範囲テーブルから対象データをDELETEする。
        evEventPublicTblRepository.delete(entity.getEvEventPublicTbls());
      }

      entity = evEventTblRepository.save(entity);

      List<EvEventPublicTbl> publicList = new ArrayList<>();
      int count = 1;

      // 企業・研究所などがチェックONの場合、1件出力する。
      if (form.checkHasPublicItem("1")) {
        EvEventPublicTbl tbl = new EvEventPublicTbl();
        EvEventPublicTblPK pk = new EvEventPublicTblPK();
        pk.setEventKey(entity.getEventKey());
        pk.setSeqNo(count);
        tbl.setId(pk);

        // 企業・研究所等が、設定されている分の出力を行う場合、1:ROLE。
        tbl.setPublicKbn("1");
        // 企業・研究所等が、設定されている分の出力を行う場合、1:ROLE。
        tbl.setRole("1");
        // 企業・研究所等が、設定されている分の出力を行う場合、NULL。
        tbl.setPartyCode(null);
        // 現在時刻を設定する。
        tbl.setUpdDate(DateUtil.getNowTimestamp());
        // ログイン者のユーザキーの値を設定する。
        tbl.setUpdUserKey(userInfo.getLoginUserKey());
        publicList.add(tbl);
        count = count + 1;
      }
      if (form.checkHasPublicItem("2")) {
        // 大學がチェックONの場合、公開範囲(公開)で選択されている件数出力する。
        for (int i = 0; i < form.getPublicPartyArray().length; i++) {
          EvEventPublicTbl tbl = new EvEventPublicTbl();
          EvEventPublicTblPK pk = new EvEventPublicTblPK();
          pk.setEventKey(entity.getEventKey());
          pk.setSeqNo(count);
          tbl.setId(pk);

          // 大學が、設定されている分の出力を行う場合、2:組織。
          tbl.setPublicKbn("2");
          // 大學が、設定されている分の出力を行う場合、NULL。
          tbl.setRole(null);
          // 大學が、設定されている分の出力を行う場合、対象大学の組織コード。
          tbl.setPartyCode(form.getPublicPartyArray()[i]);
          // 現在時刻を設定する。
          tbl.setUpdDate(DateUtil.getNowTimestamp());
          // ログイン者のユーザキーの値を設定する。
          tbl.setUpdUserKey(userInfo.getLoginUserKey());
          publicList.add(tbl);
          count = count + 1;
        }
      }
      if (form.getPageMode().equals(CommonConst.PAGE_MODE_ADD)
          || form.getPageMode().equals(CommonConst.PAGE_MODE_COPY)) {
        // お知らせ情報、お知らせ情報公開範囲登録
        this.insertCmInfo(userInfo, form, "201", userInfo.getTargetRole().getAuthority(), null);
      }

      evEventPublicTblRepository.save(publicList);

      if (entity != null) {
        logger.infoCode("I0002");
        return true;
      }

    } catch (Exception e) {
      logger.errorCode("E1007", e); // E1007=登録に失敗しました。{0}
    }
    return false;
  }
  /**
   * 一覧取得
   *
   * @param form
   * @param locale
   * @return
   */
  public List<SpSupportDto> findAllLikeKeyWords(SupportForm form, Locale locale) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    Date today = DateUtil.toDate(DateUtil.getSysdate("yyyyMMdd"));

    // 取得条件:区分
    Specification<SpSupportTbl> whereSupportSpkikiKbn =
        StringUtil.isNull(form.getSearchSpkikiKbn())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("supportSpkikiKbn"), form.getSearchSpkikiKbn());
              }
            };

    // 取得条件:公開
    Specification<SpSupportTbl> wherePublicFlag =
        StringUtil.isNull(form.getSearchPublicFlag())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("publicFlag"), form.getSearchPublicFlag());
              }
            };

    // 取得条件:HIRAKUリンク区分
    Specification<SpSupportTbl> whereSupportHirakuKbn =
        StringUtil.isNull(form.getSearchHirakuKbn())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("supportHirakuKbn"), form.getSearchHirakuKbn());
              }
            };

    // 取得条件:地域区分
    Specification<SpSupportTbl> whereSupportAreaKbn =
        StringUtil.isNull(form.getSearchAreaKbn())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("supportAreaKbn"), form.getSearchAreaKbn());
              }
            };

    // 取得条件:組織コード
    Specification<SpSupportTbl> wherePartyCode =
        StringUtil.isNull(form.getSearchPartyCode())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("partyCode"), form.getSearchPartyCode());
              }
            };

    // 取得条件:キーワード
    Specification<SpSupportTbl> whereKeywords =
        StringUtil.isNull(form.getSearchKeyword())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                String[] keywords = form.getSearchKeyword().split(",");
                Predicate predicate = cb.conjunction();
                for (int i = 0; i < keywords.length; i++) {
                  String keyword = keywords[i];
                  predicate =
                      cb.and(predicate, cb.like(root.get("supportKeyword"), "%" + keyword + "%"));
                }
                return predicate;
              }
            };

    // 取得条件:支援制度種別コード
    Specification<SpSupportTbl> whereSyb =
        StringUtil.isNull(form.getSearchSybCode())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                String[] sybcodes = form.getSearchSybCodeArray();
                Predicate predicate = cb.conjunction();
                for (int i = 0; i < sybcodes.length; i++) {
                  String sybcode = sybcodes[i];
                  predicate =
                      cb.and(predicate, cb.like(root.get("supportSybCode"), "%" + sybcode + "%"));
                }
                return predicate;
              }
            };

    // 取得条件:日付(期間)
    Specification<SpSupportTbl> whereDate =
        StringUtil.isNull(form.getSearchDateType())
            ? null
            : new Specification<SpSupportTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<SpSupportTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                // batch処理
                if (SEARCH_DATE_TYPE_BATCH.equals(form.getSearchDateType().toLowerCase())) {
                  Predicate predicate = cb.conjunction();
                  Predicate predicate2 = cb.conjunction();
                  predicate2 =
                      cb.and(predicate2, cb.equal(root.get("updDate").as(Date.class), today));
                  predicate2 =
                      cb.and(
                          predicate2,
                          cb.lessThan(root.get("supportStartDate").as(Date.class), today));
                  predicate =
                      cb.and(
                          predicate, cb.equal(root.get("supportStartDate").as(Date.class), today));
                  predicate = cb.or(predicate2);
                  return predicate;
                }
                // 期間中
                if (SEARCH_DATE_TYPE_CURRENT.equals(form.getSearchDateType())) {
                  Predicate predicate = cb.conjunction();
                  predicate =
                      cb.and(
                          predicate,
                          cb.lessThanOrEqualTo(root.get("supportStartDate").as(Date.class), today));
                  predicate =
                      cb.and(
                          predicate,
                          cb.greaterThanOrEqualTo(
                              root.get("supportEndDate").as(Date.class), today));
                  return predicate;
                }
                // 過去情報
                if (SEARCH_DATE_TYPE_PAST.equals(form.getSearchDateType())) {
                  return cb.lessThan(root.get("supportEndDate").as(Date.class), today);
                }
                // 終了前
                if (SEARCH_DATE_TYPE_PRESENT.equals(form.getSearchDateType())) {
                  return cb.greaterThanOrEqualTo(root.get("supportEndDate").as(Date.class), today);
                }
                return null;
              }
            };

    List<SpSupportTbl> list =
        spSupportTblRepository.findAll(
            Specifications.where(whereSupportSpkikiKbn)
                .and(whereSupportHirakuKbn)
                .and(whereSupportAreaKbn)
                .and(wherePublicFlag)
                .and(wherePartyCode)
                .and(whereKeywords)
                .and(whereSyb)
                .and(whereDate),
            orderBy());

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return getDtoList(list, locale);
  }