コード例 #1
0
  @Override
  public Response<Boolean> topicWithSupplier(Long solutionId, Long topicId, BaseUser user) {
    Response<Boolean> result = new Response<Boolean>();

    if (solutionId == null) {
      log.error("update requirement solution need solutionId");
      result.setError("solution.id.null");
      return result;
    }

    // 验证用户是否已登入
    if (user == null) {
      log.error("create requirement solution, user must login.");
      result.setError("user.not.login");
      return result;
    }

    try {
      RequirementSolution requirementSolution = requirementSolutionDao.findById(solutionId);

      // 需要保证该方案处于3:方案交互 or 4:方案综投.需求才能被更改
      RequirementStatus[] statuses = {RequirementStatus.SOL_INTERACTIVE, RequirementStatus.SOL_END};
      Response<Boolean> statusRes =
          checkRequirementStatus(requirementSolution.getRequirementId(), statuses);
      if (!statusRes.isSuccess()) {
        log.error("check requirement status failed, error code={}", statusRes.getError());
        result.setError(statusRes.getError());
        return result;
      }
      if (!statusRes.getResult()) {
        log.error("requirement status can't allow suppler update solution.");
        result.setError("solution.status.notUpdate");
        return result;
      }

      RequirementSolution solution = new RequirementSolution();
      solution.setId(solutionId);
      solution.setTopicId(topicId);
      result.setResult(requirementSolutionDao.update(solution));
    } catch (Exception e) {
      log.error(
          "update requirement solution failed, solutionId={}, error code={}",
          solutionId,
          Throwables.getStackTraceAsString(e));
      result.setError("solution.update.failed");
    }

    return result;
  }
コード例 #2
0
 @Override
 public RequirementSolution load(Long solutionId) throws Exception {
   // 查询需求详细信息
   return requirementSolutionDao.findById(solutionId);
 }