From f09922d11f5f1b1c6e74781e4ece70fb5657168d Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期三, 21 四月 2021 17:47:17 +0800
Subject: [PATCH] no
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOrderServiceImpl.java | 38 +++++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 7 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 82ce97c..a1f380d 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;
@@ -176,11 +177,12 @@
}
}else{//查询到用户上一笔订单
ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(shopOrders.get(0).getReceiverId());
- ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
- BeanUtils.copyProperties(userAddressDO,userAddressVO);
- orderPreviewVO.setUserAddressVO(userAddressVO);
+ if(userAddressDO != null){
+ ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO();
+ BeanUtils.copyProperties(userAddressDO,userAddressVO);
+ orderPreviewVO.setUserAddressVO(userAddressVO);
+ }
}
-
return R.ok(orderPreviewVO);
}
@@ -320,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());
@@ -377,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() + " " );
});
@@ -618,6 +630,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);
}
@@ -673,11 +691,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){
@@ -687,9 +707,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())));
+ shopOrderDO.setPayTime(DateUtils.stringToDate(wxPayNotifyOrderDTO.getPayTime(),new SimpleDateFormat("yyyyMMddHHmmss")));
this.baseMapper.updateById(shopOrderDO);
//查询订单商品
@@ -721,7 +741,6 @@
comShopStoreDAO.updateById(storeDO);
}
}
-
//添加订单操作记录
ComShopOrderOperateDO orderOperateDO = new ComShopOrderOperateDO();
@@ -770,4 +789,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