| | |
| | | package com.jilongda.manage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.common.utils.TimeUtils; |
| | | import com.jilongda.manage.authority.mapper.SecUserMapper; |
| | | import com.jilongda.manage.authority.model.SecUser; |
| | | import com.jilongda.manage.mapper.TAppUserMapper; |
| | | import com.jilongda.manage.mapper.TOrderGoodsMapper; |
| | | import com.jilongda.manage.mapper.TStoreMapper; |
| | | import com.jilongda.manage.model.TAppUser; |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.jilongda.manage.mapper.TOrderMapper; |
| | | import com.jilongda.manage.model.TOrderGoods; |
| | | import com.jilongda.manage.model.TStore; |
| | | import com.jilongda.manage.query.TOrderQuery; |
| | | import com.jilongda.manage.service.TOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.manage.vo.TAppUserVO; |
| | | import com.jilongda.manage.vo.TModelVO; |
| | | import com.jilongda.manage.vo.TOrderListVO; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public TOrderVO getOrderDetailById(Integer orderId) { |
| | | return this.baseMapper.getOrderDetailById(orderId); |
| | | } |
| | | |
| | | @Autowired |
| | | private TAppUserMapper appUserMapper; |
| | | @Autowired |
| | | private TStoreMapper storeMapper; |
| | | @Autowired |
| | | private SecUserMapper secUserMapper; |
| | | @Autowired |
| | | private TOrderGoodsMapper orderGoodsMapper; |
| | | @Override |
| | | public PageInfo<TOrderListVO> pageList(TOrderQuery query) { |
| | | PageInfo<TOrderListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TOrder> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<TOrderListVO> res = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TOrder tOrder : list) { |
| | | TOrderListVO tOrderListVO = new TOrderListVO(); |
| | | TAppUser tAppUser = appUserMapper.selectById(tOrder.getUserId()); |
| | | if (tAppUser!=null){ |
| | | tOrderListVO.setWxName(tAppUser.getName()); |
| | | } |
| | | TStore tStore = storeMapper.selectById(tOrder.getStoreId()); |
| | | if (tStore!=null){ |
| | | tOrderListVO.setStoreName(tStore.getName()); |
| | | } |
| | | SecUser secUser = secUserMapper.selectById(tOrder.getSysId()); |
| | | if (secUser!=null){ |
| | | tOrderListVO.setStaffName(secUser.getNickName()); |
| | | } |
| | | tOrderListVO.setId(tOrder.getId()); |
| | | tOrderListVO.setPhone(tOrder.getPhone()); |
| | | tOrderListVO.setRealName(tOrder.getRealName()); |
| | | List<TOrderGoods> orderGoods = orderGoodsMapper.selectList(new LambdaQueryWrapper<TOrderGoods>().eq(TOrderGoods::getOrderId, tOrder.getId())); |
| | | for (TOrderGoods orderGood : orderGoods) { |
| | | if (StringUtils.hasLength(orderGood.getModelName())){ |
| | | // 镜架 |
| | | tOrderListVO.setFrame(orderGood.getBrandName()+orderGood.getModelName()+" "+orderGood.getColor()); |
| | | continue; |
| | | } |
| | | if (StringUtils.hasLength(orderGood.getLLens())){ |
| | | String temp = null; |
| | | switch (orderGood.getType()){ |
| | | case 1: |
| | | temp = "球面"; |
| | | break; |
| | | case 2: |
| | | temp = "非球面"; |
| | | break; |
| | | case 3: |
| | | temp = "双非"; |
| | | break; |
| | | } |
| | | tOrderListVO.setLensL(orderGood.getBrandName() + orderGood.getSeriesName() + temp + orderGood.getRefractiveIndex()); |
| | | continue; |
| | | } |
| | | if (StringUtils.hasLength(orderGood.getRLens())){ |
| | | String temp = null; |
| | | switch (orderGood.getType()){ |
| | | case 1: |
| | | temp = "球面"; |
| | | break; |
| | | case 2: |
| | | temp = "非球面"; |
| | | break; |
| | | case 3: |
| | | temp = "双非"; |
| | | break; |
| | | } |
| | | tOrderListVO.setLensR(orderGood.getBrandName() + orderGood.getSeriesName() + temp + orderGood.getRefractiveIndex()); |
| | | } |
| | | } |
| | | tOrderListVO.setCouponMoney(tOrder.getCouponMoney()); |
| | | tOrderListVO.setOrderMoney(tOrder.getOrderMoney()); |
| | | tOrderListVO.setOrderTime(TimeUtils.localDateTimeToString(tOrder.getCreateTime())); |
| | | res.add(tOrderListVO); |
| | | } |
| | | pageInfo.setRecords(res); |
| | | return pageInfo; |
| | | } |
| | | } |