@RemoteMethod public ListRange findAll( TemplateShareGroupDetailDto filter, SortField[] sortFields, int start, int limit) { ListRange lr = new ListRange(); String hql = "FROM TemplateShareGroupDetail WHERE templateShare.templateFile.id = ? AND " + BusinessConstant.FIND_NOT_INCLUDE_DELETE_HQL + " ORDER BY create_date DESC"; int count = 0; List<TemplateShareGroupDetail> list = templateShareGroupDetailDaoImpl.findAll(hql, start, limit, filter.getTemplateFileId()); List<TemplateShareGroupDetailDto> dtoList = new ArrayList<TemplateShareGroupDetailDto>(); for (TemplateShareGroupDetail templateShareGroupDetail : list) { TemplateShareGroupDetailDto templateShareGroupDetailDto = dozerAssembly.bean2Dto(templateShareGroupDetail, TemplateShareGroupDetailDto.class); templateShareGroupDetailDto.setCreate_date( DateUtils.DateToDateTimeString(templateShareGroupDetail.getCreate_date())); if (templateShareGroupDetail.getAccount() != null && templateShareGroupDetail.getAccount().getPerson() != null) templateShareGroupDetailDto.setPersonName( templateShareGroupDetail.getAccount().getPerson().getName()); dtoList.add(templateShareGroupDetailDto); } count = templateShareGroupDetailDaoImpl.getCount(hql, filter.getTemplateFileId()); lr.setData(dtoList); lr.setTotalSize(count); return lr; }
/** 根据ID查询 */ @RemoteMethod public BpmConfigDto findById(String id) { BpmConfig bpmConfig = bpmConfigDaoImpl.findById(id); BpmConfigDto templateConfigDto = dozerAssembly.bean2Dto(bpmConfig, BpmConfigDto.class); templateConfigDto.setBpmTemplateDto(esbService.getBpmTemplateDto(bpmConfig.getFlow_code())); // templateConfigDto.setFlow_code(DictionaryUtils.getItemNameByGroupCode("flow", // templateConfigDto.getFlow_code())); if (bpmConfig.getFormEntity() != null && bpmConfig.getFormEntity().getFormTree() != null) { FormTree formTree = bpmConfig.getFormEntity().getFormTree(); TreeDto treeDto = new TreeDto(); treeDto.setId(formTree.getId()); treeDto.setText(formTreeService.getParentText(formTree.getId()) + "/" + formTree.getText()); treeDto.setPath( formTreeService.getParentPath(formTree.getId()) + "/" + formTree.getId() + "/"); templateConfigDto.setTreeDto(treeDto); } return templateConfigDto; }
/** 添加 */ @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); }