Esempio n. 1
0
  @RemoteMethod
  public ListRange findAll(BpmConfigDto filter, SortField[] sortFields, int start, int limit) {
    // TODO同步流程信息
    bpmFlowService.saveBpmFlowDesign();

    // 需要form_name
    String msql =
        "SELECT b.*, f.name form_name,f.id form_id FROM tbl_bpm_config b,tbl_formbuild_formentity f WHERE (b.deleted ='N' OR b.deleted IS NULL) and b.formEntity_id=f.id ORDER BY b.id DESC LIMIT 100 ";
    List l1 = baseDao.findBySql(msql);
    List<BpmConfigDto> list = Copy.listMap2ListModel(l1, BpmConfigDto.class);
    int count = list.size();

    Collection<BpmConfigDto> bpmConfigDtoList = new ArrayList<BpmConfigDto>();
    BpmTemplateDto bpmTemplateDto = null;

    for (BpmConfigDto bpmConfigDto : list) {
      bpmConfigDto.setRangeJson(this.getRangeStr(bpmConfigDto.getRangeJson()));
      bpmTemplateDto = esbService.getBpmTemplateDto(bpmConfigDto.getFlow_code());
      if (bpmTemplateDto != null) bpmConfigDto.setFlow_code(bpmTemplateDto.getTemplateName());
      bpmConfigDtoList.add(bpmConfigDto);
    }
    ListRange lr = new ListRange();
    lr.setData((List<BpmConfigDto>) bpmConfigDtoList);
    lr.setTotalSize(count);
    return lr;
  }
Esempio n. 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);
  }