Пример #1
0
  /** 设置为生效 */
  @RemoteMethod
  public void updateById(String id) {
    BpmConfig bpmConfig = bpmConfigDaoImpl.findById(id);
    bpmConfigDaoImpl.updateByEntityId(bpmConfig.getFormEntity().getId());

    bpmConfig.setEnabled("已启用");
    bpmConfig.setModify_date(new Date());
    bpmConfig.setModify_user_id(getUser().getId());
    bpmConfigDaoImpl.update(bpmConfig);
  }
Пример #2
0
  /** 添加 */
  @RemoteMethod
  public void save(BpmConfigDto bpmConfigDto) {
    // 判断是否排序唯一
    String entityId = null;
    if (bpmConfigDto.getTreeDto() != null
        && StringUtils.isNotEmpty(bpmConfigDto.getTreeDto().getId()))
      entityId = bpmConfigDto.getTreeDto().getId();
    boolean exist =
        bpmConfigDaoImpl.sortExist(bpmConfigDto.getSort(), bpmConfigDto.getId(), entityId);
    if (exist) throw new BusinessException(ERR_COMPONENT + "101");

    BpmConfig bpmConfig = null;
    FormEntity formEntity = null;
    if (StringUtils.isNotEmpty(entityId)) {
      formEntity = formEntityDaoImpl.findByFormTree(bpmConfigDto.getTreeDto().getId());
    }
    if (StringUtils.isEmpty(bpmConfigDto.getId())) {
      bpmConfig = new BpmConfig();
      bpmConfig = dozerAssembly.dto2Bean(bpmConfigDto, BpmConfig.class);
      bpmConfig.setCreate_date(new Date());
      bpmConfig.setCreate_user_id(getUser().getId());
      bpmConfig.setFlow_code(bpmConfigDto.getBpmTemplateDto().getId());
      bpmConfig.setFormEntity(formEntity);
      bpmConfigDaoImpl.add(bpmConfig);
    } else {
      bpmConfig = bpmConfigDaoImpl.findById(bpmConfigDto.getId());
      bpmConfig.setFlow_code(bpmConfigDto.getBpmTemplateDto().getId());
      bpmConfig.setBpmkey(bpmConfigDto.getBpmkey());
      bpmConfig.setFormEntity(formEntity);
      bpmConfig.setModify_date(new Date());
      bpmConfig.setModify_user_id(getUser().getId());
      bpmConfig.setRangeJson(bpmConfigDto.getRangeJson());
      bpmConfig.setSort(bpmConfigDto.getSort());
      bpmConfigDaoImpl.update(bpmConfig);
    }
    bpmConfigRangeDaoImpl.saveRange(bpmConfig);
  }