コード例 #1
0
 // 自动更新减少积分
 public void blurAction() {
   if (biRedPointsShowAdd.getGoodsQty() == null) {
     return;
   }
   if (biRedPointsShowAdd.getGoodsQty() != null && biRedPointsShowAdd.getGoodsQty() < 0) {
     MessageUtil.addError("兑换数量(" + biRedPointsShowAdd.getGoodsQty() + ")请输入正数!");
     return;
   }
   if (gmGoodsInfoShowAdd.getGoodsId() != null) {
     BigDecimal bigDecimal;
     List<GmGoodsInfo> gmGoodsInfoListTmp =
         gmGoodsInfoService.getGmGoodsInfoListByID(gmGoodsInfoShowAdd.getGoodsId());
     if (gmGoodsInfoListTmp == null || gmGoodsInfoListTmp.size() <= 0) {
       MessageUtil.addError("该物品(" + gmGoodsInfoShowAdd.getGoodsId() + ")不存在,请确认您输入的物品号!");
       return;
     }
     if (gmGoodsInfoListTmp.get(0).getPoints() == null
         || biRedPointsShowAdd.getGoodsQty() == null) {
       bigDecimal = null;
     } else {
       bigDecimal =
           gmGoodsInfoListTmp
               .get(0)
               .getPoints()
               .multiply(new BigDecimal(biRedPointsShowAdd.getGoodsQty()));
     }
     biRedPointsShowAdd.setPoints(bigDecimal);
   }
 }
コード例 #2
0
  private Boolean preSubmitCheck(BpRedPointsShow bpRedPointsShowPara) {
    if (ToolUtil.getStrIgnoreNull(gmGoodsInfoShowAdd.getGoodsId()).length() == 0) {
      MessageUtil.addError("物品号不能为空,请输入物品号!");
      return false;
    }

    List<BpCusts> gmBpCustsTmp = bpCustsService.getBpCustListByID(bpRedPointsShowPara.getCustNo());
    if (gmBpCustsTmp == null || gmBpCustsTmp.size() <= 0) {
      MessageUtil.addError("该客户(" + bpRedPointsShowPara.getCustNo() + ")不存在,请确认您输入的客户号!");
      return false;
    }
    List<GmGoodsInfo> gmGoodsInfoListTmp =
        gmGoodsInfoService.getGmGoodsInfoListByID(gmGoodsInfoShowAdd.getGoodsId());
    if (gmGoodsInfoListTmp == null || gmGoodsInfoListTmp.size() <= 0) {
      MessageUtil.addError("该物品(" + gmGoodsInfoShowAdd.getGoodsId() + ")不存在,请确认您输入的物品号!");
      return false;
    }
    BigDecimal bdCumuPoints = ToolUtil.getBdIgnoreNull(gmBpCustsTmp.get(0).getCumuPoints());
    if (bdCumuPoints.compareTo(ToolUtil.getBdIgnoreNull(bpRedPointsShowPara.getPoints())) < 0) {
      MessageUtil.addError("该客户剩余积分(" + bdCumuPoints + ")不足本次捐赠,请确认您本次捐赠操作是否正确?");
      return false;
    }
    Long storQty = ToolUtil.getLongIgnoreNull(gmGoodsInfoListTmp.get(0).getStorQty());
    if (storQty < bpRedPointsShowPara.getGoodsQty()) {
      MessageUtil.addError("该物品库存量(" + storQty + ")不足本次捐赠,请确认您本次捐赠操作是否正确?");
      return false;
    }
    return true;
  }