From cabf2cffb64e98401d87c2e03537720390e2f4ea Mon Sep 17 00:00:00 2001 From: xinyb <574600396@qq.com> Date: 星期四, 05 九月 2024 10:01:02 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/com/yc/api/controller/QrCodeController.java | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/com/yc/api/controller/QrCodeController.java b/src/com/yc/api/controller/QrCodeController.java index 3e6b835..7912aea 100644 --- a/src/com/yc/api/controller/QrCodeController.java +++ b/src/com/yc/api/controller/QrCodeController.java @@ -140,12 +140,6 @@ SpObserver.setDBtoInstance("_" +dbid ); String hostUrl = SettingKey.getHostUrlForImage(request); final List<com.yc.api.bean.CartEntity> cartList = qrServiceIfc.getCartList(request.getSession().getAttribute(SessionKey.USERCODE) + "", docCode); -// cartList.stream().map(x -> { -// x.setPhotoPath(imgData.getImageUrl(x.getPhotoPath(), 120, -// 120, false, -// false, request)); -// return x; -// }).collect(Collectors.toList()); cartList.stream().forEach(x -> { x.setPhotoPath(SettingKey.getUrl(hostUrl, x.getPhotoPathUrl(), dbid+"",null)); x.setPhotoPathUrl(SettingKey.getUrl(hostUrl, x.getPhotoPathUrl(), dbid+"",null)); @@ -160,31 +154,31 @@ BeanUtils.copyProperties(cartEntity,cart); double totalAmount=StringUtils.isNotBlank(cart.getAmount())?Double.parseDouble(cart.getAmount()):0;//鍚堝苟鎬讳环 double totalQuantity=cart.getQuantity();//鍚堝苟鏁伴噺 + StringJoiner cartIdjoiner=new StringJoiner(";"); iterator.remove(); if(!matCode.equalsIgnoreCase(cart.getMatCode())) { matCode=cart.getMatCode(); + cartIdjoiner.add(cart.getCartId()+""); Iterator<CartEntity> iterator2 = cartList.iterator(); while (iterator2.hasNext()) { CartEntity cartEntity2 = iterator2.next(); if (cart.getMatCode().equalsIgnoreCase(cartEntity2.getMatCode())) { totalAmount += Double.parseDouble(cartEntity2.getAmount()); totalQuantity += cartEntity2.getQuantity(); + cartIdjoiner.add(cartEntity2.getCartId()+""); } } + cart.setCartIdList(cartIdjoiner.toString()); cart.setAmount(totalAmount + ""); cart.setQuantity(totalQuantity); newCartList.add(cart); } } - //List<Gfrom> refFormIdList = getRefFormIdList(request, refFormid); Map map = new HashMap(); map.put("carts", newCartList); - //map.put("refFormids", refFormIdList); - callBackMessage.setInfo(map); callBackMessage.sendSuccessMessage("鎴愬姛"); return callBackMessage.toJSONObject(); - } catch (Exception ex) { callBackMessage.sendErrorMessage(this.getErrorMsg(ex)); return callBackMessage.toJSONObject(); @@ -375,6 +369,9 @@ cartids = postCartEntity.getCartids(); } map = qrServiceIfc.savePost(postCartEntity, cartids, userCode, cartSql); + if (map == null || StringUtils.isBlank(GridUtils.prossRowSetDataType_String(map, "docCode"))) { + throw new ApplicationException(postCartEntity.getFormId() + "鐢熸垚鍗曟嵁鍑洪敊:鍗曞彿涓虹┖"); + } if (map != null) { postCartEntity.setCartids(map.get("cartIds") + ""); final Integer result = qrServiceIfc.delCart(postCartEntity); @@ -385,6 +382,7 @@ if (map == null || StringUtils.isBlank(GridUtils.prossRowSetDataType_String(map, "docCode"))) { throw new ApplicationException(postCartEntity.getFormId() + "鐢熸垚鍗曟嵁鍑洪敊:鍗曞彿涓虹┖"); } + log.info("cltCode:" + userCode + "-瀹㈡埛锛�" + userCode + "涓嬪崟鑺辫垂:" + (System.currentTimeMillis() - startTime)); callBackMessage.setInfo(map); callBackMessage.sendSuccessMessageByDefault(); -- Gitblit v1.8.0