Example #1
0
 public boolean isAddSign() {
   if (StringUtil.isEmpty(this.addSignType)) {
     return false;
   } else {
     return true;
   }
 }
 public void deleteDeploy(Map<String, Object> params) {
   String deploymentId = StringUtil.getString(params.get("deploymentId"));
   try {
     if (StringUtil.isEmpty(deploymentId)) {
       throw new FoxbpmWebException(
           FoxbpmExceptionCode.FOXBPMEX_DEPLOYMENTID, "deploymentId is null !");
     }
     String[] deploymentIds = deploymentId.split(",");
     for (int i = 0; i < deploymentIds.length; i++) {
       modelService.deleteDeployment(deploymentIds[i]);
     }
   } catch (Exception e) {
     throw new FoxbpmWebException(e);
   }
 }
  public void saveUserDelegationInfo(Map<String, Object> params) {
    String addInfo = StringUtil.getString(params.get("add"));
    String updateInfo = StringUtil.getString(params.get("update"));
    String deleteInfo = StringUtil.getString(params.get("delete"));

    String agentUser = StringUtil.getString(params.get("agentUser"));
    String agentId = StringUtil.getString(params.get("agentId"));
    String startTime = StringUtil.getString(params.get("startTime"));
    String endTime = StringUtil.getString(params.get("endTime"));
    String status = StringUtil.getString(params.get("status"));

    if (StringUtil.isNotEmpty(agentUser)) {

      AgentEntity agentEntity = new AgentEntity();
      agentEntity.setAgentFrom(agentUser);
      agentEntity.setStatus(status);
      agentEntity.setId(agentId);
      if (StringUtil.isNotEmpty(startTime)) {
        agentEntity.setStartTime(DateUtil.stringToyyyyMmDdDate(startTime));
      }
      if (StringUtil.isNotEmpty(endTime)) {
        agentEntity.setEndTime(DateUtil.stringToyyyyMmDdDate(endTime));
      }

      // 代理id为空说明是新增
      if (StringUtil.isEmpty(agentId)) {
        agentEntity.setId(GuidUtil.CreateGuid());
        identityService.addAgent(agentEntity);
      } else {
        identityService.updateAgentEntity(agentEntity);
      }

      // 新增
      if (StringUtil.isNotEmpty(addInfo)) {
        Map<String, Object> agentInfo = JSONUtil.parseJSON2Map(addInfo);
        Iterator<String> iterator = agentInfo.keySet().iterator();
        String key = null;
        AgentDetailsEntity agentDetailsEntity = null;
        while (iterator.hasNext()) {
          key = iterator.next();
          agentDetailsEntity = new AgentDetailsEntity();
          agentDetailsEntity.setId(GuidUtil.CreateGuid());
          agentDetailsEntity.setAgentId(agentEntity.getId());
          agentDetailsEntity.setAgentTo(StringUtil.getString(agentInfo.get(key)));
          agentDetailsEntity.setProcessKey(key);
          identityService.addAgentDetails(agentDetailsEntity);
        }
      }
      // 更新
      if (StringUtil.isNotEmpty(updateInfo)) {
        Map<String, Object> agentInfo = JSONUtil.parseJSON2Map(updateInfo);
        Iterator<String> iterator = agentInfo.keySet().iterator();
        String key = null;
        Map<String, String> value = null;
        AgentDetailsEntity agentDetailsEntity = null;
        while (iterator.hasNext()) {
          key = iterator.next();
          value = (Map<String, String>) agentInfo.get(key);
          agentDetailsEntity = new AgentDetailsEntity();
          agentDetailsEntity.setId(key);
          agentDetailsEntity.setAgentId(agentEntity.getId());
          agentDetailsEntity.setAgentTo(value.get("user"));
          agentDetailsEntity.setProcessKey(value.get("key"));
          identityService.updateAgentDetailsEntity(agentDetailsEntity);
        }
      }
      // 删除
      if (StringUtil.isNotEmpty(deleteInfo)) {
        StringTokenizer st = new StringTokenizer(deleteInfo, ",");
        while (st.hasMoreTokens()) {
          identityService.deleteAgentDetails(st.nextToken());
        }
      }
    }
  }