@ResourceMapping(value = "submitMeteruseinfoForm")
  public Resultmsg onSubmitMeteruseinfoForm(
      @ModelAttribute("meteruseinfo") Meteruseinfo meteruseinfo,
      BindingResult result,
      SessionStatus status,
      ResourceRequest request,
      ResourceResponse response) {
    Resultmsg msg = new Resultmsg();
    boolean isnew = true;
    if (request.getParameter("isnew") == null) {
      msg.setMsg("页面缺少新增或编辑标记 isnew");
    } else {
      isnew = Boolean.valueOf(request.getParameter("isnew"));
    }
    new MeteruseinfoValidator().validate(meteruseinfo, result);
    if (result.hasErrors()) {
      logger.error(result);
      StringBuilder sb = new StringBuilder();
      for (ObjectError err : result.getAllErrors()) {
        sb.append(err.getDefaultMessage());
      }
      msg.setMsg(sb.toString());
    } else {
      try {
        if (!StringUtils.hasLength(meteruseinfo.getBuildregioninfo().getRegionId())) {
          meteruseinfo.setBuildregioninfo(null);
        }
        Circuitinfo circuitinfo =
            circuitinfoService.getCircuitinfo(meteruseinfo.getCircuitinfo().getCircuitId());
        meteruseinfo.setCircuitinfo(circuitinfo);
        if ("系统生成".equals(meteruseinfo.getMeterId()) || "".equals(meteruseinfo.getMeterId())) {
          meteruseinfoService.addMeteruseinfo(meteruseinfo);
        } else {
          meteruseinfoService.updateMeteruseinfo(meteruseinfo);
        }

        // meteruseinfoService.saveOrUpdateMeteruseinfo(meteruseinfo);

        // 保存分类分项与装表关系数据
        if (StringUtils.hasLength(request.getParameter("energyItemcode"))) {
          String energyItemcode = request.getParameter("energyItemcode").trim();
          String resultId = request.getParameter("resultId").trim();
          Energyitemresult energyitemresult = new Energyitemresult();
          energyitemresult.setResultId(resultId);
          energyitemresult.setMeteruseinfo(meteruseinfo);
          Energyitemdict energyitemdict = energyitemdictService.getEnergyitemdict(energyItemcode);
          energyitemresult.setEnergyitemdict(energyitemdict);
          energyitemresultService.saveOrUpdateEnergyitemresult(energyitemresult);
        }
        status.setComplete();
        msg.setMsg(meteruseinfo.getMeterId());
        msg.setSuccess("true");
      } catch (Exception e) {
        msg.setMsg(e.getMessage());
        logger.error(e);
      }
    }
    return msg;
  }
 /** 支路装表信息 */
 @RenderMapping(params = "action=meteruseinfo")
 public ModelAndView setupMeteruseinfo(@RequestParam("circuitId") String circuitId) {
   ModelAndView mav = new ModelAndView();
   Circuitinfo circuitinfo = null;
   Meteruseinfo meteruseinfo = new Meteruseinfo();
   if (StringUtils.hasLength(circuitId)) {
     circuitinfo = circuitinfoService.getCircuitinfo(circuitId);
     meteruseinfo.setCircuitinfo(circuitinfo);
   }
   Meteruseattribute meteruseattribute = new Meteruseattribute();
   Energyitemresult energyitemresult = new Energyitemresult();
   mav.addObject("circuitinfo", circuitinfo); // 支路信息
   mav.addObject("meteruseinfo", meteruseinfo); // 仪表使用信息
   mav.addObject("meteruseattribute", meteruseattribute); // 仪表属性
   mav.addObject("energyitemresult", energyitemresult); // 能耗分类分项及装表关系
   mav.addObject("isnew", false);
   mav.setViewName("circuit/editMeteruseinfoTab");
   return mav;
 }