From 66b02aac92f89c9d5df3e75d6d342634092f0dd4 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Wed, 10 Nov 2021 15:07:56 +0800 Subject: [PATCH] 20211108 --- gc-shop/src/main/java/com/xzx/gc/shop/service/JhyService.java | 77 ++++++++++++++++++++++++++++---------- 1 files changed, 57 insertions(+), 20 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 92a0721..87fd537 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 @@ -6,17 +6,15 @@ import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.rabbitmq.client.Address; +import com.xzx.gc.common.constant.Constants; +import com.xzx.gc.common.exception.RestException; import com.xzx.gc.common.utils.StringUtils; -import com.xzx.gc.entity.JhyOrder; -import com.xzx.gc.entity.JhyOrderItems; -import com.xzx.gc.entity.ScoreOrder; -import com.xzx.gc.entity.ScoreOrderDetails; +import com.xzx.gc.entity.*; +import com.xzx.gc.shop.dto.AssignJhyOrderDto; 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; -import com.xzx.gc.shop.mapper.OrderInfoMapper; -import com.xzx.gc.shop.mapper.ScoreOrderMapper; +import com.xzx.gc.shop.mapper.*; import com.xzx.gc.shop.vo.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +52,46 @@ String name = model.getAccount(); model.setAccount(name); model.setAccountPhone(accountPhone); + List<Integer> status = new ArrayList<>(); + if(CollUtil.isEmpty(model.getStatus())){ + status.add(1); + status.add(2); + status.add(3); + status.add(4); + status.add(5); + status.add(6); + model.setStatus(status); + } + List<QueryJhyOrderListVo> maps = jhyOrderMapper.queryOrderList(model); + if(CollUtil.isNotEmpty(maps)){ + for(QueryJhyOrderListVo queryJhyOrderListVo : maps){ + Long id = queryJhyOrderListVo.getId(); + List<JhyOrderItemsVo> jhyOrderItemsVos = jhyOrderItemsMapper.selectByOrderId(id); + queryJhyOrderListVo.setJhyOrderItemsVos(jhyOrderItemsVos); +// +// String orderAddr = queryJhyOrderListVo.getArea() + queryJhyOrderListVo.getAddress(); +// Long userId = queryJhyOrderListVo.getUserId(); +// List<AddressInfo> addressInfos = jhyOrderMapper.selectAddRessInfoByUserId(userId); +// if(CollUtil.isNotEmpty(addressInfos)){ +// for(AddressInfo addressInfo : addressInfos){ +// StringBuffer address = new StringBuffer(); +// address.append(addressInfo.getDetailAddress()); +// if (StrUtil.isNotBlank(addressInfo.getTagName())) { +// address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); +// if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { +// address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); +// address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); +// } +// } +// if (orderAddr.equals(addressInfo.getAddressArea() + address)) { +// queryJhyOrderListVo.setUnitName(addressInfo.getUnitName()); +// queryJhyOrderListVo.setHouseNumber(addressInfo.getHouseNumber()); +// } +// } +// } + } + } // if(CollUtil.isNotEmpty(maps)){ // for(QueryJhyOrderListVo queryJhyOrderListVo : maps){ // String decode = StringUtils.decode(queryJhyOrderListVo.getName()); @@ -77,24 +114,15 @@ String decode = StringUtils.decode(viewJhyOrderVo.getNickName()); viewJhyOrderVo.setNickName(decode); - 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); + List<JhyOrderItemsVo> jhyOrderItemsList = jhyOrderItemsMapper.selectJhyOrderItemListByOrderId(id); if(CollUtil.isNotEmpty(jhyOrderItemsList)){ - for(JhyOrderItems jhyOrderItems : jhyOrderItemsList){ - JhyOrderItemsVo jhyOrderItemsVo = BeanUtil.copyProperties(jhyOrderItems, JhyOrderItemsVo.class); + for(JhyOrderItemsVo jhyOrderItemsVo : jhyOrderItemsList){ 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(new BigDecimal(StrUtil.isEmpty(jhyOrderItemsVo.getScore())?"0":jhyOrderItemsVo.getScore()).setScale( 2, BigDecimal.ROUND_DOWN )); - jhyOrderItemsVolist.add(jhyOrderItemsVo); } } - viewJhyOrderVo.setJhyOrderItems(jhyOrderItemsVolist); + viewJhyOrderVo.setJhyOrderItems(jhyOrderItemsList); return viewJhyOrderVo; } @@ -103,6 +131,7 @@ Long id = model.getId(); JhyOrder jhyOrder = jhyOrderMapper.selectByPrimaryKey(id); jhyOrder.setStatus(JhyOrder.ORDER_STATUS_CANCEL); + jhyOrder.setJhyId(""); jhyOrderMapper.updateByPrimaryKey(jhyOrder); } @@ -164,4 +193,12 @@ return total; } + + public void assignJhyOrder(AssignJhyOrderDto model,String userId) { + Long orderId = model.getOrderId(); + JhyOrder order = jhyOrderMapper.selectByPrimaryKey(orderId); + order.setJhyId(userId); + order.setStatus(JhyOrder.ORDER_STATUS_IMG); + jhyOrderMapper.updateByPrimaryKey(order); + } } -- Gitblit v1.9.1