Ejemplo n.º 1
0
  // 保存
  public void save(BusinessRequest res) {

    HopIncDto dto = super.getDto(HopIncDto.class, res);
    if (dto.getHopInc().getIncId() == null) {
      dto.getHopInc().setIncHospid(Long.valueOf(super.getLoginInfo().get("HOPID").toString()));
    } else {
      List<HopIncAlias> hopIncAlias =
          commonService.findByProperty(
              HopIncAlias.class, "incAliaIncId", dto.getHopInc().getIncId());
      if (hopIncAlias.size() > 0) {
        for (HopIncAlias hopIncAlias2 : hopIncAlias) {
          commonService.delete(hopIncAlias2);
        }
      }
    }
    if (org.apache.commons.lang.StringUtils.isNotBlank(dto.getHopInc().getIncAliaS())) {
      String[] alias = dto.getHopInc().getIncAliaS().split(",");
      for (String alia : alias) {
        HopIncAlias hopIncAlias = new HopIncAlias();
        hopIncAlias.setIncAliasText(alia);
        hopIncAlias.setIncAliaIncId(dto.getHopInc().getIncId());
        commonService.saveOrUpdate(hopIncAlias);
      }
    } else {
      HopIncAlias hopIncAlias = new HopIncAlias();
      hopIncAlias.setIncAliasText(PingYinUtil.getFirstSpell(dto.getHopInc().getIncName()));
      hopIncAlias.setIncAliaIncId(dto.getHopInc().getIncId());
      commonService.saveOrUpdate(hopIncAlias);
    }
    commonService.saveOrUpdate(dto.getHopInc());
  }
Ejemplo n.º 2
0
  /**
   * @Title: deleteOrdSub @Description: TODO(删除发货信息)
   *
   * @param @param res 设定文件
   * @return void 返回类型
   * @throws
   * @author zhouxin
   * @date 2015年3月28日 下午3:43:25
   */
  public void deleteOrdSub(BusinessRequest res) {

    OrderStateDto dto = super.getDto(OrderStateDto.class, res);
    dto.setOperateResult(new OperateResult());
    try {
      if (dto.getOrderDetailSub() != null) {
        if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getOrderDetailSub().getOrdSubId())) {
          OrderDetailSub orderDetailSub =
              commonService.get(OrderDetailSub.class, dto.getOrderDetailSub().getOrdSubId());
          if (orderDetailSub.getOrdSubStatus() == null) {
            commonService.delete(orderDetailSub);
            dto.getOperateResult().setResultCode("1");
          } else {
            dto.getOperateResult().setResultContent("以发货,不能删除");
          }
        }
      }
      super.writeJSON(dto.getOperateResult());
    } catch (Exception e) {
      e.printStackTrace();
      dto.getOperateResult().setResultContent(e.getMessage());
      super.writeJSON(dto.getOperateResult());
    }
  }