Просмотр исходного кода

Accept Merge Request #43: (dev-wxl -> dev-minio)

Merge Request: 上线提交

Created By: @万新亮
Accepted By: @万新亮
URL: https://chuanghaikeji.coding.net/p/moxuanyunshangwaimai/d/backend/git/merge/43?initial=true
万新亮 1 год назад
Родитель
Сommit
9d9472f437

+ 6 - 0
pom.xml

@@ -440,6 +440,12 @@
             <artifactId>minio</artifactId>
             <version>8.5.9</version>
         </dependency>
+        <!--图片压缩webp-->
+<!--        <dependency>-->
+<!--            <groupId>org.sejda.imageio</groupId>-->
+<!--            <artifactId>webp-imageio</artifactId>-->
+<!--            <version>0.1.6</version>-->
+<!--        </dependency>-->
     </dependencies>
 
     <dependencyManagement>

+ 14 - 53
src/main/java/com/sqx/modules/exportExecl/controller/ExportExeclController.java

@@ -15,6 +15,7 @@ import com.sqx.modules.exportExecl.mapper.ExportJobMapper;
 import com.sqx.modules.exportExecl.model.ExportJob;
 import com.sqx.modules.exportExecl.service.ExportJobService;
 import com.sqx.modules.order.dao.AppOrderDao;
+import com.sqx.modules.order.dto.OrderQueryDto;
 import com.sqx.modules.pay.controller.query.CashOutQueryDTO;
 import com.sqx.modules.pay.controller.query.WalletDetailQuery;
 import com.sqx.modules.riderStation.entity.RiderStation;
@@ -55,51 +56,25 @@ public class ExportExeclController {
 
     @GetMapping("excelOrder")
     @ApiOperation("导出订单列表")
-    public Result excelOrder(Integer status, String phone, Long shopId, String userName,
-                             String orderNumber, Integer orderType, String shopName, String riderPhone,
-                             String startTime, String endTime, String userId, String payStartTime, String payEndTime,Integer riderStationId) throws Exception{
-        Integer size = appOrderDao.excelAllOrderAdminCount( status, phone, shopId, userName, orderNumber, orderType,
-                shopName, riderPhone,startTime,endTime,payStartTime,payEndTime,riderStationId);
+    public Result excelOrder(OrderQueryDto queryDto) throws Exception{
+        if(!StringUtils.hasText(queryDto.getUserId())){
+            return Result.error("用户id不能为空");
+        }
+        Integer size = appOrderDao.excelAllOrderAdminCount(queryDto);
         //可导出最大数量
         String count=commonInfoService.findOne(431).getValue();
         if(size>Integer.parseInt(count)){
             return Result.error("导出总数不能超过"+Integer.parseInt(count)+",请添加筛选条件");
         }
-        if(!StringUtils.hasText(userId)){
-            return Result.error("用户id不能为空");
-        }
-        StringBuffer stringBuffer=new StringBuffer();
-        if(status!=null){stringBuffer.append("状态:"+getState(status)+";");}
-        if(phone!=null&&!phone.trim().equals("")){stringBuffer.append("手机号:"+phone+";");}
-//        if(shopId!=null){stringBuffer.append(":"+shopId+";");}
-        if(userName!=null&&!userName.trim().equals("")){stringBuffer.append("昵称:"+userName+";");}
-        if(orderNumber!=null&&!orderNumber.trim().equals("")){stringBuffer.append("订单号:"+orderNumber+";");}
-        if(orderType!=null){stringBuffer.append("订单类型:"+(orderType==1?"到店取餐":(orderType==2?"骑手配送":"商家配送"))+";");}
-        if(shopName!=null&&!shopName.trim().equals("")){stringBuffer.append("商铺名称:"+shopName+";");}
-        if(riderPhone!=null&&!riderPhone.trim().equals("")){stringBuffer.append("骑手手机号:"+riderPhone+";");}
-        if(startTime!=null&&!startTime.trim().equals("")){stringBuffer.append("开始时间:"+startTime+";");}
-        if(endTime!=null&&!endTime.trim().equals("")){stringBuffer.append("结束时间:"+endTime+";");}
-        if(payStartTime!=null&&!payStartTime.trim().equals("")){stringBuffer.append("支付开始时间:"+payStartTime+";");}
-        if(payEndTime!=null&&!payEndTime.trim().equals("")){stringBuffer.append("支付结束时间:"+payEndTime+";");}
-        if(riderStationId!=null){
-            RiderStation riderStation=riderStationService.getById(riderStationId);
+        String strMessage=queryDto.toStrMessage();
+        if(queryDto.getRiderStationId()!=null){
+            RiderStation riderStation=riderStationService.getById(queryDto.getRiderStationId());
             if(riderStation!=null){
-                stringBuffer=stringBuffer.append("站点:"+riderStation.getStationName()+";");
+                strMessage=strMessage+"站点:"+riderStation.getStationName()+";";
             }
         }
-        ExportJob exportJob =new ExportJob();
-        exportJob.setFlag(0);
-        exportJob.setFileType("order");
-        exportJob.setConditionDetail(stringBuffer.toString());
-        exportJob.setConditions(","+(status==null?"":status)+","+phone+","+(shopId==null?"":shopId)+","+userName+","+orderNumber+","
-                +(orderType==null?"":orderType)+","+shopName+","
-                +riderPhone+","+startTime+","+endTime+","+payStartTime+","+payEndTime+","+(riderStationId==null?"":riderStationId)+",");
-        LocalDateTime localDateTime = LocalDateTime.now();
-        String time=localDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
-        exportJob.setFileName((int) (Math.random() * 100) +time+"订单列表.xlsx");
-        exportJob.setUserId(userId);
-        exportJob.setCreateTime(new Date());
-        exportJob.setUpdateTime(new Date());
+        ExportJob exportJob =this.buildExportJob("订单列表.xlsx","order", queryDto.getUserId(),strMessage,queryDto.toStrCode());
+
         boolean a=exportJobService.save(exportJob);
         if (a){
             return Result.success("新增导出计划成功");
@@ -210,21 +185,7 @@ public class ExportExeclController {
         }
     }
 
-    // '订单状态 0待结算 1待支付 2直接购买(未支付) 7商家待接单 8商家拒绝接单 6制作中  3待取餐/派送中 4已完成 5已取消 ',
-    private String getState(Integer state){
-        switch (state){
-            case 1: return "待支付";
-            case 2: return "未支付";
-            case 3: return "待取餐";
-            case 4: return "已完成";
-            case 5: return "已取消";
-            case 6: return "制作中";
-            case 7: return "商家待接单";
-            case 8: return "商家拒绝接单";
-            case 0: return "待结算";
-            default: return state+"";
-        }
-    }
+
 
     //构建导出对象
     private ExportJob buildExportJob(String fileName,String fileType,String userId,String condDetail,String condCode){
@@ -236,7 +197,7 @@ public class ExportExeclController {
         exportJob.setConditions(condCode);
         LocalDateTime localDateTime = LocalDateTime.now();
         String time=localDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
-        exportJob.setFileName(time+fileName);
+        exportJob.setFileName(time+(int)(Math.random() * 100)+fileName);
         exportJob.setCreateTime(new Date());
         exportJob.setUpdateTime(new Date());
         exportJob.setUserId(userId);

+ 77 - 8
src/main/java/com/sqx/modules/file/AliFileUploadController.java

@@ -16,21 +16,25 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.util.IOUtils;
 import org.jaudiotagger.audio.AudioFileIO;
 import org.jaudiotagger.audio.mp3.MP3AudioHeader;
 import org.jaudiotagger.audio.mp3.MP3File;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.StreamUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
+import java.net.URLDecoder;
+import java.nio.file.Files;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -81,7 +85,57 @@ public class AliFileUploadController {
             // Minio上传
             String suffix = file.getOriginalFilename().substring(Objects.requireNonNull(file.getOriginalFilename()).lastIndexOf("."));
             String completePath = getPath(suffix);
+//            long fileSize =file.getSize();
             try {
+                //图片压缩webp
+//                InputStream inputStream=file.getInputStream();
+//                if(this.isPicture(suffix)&&file.getSize()>1024*1024*2){
+//                    completePath=getPath(".webp");
+//                    String tmpPath =UUID.randomUUID().toString().replaceAll("-", "")+".webp";
+//                    ApplicationHome applicationHome = new ApplicationHome(AliFileUploadController.class);
+//                    String pathResouce = applicationHome.getDir().getParentFile().getParentFile().getAbsolutePath();
+//                    String decode = URLDecoder.decode(pathResouce, "utf-8");
+//                    File newFile = new File(decode + tmpPath);
+//                    ImageOutputStream  ios=null;
+//                    try {
+//                        BufferedImage image = ImageIO.read(inputStream);
+//                        ImageWriter writer = ImageIO.getImageWritersByMIMEType("image/webp").next();
+//                        WebPWriteParam writeParam = new WebPWriteParam(writer.getLocale());
+//                        writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+//                        // 设置有损压缩
+//                        writeParam.setCompressionType(writeParam.getCompressionTypes()[WebPWriteParam.LOSSY_COMPRESSION]);
+//                        //设置 80% 的质量. 设置范围 0-1
+//                        writeParam.setCompressionQuality(0.8f);
+//                        // Save the image
+//                        ios =ImageIO.createImageOutputStream(newFile);
+//                        writer.setOutput(ios);
+//                        writer.write(null, new IIOImage(image, null, null), writeParam);
+//                        writer.dispose();
+//                        ios.close();
+//                        minioClient.putObject(PutObjectArgs.builder()
+//                                .bucket(minioConfig.getBucket())
+//                                .object(completePath)
+//                                .stream(Files.newInputStream(newFile.toPath()), newFile.length(), -1)
+//                                .build());
+//                        inputStream.close();
+//                        delteTempFile(newFile);
+//                        String src = commonRepository.findOne(72).getValue() + "/" + completePath;
+//                        return Result.success().put("data", src);
+//                    } catch (IOException e) {
+//                        throw new RuntimeException(e);
+//                    }finally {
+//                        try {
+//                            if(inputStream!=null){
+//                                inputStream.close();
+//                            }
+//                            if(ios!=null){
+//                                ios.close();
+//                            }
+//                        } catch (IOException e) {
+//                            log.info(e.getMessage());
+//                        }
+//                    }
+//                }
                 minioClient.putObject(PutObjectArgs.builder()
                         .bucket(minioConfig.getBucket())
                         .object(completePath)
@@ -93,7 +147,6 @@ public class AliFileUploadController {
             } catch (Exception e) {
                 throw new SqxException("文件上传失败!");
             }
-
         } else{
             try
             {
@@ -286,7 +339,23 @@ public class AliFileUploadController {
         }
         return null;
     }
-
+    /**
+     * 判断文件是否为图片
+     */
+    public boolean isPicture(String imgName) {
+        boolean flag = false;
+        if (StringUtils.isBlank(imgName)) {
+            return false;
+        }
+        String[] arr = {".bmp", ".dib", ".gif", ".jfif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff", ".ico"};
+        for (String item : arr) {
+            if (item.equals(imgName)) {
+                flag = true;
+                break;
+            }
+        }
+        return flag;
+    }
 
 
 }

+ 4 - 12
src/main/java/com/sqx/modules/order/dao/AppOrderDao.java

@@ -28,20 +28,12 @@ public interface AppOrderDao extends BaseMapper<TbOrder> {
 
     @DataSource("dynamic")
     IPage<TbOrder> selectAllOrderAdmin(Page<TbOrder> pages,@Param("query") OrderQueryDto queryDto);
+
     @DataSource("dynamic")
-    List<TbOrder> excelAllOrderAdmin(@Param("status") Integer status,@Param("phone") String phone, @Param("shopId") Long shopId,
-                                       @Param("userName") String userName, @Param("orderNumber") String orderNumber,
-                                     @Param("orderType") Integer orderType,@Param("shopName")String shopName,
-                                     @Param("riderPhone") String riderPhone,@Param("startTime") String startTime,
-                                     @Param("endTime") String endTime,@Param("payStartTime") String payStartTime,
-                                     @Param("payEndTime") String payEndTime,@Param("riderStationId")String riderStationId);
+    List<TbOrder> excelAllOrderAdmin(@Param("query") OrderQueryDto queryDto);
+
     @DataSource("dynamic")
-    Integer excelAllOrderAdminCount(@Param("status") Integer status,@Param("phone") String phone, @Param("shopId") Long shopId,
-                                     @Param("userName") String userName, @Param("orderNumber") String orderNumber,
-                                     @Param("orderType") Integer orderType,@Param("shopName")String shopName,
-                                     @Param("riderPhone") String riderPhone,@Param("startTime") String startTime,
-                                     @Param("endTime") String endTime,@Param("payStartTime") String payStartTime,
-                                    @Param("payEndTime") String payEndTime,@Param("riderStationId")Integer riderStationId);
+    Integer excelAllOrderAdminCount(@Param("query") OrderQueryDto queryDto);
 
 
     IPage<TbOrder> selectOrderByAdmin(Page<TbOrder> pages,@Param("status") Integer status,@Param("phone") String phone,

+ 76 - 0
src/main/java/com/sqx/modules/order/dto/OrderQueryDto.java

@@ -8,6 +8,8 @@ import lombok.Data;
 @Data
 public class OrderQueryDto extends PageQuery {
 
+    @ApiModelProperty("操作人id 导出用")
+    private String userId;
     @ApiModelProperty("订单状态 0待结算 1待支付 2直接购买(未支付) 7商家待接单 8商家拒绝接单 6制作中  3待取餐/派送中 4已完成 5已取消 13外卖待接单")
     private Integer status;
     @ApiModelProperty("用户手机号")
@@ -41,4 +43,78 @@ public class OrderQueryDto extends PageQuery {
     private Integer riderStationId;
     @ApiModelProperty("商铺类型id")
     private String shopTypeId;
+    @ApiModelProperty("优惠券类型 0 平台 1商家 不选查所有")
+    private String couponType;
+
+    public String toStrMessage() {
+        StringBuilder stringBuffer=new StringBuilder();
+        if(status!=null){stringBuffer.append("状态:"+getStateStr(status)+";");}
+        if(phone!=null&&!phone.trim().equals("")){stringBuffer.append("手机号:"+phone+";");}
+//        if(shopId!=null){stringBuffer.append(":"+shopId+";");}
+        if(userName!=null&&!userName.trim().equals("")){stringBuffer.append("昵称:"+userName+";");}
+        if(orderNumber!=null&&!orderNumber.trim().equals("")){stringBuffer.append("订单号:"+orderNumber+";");}
+        if(orderType!=null){stringBuffer.append("订单类型:"+(orderType==1?"到店取餐":(orderType==2?"骑手配送":"商家配送"))+";");}
+        if(shopName!=null&&!shopName.trim().equals("")){stringBuffer.append("商铺名称:"+shopName+";");}
+        if(riderPhone!=null&&!riderPhone.trim().equals("")){stringBuffer.append("骑手手机号:"+riderPhone+";");}
+        if(startTime!=null&&!startTime.trim().equals("")){stringBuffer.append("开始时间:"+startTime+";");}
+        if(endTime!=null&&!endTime.trim().equals("")){stringBuffer.append("结束时间:"+endTime+";");}
+        if(payStartTime!=null&&!payStartTime.trim().equals("")){stringBuffer.append("支付开始时间:"+payStartTime+";");}
+        if(payEndTime!=null&&!payEndTime.trim().equals("")){stringBuffer.append("支付结束时间:"+payEndTime+";");}
+        if(shopTypeId!=null&&!shopTypeId.trim().equals("")){stringBuffer.append("商铺类型id:"+shopTypeId+";");}
+        if(couponType!=null&&!couponType.trim().equals("")){stringBuffer.append(couponType.equals("0")?"优惠券类型:平台;":"优惠券类型:商家;");}
+        if(indentStatus!=null&&!indentStatus.trim().equals("")){stringBuffer.append("跑腿订单状态:"+getIndentStateStr(indentStatus)+";");}
+        return stringBuffer.toString();
+    }
+
+    private String getIndentStateStr(String indentStatus) {
+        switch (indentStatus){
+            case "1": return "超时关闭未支付订单";
+            case "2": return "已支付";
+            case "3": return "骑手已接单";
+            case "4": return "骑手已取货";
+            case "6": return "订单已完成";
+            case "8": return "用户取消订单";
+            case "9": return "骑手取消订单";
+            case "10": return "平台下架订单";
+            case "11": return "外卖订单下单后生成跑腿订单,只参与群聊,无法被接单";
+            case "0": return "已下单未支付";
+            default: return indentStatus+"";
+        }
+    }
+
+    public String toStrCode() {
+        return ","+(status==null?"":status)+
+                ","+(phone==null?"":phone)+
+                ","+(shopId==null?"":shopId)+
+                ","+(userName==null?"":userName)+
+                ","+(orderNumber==null?"":orderNumber)+
+                ","+(orderType==null?"":orderType)+
+                ","+(shopName==null?"":shopName)+
+                ","+(riderPhone==null?"":riderPhone)+
+                ","+(startTime==null?"":startTime)+
+                ","+(endTime==null?"":endTime)+
+                ","+(payStartTime ==null?"":payStartTime)+
+                ","+(payEndTime==null?"":payEndTime)+
+                ","+(riderStationId==null?"":riderStationId)+
+                ","+(shopTypeId==null?"":shopTypeId)+
+                ","+(couponType==null?"":couponType)+
+                ","+(indentStatus==null?"":indentStatus)+
+                ",";
+    }
+
+    // '订单状态 0待结算 1待支付 2直接购买(未支付) 7商家待接单 8商家拒绝接单 6制作中  3待取餐/派送中 4已完成 5已取消 ',
+    private String getStateStr(Integer state){
+        switch (state){
+            case 1: return "待支付";
+            case 2: return "未支付";
+            case 3: return "待取餐";
+            case 4: return "已完成";
+            case 5: return "已取消";
+            case 6: return "制作中";
+            case 7: return "商家待接单";
+            case 8: return "商家拒绝接单";
+            case 0: return "待结算";
+            default: return state+"";
+        }
+    }
 }

+ 4 - 0
src/main/java/com/sqx/modules/order/entity/TbOrder.java

@@ -285,5 +285,9 @@ public class TbOrder implements Serializable {
     @ApiModelProperty("超时时间")
     private Long timeOut;
 
+    @ApiModelProperty("优惠券类型 平台/商家优惠券")
+    @TableField(exist = false)
+    private String couponTypeRemark;
+
     public TbOrder() {}
 }

+ 1 - 3
src/main/java/com/sqx/modules/order/service/AppOrderService.java

@@ -34,9 +34,7 @@ public interface AppOrderService extends IService<TbOrder> {
 
     Result selectAllOrderAdmin(OrderQueryDto queryDto);
 
-    ExcelData excelAllOrderAdmin(Integer status, String phone, Long shopId,
-                                 String userName, String orderNumber, Integer orderType, String shopName,
-                                 String riderPhone, String startTime, String endTime,String payStartTime, String payEndTime,String riderStationId);
+    ExcelData excelAllOrderAdmin(OrderQueryDto queryDto);
 
     Result selectOrderByUserId(Long userId, String date, String dateType);
 

+ 5 - 5
src/main/java/com/sqx/modules/order/service/impl/AppAppOrderServiceImpl.java

@@ -1311,11 +1311,8 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
     }
 
     @Override
-    public ExcelData excelAllOrderAdmin(Integer status, String phone, Long shopId,
-                                        String userName, String orderNumber, Integer orderType, String shopName,
-                                        String riderPhone, String startTime, String endTime,String payStartTime, String payEndTime,String riderStationId) {
-        List<TbOrder> tbOrderIPage = appOrderDao.excelAllOrderAdmin( status, phone, shopId, userName, orderNumber, orderType,
-                shopName, riderPhone,startTime,endTime,payStartTime,payEndTime,riderStationId);
+    public ExcelData excelAllOrderAdmin(OrderQueryDto queryDto) {
+        List<TbOrder> tbOrderIPage = appOrderDao.excelAllOrderAdmin(queryDto);
 //        for (int i = 0; i < tbOrderIPage.size(); i++) {
 //            List<OrderGoods> orderGoodsList = orderGoodsDao.selectList(new QueryWrapper<OrderGoods>()
 //                    .eq("order_id", tbOrderIPage.get(i).getOrderId()));
@@ -1333,6 +1330,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
         titles.add("打包费(元/个 具体按照数量计算)");titles.add("跑腿费(元)");titles.add("支付金额(元)");
         titles.add("跑腿费说明"); titles.add("订单备注");titles.add("支付时间");titles.add("支付方式");
         titles.add("取餐号"); titles.add("状态");titles.add("是否转单");titles.add("骑手站点");
+        titles.add("商铺类型名称");titles.add("优惠券类型");
 
         data.setTitles(titles);
         List<List<Object>> rows = new ArrayList();
@@ -1431,6 +1429,8 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
                 row.add("");
             }
             row.add(order.getStationName());
+            row.add(order.getShopTypeName());
+            row.add(order.getCouponTypeRemark());
             rows.add(row);
         }
         data.setRows(rows);

+ 21 - 18
src/main/java/com/sqx/scheduler/export/ExportScheduler.java

@@ -12,6 +12,7 @@ import com.sqx.modules.datacentre.service.DataCentreService;
 import com.sqx.modules.exportExecl.dto.AccountEntry;
 import com.sqx.modules.exportExecl.model.ExportJob;
 import com.sqx.modules.exportExecl.service.ExportJobService;
+import com.sqx.modules.order.dto.OrderQueryDto;
 import com.sqx.modules.order.service.AppOrderService;
 import com.sqx.modules.pay.controller.query.CashOutQueryDTO;
 import com.sqx.modules.pay.controller.query.WalletDetailQuery;
@@ -166,31 +167,33 @@ public class ExportScheduler {
     //订单导出
     private ExcelData getOrderExcelData(ExportJob exportJob){
         String[] conditions=exportJob.getConditions().split(",",-1);
-        Integer status=null;
+        OrderQueryDto queryDto =new OrderQueryDto();
         if(!"".equals(conditions[1])){
-            status= Integer.valueOf(conditions[1]);
+            queryDto.setStatus(Integer.valueOf(conditions[1]));
         }
-        String phone=conditions[2];
-        Long shopId=null;
+        queryDto.setPhone(conditions[2]);
         if(!"".equals(conditions[3])){
-            shopId= Long.valueOf(conditions[3]);
+            queryDto.setShopId(Long.valueOf(conditions[3]));
         }
-        String userName=conditions[4];
-        String orderNumber=conditions[5];
-
-        Integer orderType=null;
+        queryDto.setUserName(conditions[4]);
+        queryDto.setOrderNumber(conditions[5]);
         if(!"".equals(conditions[6])){
-            orderType= Integer.valueOf(conditions[6]);
+            queryDto.setOrderType(Integer.valueOf(conditions[6]));
+        }
+        queryDto.setShopName(conditions[7]);
+        queryDto.setRiderPhone(conditions[8]);
+        queryDto.setStartTime(conditions[9]);
+        queryDto.setEndTime(conditions[10]);
+        queryDto.setPayStartTime(conditions[11]);
+        queryDto.setPayEndTime(conditions[12]);
+        if(!"".equals(conditions[13])){
+            queryDto.setRiderStationId(Integer.valueOf(conditions[13]));
         }
-        String shopName=conditions[7];
-        String riderPhone=conditions[8];
-        String startTime=conditions[9];
-        String endTime=conditions[10];
-        String payStartTime=conditions[11];
-        String payEndTime=conditions[12];
-        String riderStationId=conditions[13];
+        queryDto.setShopTypeId(conditions[14]);
+        queryDto.setCouponType(conditions[15]);
+        queryDto.setIndentStatus(conditions[16]);
 
-        return appOrderService.excelAllOrderAdmin(status, phone, shopId, userName, orderNumber, orderType, shopName, riderPhone, startTime, endTime,payStartTime,payEndTime,riderStationId);
+        return appOrderService.excelAllOrderAdmin(queryDto);
     }
 
     //充值记录导出

+ 9 - 0
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -303,6 +303,15 @@
         <if test="query.shopType != null and query.shopType != '' ">
             and gp.id = #{query.shopType}
         </if>
+        <if test="query.dateType=='day'">
+            and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
+        </if>
+        <if test="query.dateType=='month'">
+            and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
+        </if>
+        <if test="query.dateType=='year'">
+            and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
+        </if>
         GROUP BY tor.shop_id ) a
         ORDER BY shopMoney DESC
     </select>

+ 98 - 56
src/main/resources/mapper/order/OrderMapper.xml

@@ -88,7 +88,8 @@
         ti.rider_user_id as riderUserId, tcu.money as couponMoney,
         apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,
         (select rs.station_name from rider_station rs where  rs.id =tiu.rider_station_id ) as stationName,
-        (select st.shop_type_name from shop_type st where  st.id =gs.shop_type_id ) as shopTypeName
+        (select st.shop_type_name from shop_type st where  st.id =gs.shop_type_id ) as shopTypeName,
+        (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) as couponTypeRemark
         from tb_order tor
         left join tb_user tu on tor.user_id = tu.user_id
         left join goods_shop gs on tor.shop_id = gs.shop_id
@@ -97,6 +98,7 @@
         left join tb_coupon_user tcu on tor.coupon_id = tcu.id
         left join activity_part_record apr on apr.order_id = tor.order_id
         left join activity ai on ai.id = apr.activity_id
+        left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
         where 1 = 1
         <if test="query.riderPhone!=null and query.riderPhone!=''">
             and tiu.phone =#{query.riderPhone}
@@ -149,6 +151,12 @@
         <if test="query.shopTypeId!=null and query.shopTypeId!=''">
             and gs.shop_type_id=#{query.shopTypeId}
         </if>
+        <if test='query.couponType== "0" '>
+            and tcu.shop_id =0
+        </if>
+        <if test='query.couponType== "1"'>
+            and tcu.shop_id !=0
+        </if>
         order by tor.pay_time desc, tor.create_time desc
     </select>
 
@@ -158,7 +166,9 @@
         tiu.nick_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
         ti.rider_user_id as riderUserId, tcu.money as couponMoney,
         apr.discount_amount as activityDiscountAmount, ai.title activityTitle,ogg.detail,ogg.sumPrice,
-        (select rs.station_name from rider_station rs where  rs.id =tiu.rider_station_id ) as stationName
+        (select rs.station_name from rider_station rs where  rs.id =tiu.rider_station_id ) as stationName,
+        (select st.shop_type_name from shop_type st where  st.id =gs.shop_type_id ) as shopTypeName,
+        (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) as couponTypeRemark
         from tb_order tor
         left join tb_user tu on tor.user_id = tu.user_id
         left join goods_shop gs on tor.shop_id = gs.shop_id
@@ -169,48 +179,64 @@
         left join activity ai on ai.id = apr.activity_id
         left join (  select @a:=0,order_id ,group_concat(@a:=@a+1,".商品名:",goods_name,",数量:",goods_num,",规格:",sku_message) detail,sum(goods_num*goods_price) sumPrice  from order_goods og group by order_id
         ) ogg on ogg.order_id =tor.order_id
+        left join goods_shop gs2 on gs2.shop_id=tcu.shop_id
         where 1 = 1
-        <if test="riderPhone!=null and riderPhone!=''">
-            and tiu.phone =#{riderPhone}
+        <if test="query.riderPhone!=null and query.riderPhone!=''">
+            and tiu.phone =#{query.riderPhone}
         </if>
-        <if test="shopName!=null and shopName!=''">
-            and gs.shop_name like concat('%',#{shopName},'%')
+        <if test="query.shopName!=null and query.shopName!=''">
+            and gs.shop_name like concat('%',#{query.shopName},'%')
         </if>
-        <if test="userName!=null and userName!=''">
-            and tor.user_name like concat('%',#{userName},'%')
+        <if test="query.userName!=null and query.userName!=''">
+            and tor.user_name like concat('%',#{query.userName},'%')
         </if>
-        <if test="phone!=null and phone!=''">
-            and tor.phone like concat('%',#{phone},'%')
+        <if test="query.phone!=null and query.phone!=''">
+            and tor.phone like concat('%',#{query.phone},'%')
         </if>
-        <if test="orderNumber!=null and orderNumber!=''">
-            and tor.order_number = #{orderNumber}
+        <if test="query.orderNumber!=null and query.orderNumber!=''">
+            and tor.order_number = #{query.orderNumber}
         </if>
-        <if test="status!=null and status!=-1 and status!=1">
-            and tor.status = #{status}
+        <if test="query.status!=null and query.status!=-1 and query.status!=1">
+            and tor.status = #{query.status}
         </if>
-        <if test="status!=null and status==1">
+        <if test="query.status!=null and query.status==1">
             and tor.status in (1,2)
         </if>
-        <if test="shopId!=null">
-            and tor.shop_id = #{shopId}
+        <if test="query.shopId!=null">
+            and tor.shop_id = #{query.shopId}
         </if>
-        <if test="orderType!=null">
-            and tor.order_type_extra = #{orderType}
+        <if test="query.orderType!=null">
+            and tor.order_type_extra = #{query.orderType}
+        </if>
+        <if test="query.indentStatus != null and query.indentStatus != ''">
+            and ti.indent_state = #{query.indentStatus}
+        </if>
+        <if test="query.reservationFlag != null and query.reservationFlag !=''">
+            and tor.reservation_flag = #{query.reservationFlag}
+        </if>
+        <if test="query.startTime!=null and query.startTime!=''">
+            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{query.startTime},'%Y-%m-%d')
         </if>
-        <if test="startTime!=null and startTime!=''">
-            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
+        <if test="query.endTime!=null and query.endTime!='' ">
+            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{query.endTime},'%Y-%m-%d')
         </if>
-        <if test="endTime!=null and endTime!='' ">
-            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
+        <if test="query.payStartTime != null and query.payStartTime != ''">
+            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{query.payStartTime},'%Y-%m-%d')
         </if>
-        <if test="payStartTime != null and payStartTime != ''">
-            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
+        <if test="query.payEndTime != null and query.payEndTime != '' ">
+            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{query.payEndTime},'%Y-%m-%d')
+        </if>
+        <if test="query.riderStationId!=null and query.riderStationId!=''">
+            and tiu.rider_station_id=#{query.riderStationId}
+        </if>
+        <if test="query.shopTypeId!=null and query.shopTypeId!=''">
+            and gs.shop_type_id=#{query.shopTypeId}
         </if>
-        <if test="payEndTime != null and payEndTime != '' ">
-            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%Y-%m-%d')
+        <if test='query.couponType== "0" '>
+            and tcu.shop_id =0
         </if>
-        <if test="riderStationId!=null and riderStationId!=''">
-            and tiu.rider_station_id=#{riderStationId}
+        <if test='query.couponType== "1"'>
+            and tcu.shop_id !=0
         </if>
         order by tor.pay_time desc, tor.create_time desc
     </select>
@@ -221,48 +247,64 @@
         left join goods_shop gs on tor.shop_id = gs.shop_id
         left join tb_indent ti on tor.order_id = ti.order_id
         left join tb_user tiu on tiu.user_id = ti.rider_user_id
+        left join tb_coupon_user tcu on tor.coupon_id = tcu.id
         where 1 = 1
-        <if test="riderPhone!=null and riderPhone!=''">
-            and tiu.phone =#{riderPhone}
+        <if test="query.riderPhone!=null and query.riderPhone!=''">
+            and tiu.phone =#{query.riderPhone}
         </if>
-        <if test="shopName!=null and shopName!=''">
-            and gs.shop_name like concat('%',#{shopName},'%')
+        <if test="query.shopName!=null and query.shopName!=''">
+            and gs.shop_name like concat('%',#{query.shopName},'%')
         </if>
-        <if test="userName!=null and userName!=''">
-            and tor.user_name like concat('%',#{userName},'%')
+        <if test="query.userName!=null and query.userName!=''">
+            and tor.user_name like concat('%',#{query.userName},'%')
         </if>
-        <if test="phone!=null and phone!=''">
-            and tor.phone like concat('%',#{phone},'%')
+        <if test="query.phone!=null and query.phone!=''">
+            and tor.phone like concat('%',#{query.phone},'%')
         </if>
-        <if test="orderNumber!=null and orderNumber!=''">
-            and tor.order_number = #{orderNumber}
+        <if test="query.orderNumber!=null and query.orderNumber!=''">
+            and tor.order_number = #{query.orderNumber}
         </if>
-        <if test="status!=null and status!=-1 and status!=1">
-            and tor.status = #{status}
+        <if test="query.status!=null and query.status!=-1 and query.status!=1">
+            and tor.status = #{query.status}
         </if>
-        <if test="status!=null and status==1">
+        <if test="query.status!=null and query.status==1">
             and tor.status in (1,2)
         </if>
-        <if test="shopId!=null">
-            and tor.shop_id = #{shopId}
+        <if test="query.shopId!=null">
+            and tor.shop_id = #{query.shopId}
         </if>
-        <if test="orderType!=null">
-            and tor.order_type_extra = #{orderType}
+        <if test="query.orderType!=null">
+            and tor.order_type_extra = #{query.orderType}
+        </if>
+        <if test="query.indentStatus != null and query.indentStatus != ''">
+            and ti.indent_state = #{query.indentStatus}
+        </if>
+        <if test="query.reservationFlag != null and query.reservationFlag !=''">
+            and tor.reservation_flag = #{query.reservationFlag}
+        </if>
+        <if test="query.startTime!=null and query.startTime!=''">
+            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{query.startTime},'%Y-%m-%d')
         </if>
-        <if test="startTime!=null and startTime!=''">
-            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
+        <if test="query.endTime!=null and query.endTime!='' ">
+            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{query.endTime},'%Y-%m-%d')
         </if>
-        <if test="endTime!=null and endTime!='' ">
-            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
+        <if test="query.payStartTime != null and query.payStartTime != ''">
+            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{query.payStartTime},'%Y-%m-%d')
         </if>
-        <if test="payStartTime != null and payStartTime != ''">
-            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
+        <if test="query.payEndTime != null and query.payEndTime != '' ">
+            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{query.payEndTime},'%Y-%m-%d')
+        </if>
+        <if test="query.riderStationId!=null and query.riderStationId!=''">
+            and tiu.rider_station_id=#{query.riderStationId}
+        </if>
+        <if test="query.shopTypeId!=null and query.shopTypeId!=''">
+            and gs.shop_type_id=#{query.shopTypeId}
         </if>
-        <if test="payEndTime != null and payEndTime != '' ">
-            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%Y-%m-%d')
+        <if test='query.couponType== "0" '>
+            and tcu.shop_id =0
         </if>
-        <if test="riderStationId!=null and riderStationId!=''">
-            and tiu.rider_station_id=#{riderStationId}
+        <if test='query.couponType== "1"'>
+            and tcu.shop_id !=0
         </if>
         order by tor.pay_time desc, tor.create_time desc
     </select>