Exemplo n.º 1
0
 /**
  * 删除多条新增卡片表体
  *
  * @param LcCardtempIds
  */
 public void delete(String[] LcCardtempIds) {
   LcCardtemp LcCardtemp = null;
   for (int i = 0; i < LcCardtempIds.length; i++) {
     if (StringUtils.isNotEmpty(LcCardtempIds[i])) {
       LcCardtemp = this.findLcCardtempById(LcCardtempIds[i]); // new LcCardtemp();
       // LcCardtemp.setId(Long.parseLong(LcCardtempIds[i]));
       try {
         this.delete(LcCardtemp);
         String sql =
             "delete from Lc_Cardtemp t where t.cardcode is null and t.kpxzid = '"
                 + LcCardtemp.getKpxzid()
                 + "'";
         this.publicDao.getJdbcTemplate().update(sql);
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
Exemplo n.º 2
0
 /**
  * 根据body和card对比出卡片的变化信息,并存到变动表里,
  *
  * @param body
  * @param card
  * @return liubeibei
  */
 @SuppressWarnings("unchecked")
 public void compareCardVsBody(LcCardtemp body, Cardinfo card) {
   Map<String, Object> bodyMap = null;
   Map<String, Object> cardMap = null;
   try {
     bodyMap = BeanUtils.describe(body);
     cardMap = BeanUtils.describe(card);
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   } catch (InvocationTargetException e) {
     e.printStackTrace();
   } catch (NoSuchMethodException e) {
     e.printStackTrace();
   }
   Set<String> keySet = cardMap.keySet();
   Iterator ite = keySet.iterator();
   while (ite.hasNext()) {
     String property = (String) ite.next();
     if ("id".equals(property) || "class".equals(property) || "changereason".equals(property)) {
       continue;
     }
     Object valueAfter = bodyMap.get(property);
     Object valueBefore = cardMap.get(property);
     if (valueAfter == null && valueBefore == null) {
       continue;
     } else if ("null".equals(valueAfter) && "null".equals(valueBefore)) {
       continue;
     } else if ("".equals(valueAfter) && "".equals(valueBefore)) {
       continue;
     } else if (valueAfter != null && valueAfter.equals(valueBefore)) {
       continue;
     } else if ((valueAfter == null && valueBefore != null)
         || (valueAfter != null && !valueAfter.equals(valueBefore))) {
       // 对比时间类型的数据 add by lantianbo
       boolean d = false;
       if ("ksdate".equals(property)
           || "zxrq".equals(property)
           || "lrrq".equals(property)
           || "qydate".equals(property)) {
         d = true;
       }
       if (d) {
         Object[] dateCom = this.compareDate(body, card, valueAfter, valueBefore, property);
         boolean s1 = Boolean.parseBoolean(String.valueOf(dateCom[0]));
         if (s1) {
           continue;
         }
         valueAfter = dateCom[1];
         valueBefore = dateCom[2];
       } else {
         if (checkEmpty(String.valueOf(valueAfter))
             .equals(checkEmpty(String.valueOf(valueBefore)))) {
           continue;
         }
       }
       Recordhistory record = new Recordhistory();
       record.setBiaoming("LC_CARDTEMP"); // 变动的表名
       record.setZcId(String.valueOf(body.getId())); // 变动记录的ID,card的主键
       record.setName(property); // 改变的列名
       if (valueBefore == null) { // 改变前值
         record.setBefore(null);
       } else {
         record.setBefore(valueBefore.toString());
       }
       record.setAfter(valueAfter == null ? "" : valueAfter.toString()); // 改变后值
       // 查询head对象,获得拟稿人,拟稿日期
       CaShead shead = this.findCaSheadById(body.getKpxzid().toString());
       if (shead != null) {
         record.setChangedate(shead.getNgrq()); // 变动的日期
         record.setChangeperson(shead.getNgrmc()); // 变动记录人
         record.setWfCode(shead.getWfconfigCode()); // 流程
         record.setPkId(shead.getId().toString());
       }
       record.setZhuangTai("0"); // 设置审批状态为0:未审批
       if (valueAfter != null) {
         this.saveRecord(record); // 保存变动信息到recordhistory
       }
     }
   }
 }
Exemplo n.º 3
0
  /**
   * 批量选择要减值的卡片
   *
   * @return
   * @throws IOException
   */
  public String chooseDevalueBatch() throws IOException {
    String reduceCheck = "";
    String cardIds = request.getParameter("cardIds");
    String headId = request.getParameter("headId");
    if (cardIds.startsWith(",")) {
      cardIds = cardIds.substring(1);
    }
    String[] Ids = cardIds.split(",");
    for (int i = 0; i < Ids.length; i++) {
      String bodyId = "";
      card = cardCommonUCCImpl.findCardinfoByCardId(Ids[i]);
      if ("03".equals(card.getState())) {
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write("退役卡片不能选择");
        return null;
      }
      body = cardCommonUCCImpl.card2Body(card);
      body.setKpxzid(Long.parseLong(headId));
      body.setCardinfoid(String.valueOf(card.getId()));
      if ("0".equals(body.getSfzy().trim())) {
        JyzcXx zc = new JyzcXx();
        zc = cardCommonUCCImpl.findJyzcXxByZcId(body.getZcid());
        if (zc != null) {
          if ("3".equals(zc.getCZczc()) || "4".equals(zc.getCZczc()) || "5".equals(zc.getCZczc())) {
            reduceCheck = reduceCheck + body.getCardinfoid() + ",";
          } else {
            bodyId = cardCommonUCCImpl.saveBody(body).toString();
          }
        } else {
          bodyId = cardCommonUCCImpl.saveBody(body).toString();
        }

        if (!"".equals(bodyId)) {
          head = cardCommonUCCImpl.findCaSheadById(headId);
          record = new Recordhistory();
          record.setZcId(bodyId);
          record.setPkId(body.getKpxzid().toString());
          record.setBefore(String.valueOf(body.getJzzb() - body.getBcjt()));
          record.setAfter(body.getJzzb().toString());
          record.setChangetype("卡片减值");
          record.setZcType("card");
          record.setName("减值准备");
          record.setChangeinfoid(body.getCardinfoid());
          record.setChangestate("01");
          record.setWfCode(head.getWfconfigCode()); // 流程
          record.setChangedate(head.getNgrq());
          cardCommonUCCImpl.saveRecord(record);
        }
      } else {
        reduceCheck = "自用资产卡片不能减值!";
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(reduceCheck);
        return null;
      }
    }
    if (!"".equals(reduceCheck)) {
      reduceCheck = "编号为" + reduceCheck + "的卡片无法减值";
      response.setCharacterEncoding("UTF-8");
      response.getWriter().write(reduceCheck);
      return null;
    }
    response.setCharacterEncoding("UTF-8");
    response.getWriter().write(reduceCheck + "保存成功");
    return null;
  }