Beispiel #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);
  }
Beispiel #2
0
 /** 根据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;
 }
Beispiel #3
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);
  }
Beispiel #4
0
 /**
  * 保存发布范围 saveRange(这里用一句话描述这个方法的作用)
  *
  * @param entity
  * @return void
  * @exception
  */
 public void saveRange(BpmConfig entity) {
   List<BpmConfigRange> rangeList = findByConfigId(entity.getId());
   for (BpmConfigRange range : rangeList) {
     delete(range);
   }
   if (entity.getRangeJson() != null) {
     JSONObject jsonObject = JSONObject.fromObject(entity.getRangeJson());
     if (jsonObject != null) {
       JSONArray userArray = jsonObject.getJSONArray("users");
       for (int i = 0; i < userArray.size(); i++) {
         if (userArray.getJSONObject(i) != null) {
           BpmConfigRange range = new BpmConfigRange();
           range.setR_id(userArray.getJSONObject(i).getString("id"));
           range.setName(userArray.getJSONObject(i).getString("cname"));
           range.setDept_path(userArray.getJSONObject(i).getString("deptPath"));
           range.setDept_name(userArray.getJSONObject(i).getString("deptName"));
           range.setType(BusinessConstant.RANGE_TYPE_USER);
           range.setTemplateConfig(entity);
           add(range);
         }
       }
       JSONArray deptArray = jsonObject.getJSONArray("departments");
       for (int i = 0; i < deptArray.size(); i++) {
         if (deptArray.getJSONObject(i) != null) {
           BpmConfigRange range = new BpmConfigRange();
           if (deptArray.getJSONObject(i).get("includesub") != null)
             range.setIncludesub(deptArray.getJSONObject(i).getBoolean("includesub"));
           range.setR_id(deptArray.getJSONObject(i).getString("id"));
           range.setDept_path(deptArray.getJSONObject(i).getString("deptPath"));
           range.setDept_name(deptArray.getJSONObject(i).getString("deptName"));
           range.setType(BusinessConstant.RANGE_TYPE_DEPT);
           range.setTemplateConfig(entity);
           add(range);
         }
       }
       JSONArray jobsArray = jsonObject.getJSONArray("jobs");
       for (int i = 0; i < jobsArray.size(); i++) {
         if (jobsArray.getJSONObject(i) != null) {
           BpmConfigRange range = new BpmConfigRange();
           range.setR_id(jobsArray.getJSONObject(i).getString("id"));
           range.setName(jobsArray.getJSONObject(i).getString("cname"));
           range.setDept_path(jobsArray.getJSONObject(i).getString("deptPath"));
           range.setDept_name(jobsArray.getJSONObject(i).getString("deptName"));
           range.setType(BusinessConstant.RANGE_TYPE_POST);
           range.setTemplateConfig(entity);
           add(range);
         }
       }
       JSONArray rolesArray = jsonObject.getJSONArray("roles");
       for (int i = 0; i < rolesArray.size(); i++) {
         if (rolesArray.getJSONObject(i) != null) {
           BpmConfigRange range = new BpmConfigRange();
           range.setR_id(rolesArray.getJSONObject(i).getString("id"));
           range.setName(rolesArray.getJSONObject(i).getString("cname"));
           range.setType(BusinessConstant.RANGE_TYPE_ROLE);
           range.setTemplateConfig(entity);
           add(range);
         }
       }
     }
   }
 }