|  |  |  | 
|---|
|  |  |  | package com.xzx.gc.shop.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.shop.dto.QueryJhyOrderListDto; | 
|---|
|  |  |  | import com.xzx.gc.shop.mapper.JhyOrderItemsMapper; | 
|---|
|  |  |  | import com.xzx.gc.shop.mapper.JhyOrderMapper; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.QueryGoodsListVo; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.QueryJhyOrderListVo; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.QueryScoreDetailsListVo; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.ViewJhyOrderVo; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import tk.mybatis.mapper.entity.Example; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | model.setAccount(name); | 
|---|
|  |  |  | model.setAccountPhone(accountPhone); | 
|---|
|  |  |  | List<QueryJhyOrderListVo> maps = jhyOrderMapper.queryOrderList(model); | 
|---|
|  |  |  | if(CollUtil.isNotEmpty(maps)){ | 
|---|
|  |  |  | for(QueryJhyOrderListVo queryJhyOrderListVo : maps){ | 
|---|
|  |  |  | 
|---|
|  |  |  | Example exampleItems = new Example(JhyOrderItems.class); | 
|---|
|  |  |  | Example.Criteria criteriaItems = exampleItems.createCriteria(); | 
|---|
|  |  |  | criteriaItems.andEqualTo("orderId",id); | 
|---|
|  |  |  | ArrayList<JhyOrderItemsVo> jhyOrderItemsVolist = new ArrayList<>(); | 
|---|
|  |  |  | List<JhyOrderItems> jhyOrderItemsList = jhyOrderItemsMapper.selectByExample(exampleItems); | 
|---|
|  |  |  | viewJhyOrderVo.setJhyOrderItems(jhyOrderItemsList); | 
|---|
|  |  |  | if(CollUtil.isNotEmpty(jhyOrderItemsList)){ | 
|---|
|  |  |  | for(JhyOrderItems jhyOrderItems : jhyOrderItemsList){ | 
|---|
|  |  |  | JhyOrderItemsVo jhyOrderItemsVo = BeanUtil.copyProperties(jhyOrderItems, JhyOrderItemsVo.class); | 
|---|
|  |  |  | BigDecimal multiply = jhyOrderItemsVo.getPrice().multiply(new BigDecimal(40)); | 
|---|
|  |  |  | BigDecimal multiplyScore = jhyOrderItemsVo.getPrice() | 
|---|
|  |  |  | .multiply(jhyOrderItemsVo.getWeight()==null?BigDecimal.ZERO :jhyOrderItemsVo.getWeight()) | 
|---|
|  |  |  | .multiply(new BigDecimal(40)); | 
|---|
|  |  |  | jhyOrderItemsVo.setPrice(multiply); | 
|---|
|  |  |  | jhyOrderItemsVo.setAllPrice(multiplyScore); | 
|---|
|  |  |  | jhyOrderItemsVolist.add(jhyOrderItemsVo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | viewJhyOrderVo.setJhyOrderItems(jhyOrderItemsVolist); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return viewJhyOrderVo; | 
|---|
|  |  |  | } | 
|---|