fix
Helius
2021-07-22 ff030a19308da2f20f141024638e66f42e0a6fbc
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -18,6 +18,7 @@
import com.xzx.gc.order.mapper.*;
import com.xzx.gc.order.vo.JhyOrderDetailsVo;
import com.xzx.gc.order.vo.JhyOrderListVo;
import com.xzx.gc.order.vo.JhyStatusCountVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -25,9 +26,7 @@
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
@Slf4j
@Service
@@ -137,6 +136,8 @@
        JhyOrderDetailsVo detailsVo = new JhyOrderDetailsVo();
        BeanUtil.copyProperties(order, detailsVo);
        detailsVo.setLongitude(order.getLongitude());
        detailsVo.setLatitude(order.getLatitude());
        detailsVo.setAddress(order.getArea() + order.getAddress());
        detailsVo.setTotalPrice(total);
        detailsVo.setItems(items);
@@ -172,6 +173,7 @@
            order.setStatus(JhyOrder.ORDER_STATUS_CANCEL);
        }
        order.setJhyId(null);
        jhyOrderMapper.updateByPrimaryKey(order);
    }
@@ -236,4 +238,30 @@
        distribService.distribRecord(order.getId(), order.getUserId());
    }
    public Map<Integer, Integer> orderStatusCount(Integer type, String userId) {
        List<JhyStatusCountVo> count = jhyOrderMapper.selectOrderStatusCount(type, userId);
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 1; i < 6; i++) {
            if (CollUtil.isNotEmpty(count)) {
                boolean flag = false;
                for (JhyStatusCountVo jhyStatusCountVo : count) {
                    if (i == jhyStatusCountVo.getStatus()) {
                        map.put(i, jhyStatusCountVo.getCnt());
                        flag = true;
                        break;
                    }
                }
                if (flag) {
                    continue;
                }
            }
            map.put(i, 0);
        }
        return map;
    }
}