Parcourir la source

Merge remote-tracking branch 'origin/dev-查询重复入账' into dev-rht-pay

# Conflicts:
#	pom.xml
#	src/main/java/com/sqx/modules/order/dto/OrderQueryDto.java
#	src/main/java/com/sqx/modules/order/entity/TbOrder.java
#	src/main/java/com/sqx/modules/order/service/AppOrderService.java
#	src/main/resources/mapper/order/OrderMapper.xml
#	src/main/resources/mapper/pay/CashDao.xml
codingliang il y a 1 an
Parent
commit
8ae024e890
30 fichiers modifiés avec 666 ajouts et 190 suppressions
  1. 3 0
      db/update_241024.sql
  2. 12 0
      src/main/java/com/sqx/modules/app/controller/UserController.java
  3. 2 0
      src/main/java/com/sqx/modules/app/dao/UserMoneyDetailsDao.java
  4. 4 0
      src/main/java/com/sqx/modules/app/entity/UserMoneyDetails.java
  5. 1 0
      src/main/java/com/sqx/modules/app/service/UserMoneyDetailsService.java
  6. 9 1
      src/main/java/com/sqx/modules/app/service/impl/UserMoneyDetailsServiceImpl.java
  7. 25 0
      src/main/java/com/sqx/modules/datacentre/controller/app/AppRiderBankCardInfoController.java
  8. 14 53
      src/main/java/com/sqx/modules/exportExecl/controller/ExportExeclController.java
  9. 2 1
      src/main/java/com/sqx/modules/exportExecl/dto/AccountEntry.java
  10. 77 8
      src/main/java/com/sqx/modules/file/AliFileUploadController.java
  11. 13 0
      src/main/java/com/sqx/modules/goods/controller/app/AppGoodsController.java
  12. 3 0
      src/main/java/com/sqx/modules/goods/entity/GoodsShop.java
  13. 5 0
      src/main/java/com/sqx/modules/goods/service/GoodsService.java
  14. 25 0
      src/main/java/com/sqx/modules/goods/service/impl/GoodsServiceImpl.java
  15. 4 1
      src/main/java/com/sqx/modules/goods/service/impl/GoodsShopServiceImpl.java
  16. 6 0
      src/main/java/com/sqx/modules/order/controller/OrderController.java
  17. 8 12
      src/main/java/com/sqx/modules/order/dao/AppOrderDao.java
  18. 76 0
      src/main/java/com/sqx/modules/order/dto/OrderQueryDto.java
  19. 4 0
      src/main/java/com/sqx/modules/order/entity/TbOrder.java
  20. 4 3
      src/main/java/com/sqx/modules/order/service/AppOrderService.java
  21. 51 29
      src/main/java/com/sqx/modules/order/service/impl/AppAppOrderServiceImpl.java
  22. 6 0
      src/main/java/com/sqx/modules/pay/entity/CashOut.java
  23. 5 0
      src/main/java/com/sqx/modules/pay/vo/CashOutVO.java
  24. 8 0
      src/main/java/com/sqx/modules/shop/controller/app/ShopMoneyController.java
  25. 21 18
      src/main/java/com/sqx/scheduler/export/ExportScheduler.java
  26. 1 1
      src/main/resources/application-dev.yml
  27. 10 1
      src/main/resources/mapper/dataCentre/dataCenterMapper.xml
  28. 180 59
      src/main/resources/mapper/order/OrderMapper.xml
  29. 1 2
      src/main/resources/mapper/pay/CashDao.xml
  30. 86 1
      src/main/resources/mapper/userMoney/UserMoneyDetailsMapper.xml

+ 3 - 0
db/update_241024.sql

@@ -0,0 +1,3 @@
+ALTER TABLE goods_shop ADD message_configuration int COMMENT '消息配置  0开启  1关闭';
+
+UPDATE goods_shop SET message_configuration= 0;

+ 12 - 0
src/main/java/com/sqx/modules/app/controller/UserController.java

@@ -1,5 +1,6 @@
 package com.sqx.modules.app.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.app.entity.UserEntity;
@@ -9,6 +10,8 @@ import com.sqx.modules.app.response.UserMessageResponse;
 import com.sqx.modules.app.service.UserMoneyDetailsService;
 import com.sqx.modules.app.service.UserMoneyService;
 import com.sqx.modules.app.service.UserService;
+import com.sqx.modules.goods.entity.GoodsShop;
+import com.sqx.modules.goods.service.GoodsShopService;
 import com.sqx.modules.pay.service.PayDetailsService;
 import icu.xuyijie.secureapi.annotation.DecryptParam;
 import io.swagger.annotations.Api;
@@ -46,6 +49,8 @@ public class UserController {
     private UserMoneyService userMoneyService;
     @Autowired
     private PayDetailsService payDetailsService;
+    @Autowired
+    private GoodsShopService goodsShopService;
 
     @RequestMapping(value = "/{userId}", method = RequestMethod.GET)
     @ApiOperation("获取用户详细信息")
@@ -216,5 +221,12 @@ public class UserController {
         return Result.error("用户不存在!");
     }
 
+    @RequestMapping(value = "/selectShopPhoneByShopId", method = RequestMethod.POST)
+    @ApiOperation("商家端查询店铺手机号")
+    @ResponseBody
+    public Result selectShopPhoneByUserId(Long shopId) {
+        GoodsShop goodsShop=goodsShopService.getById(shopId);
+        return Result.success().put("data", goodsShop.getPhone());
+    }
 
 }

+ 2 - 0
src/main/java/com/sqx/modules/app/dao/UserMoneyDetailsDao.java

@@ -46,4 +46,6 @@ public interface UserMoneyDetailsDao extends BaseMapper<UserMoneyDetails> {
                                            @Param("orderNumber") String orderNumber, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     List<UserMoneyDetails> excelAccountEntry(@Param("query") AccountEntry query);
+
+    IPage<UserMoneyDetails> accountEntryAbnormal(Page<UserMoneyDetails> pages,@Param("query") AccountEntry query);
 }

+ 4 - 0
src/main/java/com/sqx/modules/app/entity/UserMoneyDetails.java

@@ -149,4 +149,8 @@ public class UserMoneyDetails implements Serializable {
     private BigDecimal orderAmount;
 
 
+//    配送类型 订单类型拓展 1上门 2骑手配送 3商家配送;
+    @TableField(exist = false)
+    private Integer orderTypeExtra;
+
 }

+ 1 - 0
src/main/java/com/sqx/modules/app/service/UserMoneyDetailsService.java

@@ -62,4 +62,5 @@ public interface UserMoneyDetailsService extends IService<UserMoneyDetails> {
      */
     ExcelData excelAccountEntry(AccountEntry query);
 
+    Result accountEntryAbnormal(AccountEntry accountEntry);
 }

+ 9 - 1
src/main/java/com/sqx/modules/app/service/impl/UserMoneyDetailsServiceImpl.java

@@ -150,7 +150,7 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
         Double smsMoney = Double.valueOf(value);
 
 //        计算每个订单所发送短信金额
-        LambdaQueryWrapper<TbIndentSmsSendLog> wrapper=new LambdaQueryWrapper<>();
+
         for (int i = 0; i < userMoneyDetailsList.size(); i++) {
             UserMoneyDetails userMoneyDetails = userMoneyDetailsList.get(i);
             BigDecimal couponMoney = userMoneyDetails.getCouponMoney();
@@ -170,6 +170,7 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
             wrapperTBI.eq(TbIndent::getOrderId,userMoneyDetails.getOrderId());
             TbIndent tbIndent = tbIndentService.getOne(wrapperTBI);
             if (ObjectUtils.isNotEmpty(tbIndent)) {
+                LambdaQueryWrapper<TbIndentSmsSendLog> wrapper=new LambdaQueryWrapper<>();
                 wrapper.eq(TbIndentSmsSendLog::getSuccessFlag,"1");
                 wrapper.eq(TbIndentSmsSendLog::getOrderId,tbIndent.getIndentId());
                 List<TbIndentSmsSendLog> list = smsSendLogService.list(wrapper);
@@ -244,4 +245,11 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
         data.setRows(rows);
         return data;
     }
+
+    @Override
+    public Result accountEntryAbnormal(AccountEntry accountEntry) {
+        Page<UserMoneyDetails> pages = new Page<>(accountEntry.getPage(), accountEntry.getLimit());
+        PageUtils pageUtils = new PageUtils(baseMapper.accountEntryAbnormal(pages, accountEntry));
+        return Result.success().put("data", pageUtils);
+    }
 }

+ 25 - 0
src/main/java/com/sqx/modules/datacentre/controller/app/AppRiderBankCardInfoController.java

@@ -0,0 +1,25 @@
+package com.sqx.modules.datacentre.controller.app;
+
+import com.sqx.common.utils.Result;
+import com.sqx.modules.datacentre.service.RiderBankCardInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags={"骑手银行卡信息"})
+@RestController
+@RequestMapping("/app/rider/bank")
+public class AppRiderBankCardInfoController {
+
+    @Autowired
+    private RiderBankCardInfoService riderBankCardInfoService;
+
+    @ApiOperation("查询单个骑手银行卡信息")
+    @GetMapping("/getUserId")
+    public Result getUserIdCardInfo(Long userId) {
+        return riderBankCardInfoService.getUserIdCardInfo(userId);
+    }
+}

+ 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);

+ 2 - 1
src/main/java/com/sqx/modules/exportExecl/dto/AccountEntry.java

@@ -1,10 +1,11 @@
 package com.sqx.modules.exportExecl.dto;
 
+import com.sqx.common.query.PageQuery;
 import lombok.Data;
 import org.springframework.util.StringUtils;
 
 @Data
-public class AccountEntry {
+public class AccountEntry extends PageQuery {
 
     private String shopName;
     private String shopPhone;

+ 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;
+    }
 
 
 }

+ 13 - 0
src/main/java/com/sqx/modules/goods/controller/app/AppGoodsController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.app.annotation.Login;
 import com.sqx.modules.goods.dto.ShopQueryDTO;
+import com.sqx.modules.goods.entity.GoodsShop;
 import com.sqx.modules.goods.service.GoodsService;
 import com.sqx.modules.goods.service.GoodsShopService;
 import com.sqx.modules.shop.service.SearchHistoryService;
@@ -101,6 +102,18 @@ public class AppGoodsController {
         return goodsService.selectSupplierShop(queryDTO);
     }
 
+    @ApiOperation("根据商铺id查看消息订阅")
+    @GetMapping(value = "/selectGoodShop")
+    public Result selectGoodShop(Long shopId){
 
+        return goodsService.selectGoodShop(shopId);
+    }
+
+    @ApiOperation("修改消息订阅")
+    @PostMapping(value = "/updateGoodShop")
+    public Result updateGoodShop(@RequestBody GoodsShop goodsShop){
+
+        return goodsService.updateGoodShop(goodsShop);
+    }
 
 }

+ 3 - 0
src/main/java/com/sqx/modules/goods/entity/GoodsShop.java

@@ -263,4 +263,7 @@ public class GoodsShop implements Serializable {
 
     @ApiModelProperty("是否供应商 0是  1不是")
     private Integer isSupplier;
+
+    @ApiModelProperty("消息配置  0开启  1关闭")
+    private Integer messageConfiguration;
 }

+ 5 - 0
src/main/java/com/sqx/modules/goods/service/GoodsService.java

@@ -6,6 +6,7 @@ import com.sqx.common.utils.Result;
 import com.sqx.modules.goods.dto.ShopQueryDTO;
 import com.sqx.modules.goods.entity.Goods;
 import com.sqx.modules.goods.entity.GoodsAttr;
+import com.sqx.modules.goods.entity.GoodsShop;
 
 import java.util.List;
 
@@ -64,4 +65,8 @@ public interface GoodsService extends IService<Goods> {
     List<Long> getByAllGoodsIdByShopId(Long shopId);
 
     Result selectSupplierShop(ShopQueryDTO queryDTO);
+
+    Result selectGoodShop(Long shopId);
+
+    Result updateGoodShop(GoodsShop goodsShop);
 }

+ 25 - 0
src/main/java/com/sqx/modules/goods/service/impl/GoodsServiceImpl.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sqx.common.exception.SqxException;
@@ -811,4 +812,28 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
         return Result.success().put("data", pageUtils);
     }
 
+    @Override
+    public Result selectGoodShop(Long shopId) {
+        GoodsShop goodsShop = goodsShopDao.selectById(shopId);
+
+        return Result.success().put("data",goodsShop);
+    }
+
+    @Override
+    public Result updateGoodShop(GoodsShop goodsShop) {
+        Long shopId = goodsShop.getShopId();
+        Integer messageConfiguration = goodsShop.getMessageConfiguration();
+
+        GoodsShop goodsShop1 = goodsShopDao.selectById(shopId);
+        if (ObjectUtils.isEmpty(goodsShop1)) {
+            return Result.error("不存在该店铺");
+        }
+
+        goodsShop1.setMessageConfiguration(messageConfiguration);
+
+        goodsShopDao.updateById(goodsShop1);
+
+        return Result.success();
+    }
+
 }

+ 4 - 1
src/main/java/com/sqx/modules/goods/service/impl/GoodsShopServiceImpl.java

@@ -146,7 +146,8 @@ public class GoodsShopServiceImpl extends ServiceImpl<GoodsShopDao, GoodsShop> i
         }
         //        默认不是供应商
         goodsShop.setIsSupplier(1);
-
+//        默认开启消息配置
+        goodsShop.setMessageConfiguration(0);
 
         baseMapper.insert(goodsShop);
         UserEntity userEntity1 = userService.selectUserById(goodsShop.getUserId());
@@ -470,6 +471,8 @@ public class GoodsShopServiceImpl extends ServiceImpl<GoodsShopDao, GoodsShop> i
         BeanUtils.copyProperties(goodsShopVo, shop);
 //        默认不是供应商
         shop.setIsSupplier(1);
+//        默认开启消息配置
+        shop.setMessageConfiguration(0);
         baseMapper.insert(shop);
         CommonInfo name = commonInfoService.findOne(12);
         Msg byPhone = msgDao.findByPhone(goodsShopVo.getPhone());

+ 6 - 0
src/main/java/com/sqx/modules/order/controller/OrderController.java

@@ -115,4 +115,10 @@ public class OrderController extends AbstractController {
         return Result.success().put("data", appOrderService.getEvaluateList(evaluate, page, limit));
     }
 
+    @ApiOperation("店铺总交易金额")
+    @GetMapping(value = "selectAllOrderTotalPrice")
+    public Result selectAllOrderTotalPrice(OrderQueryDto queryDto) {
+        return appOrderService.selectAllOrderTotalPrice(queryDto);
+    }
+
 }

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

@@ -30,20 +30,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,
@@ -108,4 +100,8 @@ public interface AppOrderDao extends BaseMapper<TbOrder> {
     int countUnFinishByShopId(@Param("shopId") Long shopId);
 
     int countCurDayPayByShopId(@Param("shopId") Long shopId, @Param("payTime") String payTime);
+
+    IPage<TbOrder> selectOrderPage(Page<TbOrder> pages,@Param("userId") Long userId,@Param("orderId") Integer orderId);
+
+    BigDecimal selectAllOrderTotalPrice(@Param("query") OrderQueryDto queryDto);
 }

+ 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("用户手机号")
@@ -43,4 +45,78 @@ public class OrderQueryDto extends PageQuery {
     private String shopTypeId;
     @ApiModelProperty("第三方支付系统交易号")
     private String transactionId;
+    @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

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

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

@@ -35,9 +35,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);
 
@@ -183,4 +181,7 @@ public interface AppOrderService extends IService<TbOrder> {
      * @return 交易参数
      */
     PayTransactionsVO getTransactionsParam(Long userId, PayOrderDTO payOrderDTO);
+
+    Result selectAllOrderTotalPrice(OrderQueryDto queryDto);
+
 }

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

@@ -586,7 +586,6 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
         }
     }
 
-    @Transactional(propagation = Propagation.SUPPORTS)
     @Override
     public void updateOrderAfterPaySuccess(TbOrder order) {
         String currentTimeStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
@@ -603,15 +602,6 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
         // 用户信息
         UserEntity userEntity = userDao.selectById(order.getUserId());
 
-        // 添加消息记录并且进行推送
-        MyGlobalThreadPool.execute(() -> {
-            try {
-                addOrderMessageAndPush(order, goodsShop, mpPushConfig, userEntity);
-            } catch (Exception e) {
-                log.error("订单:{},订单支付成功通知发送失败,失败原因:{}", order.getOrderId(), e);
-            }
-        });
-
         // 是否自动接单
         boolean autoAccept = goodsShop.getAutoAcceptOrder() != null && goodsShop.getAutoAcceptOrder() == 0;
         // 是否预约订单
@@ -627,20 +617,48 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
             order.setStatus(7);
         }
 
-        // 计算订单顺序号
-        order.setOrderSequence(String.format("%04d", selectCurrentOrderSequenceByShopId(order, order.getShopId())));
+        RLock lock = redissonClient.getLock(String.format(RedisKey.UPDATE_ORDER_LOCK, order.getOrderId()));
+        lock.lock();
+        TransactionStatus status = null;
+        try {
+            // 开启编程式事务
+            status = transactionManager.getTransaction(new DefaultTransactionDefinition());
 
-        // 更新订单状态
-        updateById(order);
+            // 计算订单顺序号
+            order.setOrderSequence(String.format("%04d", selectCurrentOrderSequenceByShopId(order, order.getShopId())));
+
+            // 更新订单状态
+            updateById(order);
 
-        // 扣减库存
-        this.subStock(order);
+            // 扣减库存
+            this.subStock(order);
 
-        // 优惠券变成已使用状态
-        updateCouponState(order);
+            // 优惠券变成已使用状态
+            updateCouponState(order);
 
-        // 如果是支付宝或者微信支付,用户钱包新增消费记录
-        addConsumeRecordInUserMoneyDetail(order);
+            // 如果是支付宝或者微信支付,用户钱包新增消费记录
+            addConsumeRecordInUserMoneyDetail(order);
+
+            // 在锁中提交事务
+            transactionManager.commit(status);
+        } catch (Exception e) {
+            if (ObjectUtil.isNotNull(status)) {
+                transactionManager.rollback(status);
+            }
+            log.error("订单【{}】支付成功状态修改失败,异常信息【{}】", order.getOrderId(), e.getMessage());
+            throw new SqxException("订单状态修改失败," + e);
+        } finally {
+            lock.unlock();
+        }
+
+        // 添加消息记录并且进行推送
+        MyGlobalThreadPool.execute(() -> {
+            try {
+                addOrderMessageAndPush(order, goodsShop, mpPushConfig, userEntity);
+            } catch (Exception e) {
+                log.error("订单:{},订单支付成功通知发送失败,失败原因:{}", order.getOrderId(), e);
+            }
+        });
 
         // 已接单状态的订单生成跑腿订单
         if (order.getStatus() == 6) {
@@ -1325,11 +1343,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()));
@@ -1347,6 +1362,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();
@@ -1445,6 +1461,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);
@@ -2539,10 +2557,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
     public Result selectOrder(Long userId, Integer orderId,Integer page, Integer limit) {
         HashMap hashMap = new HashMap();
         Page<TbOrder> pages = new Page(page, limit);
-        LambdaQueryWrapper<TbOrder> wrapper=new LambdaQueryWrapper<>();
-        wrapper.eq(TbOrder::getOrderId,orderId)
-                .eq(TbOrder::getUserId,userId);
-        IPage<TbOrder> tbOrderList = baseMapper.selectPage(pages, wrapper);
+        IPage<TbOrder> tbOrderList = baseMapper.selectOrderPage(pages, userId,orderId);
         BigDecimal money = new BigDecimal(0);
         ArrayList list = new ArrayList();
         for (int i = 0; i < tbOrderList.getRecords().size(); i++) {
@@ -2625,6 +2640,13 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
         }
     }
 
+    @Override
+    public Result selectAllOrderTotalPrice(OrderQueryDto queryDto) {
+        BigDecimal totalPrice = appOrderDao.selectAllOrderTotalPrice(queryDto);
+
+        return Result.success().put("data", totalPrice);
+    }
+
     /**
      * 获取当前店铺当前订单在已支付订单中的序号
      * @param order 订单信息

+ 6 - 0
src/main/java/com/sqx/modules/pay/entity/CashOut.java

@@ -117,6 +117,12 @@ public class CashOut implements Serializable {
     @ApiModelProperty(name = "银行卡开户行")
     private String openBank ;
 
+    /**
+     * 用户手机号
+     */
+    private String phone;
+
+
     @TableField(exist = false)
     private String userName;
 

+ 5 - 0
src/main/java/com/sqx/modules/pay/vo/CashOutVO.java

@@ -24,4 +24,9 @@ public class CashOutVO extends CashOut {
      */
     private String mchId;
 
+    /**
+     * 用户手机号
+     */
+    private String phoneNumber;
+
 }

+ 8 - 0
src/main/java/com/sqx/modules/shop/controller/app/ShopMoneyController.java

@@ -9,6 +9,7 @@ import com.sqx.modules.app.service.UserMoneyDetailsService;
 import com.sqx.modules.app.service.UserMoneyService;
 import com.sqx.modules.app.service.UserService;
 import com.sqx.modules.datacentre.entity.SysUserShop;
+import com.sqx.modules.exportExecl.dto.AccountEntry;
 import com.sqx.modules.goods.dao.GoodsShopDao;
 import com.sqx.modules.goods.entity.GoodsShop;
 import com.sqx.modules.pay.controller.app.AliPayController;
@@ -187,4 +188,11 @@ public class ShopMoneyController extends AbstractController {
         return Result.success().put("data", pageUtils);
     }
 
+    @GetMapping(value = "/accountEntryAbnormal")
+    @ApiOperation("异常入账管理")
+    public Result accountEntryAbnormal(AccountEntry accountEntry){
+        return userMoneyDetailsService.accountEntryAbnormal(accountEntry);
+
+    }
+
 }

+ 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);
     }
 
     //充值记录导出

+ 1 - 1
src/main/resources/application-dev.yml

@@ -47,7 +47,7 @@ spring:
                 max-wait: -1
 secure-api:
     # 开启SecureApi功能,如果为false则其余配置项均不生效
-    enabled: true
+    enabled: false
     # 开启加解密日志打印,会打印出接口名、加密模式、算法、明文和密文等信息
     show-log: true
     url-safe: true

+ 10 - 1
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -178,7 +178,7 @@
         i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName
         FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
         left join rider_station rs on u.rider_station_id=rs.id
-        WHERE i.rider_user_id IS NOT NULL
+        WHERE i.rider_user_id IS NOT NULL and i.indent_state = 6
         <if test="address!=null and address!=''">
                 and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
                 i.user_district like concat('%',#{address},'%'))
@@ -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>

+ 180 - 59
src/main/resources/mapper/order/OrderMapper.xml

@@ -92,8 +92,8 @@
         tiu.user_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,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,
+        (case when tcu.shop_id =0 then '平台' else gs2.shop_name end) as couponTypeRemark,
         pd.trade_no as transactionId
         from tb_order tor
         left join tb_user tu on tor.user_id = tu.user_id
@@ -103,6 +103,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
         left join pay_details pd on pd.order_id = tor.order_number
         where 1 = 1
         <if test="query.riderPhone!=null and query.riderPhone!=''">
@@ -159,6 +160,12 @@
         <if test="query.transactionId != null and query.transactionId != ''">
             and pd.trade_no = #{query.transactionId}
         </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>
 
@@ -168,7 +175,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
@@ -179,48 +188,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="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="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="startTime!=null and startTime!=''">
-            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%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="endTime!=null and endTime!='' ">
-            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
+        <if test="query.riderStationId!=null and query.riderStationId!=''">
+            and tiu.rider_station_id=#{query.riderStationId}
         </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.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>
@@ -231,48 +256,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="startTime!=null and startTime!=''">
-            and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
+        <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="endTime!=null and endTime!='' ">
-            and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%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="payStartTime != null and payStartTime != ''">
-            and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%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="payEndTime != null and payEndTime != '' ">
-            and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%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="riderStationId!=null and riderStationId!=''">
-            and tiu.rider_station_id=#{riderStationId}
+        <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='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>
@@ -363,13 +404,12 @@
             and tor.status = #{status}
         </if>
         <if test="status!=null and status==5">
-            and tor.status in (5, 8)
+            and tor.status =8
         </if>
         <if test="status==null">
-            and tor.status in (0, 7, 6, 3, 4, 5, 8)
+            and tor.status in (0, 7, 6, 3, 4, 8)
         </if>
         order by tor.pay_time desc, tor.create_time desc
-
     </select>
 
 
@@ -571,5 +611,86 @@
           and shop_id = #{shopId}
           and date(pay_time) = date(#{payTime})
     </select>
+    <select id="selectOrderPage" resultType="com.sqx.modules.order.entity.TbOrder">
+        select tor.*, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.shop_lng as shopLng,
+        gs.shop_lat as shopLat, gs.phone as shopPhone,
+        gs.errand_money as errandMoney, gs.exempt_min_money as exemptMinMoney, gs.minimum_delivery as minimumDelivery,
+        gs.distribution_distance as distributionDistance
+        from tb_order tor left join goods_shop gs on tor.shop_id = gs.shop_id
+        where tor.user_id = #{userId}
+            and tor.order_id = #{orderId}
+
+    </select>
+    <select id="selectAllOrderTotalPrice" resultType="java.math.BigDecimal">
+        select SUM(tor.pay_money) as totalPrice
+        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
+        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
+        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}
+        </if>
+        <if test="query.shopName!=null and query.shopName!=''">
+            and gs.shop_name like concat('%',#{query.shopName},'%')
+        </if>
+        <if test="query.userName!=null and query.userName!=''">
+            and tor.user_name like concat('%',#{query.userName},'%')
+        </if>
+        <if test="query.phone!=null and query.phone!=''">
+            and tor.phone like concat('%',#{query.phone},'%')
+        </if>
+        <if test="query.orderNumber!=null and query.orderNumber!=''">
+            and tor.order_number = #{query.orderNumber}
+        </if>
+        <if test="query.status!=null and query.status!=-1 and query.status!=1">
+            and tor.status = #{query.status}
+        </if>
+        <if test="query.status!=null and query.status==1">
+            and tor.status in (1,2)
+        </if>
+        <if test="query.shopId!=null">
+            and tor.shop_id = #{query.shopId}
+        </if>
+        <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="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="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="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='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>
 
 </mapper>

+ 1 - 2
src/main/resources/mapper/pay/CashDao.xml

@@ -298,7 +298,7 @@
     </sql>
 
     <select id="selectCashOutList" resultType="com.sqx.modules.pay.vo.CashOutVO">
-        select gh.shop_name, co.*,rs.station_name as stationName,tu.user_name as userName,gh.mch_id as mchId
+        select gh.shop_name, co.*,rs.station_name as stationName,tu.user_name as userName, gh.mch_id as mchId, tu.phone as phoneNumber
         from cash_out co
         left join goods_shop gh on gh.shop_id = co.shop_id
         left join tb_user tu on tu.user_id=co.user_id
@@ -341,5 +341,4 @@
         order by id desc
     </select>
 
-
 </mapper>

+ 86 - 1
src/main/resources/mapper/userMoney/UserMoneyDetailsMapper.xml

@@ -123,7 +123,8 @@
         apr.discount_amount as activityDiscountAmount,
         tbo.errand_money as errandMoney,
         tbo.pay_money as payMoney,
-        tbo.order_id as orderId
+        tbo.order_id as orderId,
+        tbo.order_type_extra as orderTypeExtra
         FROM
         (
         SELECT
@@ -315,4 +316,88 @@
         ORDER BY umd2.id desc
     </select>
 
+    <select id="accountEntryAbnormal" resultType="com.sqx.modules.app.entity.UserMoneyDetails">
+        SELECT
+        umd2.id,
+        umd2.orderNumber,
+        umd2.user_id as userId,
+        umd2.shop_id as shopId,
+        umd2.title,
+        umd2.content,
+        umd2.type,
+        umd2.classify,
+        umd2.money,
+        umd2.create_time as createTime,
+        umd2.state,
+        tbu.user_name as userName,
+        tbu.phone as userPhone,
+        gs.shop_name as shopName,
+        gs.phone as shopPhone,
+        tcu.coupon_name as couponName,
+        tcu.money as couponMoney,
+        apr.discount_amount as activityDiscountAmount,
+        tbo.errand_money as errandMoney
+        FROM
+        (
+        SELECT
+        RIGHT( umd.title, 18 ) AS orderNumber,
+        umd.id,
+        umd.user_id,
+        umd.shop_id,
+        umd.title,
+        umd.content,
+        umd.type,
+        umd.classify,
+        umd.money,
+        umd.create_time,
+        umd.state,
+        umd.children_id
+        FROM
+        `user_money_details` umd
+        WHERE
+        umd.type = 1
+        AND umd.classify = 3
+        AND umd.shop_id IS NOT NULL
+        AND umd.state=2
+        AND umd.title in (select
+        title
+        from
+        user_money_details
+        where
+        title like '商户订单收入%'
+        group by title
+        HAVING COUNT(*) > 1
+        order by shop_id )
+        ) umd2
+        LEFT JOIN tb_order tbo on tbo.order_number=umd2.orderNumber
+        LEFT JOIN tb_user tbu on tbu.user_id=tbo.user_id
+        LEFT JOIN goods_shop gs on gs.shop_id=tbo.shop_id
+        LEFT JOIN tb_coupon_user tcu on tbo.coupon_id = tcu.id
+        LEFT JOIN activity_part_record apr on apr.order_id = tbo.order_id
+        where 1 = 1
+        <if test="query.shopName != null and query.shopName != ''">
+            and gs.shop_name like  concat("%", #{query.shopName}, "%")
+        </if>
+
+        <if test="query.shopPhone != null and query.shopPhone != ''">
+            and gs.phone= #{query.shopPhone}
+        </if>
+
+        <if test="query.userPhone != null and query.userPhone != ''">
+            and tbu.phone=#{query.userPhone}
+        </if>
+
+        <if test="query.couponName != null and query.couponName != ''">
+            and tcu.coupon_name like  concat("%", #{query.couponName}, "%")
+        </if>
+
+        <if test="query.orderNumber != null and query.orderNumber != ''">
+            and tbo.order_number = #{query.orderNumber}
+        </if>
+
+        <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+            and umd2.create_time >= #{query.startTime} and #{query.endTime} >= umd2.create_time
+        </if>
+        ORDER BY umd2.orderNumber,umd2.id desc
+    </select>
 </mapper>