From ac913f2f98cfb49ef98a2b07a7533b30e3f253da Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 07 Jul 2021 14:51:52 +0800
Subject: [PATCH] 20210707

---
 gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
index dc97abe..f7dafef 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java
@@ -3,11 +3,14 @@
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.xzx.gc.common.utils.StringUtils;
+import com.xzx.gc.entity.JhyOrder;
 import com.xzx.gc.entity.JhyOrderItems;
 import com.xzx.gc.entity.ScoreOrderDetails;
+import com.xzx.gc.shop.dto.CancelJhyOrderDto;
 import com.xzx.gc.shop.dto.QueryJhyOrderListDto;
 import com.xzx.gc.shop.mapper.JhyOrderItemsMapper;
 import com.xzx.gc.shop.mapper.JhyOrderMapper;
@@ -36,13 +39,18 @@
 
     public Map<String, Object> queryOrderList(QueryJhyOrderListDto model) {
         PageHelper.startPage(model.getPage(), model.getLimit());
+        String accountPhone = model.getAccount();
+//        String name = StrUtil.isEmpty(model.getAccount())?model.getAccount():StringUtils.encode(model.getAccount());
+        String name = model.getAccount();
+        model.setAccount(name);
+        model.setAccountPhone(accountPhone);
         List<QueryJhyOrderListVo> maps = jhyOrderMapper.queryOrderList(model);
-        if(CollUtil.isNotEmpty(maps)){
-            for(QueryJhyOrderListVo queryJhyOrderListVo : maps){
-                String decode = StringUtils.decode(queryJhyOrderListVo.getName());
-                queryJhyOrderListVo.setName(decode);
-            }
-        }
+//        if(CollUtil.isNotEmpty(maps)){
+//            for(QueryJhyOrderListVo queryJhyOrderListVo : maps){
+//                String decode = StringUtils.decode(queryJhyOrderListVo.getName());
+//                queryJhyOrderListVo.setName(decode);
+//            }
+//        }
         PageInfo pageInfo = new PageInfo(maps);
         int count = Convert.toInt(pageInfo.getTotal());
         Map<String, Object> map = new HashMap<>();
@@ -68,7 +76,11 @@
             for(JhyOrderItems jhyOrderItems : jhyOrderItemsList){
                 JhyOrderItemsVo jhyOrderItemsVo = BeanUtil.copyProperties(jhyOrderItems, JhyOrderItemsVo.class);
                 BigDecimal multiply = jhyOrderItemsVo.getPrice().multiply(new BigDecimal(40));
-                jhyOrderItemsVo.setAllPrice(multiply);
+//                BigDecimal multiplyScore = jhyOrderItemsVo.getPrice()
+//                        .multiply(jhyOrderItemsVo.getWeight()==null?BigDecimal.ZERO :jhyOrderItemsVo.getWeight())
+//                        .multiply(new BigDecimal(40));
+                jhyOrderItemsVo.setPrice(multiply);
+                jhyOrderItemsVo.setAllPrice(new BigDecimal(StrUtil.isEmpty(jhyOrderItemsVo.getScore())?"0":jhyOrderItemsVo.getScore()).setScale( 2, BigDecimal.ROUND_DOWN ));
                 jhyOrderItemsVolist.add(jhyOrderItemsVo);
             }
         }
@@ -76,4 +88,11 @@
 
         return viewJhyOrderVo;
     }
+
+    public void cancelJhyOrder(CancelJhyOrderDto model) {
+        Long id = model.getId();
+        JhyOrder jhyOrder = jhyOrderMapper.selectByPrimaryKey(id);
+        jhyOrder.setStatus(JhyOrder.ORDER_STATUS_CANCEL);
+        jhyOrderMapper.updateByPrimaryKey(jhyOrder);
+    }
 }

--
Gitblit v1.9.1