コード例 #1
0
 public String update() {
   results = new JsonResults();
   if (!validatePubInfo()) {
     results.fail("信息不完整");
     return JsonResults.JSON_RESULT_NAME;
   }
   if (hasSpecialChars(publisher.getName())
       || hasSpecialChars(publisher.getEmail())
       || hasSpecialChars(publisher.getMobile())
       || hasSpecialChars(publisher.getReceiveAccount())
       || hasSpecialChars(publisher.getReceiveName())
       || hasSpecialChars(publisher.getQq())) {
     results.fail("含有非法字符");
     return JsonResults.JSON_RESULT_NAME;
   }
   try {
     publisherContactService.saveOrUpdatePublisher(publisher);
     results.success();
   } catch (ServiceException e) {
     results.fail(e.getMessage());
   } catch (Exception e) {
     results.fail("系统异常");
   }
   return JsonResults.JSON_RESULT_NAME;
 }
コード例 #2
0
 private boolean validatePubInfo() {
   // 检验完整性
   if (StringUtils.isBlank(publisher.getName())
       || StringUtils.isBlank(publisher.getEmail())
       || StringUtils.isBlank(publisher.getMobile())
       || publisher.getReceiveMethod() == null
       || StringUtils.isBlank(publisher.getReceiveAccount())
       || StringUtils.isBlank(publisher.getReceiveName())) {
     return false;
   }
   return true;
 }