yshop2.1.4,订单新增批量打印,图片修改为批量上传等
This commit is contained in:
@ -56,6 +56,8 @@ public @interface Query {
|
|||||||
,BETWEEN
|
,BETWEEN
|
||||||
// 不为空
|
// 不为空
|
||||||
,NOT_NULL
|
,NOT_NULL
|
||||||
|
// 查询时间
|
||||||
|
,UNIX_TIMESTAMP
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import co.yixiang.annotation.Query;
|
import co.yixiang.annotation.Query;
|
||||||
import javax.persistence.criteria.*;
|
import javax.persistence.criteria.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,6 +119,16 @@ public class QueryHelp {
|
|||||||
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
||||||
(Comparable) between.get(0), (Comparable) between.get(1)));
|
(Comparable) between.get(0), (Comparable) between.get(1)));
|
||||||
break;
|
break;
|
||||||
|
case UNIX_TIMESTAMP:
|
||||||
|
List<Object> UNIX_TIMESTAMP = new ArrayList<>((List<Object>)val);
|
||||||
|
if(!UNIX_TIMESTAMP.isEmpty()){
|
||||||
|
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
long time1 = fm.parse(UNIX_TIMESTAMP.get(0).toString()).getTime()/1000;
|
||||||
|
long time2 = fm.parse(UNIX_TIMESTAMP.get(1).toString()).getTime()/1000;
|
||||||
|
list.add(cb.between(getExpression(attributeName, join, root),
|
||||||
|
time1, time2));
|
||||||
|
}
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,12 @@ import co.yixiang.mp.service.YxTemplateService;
|
|||||||
import co.yixiang.mp.service.YxWechatTemplateService;
|
import co.yixiang.mp.service.YxWechatTemplateService;
|
||||||
import co.yixiang.utils.OrderUtil;
|
import co.yixiang.utils.OrderUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
@ -37,7 +39,13 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -370,4 +378,110 @@ public class StoreOrderController {
|
|||||||
return new ResponseEntity(expressInfo, HttpStatus.OK);
|
return new ResponseEntity(expressInfo, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/yxStoreOrder/download")
|
||||||
|
@PreAuthorize("@el.check('admin','cate:list')")
|
||||||
|
public void download(HttpServletResponse response,
|
||||||
|
YxStoreOrderQueryCriteria criteria,
|
||||||
|
Pageable pageable,
|
||||||
|
@RequestParam(name = "orderStatus") String orderStatus,
|
||||||
|
@RequestParam(name = "orderType") String orderType,
|
||||||
|
@RequestParam(name = "listContent") String listContent) throws IOException, ParseException {
|
||||||
|
List<YxStoreOrderDTO> list = (List)getYxStoreList(criteria, pageable, orderStatus, orderType).get("content");
|
||||||
|
List<String> idList = JSONArray.parseArray(listContent).toJavaList(String.class);
|
||||||
|
List<YxStoreOrderDTO> yxStoreOrderDTOS = new ArrayList<>();
|
||||||
|
if(StringUtils.isEmpty(listContent)){
|
||||||
|
yxStoreOrderService.download(list, response);
|
||||||
|
}else {
|
||||||
|
for(YxStoreOrderDTO yx : list){
|
||||||
|
for(String ids : idList){
|
||||||
|
if(yx.getOrderId().equals(ids)){
|
||||||
|
yxStoreOrderDTOS.add(yx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yxStoreOrderService.download(yxStoreOrderDTOS, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,Object> getYxStoreList(YxStoreOrderQueryCriteria criteria,
|
||||||
|
Pageable pageable,
|
||||||
|
String orderStatus,
|
||||||
|
String orderType){
|
||||||
|
criteria.setShippingType(1);//默认查询所有快递订单
|
||||||
|
//订单状态查询
|
||||||
|
if (StrUtil.isNotEmpty(orderStatus)) {
|
||||||
|
switch (orderStatus) {
|
||||||
|
case "0":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(0);
|
||||||
|
criteria.setStatus(0);
|
||||||
|
criteria.setRefundStatus(0);
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setStatus(0);
|
||||||
|
criteria.setRefundStatus(0);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setStatus(1);
|
||||||
|
criteria.setRefundStatus(0);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setStatus(2);
|
||||||
|
criteria.setRefundStatus(0);
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setStatus(3);
|
||||||
|
criteria.setRefundStatus(0);
|
||||||
|
break;
|
||||||
|
case "-1":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setRefundStatus(1);
|
||||||
|
break;
|
||||||
|
case "-2":
|
||||||
|
criteria.setIsDel(0);
|
||||||
|
criteria.setPaid(1);
|
||||||
|
criteria.setRefundStatus(2);
|
||||||
|
break;
|
||||||
|
case "-4":
|
||||||
|
criteria.setIsDel(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//订单类型查询
|
||||||
|
if (StrUtil.isNotEmpty(orderType)) {
|
||||||
|
switch (orderType) {
|
||||||
|
case "1":
|
||||||
|
criteria.setBargainId(0);
|
||||||
|
criteria.setCombinationId(0);
|
||||||
|
criteria.setSeckillId(0);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
criteria.setNewCombinationId(0);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
criteria.setNewSeckillId(0);
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
criteria.setNewBargainId(0);
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
criteria.setShippingType(2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return yxStoreOrderService.queryAll(criteria, pageable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -6,7 +6,10 @@ import co.yixiang.modules.shop.service.dto.OrderTimeDataDTO;
|
|||||||
import co.yixiang.modules.shop.service.dto.YxStoreOrderDTO;
|
import co.yixiang.modules.shop.service.dto.YxStoreOrderDTO;
|
||||||
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
|
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.text.ParseException;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -27,6 +30,9 @@ public interface YxStoreOrderService {
|
|||||||
|
|
||||||
void refund(YxStoreOrder resources);
|
void refund(YxStoreOrder resources);
|
||||||
|
|
||||||
|
void download(List<YxStoreOrderDTO> queryAll, HttpServletResponse response) throws IOException, ParseException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
* @param criteria
|
* @param criteria
|
||||||
|
@ -3,6 +3,8 @@ package co.yixiang.modules.shop.service.dto;
|
|||||||
import co.yixiang.annotation.Query;
|
import co.yixiang.annotation.Query;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
* @date 2019-10-14
|
* @date 2019-10-14
|
||||||
@ -10,6 +12,11 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class YxStoreOrderQueryCriteria{
|
public class YxStoreOrderQueryCriteria{
|
||||||
|
|
||||||
|
// 模糊
|
||||||
|
@Query(type = Query.Type.UNIX_TIMESTAMP)
|
||||||
|
private List<String> addTime;
|
||||||
|
|
||||||
|
|
||||||
// 模糊
|
// 模糊
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String orderId;
|
private String orderId;
|
||||||
|
@ -19,6 +19,7 @@ import co.yixiang.modules.shop.service.dto.*;
|
|||||||
import co.yixiang.modules.shop.service.mapper.YxStoreOrderMapper;
|
import co.yixiang.modules.shop.service.mapper.YxStoreOrderMapper;
|
||||||
import co.yixiang.mp.service.YxMiniPayService;
|
import co.yixiang.mp.service.YxMiniPayService;
|
||||||
import co.yixiang.mp.service.YxPayService;
|
import co.yixiang.mp.service.YxPayService;
|
||||||
|
import co.yixiang.utils.FileUtil;
|
||||||
import co.yixiang.utils.OrderUtil;
|
import co.yixiang.utils.OrderUtil;
|
||||||
import co.yixiang.utils.QueryHelp;
|
import co.yixiang.utils.QueryHelp;
|
||||||
import co.yixiang.utils.ValidationUtil;
|
import co.yixiang.utils.ValidationUtil;
|
||||||
@ -31,7 +32,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -356,4 +360,50 @@ public class YxStoreOrderServiceImpl implements YxStoreOrderService {
|
|||||||
public void delete(Integer id) {
|
public void delete(Integer id) {
|
||||||
yxStoreOrderRepository.deleteById(id);
|
yxStoreOrderRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<YxStoreOrderDTO> queryAll, HttpServletResponse response) throws IOException, ParseException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (YxStoreOrderDTO storeOrderDTO : queryAll) {
|
||||||
|
List<StoreOrderCartInfoDTO> storeList = new ArrayList<StoreOrderCartInfoDTO>();
|
||||||
|
storeList = storeOrderDTO.getCartInfoList();
|
||||||
|
if(storeList != null){
|
||||||
|
for(StoreOrderCartInfoDTO storeOrderCartInfoDTO : storeList){
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("订单号", storeOrderDTO.getOrderId());
|
||||||
|
map.put("下单时间", OrderUtil.stampToDate(storeOrderDTO.getAddTime()+""));
|
||||||
|
map.put("订单状态", storeOrderDTO.getStatusName());
|
||||||
|
map.put("支付状态", storeOrderDTO.getPayTypeName());
|
||||||
|
map.put("配送费用", storeOrderDTO.getFreightPrice());
|
||||||
|
map.put("实际支付", storeOrderDTO.getPayPrice());
|
||||||
|
|
||||||
|
map.put("客户编号", storeOrderDTO.getUserDTO().getAccount());
|
||||||
|
map.put("客户名称", storeOrderDTO.getUserDTO().getNickname());
|
||||||
|
map.put("客户类型", storeOrderDTO.getUserDTO().getUserType());
|
||||||
|
map.put("客户手机号码", storeOrderDTO.getUserDTO().getPhone());
|
||||||
|
map.put("是否为推广员", storeOrderDTO.getUserDTO().getIsPromoter());
|
||||||
|
|
||||||
|
map.put("收货人", storeOrderDTO.getRealName());
|
||||||
|
map.put("联系电话", storeOrderDTO.getUserPhone());
|
||||||
|
map.put("收货地址", storeOrderDTO.getUserAddress());
|
||||||
|
|
||||||
|
Map proInfo = ((Map)storeOrderCartInfoDTO.getCartInfoMap().get("productInfo"));
|
||||||
|
map.put("商品编号", proInfo.get("id"));
|
||||||
|
map.put("商品名称", proInfo.get("store_name"));
|
||||||
|
map.put("商品规格", proInfo.get("unit_name"));
|
||||||
|
map.put("商品库存", proInfo.get("stock"));
|
||||||
|
map.put("单价", proInfo.get("price"));
|
||||||
|
map.put("订购数量", storeOrderDTO.getTotalNum());
|
||||||
|
map.put("小计", storeOrderDTO.getTotalPrice());
|
||||||
|
map.put("订单备注", storeOrderDTO.getMark());
|
||||||
|
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user