From 428bb63ebaf67e9ba4f6bd338b88a5da1e5d2afa Mon Sep 17 00:00:00 2001 From: DESKTOP-71BH0QO\L、ming <172680469@qq.com> Date: 星期四, 22 四月 2021 09:44:23 +0800 Subject: [PATCH] fix:编辑商品修改逻辑代码 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 39 insertions(+), 4 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java index 6b120cf..5bfbc88 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java @@ -8,6 +8,7 @@ import com.panzhihua.common.model.dtos.PageDTO; import com.panzhihua.common.model.dtos.shop.*; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.WxPayUtils; import com.panzhihua.service_community.dao.ComShopOrderDAO; import com.panzhihua.service_community.model.dos.ComShopOrderDO; @@ -321,6 +322,11 @@ orderGoodsDOList.forEach(orderGoods -> { ComShopOrderGoodsVO orderGoodsVO = new ComShopOrderGoodsVO(); BeanUtils.copyProperties(orderGoods,orderGoodsVO); + //根据商品规格id查询商品规格 + ComShopGoodsAttrDO goodsAttrDO = comShopGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId()); + if(goodsAttrDO != null){ + orderGoodsVO.setGoodsAttr(goodsAttrDO.getGoodsAttr()); + } orderGoodsVO.setNum(orderGoods.getAmount()); orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic()); orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice()); @@ -378,6 +384,11 @@ orderGoodsVO.setNum(orderGoods.getAmount()); orderGoodsVO.setGoodsPic(orderGoods.getGoodsAttrPic()); orderGoodsVO.setPrice(orderGoods.getGoodsAttrPrice()); + //根据商品规格id查询商品规格 + ComShopGoodsAttrDO goodsAttrDO = comShopGoodsAttrDAO.selectById(orderGoods.getGoodsAttrId()); + if(goodsAttrDO != null){ + orderGoodsVO.setGoodsAttr(goodsAttrDO.getGoodsAttr()); + } orderGoodsVOS.add(orderGoodsVO); sbr.append(orderGoods.getGoodsName() + " " ); }); @@ -548,8 +559,13 @@ return R.fail("订单不存在"); } if(!(comShopOrderDO.getStatus()==2) - || !(comShopOrderDO.getDeleteStatus()==1)){ + || !(comShopOrderDO.getDeliveryStatus()==1)){ return R.fail("订单发货失败,订单状态不允许发货"); + } + + ComShopStoreDO storeDO = comShopStoreDAO.selectById(comShopOrderDO.getStoreId()); + if(storeDO.getDeliveryType()!=2){ + return R.fail("该商家不支持通过快递物流发货"); } comShopOrderDO.setDeliveryStatus(2); comShopOrderDO.setDeliveryType(2); @@ -569,11 +585,17 @@ if(comShopOrderDO==null){ return R.fail("订单不存在"); } - if(!(comShopOrderDO.getStatus()==2)){ + if(!(comShopOrderDO.getStatus()==2) + || !(comShopOrderDO.getDeliveryStatus()==1)){ return R.fail("当前订单不能配送"); + } + ComShopStoreDO storeDO = comShopStoreDAO.selectById(comShopOrderDO.getStoreId()); + if(storeDO.getDeliveryType()!=1){ + return R.fail("该商家不支持通过商家配送"); } comShopOrderDO.setDeliveryStatus(4); comShopOrderDO.setDeliveryType(1); + comShopOrderDO.setStatus(3); int updated = comShopOrderDAO.updateById(comShopOrderDO); if(updated==1){ return R.ok("开始配送"); @@ -619,6 +641,12 @@ @Override public R getFundsStat(Long userId) { ComShopFundsVO comShopFundsVO = comShopOrderDAO.queryStatis(userId); + if(comShopFundsVO==null){ + comShopFundsVO = new ComShopFundsVO(); + comShopFundsVO.setMonthTotal(new BigDecimal(0)); + comShopFundsVO.setTodayTotal(new BigDecimal(0)); + comShopFundsVO.setWeekTotal(new BigDecimal(0)); + } return R.ok(comShopFundsVO); } @@ -674,11 +702,13 @@ @Transactional(rollbackFor = Exception.class) @Override public void wxOrderPayNotify(WxPayNotifyOrderDTO wxPayNotifyOrderDTO){ + log.info("微信订单支付回调开始处理逻辑"); if(StringUtils.isEmpty(wxPayNotifyOrderDTO.getOrderTradeNo())){ log.error("微信支付回调失败,订单号为空"); return; } + log.info("微信订单支付回调开始查询订单"); //查询订单 ComShopOrderDO shopOrderDO = this.baseMapper.selectOne(new QueryWrapper<ComShopOrderDO>().lambda().eq(ComShopOrderDO::getOrderNo,wxPayNotifyOrderDTO.getOrderTradeNo())); if(shopOrderDO == null){ @@ -688,9 +718,9 @@ shopOrderDO.setStatus(ComShopOrderDO.status.dfh); shopOrderDO.setPayType(ComShopOrderDO.payType.wx); shopOrderDO.setPayStatus(ComShopOrderDO.payStatus.yes); - shopOrderDO.setPayAmount(BigDecimal.valueOf(Integer.parseInt(wxPayNotifyOrderDTO.getCashFee()) / 100)); + shopOrderDO.setPayAmount(BigDecimal.valueOf(Double.valueOf(wxPayNotifyOrderDTO.getCashFee()) / 100)); shopOrderDO.setWxTardeNo(wxPayNotifyOrderDTO.getWxTradeNo()); - shopOrderDO.setPayTime(new Date(Long.parseLong(wxPayNotifyOrderDTO.getPayTime() + "000"))); + shopOrderDO.setPayTime(DateUtils.stringToDate(wxPayNotifyOrderDTO.getPayTime(),new SimpleDateFormat("yyyyMMddHHmmss"))); this.baseMapper.updateById(shopOrderDO); //查询订单商品 @@ -770,4 +800,9 @@ } return R.ok(shopOrderVO); } + + public static void main(String[] args) { + BigDecimal one = BigDecimal.valueOf(Double.valueOf("1") / 100); + System.out.println(); + } } -- Gitblit v1.7.1